mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 23:05:32 +02:00
Allow checking NowPlayingSegment
This commit is contained in:
parent
416a0efd84
commit
0255df2f7b
@ -44,12 +44,22 @@ def getconfigargspec(obj):
|
|||||||
else:
|
else:
|
||||||
obj = obj
|
obj = obj
|
||||||
|
|
||||||
argspec = getargspec(obj)
|
remove_self = False
|
||||||
|
try:
|
||||||
|
argspec = getargspec(obj)
|
||||||
|
except TypeError: # Workaround for now_playing segment
|
||||||
|
# TODO For NowPlayingSegment for linter: merge in information about
|
||||||
|
# player-specific arguments
|
||||||
|
argspec = getargspec(obj.__call__)
|
||||||
|
remove_self = True
|
||||||
args = []
|
args = []
|
||||||
defaults = []
|
defaults = []
|
||||||
for i, arg in zip(count(1), reversed(argspec.args)):
|
for i, arg in zip(count(1), reversed(argspec.args)):
|
||||||
if ((arg == 'segment_info' and getattr(obj, 'powerline_requires_segment_info', None)) or
|
if (
|
||||||
arg == 'pl'):
|
(arg == 'segment_info' and getattr(obj, 'powerline_requires_segment_info', None))
|
||||||
|
or arg == 'pl'
|
||||||
|
or (arg == 'self' and remove_self)
|
||||||
|
):
|
||||||
continue
|
continue
|
||||||
if argspec.defaults and len(argspec.defaults) >= i:
|
if argspec.defaults and len(argspec.defaults) >= i:
|
||||||
default = argspec.defaults[-i]
|
default = argspec.defaults[-i]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user