未验证 提交 7ac5be6c 编写于 作者: R Rongfeng Fu 提交者: GitHub

typo (#96)

上级 ee5a76bb
......@@ -1035,7 +1035,7 @@ class ConfigParserManager(Manager):
}
self.component_parsers = {}
def _formate_paraser_name(self, style):
def _format_paraser_name(self, style):
style = style.title()
return '%sConfigParser' % style.replace('-', '').replace(' ', '').replace('_', '')
......@@ -1048,7 +1048,7 @@ class ConfigParserManager(Manager):
DynamicLoading.add_lib_path(lib_path)
self.stdio and getattr(self.stdio, 'verbose', 'print')('load config parser: %s' % path)
module = DynamicLoading.import_module(module_name, self.stdio)
clz_name = self._formate_paraser_name(style)
clz_name = self._format_paraser_name(style)
try:
return getattr(module, clz_name)
except:
......
......@@ -43,14 +43,14 @@ def format_size(size, precision=1):
idx = 0
if precision:
div = 1024.0
formate = '%.' + str(precision) + 'f%s'
format = '%.' + str(precision) + 'f%s'
else:
div = 1024
formate = '%d%s'
format = '%d%s'
while idx < 5 and size >= 1024:
size /= 1024.0
idx += 1
return formate % (size, units[idx])
return format % (size, units[idx])
def create_tenant(plugin_context, cursor, *args, **kwargs):
......
......@@ -43,16 +43,16 @@ def format_size(size, precision=1):
idx = 0
if precision:
div = 1024.0
formate = '%.' + str(precision) + 'f%s'
format = '%.' + str(precision) + 'f%s'
limit = 1024
else:
div = 1024
limit = 1024
formate = '%d%s'
format = '%d%s'
while idx < units_num and size >= limit:
size /= div
idx += 1
return formate % (size, units[idx])
return format % (size, units[idx])
def get_system_memory(memory_limit):
......
......@@ -216,7 +216,7 @@ def _start_check(plugin_context, strict_check=False, *args, **kwargs):
free_memory = parse_size(str(v))
total_use = servers_memory[ip]['percentage'] * total_memory / 100 + servers_memory[ip]['num']
if total_use > free_memory:
stdio.error(EC_OBSERVER_NOT_ENOUGH_MEMORY.formate(ip=ip, free=format_size(free_memory), need=format_size(total_use)))
stdio.error(EC_OBSERVER_NOT_ENOUGH_MEMORY.format(ip=ip, free=format_size(free_memory), need=format_size(total_use)))
# disk
disk = {'/': 0}
ret = client.execute_command('df --block-size=1024')
......
......@@ -157,10 +157,10 @@ class ObVersionGraph(object):
if len(res) == 1:
res.insert(0, start_node)
return formate_route(res)
return format_route(res)
def formate_route(routes):
def format_route(routes):
return [{
'version': node.version,
'release': None if node.release == VersionNode.RELEASE_NULL else node.release,
......@@ -174,7 +174,7 @@ def upgrade_route(plugin_context, current_repository, dest_repository, *args, **
repository_dir = dest_repository.repository_dir
if current_repository.version == dest_repository.version:
return plugin_context.return_true(route=formate_route([current_repository, dest_repository]))
return plugin_context.return_true(route=format_route([current_repository, dest_repository]))
upgrade_dep_name = 'etc/oceanbase_upgrade_dep.yml'
upgrade_dep_path = os.path.join(repository_dir, upgrade_dep_name)
......
......@@ -51,16 +51,16 @@ def format_size(size, precision=1):
idx = 0
if precision:
div = 1024.0
formate = '%.' + str(precision) + 'f%s'
format = '%.' + str(precision) + 'f%s'
limit = 1024
else:
div = 1024
limit = 1024
formate = '%d%s'
format = '%d%s'
while idx < units_num and size >= limit:
size /= div
idx += 1
return formate % (size, units[idx])
return format % (size, units[idx])
def exec_cmd(cmd):
......
......@@ -51,16 +51,16 @@ def format_size(size, precision=1):
idx = 0
if precision:
div = 1024.0
formate = '%.' + str(precision) + 'f%s'
format = '%.' + str(precision) + 'f%s'
limit = 1024
else:
div = 1024
limit = 1024
formate = '%d%s'
format = '%d%s'
while idx < units_num and size >= limit:
size /= div
idx += 1
return formate % (size, units[idx])
return format % (size, units[idx])
def exec_cmd(cmd):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册