From 8743f42b495fdb8a7cf14d1c16021655b0d0222e Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Apr 2018 10:34:04 +0100 Subject: [PATCH] pep8 --- synapse/config/registration.py | 2 +- synapse/handlers/profile.py | 4 ++-- synapse/storage/profile.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/synapse/config/registration.py b/synapse/config/registration.py index 14373c502d..5c21287998 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -51,7 +51,7 @@ class RegistrationConfig(Config): self.replicate_user_profiles_to = config.get("replicate_user_profiles_to", []) if not isinstance(self.replicate_user_profiles_to, list): - self.replicate_user_profiles_to = [self.replicate_user_profiles_to,] + self.replicate_user_profiles_to = [self.replicate_user_profiles_to, ] def default_config(self, **kwargs): registration_shared_secret = random_string_with_symbols(50) diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index d56adf069b..bf91eedb7f 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -83,7 +83,7 @@ class ProfileHandler(BaseHandler): try: for i in xrange(host_batches[repl_host] + 1, latest_batch + 1): yield self._replicate_host_profile_batch(repl_host, i) - except: + except Exception: logger.exception( "Exception while replicating to %s: aborting for now", repl_host, ) @@ -110,7 +110,7 @@ class ProfileHandler(BaseHandler): yield self.http_client.post_json_get_json(url, signed_body) self.store.update_replication_batch_for_host(host, batchnum) logger.info("Sucessfully replicated profile batch %d to %s", batchnum, host) - except: + except Exception: # This will get retried when the looping call next comes around logger.exception("Failed to replicate profile batch %d to %s", batchnum, host) raise diff --git a/synapse/storage/profile.py b/synapse/storage/profile.py index a3f144eb41..048f48dcc1 100644 --- a/synapse/storage/profile.py +++ b/synapse/storage/profile.py @@ -71,7 +71,9 @@ class ProfileWorkerStore(SQLBaseStore): txn.execute("SELECT MAX(batch) as maxbatch FROM profiles") rows = self.cursor_to_dict(txn) return rows[0]['maxbatch'] - max_batch = yield self.runInteraction("get_latest_profile_replication_batch_number", f) + max_batch = yield self.runInteraction( + "get_latest_profile_replication_batch_number", f, + ) defer.returnValue(max_batch) def get_profile_batch(self, batchnum): @@ -104,7 +106,7 @@ class ProfileWorkerStore(SQLBaseStore): def f(txn): txn.execute("SELECT host, last_synced_batch FROM profile_replication_status") rows = self.cursor_to_dict(txn) - return { r['host']: r['last_synced_batch'] for r in rows } + return {r['host']: r['last_synced_batch'] for r in rows} result = yield self.runInteraction("get_replication_hosts", f) defer.returnValue(result)