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:
|
||||
echoerr(context=self.cmsg.format(key=context_key(context)),
|
||||
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)
|
||||
return False, True
|
||||
return True, False
|
||||
|
@ -380,9 +380,9 @@ def check_config(d, theme, data, context, echoerr):
|
|||
else:
|
||||
# local_themes
|
||||
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),
|
||||
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)
|
||||
return True, False, True
|
||||
return True, False, False
|
||||
|
|
|
@ -24,6 +24,12 @@ class ScannerError(MarkedError):
|
|||
pass
|
||||
|
||||
|
||||
try:
|
||||
from __builtin__ import unicode
|
||||
except ImportError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class SimpleKey:
|
||||
# See below simple keys treatment.
|
||||
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))
|
||||
self.forward()
|
||||
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 = {
|
||||
'b': '\x08',
|
||||
|
|
Loading…
Reference in New Issue