diff --git a/bots/jabber_mirror_backend.py b/bots/jabber_mirror_backend.py index cb97683..48cc29a 100755 --- a/bots/jabber_mirror_backend.py +++ b/bots/jabber_mirror_backend.py @@ -75,9 +75,9 @@ def jid_to_zulip(jid): def zulip_to_jid(email, jabber_domain): # type: (str, str) -> JID jid = JID(email, domain=jabber_domain) - if (options.zulip_email_suffix - and options.zulip_email_suffix in jid.username - and not jid.username.endswith("-bot")): + if (options.zulip_email_suffix and + options.zulip_email_suffix in jid.username and + not jid.username.endswith("-bot")): jid.username = jid.username.rpartition(options.zulip_email_suffix)[0] return jid @@ -366,10 +366,10 @@ option does not affect login credentials.'''.replace("\n", " ")) 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.") + "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', @@ -378,7 +378,7 @@ option does not affect login credentials.'''.replace("\n", " ")) default=None, action='store', help="Your Jabber conference domain (E.g. conference.jabber.example.com). " - + "If not specifed, \"conference.\" will be prepended to your JID's domain.") + "If not specifed, \"conference.\" will be prepended to your JID's domain.") jabber_group.add_option('--no-use-tls', default=None, action='store_true') @@ -413,8 +413,8 @@ option does not affect login credentials.'''.replace("\n", " ")) pass for option in ("jid", "jabber_password", "conference_domain", "mode", "zulip_email_suffix", "jabber_server_address", "jabber_server_port"): - if (getattr(options, option) is None - and config.has_option("jabber_mirror", option)): + if (getattr(options, option) is None and + config.has_option("jabber_mirror", option)): setattr(options, option, config.get("jabber_mirror", option)) for option in ("no_use_tls",): @@ -435,7 +435,7 @@ option does not affect login credentials.'''.replace("\n", " ")) if None in (options.jid, options.jabber_password): config_error("You must specify your Jabber JID and Jabber password either " - + "in the Zulip configuration file or on the commandline") + "in the Zulip configuration file or on the commandline") zulipToJabber = ZulipToJabberBot(zulip.init_from_options(options, "JabberMirror/" + __version__)) # This won't work for open realms that don't have a consistent domain diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 0a31eb9..386e078 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -104,8 +104,8 @@ def unwrap_lines(body): previous_line = lines[0] for line in lines[1:]: line = line.rstrip() - if (re.match(r'^\W', line, flags=re.UNICODE) - and re.match(r'^\W', previous_line, flags=re.UNICODE)): + if (re.match(r'^\W', line, flags=re.UNICODE) and + re.match(r'^\W', previous_line, flags=re.UNICODE)): result += previous_line + "\n" elif (line == "" or previous_line == "" or diff --git a/contrib_bots/bots/commute_bot/commute_bot.py b/contrib_bots/bots/commute_bot/commute_bot.py index ad4e0c8..f184fe0 100644 --- a/contrib_bots/bots/commute_bot/commute_bot.py +++ b/contrib_bots/bots/commute_bot/commute_bot.py @@ -171,16 +171,16 @@ class CommuteHandler(object): # determines if fare information is available try: - fare = ('Fare: ' + variable_list["fare"]["currency"] - + variable_list["fare"]["text"]) + fare = ('Fare: ' + variable_list["fare"]["currency"] + + variable_list["fare"]["text"]) output += '\n' + fare except (KeyError, IndexError): pass # determines if traffic duration information is available try: - traffic_duration = ('Duration in traffic: ' - + variable_list["duration_in_traffic"] + traffic_duration = ('Duration in traffic: ' + + variable_list["duration_in_traffic"] ["text"]) output += '\n' + traffic_duration except (KeyError, IndexError): @@ -208,13 +208,13 @@ class CommuteHandler(object): return request.json() else: self.send_info(message, - "Something went wrong. Please try again." - + " Error: {error_num}.\n{error_text}" + "Something went wrong. Please try again." + + " Error: {error_num}.\n{error_text}" .format(error_num=request.status_code, error_text=request.text), client) return - r = requests.get('https://maps.googleapis.com/maps/api/' - + 'distancematrix/json', params=params) + r = requests.get('https://maps.googleapis.com/maps/api/' + + 'distancematrix/json', params=params) result = validate_requests(r) return result diff --git a/contrib_bots/bots/foursquare/foursquare.py b/contrib_bots/bots/foursquare/foursquare.py index c70d115..22ce924 100644 --- a/contrib_bots/bots/foursquare/foursquare.py +++ b/contrib_bots/bots/foursquare/foursquare.py @@ -120,9 +120,9 @@ Example Inputs: return if received_json['meta']['code'] == 200: - response_msg = ('Food nearby ' + params['near'] - + ' coming right up:\n' - + self.format_json(received_json['response']['venues'])) + response_msg = ('Food nearby ' + params['near'] + + ' coming right up:\n' + + self.format_json(received_json['response']['venues'])) self.send_info(message, response_msg, client) return diff --git a/zulip/__init__.py b/zulip/__init__.py index e349224..4f67415 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -79,9 +79,9 @@ class CountingBackoff(object): def _check_success_timeout(self): # type: () -> None - if (self.timeout_success_equivalent is not None - and self.last_attempt_time != 0 - and time.time() - self.last_attempt_time > self.timeout_success_equivalent): + if (self.timeout_success_equivalent is not None and + self.last_attempt_time != 0 and + time.time() - self.last_attempt_time > self.timeout_success_equivalent): self.number_of_retries = 0 class RandomExponentialBackoff(CountingBackoff):