From 722fc565341e9f5210edc34695ca604d4220ab2a Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 23 Jan 2017 22:06:13 -0800 Subject: [PATCH] lint: Clean up E126 PEP-8 rule. --- bots/check-mirroring | 14 ++++---- bots/irc-mirror.py | 20 ++++++------ bots/jabber_mirror_backend.py | 2 +- contrib_bots/bots/converter/tests.py | 32 +++++++++---------- .../bots/github_issues/github_issues.py | 12 +++---- examples/create-user | 8 ++--- integrations/trac/zulip_trac.py | 8 ++--- zulip/__init__.py | 24 +++++++------- 8 files changed, 60 insertions(+), 60 deletions(-) diff --git a/bots/check-mirroring b/bots/check-mirroring index 449fbb3a..e1255e36 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -252,16 +252,16 @@ logger.info("Sent Zephyr messages!") for key, (stream, test) in hzkeys.items(): if stream == "message": send_zulip({ - "type": "private", - "content": str(key), - "to": zulip_user, + "type": "private", + "content": str(key), + "to": zulip_user, }) else: send_zulip({ - "type": "stream", - "subject": "test", - "content": str(key), - "to": stream, + "type": "stream", + "subject": "test", + "content": str(key), + "to": stream, }) receive_zephyrs() diff --git a/bots/irc-mirror.py b/bots/irc-mirror.py index ddfae937..0a9e3f29 100755 --- a/bots/irc-mirror.py +++ b/bots/irc-mirror.py @@ -65,10 +65,10 @@ class IRCBot(irc.bot.SingleServerIRCBot): # Forward the PM to Zulip print(zulip_client.send_message({ - "sender": sender, - "type": "private", - "to": "username@example.com", - "content": content, + "sender": sender, + "type": "private", + "to": "username@example.com", + "content": content, })) def on_pubmsg(self, c, e): @@ -81,12 +81,12 @@ class IRCBot(irc.bot.SingleServerIRCBot): # Forward the stream message to Zulip print(zulip_client.send_message({ - "forged": "yes", - "sender": sender, - "type": "stream", - "to": stream, - "subject": "IRC", - "content": content, + "forged": "yes", + "sender": sender, + "type": "stream", + "to": stream, + "subject": "IRC", + "content": content, })) def on_dccmsg(self, c, e): diff --git a/bots/jabber_mirror_backend.py b/bots/jabber_mirror_backend.py index 8abbfcef..e579e7a8 100755 --- a/bots/jabber_mirror_backend.py +++ b/bots/jabber_mirror_backend.py @@ -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 replaced with underscores. Zulip configuration options go in the api section, as normal.'''.replace("\n", " ") - ) + ) parser.add_option( '--mode', default=None, diff --git a/contrib_bots/bots/converter/tests.py b/contrib_bots/bots/converter/tests.py index 539d3d82..519059c3 100644 --- a/contrib_bots/bots/converter/tests.py +++ b/contrib_bots/bots/converter/tests.py @@ -22,22 +22,22 @@ def test(): ''' % (cmd, expected_response, client_dummy.output)) def sample_conversation(): return [ - ('@convert 2 m cm', '2.0 m = 200.0 cm\n'), - ('@converter 2 m cm', ''), - ('@convert 12 celsius fahrenheit', - '12.0 celsius = 53.600054 fahrenheit\n'), - ('@convert 0.002 kilometer millimile', - '0.002 kilometer = 1.2427424 millimile\n'), - ('@convert 3 megabyte kilobit', - '3.0 megabyte = 24576.0 kilobit\n'), - (('foo @convert 120.5 g lb bar baz.\n' - 'baz bar bar @convert 22 k c lorem ipsum dolor'), - ('1. conversion: 120.5 g = 0.26565703 lb\n' - '2. conversion: 22.0 k = -251.15 c\n')), - ('@convert foo bar', - ('Too few arguments given. Enter `@convert help` ' - 'for help on using the converter.\n')), - ] + ('@convert 2 m cm', '2.0 m = 200.0 cm\n'), + ('@converter 2 m cm', ''), + ('@convert 12 celsius fahrenheit', + '12.0 celsius = 53.600054 fahrenheit\n'), + ('@convert 0.002 kilometer millimile', + '0.002 kilometer = 1.2427424 millimile\n'), + ('@convert 3 megabyte kilobit', + '3.0 megabyte = 24576.0 kilobit\n'), + (('foo @convert 120.5 g lb bar baz.\n' + 'baz bar bar @convert 22 k c lorem ipsum dolor'), + ('1. conversion: 120.5 g = 0.26565703 lb\n' + '2. conversion: 22.0 k = -251.15 c\n')), + ('@convert foo bar', + ('Too few arguments given. Enter `@convert help` ' + 'for help on using the converter.\n')), + ] if __name__ == '__main__': test() diff --git a/contrib_bots/bots/github_issues/github_issues.py b/contrib_bots/bots/github_issues/github_issues.py index e1b7beda..a5ca83ad 100644 --- a/contrib_bots/bots/github_issues/github_issues.py +++ b/contrib_bots/bots/github_issues/github_issues.py @@ -85,12 +85,12 @@ class IssueHandler(object): # Creates the issue json, that is transmitted to the github api servers issue = { - 'title': new_issue_title, - 'body': '{} **Sent by [{}](https://chat.zulip.org/#) from zulip**'.format(issue_content, original_sender), - 'assignee': '', - 'milestone': 'none', - 'labels': [''], - } + 'title': new_issue_title, + 'body': '{} **Sent by [{}](https://chat.zulip.org/#) from zulip**'.format(issue_content, original_sender), + 'assignee': '', + 'milestone': 'none', + 'labels': [''], + } # Sends the HTTP post request r = session.post(url_new, json.dumps(issue)) diff --git a/examples/create-user b/examples/create-user index a9c156d4..cd33761e 100755 --- a/examples/create-user +++ b/examples/create-user @@ -48,8 +48,8 @@ parser.add_option('--new-short-name') client = zulip.init_from_options(options) print(client.create_user({ - 'email': options.new_email, - 'password': options.new_password, - 'full_name': options.new_full_name, - 'short_name': options.new_short_name + 'email': options.new_email, + 'password': options.new_password, + 'full_name': options.new_full_name, + 'short_name': options.new_short_name })) diff --git a/integrations/trac/zulip_trac.py b/integrations/trac/zulip_trac.py index 0e17fca8..b7566855 100644 --- a/integrations/trac/zulip_trac.py +++ b/integrations/trac/zulip_trac.py @@ -76,10 +76,10 @@ def trac_subject(ticket): def send_update(ticket, content): # type: (Any, str) -> None client.send_message({ - "type": "stream", - "to": config.STREAM_FOR_NOTIFICATIONS, - "content": content, - "subject": trac_subject(ticket) + "type": "stream", + "to": config.STREAM_FOR_NOTIFICATIONS, + "content": content, + "subject": trac_subject(ticket) }) class ZulipPlugin(Component): diff --git a/zulip/__init__.py b/zulip/__init__.py index ddbdc75a..34469eb4 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -285,9 +285,9 @@ class Client(object): vendor_version = platform.mac_ver()[0] return "{client_name} ({vendor}; {vendor_version})".format( - client_name=self.client_name, - vendor=vendor, - vendor_version=vendor_version, + client_name=self.client_name, + vendor=vendor, + vendor_version=vendor_version, ) 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 res = requests.request( - method, - urllib.parse.urljoin(self.base_url, url), - auth=requests.auth.HTTPBasicAuth(self.email, - self.api_key), - verify=self.tls_verification, - cert=client_cert, - timeout=90, - headers={"User-agent": self.get_user_agent()}, - **kwargs) + method, + urllib.parse.urljoin(self.base_url, url), + auth=requests.auth.HTTPBasicAuth(self.email, + self.api_key), + verify=self.tls_verification, + cert=client_cert, + timeout=90, + headers={"User-agent": self.get_user_agent()}, + **kwargs) # On 50x errors, try again after a short sleep if str(res.status_code).startswith('5'):