pep8: Fix E128 violations.

With some line-wrapping tweaks by tabbott.
This commit is contained in:
reallyly 2016-12-11 13:30:45 +00:00 committed by Tim Abbott
parent 92981590f5
commit 9d6e7cfea5
8 changed files with 49 additions and 48 deletions

View file

@ -43,7 +43,7 @@ def do_send_message(client, message_data):
if message_data['type'] == 'stream': if message_data['type'] == 'stream':
log.info('Sending message to stream "%s", subject "%s"... ' % log.info('Sending message to stream "%s", subject "%s"... ' %
(message_data['to'], message_data['subject'])) (message_data['to'], message_data['subject']))
else: else:
log.info('Sending message to %s... ' % message_data['to']) log.info('Sending message to %s... ' % message_data['to'])
response = client.send_message(message_data) response = client.send_message(message_data)

View file

@ -329,11 +329,11 @@ for key in all_keys:
if key in zhkeys: if key in zhkeys:
(stream, test) = zhkeys[key] (stream, test) = zhkeys[key]
logger.warning("%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s" % 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: if key in hzkeys:
(stream, test) = hzkeys[key] (stream, test) = hzkeys[key]
logger.warning("%10s: z got %s. h got %s. Sent via Zulip(%s): class %s" % 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("")
logger.error("Summary of specific problems:") logger.error("Summary of specific problems:")

View file

@ -34,17 +34,17 @@ parser = optparse.OptionParser(r"""
""") """)
parser.add_option('--calendar', parser.add_option('--calendar',
dest='calendar', dest='calendar',
action='store', action='store',
help='Google Calendar XML "Private Address"', help='Google Calendar XML "Private Address"',
metavar='URL') metavar='URL')
parser.add_option('--interval', parser.add_option('--interval',
dest='interval', dest='interval',
default=10, default=10,
type=int, type=int,
action='store', action='store',
help='Minutes before event for reminder [default: 10]', help='Minutes before event for reminder [default: 10]',
metavar='MINUTES') metavar='MINUTES')
parser.add_option_group(zulip.generate_option_group(parser)) parser.add_option_group(zulip.generate_option_group(parser))
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
@ -65,7 +65,7 @@ def get_calendar_url():
parser.error('The --calendar URL should be the XML "Private Address" ' + parser.error('The --calendar URL should be the XML "Private Address" ' +
'from your calendar settings') 'from your calendar settings')
return urllib.parse.urlunparse((parts.scheme, parts.netloc, pat[0] + '/full', return urllib.parse.urlunparse((parts.scheme, parts.netloc, pat[0] + '/full',
'', 'futureevents=true&orderby=startdate', '')) '', 'futureevents=true&orderby=startdate', ''))
calendar_url = get_calendar_url() calendar_url = get_calendar_url()

View file

@ -322,28 +322,28 @@ def config_error(msg):
sys.exit(2) sys.exit(2)
if __name__ == '__main__': if __name__ == '__main__':
parser = optparse.OptionParser(epilog= parser = optparse.OptionParser(
'''Most general and Jabber configuration options may also be specified in the epilog='''Most general and Jabber configuration options may also be specified in the
zulip configuration file under the jabber_mirror section (exceptions are noted 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('--mode', parser.add_option(
default=None, '--mode',
action='store', default=None,
help= action='store',
'''Which mode to run in. Valid options are "personal" and "public". In help='''Which mode to run in. Valid options are "personal" and "public". In
"personal" mode, the mirror uses an individual users' credentials and mirrors "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 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 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 user and mirrors messages sent to Jabber rooms to Zulip. Defaults to
"personal"'''.replace("\n", " ")) "personal"'''.replace("\n", " "))
parser.add_option('--zulip-email-suffix', parser.add_option(
default=None, '--zulip-email-suffix',
action='store', default=None,
help= action='store',
'''Add the specified suffix to the local part of email addresses constructed 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 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 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 "+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) default=logging.INFO)
jabber_group = optparse.OptionGroup(parser, "Jabber configuration") jabber_group = optparse.OptionGroup(parser, "Jabber configuration")
jabber_group.add_option('--jid', jabber_group.add_option(
default=None, '--jid',
action='store', default=None,
help="Your Jabber JID. If a resource is specified, " action='store',
+ "it will be used as the nickname when joining MUCs. " help="Your Jabber JID. If a resource is specified, "
+ "Specifying the nickname is mostly useful if you want " + "it will be used as the nickname when joining MUCs. "
+ "to run the public mirror from a regular user instead of " + "Specifying the nickname is mostly useful if you want "
+ "from a dedicated account.") + "to run the public mirror from a regular user instead of "
+ "from a dedicated account.")
jabber_group.add_option('--jabber-password', jabber_group.add_option('--jabber-password',
default=None, default=None,
action='store', action='store',
@ -380,12 +381,12 @@ option does not affect login credentials.'''.replace("\n", " "))
jabber_group.add_option('--jabber-server-address', jabber_group.add_option('--jabber-server-address',
default=None, default=None,
action='store', 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") "your server is missing SRV records")
jabber_group.add_option('--jabber-server-port', jabber_group.add_option('--jabber-server-port',
default='5222', default='5222',
action='store', 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") "your server is missing SRV records")
parser.add_option_group(jabber_group) parser.add_option_group(jabber_group)

View file

@ -631,7 +631,7 @@ Feedback button or at support@zulipchat.com."""
wrapper = textwrap.TextWrapper(break_long_words=False, break_on_hyphens=False) wrapper = textwrap.TextWrapper(break_long_words=False, break_on_hyphens=False)
wrapped_content = "\n".join("\n".join(wrapper.wrap(line)) 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"], zwrite_args = ["zwrite", "-n", "-s", message["sender_full_name"],
"-F", "Zephyr error: See http://zephyr.1ts.org/wiki/df", "-F", "Zephyr error: See http://zephyr.1ts.org/wiki/df",

View file

@ -89,11 +89,11 @@ def run():
parser = optparse.OptionParser(usage=usage) parser = optparse.OptionParser(usage=usage)
parser.add_option('--quiet', '-q', parser.add_option('--quiet', '-q',
action='store_true', action='store_true',
help='Turn off logging output.') help='Turn off logging output.')
parser.add_option('--config-file', parser.add_option('--config-file',
action='store', action='store',
help='(alternate config file to ~/.zuliprc)') help='(alternate config file to ~/.zuliprc)')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) == 0: if len(args) == 0:

View file

@ -74,14 +74,14 @@ parser = optparse.OptionParser(r"""
""") """)
parser.add_option('--twitter-id', parser.add_option('--twitter-id',
help='Twitter username to poll for new tweets from"', help='Twitter username to poll for new tweets from"',
metavar='URL') metavar='URL')
parser.add_option('--stream', 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', parser.add_option('--limit-tweets',
default=15, default=15,
type='int', type='int',
help='Maximum number of tweets to push at once') help='Maximum number of tweets to push at once')
parser.add_option_group(zulip.generate_option_group(parser)) parser.add_option_group(zulip.generate_option_group(parser))
(options, args) = parser.parse_args() (options, args) = parser.parse_args()

View file

@ -313,7 +313,7 @@ class Client(object):
if self.verbose: if self.verbose:
if not query_state["had_error_retry"]: if not query_state["had_error_retry"]:
sys.stdout.write("zulip API(%s): connection error%s -- retrying." % 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 query_state["had_error_retry"] = True
else: else:
sys.stdout.write(".") sys.stdout.write(".")