mirror of
https://github.com/powerline/powerline.git
synced 2025-07-31 01:35:40 +02:00
Undo renaming args to kwargs
This commit is contained in:
parent
e9852fec37
commit
d759a0a806
@ -45,16 +45,16 @@ segment_getters = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_attr_func(contents_func, key, kwargs):
|
def get_attr_func(contents_func, key, args):
|
||||||
try:
|
try:
|
||||||
func = getattr(contents_func, key)
|
func = getattr(contents_func, key)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
if kwargs is None:
|
if args is None:
|
||||||
return lambda : func()
|
return lambda : func()
|
||||||
else:
|
else:
|
||||||
return lambda pl, shutdown_event: func(pl=pl, shutdown_event=shutdown_event, **kwargs)
|
return lambda pl, shutdown_event: func(pl=pl, shutdown_event=shutdown_event, **args)
|
||||||
|
|
||||||
|
|
||||||
def gen_segment_getter(pl, ext, path, theme_configs, default_module=None):
|
def gen_segment_getter(pl, ext, path, theme_configs, default_module=None):
|
||||||
@ -86,14 +86,14 @@ def gen_segment_getter(pl, ext, path, theme_configs, default_module=None):
|
|||||||
highlight_group = segment.get('highlight_group') or segment.get('name')
|
highlight_group = segment.get('highlight_group') or segment.get('name')
|
||||||
|
|
||||||
if segment_type == 'function':
|
if segment_type == 'function':
|
||||||
kwargs = dict(((str(k), v) for k, v in get_key(segment, module, 'args', {}).items()))
|
args = dict(((str(k), v) for k, v in get_key(segment, module, 'args', {}).items()))
|
||||||
startup_func = get_attr_func(_contents_func, 'startup', kwargs)
|
startup_func = get_attr_func(_contents_func, 'startup', args)
|
||||||
shutdown_func = get_attr_func(_contents_func, 'shutdown', None)
|
shutdown_func = get_attr_func(_contents_func, 'shutdown', None)
|
||||||
|
|
||||||
if hasattr(_contents_func, 'powerline_requires_segment_info'):
|
if hasattr(_contents_func, 'powerline_requires_segment_info'):
|
||||||
contents_func = lambda pl, segment_info: _contents_func(pl=pl, segment_info=segment_info, **kwargs)
|
contents_func = lambda pl, segment_info: _contents_func(pl=pl, segment_info=segment_info, **args)
|
||||||
else:
|
else:
|
||||||
contents_func = lambda pl, segment_info: _contents_func(pl=pl, **kwargs)
|
contents_func = lambda pl, segment_info: _contents_func(pl=pl, **args)
|
||||||
else:
|
else:
|
||||||
startup_func = None
|
startup_func = None
|
||||||
shutdown_func = None
|
shutdown_func = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user