From 01a64ee66565060fe47d57a2f5802c0d76730a7e Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 10 Mar 2022 13:18:51 -0500 Subject: [PATCH 1/3] Remove unnecessary passes. --- synapse/handlers/device.py | 2 -- synapse/handlers/presence.py | 2 -- synapse/http/matrixfederationclient.py | 2 -- synapse/http/server.py | 1 - synapse/rest/media/v1/_base.py | 1 - synapse/server.py | 1 - synapse/storage/databases/main/registration.py | 1 - synapse/storage/schema/main/delta/30/as_users.py | 1 - synapse/util/caches/treecache.py | 1 - tests/handlers/test_password_providers.py | 1 - 10 files changed, 13 deletions(-) diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index d90cb259a65c..d5ccaa0c37cc 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -371,7 +371,6 @@ async def delete_device(self, user_id: str, device_id: str) -> None: log_kv( {"reason": "User doesn't have device id.", "device_id": device_id} ) - pass else: raise @@ -414,7 +413,6 @@ async def delete_devices(self, user_id: str, device_ids: List[str]) -> None: # no match set_tag("error", True) set_tag("reason", "User doesn't have that device id.") - pass else: raise diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 9927a30e6ed5..34d9411bbf61 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -267,7 +267,6 @@ async def update_external_syncs_row( is_syncing: Whether or not the user is now syncing sync_time_msec: Time in ms when the user was last syncing """ - pass async def update_external_syncs_clear(self, process_id: str) -> None: """Marks all users that had been marked as syncing by a given process @@ -277,7 +276,6 @@ async def update_external_syncs_clear(self, process_id: str) -> None: This is a no-op when presence is handled by a different worker. """ - pass async def process_replication_rows( self, stream_name: str, instance_name: str, token: int, rows: list diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 40bf1e06d602..6b98d865f5bb 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -120,7 +120,6 @@ def finish(self) -> T: """Called when response has finished streaming and the parser should return the final result (or error). """ - pass @attr.s(slots=True, frozen=True, auto_attribs=True) @@ -601,7 +600,6 @@ async def _send_request( response.code, response_phrase, ) - pass else: logger.info( "{%s} [%s] Got response headers: %d %s", diff --git a/synapse/http/server.py b/synapse/http/server.py index 09b412548968..31ca84188975 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -233,7 +233,6 @@ def register_paths( servlet_classname (str): The name of the handler to be used in prometheus and opentracing logs. """ - pass class _AsyncResource(resource.Resource, metaclass=abc.ABCMeta): diff --git a/synapse/rest/media/v1/_base.py b/synapse/rest/media/v1/_base.py index 9b40fd8a6c23..c35d42fab89d 100644 --- a/synapse/rest/media/v1/_base.py +++ b/synapse/rest/media/v1/_base.py @@ -298,7 +298,6 @@ def write_to_consumer(self, consumer: IConsumer) -> Awaitable: Returns: Resolves once the response has finished being written """ - pass def __enter__(self) -> None: pass diff --git a/synapse/server.py b/synapse/server.py index 7741ff29dc3f..2fcf18a7a69a 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -328,7 +328,6 @@ def start_listening(self) -> None: Does nothing in this base class; overridden in derived classes to start the appropriate listeners. """ - pass def setup_background_tasks(self) -> None: """ diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index dc6665237abf..9cd2d01ee49f 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -48,7 +48,6 @@ class ExternalIDReuseException(Exception): """Exception if writing an external id for a user fails, because this external id is given to an other user.""" - pass @attr.s(frozen=True, slots=True, auto_attribs=True) diff --git a/synapse/storage/schema/main/delta/30/as_users.py b/synapse/storage/schema/main/delta/30/as_users.py index 22a7901e15df..4b4b166e37a6 100644 --- a/synapse/storage/schema/main/delta/30/as_users.py +++ b/synapse/storage/schema/main/delta/30/as_users.py @@ -36,7 +36,6 @@ def run_upgrade(cur, database_engine, config, *args, **kwargs): config_files = config.appservice.app_service_config_files except AttributeError: logger.warning("Could not get app_service_config_files from config") - pass appservices = load_appservices(config.server.server_name, config_files) diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py index 563845f86769..b932a31fc2c2 100644 --- a/synapse/util/caches/treecache.py +++ b/synapse/util/caches/treecache.py @@ -22,7 +22,6 @@ class TreeCacheNode(dict): leaves. """ - pass class TreeCache: diff --git a/tests/handlers/test_password_providers.py b/tests/handlers/test_password_providers.py index 49d832de814d..d401fda93855 100644 --- a/tests/handlers/test_password_providers.py +++ b/tests/handlers/test_password_providers.py @@ -124,7 +124,6 @@ def __init__(self, config, api: ModuleApi): ("m.login.password", ("password",)): self.check_auth, } ) - pass def check_auth(self, *args): return mock_password_provider.check_auth(*args) From 914e5488491075ed0803c76f4d1a6d080cabf2f9 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 10 Mar 2022 13:21:56 -0500 Subject: [PATCH 2/3] Lint --- synapse/storage/databases/main/registration.py | 1 - synapse/util/caches/treecache.py | 1 - 2 files changed, 2 deletions(-) diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index 9cd2d01ee49f..a698d10cc535 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -49,7 +49,6 @@ class ExternalIDReuseException(Exception): because this external id is given to an other user.""" - @attr.s(frozen=True, slots=True, auto_attribs=True) class TokenLookupResult: """Result of looking up an access token. diff --git a/synapse/util/caches/treecache.py b/synapse/util/caches/treecache.py index b932a31fc2c2..e78305f78746 100644 --- a/synapse/util/caches/treecache.py +++ b/synapse/util/caches/treecache.py @@ -23,7 +23,6 @@ class TreeCacheNode(dict): """ - class TreeCache: """ Tree-based backing store for LruCache. Allows subtrees of data to be deleted From b6e85f4fbcb4975e7522d674b0c5ca92f2e7fdd3 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 10 Mar 2022 13:22:20 -0500 Subject: [PATCH 3/3] Newsfragment --- changelog.d/12206.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12206.misc diff --git a/changelog.d/12206.misc b/changelog.d/12206.misc new file mode 100644 index 000000000000..df59bb56cdb8 --- /dev/null +++ b/changelog.d/12206.misc @@ -0,0 +1 @@ +Remove unnecessary `pass` statements.