Fix various flake8 errors
This commit is contained in:
parent
696cd97e12
commit
d9943e3222
|
@ -1,4 +1,5 @@
|
|||
import zsh
|
||||
import json
|
||||
from powerline.shell import ShellPowerline
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ def underscore_to_camelcase(string):
|
|||
'''Return a underscore_separated_string as CamelCase.'''
|
||||
return ''.join(word.capitalize() or '_' for word in string.split('_'))
|
||||
|
||||
|
||||
def mergedicts(d1, d2):
|
||||
'''Recursively merge two dictionaries. First dictionary is modified in-place.
|
||||
'''
|
||||
|
|
|
@ -12,7 +12,7 @@ def get_segment_key(segment, theme_configs, key, module=None, default=None):
|
|||
name = segment['name']
|
||||
for theme_config in theme_configs:
|
||||
if 'segment_data' in theme_config:
|
||||
for segment_key in ((module+'.'+name, name) if module else (name,)):
|
||||
for segment_key in ((module + '.' + name, name) if module else (name,)):
|
||||
try:
|
||||
return theme_config['segment_data'][segment_key][key]
|
||||
except KeyError:
|
||||
|
@ -47,9 +47,10 @@ segment_getters = {
|
|||
|
||||
def gen_segment_getter(ext, path, theme_configs, default_module=None):
|
||||
data = {
|
||||
'default_module': default_module or 'powerline.segments.'+ext,
|
||||
'default_module': default_module or 'powerline.segments.' + ext,
|
||||
'path': path,
|
||||
}
|
||||
|
||||
def get_key(segment, module, key, default=None):
|
||||
return get_segment_key(segment, theme_configs, key, module, default)
|
||||
data['get_key'] = get_key
|
||||
|
@ -68,7 +69,7 @@ def gen_segment_getter(ext, path, theme_configs, default_module=None):
|
|||
'highlight_group': highlight_group,
|
||||
'divider_highlight_group': divider_highlight_group,
|
||||
'before': get_key(segment, module, 'before', ''),
|
||||
'after': get_key(segment, module, 'after', ''),
|
||||
'after': get_key(segment, module, 'after', ''),
|
||||
'contents_func': contents_func,
|
||||
'contents': contents,
|
||||
'args': get_key(segment, module, 'args', {}) if segment_type == 'function' else {},
|
||||
|
|
|
@ -7,7 +7,6 @@ from powerline.lib import mergedicts
|
|||
def mergeargs(argvalue):
|
||||
if not argvalue:
|
||||
return None
|
||||
l = argvalue
|
||||
r = dict([argvalue[0]])
|
||||
for subval in argvalue[1:]:
|
||||
mergedicts(r, dict([subval]))
|
||||
|
|
|
@ -11,6 +11,7 @@ import vim
|
|||
|
||||
vim_exists = vim_get_func('exists', rettype=int)
|
||||
|
||||
|
||||
def _override_from(config, override_varname):
|
||||
if vim_exists(override_varname):
|
||||
# FIXME vim.eval has problem with numeric types, vim.bindeval may be
|
||||
|
@ -51,7 +52,8 @@ class VimPowerline(Powerline):
|
|||
# Note: themes with non-[a-zA-Z0-9_] names are impossible to override
|
||||
# (though as far as I know exists() won’t throw). Won’t fix, use proper
|
||||
# theme names.
|
||||
return _override_from(super(VimPowerline, self).load_theme_config(name), 'g:powerline_theme_overrides__'+name)
|
||||
return _override_from(super(VimPowerline, self).load_theme_config(name),
|
||||
'g:powerline_theme_overrides__' + name)
|
||||
|
||||
def get_local_themes(self, local_themes):
|
||||
self.get_matcher = gen_matcher_getter(self.ext, self.import_paths)
|
||||
|
|
Loading…
Reference in New Issue