diff options
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2024-07-05 12:35:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-05 12:35:57 +0000 |
commit | 20de685a4b500212d19acda5f637d51a8dd6be4e (patch) | |
tree | cb4ede58d67fc349a4c783b99eb178bd28e061cb | |
parent | Allow enabling sliding sync per-user (#17393) (diff) | |
download | synapse-20de685a4b500212d19acda5f637d51a8dd6be4e.tar.xz |
Bump ruff from 0.3.7 to 0.5.0 (#17381)
-rw-r--r-- | .github/workflows/tests.yml | 4 | ||||
-rw-r--r-- | changelog.d/17381.misc | 1 | ||||
-rw-r--r-- | poetry.lock | 39 | ||||
-rw-r--r-- | pyproject.toml | 3 | ||||
-rwxr-xr-x | scripts-dev/lint.sh | 2 | ||||
-rwxr-xr-x | synapse/_scripts/generate_workers_map.py | 2 | ||||
-rw-r--r-- | synapse/_scripts/update_synapse_database.py | 2 | ||||
-rw-r--r-- | synapse/app/admin_cmd.py | 2 | ||||
-rw-r--r-- | synapse/app/generic_worker.py | 2 | ||||
-rw-r--r-- | synapse/app/homeserver.py | 2 | ||||
-rw-r--r-- | synapse/federation/sender/per_destination_queue.py | 2 | ||||
-rw-r--r-- | synapse/server.py | 14 | ||||
-rw-r--r-- | tests/server.py | 2 |
13 files changed, 41 insertions, 36 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2cc5a525a6..767495101b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,7 +73,7 @@ jobs: - 'pyproject.toml' - 'poetry.lock' - '.github/workflows/tests.yml' - + linting_readme: - 'README.rst' @@ -139,7 +139,7 @@ jobs: - name: Semantic checks (ruff) # --quiet suppresses the update check. - run: poetry run ruff --quiet . + run: poetry run ruff check --quiet . lint-mypy: runs-on: ubuntu-latest diff --git a/changelog.d/17381.misc b/changelog.d/17381.misc new file mode 100644 index 0000000000..ca9830c136 --- /dev/null +++ b/changelog.d/17381.misc @@ -0,0 +1 @@ +Fix linting errors from new `ruff` version. diff --git a/poetry.lock b/poetry.lock index 8142406e3f..3a322b773e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2345,28 +2345,29 @@ files = [ [[package]] name = "ruff" -version = "0.3.7" +version = "0.5.0" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"}, - {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"}, - {file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"}, - {file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"}, - {file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"}, - {file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"}, - {file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"}, - {file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"}, + {file = "ruff-0.5.0-py3-none-linux_armv6l.whl", hash = "sha256:ee770ea8ab38918f34e7560a597cc0a8c9a193aaa01bfbd879ef43cb06bd9c4c"}, + {file = "ruff-0.5.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:38f3b8327b3cb43474559d435f5fa65dacf723351c159ed0dc567f7ab735d1b6"}, + {file = "ruff-0.5.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7594f8df5404a5c5c8f64b8311169879f6cf42142da644c7e0ba3c3f14130370"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:adc7012d6ec85032bc4e9065110df205752d64010bed5f958d25dbee9ce35de3"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d505fb93b0fabef974b168d9b27c3960714d2ecda24b6ffa6a87ac432905ea38"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9dc5cfd3558f14513ed0d5b70ce531e28ea81a8a3b1b07f0f48421a3d9e7d80a"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:db3ca35265de239a1176d56a464b51557fce41095c37d6c406e658cf80bbb362"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b1a321c4f68809fddd9b282fab6a8d8db796b270fff44722589a8b946925a2a8"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c4dfcd8d34b143916994b3876b63d53f56724c03f8c1a33a253b7b1e6bf2a7d"}, + {file = "ruff-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81e5facfc9f4a674c6a78c64d38becfbd5e4f739c31fcd9ce44c849f1fad9e4c"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e589e27971c2a3efff3fadafb16e5aef7ff93250f0134ec4b52052b673cf988d"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d2ffbc3715a52b037bcb0f6ff524a9367f642cdc5817944f6af5479bbb2eb50e"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:cd096e23c6a4f9c819525a437fa0a99d1c67a1b6bb30948d46f33afbc53596cf"}, + {file = "ruff-0.5.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:46e193b36f2255729ad34a49c9a997d506e58f08555366b2108783b3064a0e1e"}, + {file = "ruff-0.5.0-py3-none-win32.whl", hash = "sha256:49141d267100f5ceff541b4e06552e98527870eafa1acc9dec9139c9ec5af64c"}, + {file = "ruff-0.5.0-py3-none-win_amd64.whl", hash = "sha256:e9118f60091047444c1b90952736ee7b1792910cab56e9b9a9ac20af94cd0440"}, + {file = "ruff-0.5.0-py3-none-win_arm64.whl", hash = "sha256:ed5c4df5c1fb4518abcb57725b576659542bdbe93366f4f329e8f398c4b71178"}, + {file = "ruff-0.5.0.tar.gz", hash = "sha256:eb641b5873492cf9bd45bc9c5ae5320648218e04386a5f0c264ad6ccce8226a1"}, ] [[package]] @@ -3201,4 +3202,4 @@ user-search = ["pyicu"] [metadata] lock-version = "2.0" python-versions = "^3.8.0" -content-hash = "e8d5806e10eb69bc06900fde18ea3df38f38490ab6baa73fe4a563dfb6abacba" +content-hash = "3372a97db99050a34f8eddad2ddf8efe8b7b704b6123df4a3e36ddc171e8f34d" diff --git a/pyproject.toml b/pyproject.toml index 88595a3079..2d1481f263 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ target-version = ['py38', 'py39', 'py310', 'py311'] [tool.ruff] line-length = 88 +[tool.ruff.lint] # See https://beta.ruff.rs/docs/rules/#error-e # for error codes. The ones we ignore are: # E501: Line too long (black enforces this for us) @@ -321,7 +322,7 @@ all = [ # This helps prevents merge conflicts when running a batch of dependabot updates. isort = ">=5.10.1" black = ">=22.7.0" -ruff = "0.3.7" +ruff = "0.5.0" # Type checking only works with the pydantic.v1 compat module from pydantic v2 pydantic = "^2" diff --git a/scripts-dev/lint.sh b/scripts-dev/lint.sh index 9e4ed3246e..8acf0a6fb8 100755 --- a/scripts-dev/lint.sh +++ b/scripts-dev/lint.sh @@ -112,7 +112,7 @@ python3 -m black "${files[@]}" # Catch any common programming mistakes in Python code. # --quiet suppresses the update check. -ruff --quiet --fix "${files[@]}" +ruff check --quiet --fix "${files[@]}" # Catch any common programming mistakes in Rust code. # diff --git a/synapse/_scripts/generate_workers_map.py b/synapse/_scripts/generate_workers_map.py index 5b6c8f6837..715c7ddc17 100755 --- a/synapse/_scripts/generate_workers_map.py +++ b/synapse/_scripts/generate_workers_map.py @@ -44,7 +44,7 @@ logger = logging.getLogger("generate_workers_map") class MockHomeserver(HomeServer): - DATASTORE_CLASS = DataStore # type: ignore + DATASTORE_CLASS = DataStore def __init__(self, config: HomeServerConfig, worker_app: Optional[str]) -> None: super().__init__(config.server.server_name, config=config) diff --git a/synapse/_scripts/update_synapse_database.py b/synapse/_scripts/update_synapse_database.py index 8d22bf53d4..d8b4dbd6c6 100644 --- a/synapse/_scripts/update_synapse_database.py +++ b/synapse/_scripts/update_synapse_database.py @@ -41,7 +41,7 @@ logger = logging.getLogger("update_database") class MockHomeserver(HomeServer): - DATASTORE_CLASS = DataStore # type: ignore [assignment] + DATASTORE_CLASS = DataStore def __init__(self, config: HomeServerConfig): super().__init__( diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py index 3990eda0fa..7c9b94c65c 100644 --- a/synapse/app/admin_cmd.py +++ b/synapse/app/admin_cmd.py @@ -110,7 +110,7 @@ class AdminCmdStore( class AdminCmdServer(HomeServer): - DATASTORE_CLASS = AdminCmdStore # type: ignore + DATASTORE_CLASS = AdminCmdStore async def export_data_command(hs: HomeServer, args: argparse.Namespace) -> None: diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index 8c2a74a723..599f95466b 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -163,7 +163,7 @@ class GenericWorkerStore( class GenericWorkerServer(HomeServer): - DATASTORE_CLASS = GenericWorkerStore # type: ignore + DATASTORE_CLASS = GenericWorkerStore def _listen_http(self, listener_config: ListenerConfig) -> None: assert listener_config.http_options is not None diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 8a545a86c1..2b111847b7 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -81,7 +81,7 @@ def gz_wrap(r: Resource) -> Resource: class SynapseHomeServer(HomeServer): - DATASTORE_CLASS = DataStore # type: ignore + DATASTORE_CLASS = DataStore def _listener_http( self, diff --git a/synapse/federation/sender/per_destination_queue.py b/synapse/federation/sender/per_destination_queue.py index 9f1c2fe22a..b435588da0 100644 --- a/synapse/federation/sender/per_destination_queue.py +++ b/synapse/federation/sender/per_destination_queue.py @@ -322,7 +322,6 @@ class PerDestinationQueue: ) async def _transaction_transmission_loop(self) -> None: - pending_pdus: List[EventBase] = [] try: self.transmission_loop_running = True @@ -338,7 +337,6 @@ class PerDestinationQueue: # not caught up yet return - pending_pdus = [] while True: self._new_data_to_send = False diff --git a/synapse/server.py b/synapse/server.py index ae927c3904..4a3f9ff934 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -28,7 +28,7 @@ import abc import functools import logging -from typing import TYPE_CHECKING, Callable, Dict, List, Optional, TypeVar, cast +from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Type, TypeVar, cast from typing_extensions import TypeAlias @@ -161,6 +161,7 @@ if TYPE_CHECKING: from synapse.handlers.jwt import JwtHandler from synapse.handlers.oidc import OidcHandler from synapse.handlers.saml import SamlHandler + from synapse.storage._base import SQLBaseStore # The annotation for `cache_in_self` used to be @@ -255,10 +256,13 @@ class HomeServer(metaclass=abc.ABCMeta): "stats", ] - # This is overridden in derived application classes - # (such as synapse.app.homeserver.SynapseHomeServer) and gives the class to be - # instantiated during setup() for future return by get_datastores() - DATASTORE_CLASS = abc.abstractproperty() + @property + @abc.abstractmethod + def DATASTORE_CLASS(self) -> Type["SQLBaseStore"]: + # This is overridden in derived application classes + # (such as synapse.app.homeserver.SynapseHomeServer) and gives the class to be + # instantiated during setup() for future return by get_datastores() + pass def __init__( self, diff --git a/tests/server.py b/tests/server.py index f3a917f835..f1cd0f76be 100644 --- a/tests/server.py +++ b/tests/server.py @@ -946,7 +946,7 @@ def connect_client( class TestHomeServer(HomeServer): - DATASTORE_CLASS = DataStore # type: ignore[assignment] + DATASTORE_CLASS = DataStore def setup_test_homeserver( |