summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-05-14 11:51:16 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-05-14 11:51:16 +0100
commit3fb2ea99329ad2c4f054deff83ad19af571241f8 (patch)
tree28b881fcb9973f47da50bf0733d17b2262bca76a /synapse/handlers
parentTemporarily add m.lazy_load_members to unstable_features (diff)
downloadsynapse-3fb2ea99329ad2c4f054deff83ad19af571241f8.tar.xz
apply linting
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/account_validity.py4
-rw-r--r--synapse/handlers/federation.py3
-rw-r--r--synapse/handlers/identity.py24
-rw-r--r--synapse/handlers/register.py12
-rw-r--r--synapse/handlers/room_member.py10
5 files changed, 23 insertions, 30 deletions
diff --git a/synapse/handlers/account_validity.py b/synapse/handlers/account_validity.py
index 72baee44c3..a6c907b9c9 100644
--- a/synapse/handlers/account_validity.py
+++ b/synapse/handlers/account_validity.py
@@ -93,7 +93,9 @@ class AccountValidityHandler(object):
         # If account_validity is enabled,check every hour to remove expired users from
         # the user directory
         if self._account_validity.enabled:
-            self.clock.looping_call(self._mark_expired_users_as_inactive, 60 * 60 * 1000)
+            self.clock.looping_call(
+                self._mark_expired_users_as_inactive, 60 * 60 * 1000
+            )
 
     async def _send_renewal_emails(self):
         """Gets the list of users whose account is expiring in the amount of time
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 5d686ab2c9..ebdc239fff 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -412,8 +412,7 @@ class FederationHandler(BaseHandler):
                     # First though we need to fetch all the events that are in
                     # state_map, so we can build up the state below.
                     evs = await self.store.get_events(
-                        list(state_map.values()),
-                        get_prev_content=False,
+                        list(state_map.values()), get_prev_content=False,
                     )
                     event_map.update(evs)
 
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py
index e8a6cf7788..1d07361661 100644
--- a/synapse/handlers/identity.py
+++ b/synapse/handlers/identity.py
@@ -172,9 +172,7 @@ class IdentityHandler(BaseHandler):
         bind_data = {"sid": sid, "client_secret": client_secret, "mxid": mxid}
         if use_v2:
             bind_url = "%s/_matrix/identity/v2/3pid/bind" % (id_server_url,)
-            headers["Authorization"] = create_id_access_token_header(
-                id_access_token
-            )
+            headers["Authorization"] = create_id_access_token_header(id_access_token)
         else:
             bind_url = "%s/_matrix/identity/api/v1/3pid/bind" % (id_server_url,)
 
@@ -417,7 +415,9 @@ class IdentityHandler(BaseHandler):
         if add_https:
             rewritten_url = "https://" + rewritten_url
 
-        rewritten_url = self.rewrite_identity_server_urls.get(rewritten_url, rewritten_url)
+        rewritten_url = self.rewrite_identity_server_urls.get(
+            rewritten_url, rewritten_url
+        )
         logger.debug("Rewriting identity server rule from %s to %s", url, rewritten_url)
         return rewritten_url
 
@@ -463,7 +463,8 @@ class IdentityHandler(BaseHandler):
 
         try:
             data = yield self.http_client.post_json_get_json(
-                "%s/_matrix/identity/api/v1/validate/email/requestToken" % (id_server_url,),
+                "%s/_matrix/identity/api/v1/validate/email/requestToken"
+                % (id_server_url,),
                 params,
             )
             return data
@@ -520,7 +521,8 @@ class IdentityHandler(BaseHandler):
         id_server_url = self.rewrite_id_server_url(id_server_url)
         try:
             data = yield self.http_client.post_json_get_json(
-                "%s/_matrix/identity/api/v1/validate/msisdn/requestToken" % (id_server_url,),
+                "%s/_matrix/identity/api/v1/validate/msisdn/requestToken"
+                % (id_server_url,),
                 params,
             )
         except HttpResponseException as e:
@@ -806,7 +808,7 @@ class IdentityHandler(BaseHandler):
                 400,
                 "Non-dict object from %s during v2 hash_details request: %s"
                 % (id_server_url, hash_details),
-                )
+            )
 
         # Extract information from hash_details
         supported_lookup_algorithms = hash_details.get("algorithms")
@@ -821,7 +823,7 @@ class IdentityHandler(BaseHandler):
                 400,
                 "Invalid hash details received from identity server %s: %s"
                 % (id_server_url, hash_details),
-                )
+            )
 
         # Check if any of the supported lookup algorithms are present
         if LookupAlgorithm.SHA256 in supported_lookup_algorithms:
@@ -863,7 +865,7 @@ class IdentityHandler(BaseHandler):
                     "pepper": lookup_pepper,
                 },
                 headers=headers,
-                )
+            )
         except TimeoutError:
             raise SynapseError(500, "Timed out contacting identity server")
         except Exception as e:
@@ -1011,9 +1013,7 @@ class IdentityHandler(BaseHandler):
                 raise SynapseError(500, "Timed out contacting identity server")
             except HttpResponseException as e:
                 logger.warning(
-                    "Error trying to call /store-invite on %s: %s",
-                    id_server_url,
-                    e,
+                    "Error trying to call /store-invite on %s: %s", id_server_url, e,
                 )
 
             if data is None:
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 85635f1a0f..34b876b6af 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -619,10 +619,7 @@ class RegistrationHandler(BaseHandler):
 
     @defer.inlineCallbacks
     def post_registration_actions(
-        self,
-        user_id,
-        auth_result,
-        access_token,
+        self, user_id, auth_result, access_token,
     ):
         """A user has completed registration
 
@@ -654,7 +651,8 @@ class RegistrationHandler(BaseHandler):
                 # Bind the 3PID to the identity server
                 logger.debug(
                     "Binding email to %s on id_server %s",
-                    user_id, self.hs.config.account_threepid_delegate_email,
+                    user_id,
+                    self.hs.config.account_threepid_delegate_email,
                 )
                 threepid_creds = threepid["threepid_creds"]
 
@@ -662,7 +660,9 @@ class RegistrationHandler(BaseHandler):
                 # `bind_threepid` will add https:// to it, so this restricts
                 # account_threepid_delegate.email to https:// addresses only
                 # We assume this is always the case for dinsic however.
-                if self.hs.config.account_threepid_delegate_email.startswith("https://"):
+                if self.hs.config.account_threepid_delegate_email.startswith(
+                    "https://"
+                ):
                     id_server = self.hs.config.account_threepid_delegate_email[8:]
                 else:
                     # Must start with http:// instead
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 2d9ff97324..cddc95413a 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -24,16 +24,8 @@ from twisted.internet import defer
 
 from synapse import types
 from synapse.api.constants import EventTypes, Membership
-from synapse.api.ratelimiting import Ratelimiter
-from synapse.api.errors import (
-    AuthError,
-    Codes,
-    HttpResponseException,
-    SynapseError,
-)
-from synapse.handlers.identity import LookupAlgorithm, create_id_access_token_header
-from synapse.http.client import SimpleHttpClient
 from synapse.api.errors import AuthError, Codes, SynapseError
+from synapse.api.ratelimiting import Ratelimiter
 from synapse.types import Collection, RoomID, UserID
 from synapse.util.async_helpers import Linearizer
 from synapse.util.distributor import user_joined_room, user_left_room