diff --git a/bin/zulip-send b/bin/zulip-send index 7144720..5d3adbd 100755 --- a/bin/zulip-send +++ b/bin/zulip-send @@ -43,7 +43,7 @@ def do_send_message(client, message_data): if message_data['type'] == 'stream': log.info('Sending message to stream "%s", subject "%s"... ' % - (message_data['to'], message_data['subject'])) + (message_data['to'], message_data['subject'])) else: log.info('Sending message to %s... ' % message_data['to']) response = client.send_message(message_data) diff --git a/bots/check-mirroring b/bots/check-mirroring index 72b1aa1..8a131d8 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -329,11 +329,11 @@ for key in all_keys: if key in zhkeys: (stream, test) = zhkeys[key] logger.warning("%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s" % - (key, z_key_counts[key], h_key_counts[key], test, stream)) + (key, z_key_counts[key], h_key_counts[key], test, stream)) if key in hzkeys: (stream, test) = hzkeys[key] logger.warning("%10s: z got %s. h got %s. Sent via Zulip(%s): class %s" % - (key, z_key_counts[key], h_key_counts[key], test, stream)) + (key, z_key_counts[key], h_key_counts[key], test, stream)) logger.error("") logger.error("Summary of specific problems:") diff --git a/bots/gcal-bot b/bots/gcal-bot index a7728df..1064c3d 100755 --- a/bots/gcal-bot +++ b/bots/gcal-bot @@ -34,17 +34,17 @@ parser = optparse.OptionParser(r""" """) parser.add_option('--calendar', - dest='calendar', - action='store', - help='Google Calendar XML "Private Address"', - metavar='URL') + dest='calendar', + action='store', + help='Google Calendar XML "Private Address"', + metavar='URL') parser.add_option('--interval', - dest='interval', - default=10, - type=int, - action='store', - help='Minutes before event for reminder [default: 10]', - metavar='MINUTES') + dest='interval', + default=10, + type=int, + action='store', + help='Minutes before event for reminder [default: 10]', + metavar='MINUTES') parser.add_option_group(zulip.generate_option_group(parser)) (options, args) = parser.parse_args() @@ -65,7 +65,7 @@ def get_calendar_url(): parser.error('The --calendar URL should be the XML "Private Address" ' + 'from your calendar settings') return urllib.parse.urlunparse((parts.scheme, parts.netloc, pat[0] + '/full', - '', 'futureevents=true&orderby=startdate', '')) + '', 'futureevents=true&orderby=startdate', '')) calendar_url = get_calendar_url() diff --git a/bots/jabber_mirror_backend.py b/bots/jabber_mirror_backend.py index 7fde854..e2d70bf 100755 --- a/bots/jabber_mirror_backend.py +++ b/bots/jabber_mirror_backend.py @@ -322,28 +322,28 @@ def config_error(msg): sys.exit(2) if __name__ == '__main__': - parser = optparse.OptionParser(epilog= -'''Most general and Jabber configuration options may also be specified in the + parser = optparse.OptionParser( + epilog='''Most general and Jabber configuration options may also be specified in the 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, - action='store', - help= -'''Which mode to run in. Valid options are "personal" and "public". In + parser.add_option( + '--mode', + default=None, + action='store', + help='''Which mode to run in. Valid options are "personal" and "public". In "personal" mode, the mirror uses an individual users' credentials and mirrors all messages they send on Zulip to Jabber and all private Jabber messages to Zulip. In "public" mode, the mirror uses the credentials for a dedicated mirror user and mirrors messages sent to Jabber rooms to Zulip. Defaults to "personal"'''.replace("\n", " ")) - parser.add_option('--zulip-email-suffix', - default=None, - action='store', - help= -'''Add the specified suffix to the local part of email addresses constructed + parser.add_option( + '--zulip-email-suffix', + default=None, + action='store', + help='''Add the specified suffix to the local part of email addresses constructed from JIDs and nicks before sending requests to the Zulip server, and remove the suffix before sending requests to the Jabber server. For example, specifying "+foo" will cause messages that are sent to the "bar" room by nickname "qux" to @@ -357,14 +357,15 @@ option does not affect login credentials.'''.replace("\n", " ")) default=logging.INFO) jabber_group = optparse.OptionGroup(parser, "Jabber configuration") - jabber_group.add_option('--jid', - default=None, - action='store', - help="Your Jabber JID. If a resource is specified, " - + "it will be used as the nickname when joining MUCs. " - + "Specifying the nickname is mostly useful if you want " - + "to run the public mirror from a regular user instead of " - + "from a dedicated account.") + jabber_group.add_option( + '--jid', + default=None, + action='store', + help="Your Jabber JID. If a resource is specified, " + + "it will be used as the nickname when joining MUCs. " + + "Specifying the nickname is mostly useful if you want " + + "to run the public mirror from a regular user instead of " + + "from a dedicated account.") jabber_group.add_option('--jabber-password', default=None, action='store', @@ -380,12 +381,12 @@ option does not affect login credentials.'''.replace("\n", " ")) jabber_group.add_option('--jabber-server-address', default=None, action='store', - help="The hostname of your Jabber server. This is only needed if " + help="The hostname of your Jabber server. This is only needed if " "your server is missing SRV records") jabber_group.add_option('--jabber-server-port', default='5222', action='store', - help="The port of your Jabber server. This is only needed if " + help="The port of your Jabber server. This is only needed if " "your server is missing SRV records") parser.add_option_group(jabber_group) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 1cbfa34..77886f8 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -631,7 +631,7 @@ Feedback button or at support@zulipchat.com.""" wrapper = textwrap.TextWrapper(break_long_words=False, break_on_hyphens=False) wrapped_content = "\n".join("\n".join(wrapper.wrap(line)) - for line in message["content"].replace("@", "@@").split("\n")) + for line in message["content"].replace("@", "@@").split("\n")) zwrite_args = ["zwrite", "-n", "-s", message["sender_full_name"], "-F", "Zephyr error: See http://zephyr.1ts.org/wiki/df", diff --git a/contrib_bots/run.py b/contrib_bots/run.py index 214c2eb..e686472 100755 --- a/contrib_bots/run.py +++ b/contrib_bots/run.py @@ -89,11 +89,11 @@ def run(): parser = optparse.OptionParser(usage=usage) parser.add_option('--quiet', '-q', - action='store_true', - help='Turn off logging output.') + action='store_true', + help='Turn off logging output.') parser.add_option('--config-file', - action='store', - help='(alternate config file to ~/.zuliprc)') + action='store', + help='(alternate config file to ~/.zuliprc)') (options, args) = parser.parse_args() if len(args) == 0: diff --git a/integrations/twitter/twitter-bot b/integrations/twitter/twitter-bot index d7aabb2..a5dfc12 100755 --- a/integrations/twitter/twitter-bot +++ b/integrations/twitter/twitter-bot @@ -74,14 +74,14 @@ parser = optparse.OptionParser(r""" """) parser.add_option('--twitter-id', - help='Twitter username to poll for new tweets from"', - metavar='URL') + help='Twitter username to poll for new tweets from"', + metavar='URL') parser.add_option('--stream', - help='Default zulip stream to write tweets to') + help='Default zulip stream to write tweets to') parser.add_option('--limit-tweets', - default=15, - type='int', - help='Maximum number of tweets to push at once') + default=15, + type='int', + help='Maximum number of tweets to push at once') parser.add_option_group(zulip.generate_option_group(parser)) (options, args) = parser.parse_args() diff --git a/zulip/__init__.py b/zulip/__init__.py index 8b6ff38..d8243c8 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -313,7 +313,7 @@ class Client(object): if self.verbose: if not query_state["had_error_retry"]: sys.stdout.write("zulip API(%s): connection error%s -- retrying." % - (url.split(API_VERSTRING, 2)[0], error_string,)) + (url.split(API_VERSTRING, 2)[0], error_string,)) query_state["had_error_retry"] = True else: sys.stdout.write(".")