mirror of https://github.com/zulip/zulip.git
Harden style rule for % comprehensions and fix existing errors.
This commit is contained in:
parent
4887a79d21
commit
aad3bff193
|
@ -165,7 +165,7 @@ python_rules = [
|
||||||
# This next check could have false positives, but it seems pretty
|
# This next check could have false positives, but it seems pretty
|
||||||
# rare; if we find any, they can be added to the exclude list for
|
# rare; if we find any, they can be added to the exclude list for
|
||||||
# this rule.
|
# this rule.
|
||||||
{'pattern': '% [a-z_]*\)?$',
|
{'pattern': '% [a-zA-Z0-9_.]*\)?$',
|
||||||
'description': 'Used % comprehension without a tuple'},
|
'description': 'Used % comprehension without a tuple'},
|
||||||
] + whitespace_rules
|
] + whitespace_rules
|
||||||
python_line_skip_rules = [
|
python_line_skip_rules = [
|
||||||
|
|
|
@ -77,7 +77,7 @@ for msg in result['messages']:
|
||||||
msg.pop(k, None)
|
msg.pop(k, None)
|
||||||
messages.append(msg)
|
messages.append(msg)
|
||||||
|
|
||||||
filename = "zulip-%s.json" % options.stream
|
filename = "zulip-%s.json" % (options.stream,)
|
||||||
f = codecs.open(filename, encoding='utf-8', mode="wb")
|
f = codecs.open(filename, encoding='utf-8', mode="wb")
|
||||||
f.write(json.dumps(messages, indent=0, sort_keys=False))
|
f.write(json.dumps(messages, indent=0, sort_keys=False))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
@ -105,7 +105,7 @@ class CodeHilite(object):
|
||||||
txt = txt.replace('"', '"')
|
txt = txt.replace('"', '"')
|
||||||
classes = []
|
classes = []
|
||||||
if self.lang:
|
if self.lang:
|
||||||
classes.append('language-%s' % self.lang)
|
classes.append('language-%s' % (self.lang,))
|
||||||
if self.linenos:
|
if self.linenos:
|
||||||
classes.append('linenums')
|
classes.append('linenums')
|
||||||
class_str = ''
|
class_str = ''
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Command(BaseCommand):
|
||||||
This command should be used only on a newly created, empty Zulip instance to
|
This command should be used only on a newly created, empty Zulip instance to
|
||||||
import a database dump from one or more JSON files.
|
import a database dump from one or more JSON files.
|
||||||
|
|
||||||
Usage: python2.7 manage.py import_dump [--destroy-rebuild-database] [--chunk-size=%s] <json file name> [<json file name>...]""" % DEFAULT_CHUNK_SIZE
|
Usage: python2.7 manage.py import_dump [--destroy-rebuild-database] [--chunk-size=%s] <json file name> [<json file name>...]""" % (DEFAULT_CHUNK_SIZE,)
|
||||||
|
|
||||||
option_list = BaseCommand.option_list + (
|
option_list = BaseCommand.option_list + (
|
||||||
make_option('--destroy-rebuild-database',
|
make_option('--destroy-rebuild-database',
|
||||||
|
|
|
@ -499,7 +499,7 @@ def finish_google_oauth2(request):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
raise Exception('Could not convert google oauth2 code to access_token\r%r' % resp.text)
|
raise Exception('Could not convert google oauth2 code to access_token\r%r' % (resp.text,))
|
||||||
access_token = extract_json_response(resp)['access_token']
|
access_token = extract_json_response(resp)['access_token']
|
||||||
|
|
||||||
resp = requests.get(
|
resp = requests.get(
|
||||||
|
@ -507,7 +507,7 @@ def finish_google_oauth2(request):
|
||||||
params={'access_token': access_token}
|
params={'access_token': access_token}
|
||||||
)
|
)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
raise Exception('Google login failed making API call\r%r' % resp.text)
|
raise Exception('Google login failed making API call\r%r' % (resp.text,))
|
||||||
body = extract_json_response(resp)
|
body = extract_json_response(resp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue