lint: Clean up E126 PEP-8 rule.

This commit is contained in:
Tim Abbott 2017-01-23 22:06:13 -08:00
parent 31efc903bd
commit 722fc56534
8 changed files with 60 additions and 60 deletions

View file

@ -252,16 +252,16 @@ logger.info("Sent Zephyr messages!")
for key, (stream, test) in hzkeys.items(): for key, (stream, test) in hzkeys.items():
if stream == "message": if stream == "message":
send_zulip({ send_zulip({
"type": "private", "type": "private",
"content": str(key), "content": str(key),
"to": zulip_user, "to": zulip_user,
}) })
else: else:
send_zulip({ send_zulip({
"type": "stream", "type": "stream",
"subject": "test", "subject": "test",
"content": str(key), "content": str(key),
"to": stream, "to": stream,
}) })
receive_zephyrs() receive_zephyrs()

View file

@ -65,10 +65,10 @@ class IRCBot(irc.bot.SingleServerIRCBot):
# Forward the PM to Zulip # Forward the PM to Zulip
print(zulip_client.send_message({ print(zulip_client.send_message({
"sender": sender, "sender": sender,
"type": "private", "type": "private",
"to": "username@example.com", "to": "username@example.com",
"content": content, "content": content,
})) }))
def on_pubmsg(self, c, e): def on_pubmsg(self, c, e):
@ -81,12 +81,12 @@ class IRCBot(irc.bot.SingleServerIRCBot):
# Forward the stream message to Zulip # Forward the stream message to Zulip
print(zulip_client.send_message({ print(zulip_client.send_message({
"forged": "yes", "forged": "yes",
"sender": sender, "sender": sender,
"type": "stream", "type": "stream",
"to": stream, "to": stream,
"subject": "IRC", "subject": "IRC",
"content": content, "content": content,
})) }))
def on_dccmsg(self, c, e): def on_dccmsg(self, c, e):

View file

@ -332,7 +332,7 @@ zulip configuration file under the jabber_mirror section (exceptions are noted
in their help sections). Keys have the same name as options with hyphens in their help sections). Keys have the same name as options with hyphens
replaced with underscores. Zulip configuration options go in the api section, replaced with underscores. Zulip configuration options go in the api section,
as normal.'''.replace("\n", " ") as normal.'''.replace("\n", " ")
) )
parser.add_option( parser.add_option(
'--mode', '--mode',
default=None, default=None,

View file

@ -22,22 +22,22 @@ def test():
''' % (cmd, expected_response, client_dummy.output)) ''' % (cmd, expected_response, client_dummy.output))
def sample_conversation(): def sample_conversation():
return [ return [
('@convert 2 m cm', '2.0 m = 200.0 cm\n'), ('@convert 2 m cm', '2.0 m = 200.0 cm\n'),
('@converter 2 m cm', ''), ('@converter 2 m cm', ''),
('@convert 12 celsius fahrenheit', ('@convert 12 celsius fahrenheit',
'12.0 celsius = 53.600054 fahrenheit\n'), '12.0 celsius = 53.600054 fahrenheit\n'),
('@convert 0.002 kilometer millimile', ('@convert 0.002 kilometer millimile',
'0.002 kilometer = 1.2427424 millimile\n'), '0.002 kilometer = 1.2427424 millimile\n'),
('@convert 3 megabyte kilobit', ('@convert 3 megabyte kilobit',
'3.0 megabyte = 24576.0 kilobit\n'), '3.0 megabyte = 24576.0 kilobit\n'),
(('foo @convert 120.5 g lb bar baz.\n' (('foo @convert 120.5 g lb bar baz.\n'
'baz bar bar @convert 22 k c lorem ipsum dolor'), 'baz bar bar @convert 22 k c lorem ipsum dolor'),
('1. conversion: 120.5 g = 0.26565703 lb\n' ('1. conversion: 120.5 g = 0.26565703 lb\n'
'2. conversion: 22.0 k = -251.15 c\n')), '2. conversion: 22.0 k = -251.15 c\n')),
('@convert foo bar', ('@convert foo bar',
('Too few arguments given. Enter `@convert help` ' ('Too few arguments given. Enter `@convert help` '
'for help on using the converter.\n')), 'for help on using the converter.\n')),
] ]
if __name__ == '__main__': if __name__ == '__main__':
test() test()

View file

@ -85,12 +85,12 @@ class IssueHandler(object):
# Creates the issue json, that is transmitted to the github api servers # Creates the issue json, that is transmitted to the github api servers
issue = { issue = {
'title': new_issue_title, 'title': new_issue_title,
'body': '{} **Sent by [{}](https://chat.zulip.org/#) from zulip**'.format(issue_content, original_sender), 'body': '{} **Sent by [{}](https://chat.zulip.org/#) from zulip**'.format(issue_content, original_sender),
'assignee': '', 'assignee': '',
'milestone': 'none', 'milestone': 'none',
'labels': [''], 'labels': [''],
} }
# Sends the HTTP post request # Sends the HTTP post request
r = session.post(url_new, json.dumps(issue)) r = session.post(url_new, json.dumps(issue))

View file

@ -48,8 +48,8 @@ parser.add_option('--new-short-name')
client = zulip.init_from_options(options) client = zulip.init_from_options(options)
print(client.create_user({ print(client.create_user({
'email': options.new_email, 'email': options.new_email,
'password': options.new_password, 'password': options.new_password,
'full_name': options.new_full_name, 'full_name': options.new_full_name,
'short_name': options.new_short_name 'short_name': options.new_short_name
})) }))

View file

@ -76,10 +76,10 @@ def trac_subject(ticket):
def send_update(ticket, content): def send_update(ticket, content):
# type: (Any, str) -> None # type: (Any, str) -> None
client.send_message({ client.send_message({
"type": "stream", "type": "stream",
"to": config.STREAM_FOR_NOTIFICATIONS, "to": config.STREAM_FOR_NOTIFICATIONS,
"content": content, "content": content,
"subject": trac_subject(ticket) "subject": trac_subject(ticket)
}) })
class ZulipPlugin(Component): class ZulipPlugin(Component):

View file

@ -285,9 +285,9 @@ class Client(object):
vendor_version = platform.mac_ver()[0] vendor_version = platform.mac_ver()[0]
return "{client_name} ({vendor}; {vendor_version})".format( return "{client_name} ({vendor}; {vendor_version})".format(
client_name=self.client_name, client_name=self.client_name,
vendor=vendor, vendor=vendor,
vendor_version=vendor_version, vendor_version=vendor_version,
) )
def do_api_query(self, orig_request, url, method="POST", longpolling=False, files=None): def do_api_query(self, orig_request, url, method="POST", longpolling=False, files=None):
@ -357,15 +357,15 @@ class Client(object):
client_cert = self.client_cert client_cert = self.client_cert
res = requests.request( res = requests.request(
method, method,
urllib.parse.urljoin(self.base_url, url), urllib.parse.urljoin(self.base_url, url),
auth=requests.auth.HTTPBasicAuth(self.email, auth=requests.auth.HTTPBasicAuth(self.email,
self.api_key), self.api_key),
verify=self.tls_verification, verify=self.tls_verification,
cert=client_cert, cert=client_cert,
timeout=90, timeout=90,
headers={"User-agent": self.get_user_agent()}, headers={"User-agent": self.get_user_agent()},
**kwargs) **kwargs)
# On 50x errors, try again after a short sleep # On 50x errors, try again after a short sleep
if str(res.status_code).startswith('5'): if str(res.status_code).startswith('5'):