mirror of
https://github.com/powerline/powerline.git
synced 2025-07-22 05:14:58 +02:00
Some lint fixes
* Fixed handling of empty scalars in python2: ''.join([]) returns str, ''.join([u'smth']) returns unicode * Fixed check_config: it was always checking for themes, even if it was requested to check colorscheme
This commit is contained in:
parent
83ed36903c
commit
bb06207838
@ -84,7 +84,7 @@ class Spec(object):
|
|||||||
if type(value.value) is not t:
|
if type(value.value) is not t:
|
||||||
echoerr(context=self.cmsg.format(key=context_key(context)),
|
echoerr(context=self.cmsg.format(key=context_key(context)),
|
||||||
context_mark=context_mark,
|
context_mark=context_mark,
|
||||||
problem='must be a {0} instance'.format(t.__name__),
|
problem='{0!r} must be a {1} instance, not {2}'.format(value, t.__name__, type(value.value).__name__),
|
||||||
problem_mark=value.mark)
|
problem_mark=value.mark)
|
||||||
return False, True
|
return False, True
|
||||||
return True, False
|
return True, False
|
||||||
@ -380,9 +380,9 @@ def check_config(d, theme, data, context, echoerr):
|
|||||||
else:
|
else:
|
||||||
# local_themes
|
# local_themes
|
||||||
ext = context[-3][0]
|
ext = context[-3][0]
|
||||||
if ext not in data['configs']['themes'] or theme not in data['configs']['themes'][ext]:
|
if ext not in data['configs'][d] or theme not in data['configs'][d][ext]:
|
||||||
echoerr(context='Error while loading {0} from {1} extension configuration'.format(d[:-1], ext),
|
echoerr(context='Error while loading {0} from {1} extension configuration'.format(d[:-1], ext),
|
||||||
problem='failed to find configuration file themes/{0}/{1}.json'.format(ext, theme),
|
problem='failed to find configuration file {0}/{1}/{2}.json'.format(d, ext, theme),
|
||||||
problem_mark=theme.mark)
|
problem_mark=theme.mark)
|
||||||
return True, False, True
|
return True, False, True
|
||||||
return True, False, False
|
return True, False, False
|
||||||
|
@ -24,6 +24,12 @@ class ScannerError(MarkedError):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
from __builtin__ import unicode
|
||||||
|
except ImportError:
|
||||||
|
unicode = str
|
||||||
|
|
||||||
|
|
||||||
class SimpleKey:
|
class SimpleKey:
|
||||||
# See below simple keys treatment.
|
# See below simple keys treatment.
|
||||||
def __init__(self, token_number, index, line, column, mark):
|
def __init__(self, token_number, index, line, column, mark):
|
||||||
@ -379,7 +385,7 @@ class Scanner:
|
|||||||
chunks.extend(self.scan_flow_scalar_non_spaces(start_mark))
|
chunks.extend(self.scan_flow_scalar_non_spaces(start_mark))
|
||||||
self.forward()
|
self.forward()
|
||||||
end_mark = self.get_mark()
|
end_mark = self.get_mark()
|
||||||
return ScalarToken(''.join(chunks), False, start_mark, end_mark, '"')
|
return ScalarToken(unicode().join(chunks), False, start_mark, end_mark, '"')
|
||||||
|
|
||||||
ESCAPE_REPLACEMENTS = {
|
ESCAPE_REPLACEMENTS = {
|
||||||
'b': '\x08',
|
'b': '\x08',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user