Bump ruff from 0.0.252 to 0.0.259 (#15328)

* Bump ruff from 0.0.252 to 0.0.259

Bumps [ruff](https://github.com/charliermarsh/ruff) from 0.0.252 to 0.0.259.
- [Release notes](https://github.com/charliermarsh/ruff/releases)
- [Changelog](https://github.com/charliermarsh/ruff/blob/main/BREAKING_CHANGES.md)
- [Commits](https://github.com/charliermarsh/ruff/compare/v0.0.252...v0.0.259)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix new warnings

* Mypy

* Newsfile

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Erik Johnston <erik@matrix.org>
pull/15338/head
dependabot[bot] 2023-03-28 09:46:47 +01:00 committed by GitHub
parent 96f163d932
commit bd4d958aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 54 additions and 35 deletions

1
changelog.d/15328.misc Normal file
View File

@ -0,0 +1 @@
Bump ruff from 0.0.252 to 0.0.259.

38
poetry.lock generated
View File

@ -2323,29 +2323,29 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]] [[package]]
name = "ruff" name = "ruff"
version = "0.0.252" version = "0.0.259"
description = "An extremely fast Python linter, written in Rust." description = "An extremely fast Python linter, written in Rust."
category = "dev" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "ruff-0.0.252-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:349367a227c4db7abbc3a9993efea8a608b5bea4bb4a1e5fc6f0d56819524f92"}, {file = "ruff-0.0.259-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:f3938dc45e2a3f818e9cbd53007265c22246fbfded8837b2c563bf0ebde1a226"},
{file = "ruff-0.0.252-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:ce77f9106d96b4faf7865860fb5155b9deaf6f699d9c279118c5ad947739ecaf"}, {file = "ruff-0.0.259-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:22e1e35bf5f12072cd644d22afd9203641ccf258bc14ff91aa1c43dc14f6047d"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:edadb0b050293b4e60dab979ba6a4e734d9c899cbe316a0ee5b65e3cdd39c750"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d2fb20e89e85d147c85caa807707a1488bccc1f3854dc3d53533e89b52a0c5ff"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4efdae98937d1e4d23ab0b7fc7e8e6b6836cc7d2d42238ceeacbc793ef780542"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:49e903bcda19f6bb0725a962c058eb5d61f40d84ef52ed53b61939b69402ab4e"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c8546d879f7d3f669379a03e7b103d90e11901976ab508aeda59c03dfd8a359e"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:71f0ef1985e9a6696fa97da8459917fa34bdaa2c16bd33bd5edead585b7d44f7"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:83fdc7169b6c1fb5fe8d1cdf345697f558c1b433ef97df9ca11defa2a8f3ee9e"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7cfef26619cba184d59aa7fa17b48af5891d51fc0b755a9bc533478a10d4d066"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:84ed9be1a17e2a556a571a5b959398633dd10910abd8dcf8b098061e746e892d"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:79b02fa17ec1fd8d306ae302cb47fb614b71e1f539997858243769bcbe78c6d9"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f5e77bd9ba4438cf2ee32154e2673afe22f538ef29f5d65ca47e3dc46c42cf8"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:428507fb321b386dda70d66cd1a8aa0abf51d7c197983d83bb9e4fa5ee60300b"},
{file = "ruff-0.0.252-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a5179b94b45c0f8512eaff3ab304c14714a46df2e9ca72a9d96084adc376b71"}, {file = "ruff-0.0.259-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c5fbaea9167f1852757f02133e5daacdb8c75b3431343205395da5b10499927a"},
{file = "ruff-0.0.252-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:92efd8a71157595df5bc46aaaa0613d8a2fbc5cddc53ae7b749c16025c324732"}, {file = "ruff-0.0.259-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:40ae87f2638484b7e8a7567b04a7af719f1c484c5bf132038b702bb32e1f6577"},
{file = "ruff-0.0.252-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fd350fc10832cfd28e681d829a8aa83ea3e653326e0ea9d98637dfb8d46177d2"}, {file = "ruff-0.0.259-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:29e2b77b7d5da6a7dd5cf9b738b511355c5734ece56f78e500d4b5bffd58c1a0"},
{file = "ruff-0.0.252-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f119240c9631216e846166e06023b1d878e25fbac93bf20da50069e91cfbfaee"}, {file = "ruff-0.0.259-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b3c1beacf6037e7f0781d4699d9a2dd4ba2462f475be5b1f45cf84c4ba3c69d"},
{file = "ruff-0.0.252-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5c5a49f89f5ede93d16eddfeeadd7e5739ec703e8f63ac95eac30236b9e49da3"}, {file = "ruff-0.0.259-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:daaea322e7e85f4c13d82be9536309e1c4b8b9851bb0cbc7eeb15d490fd46bf9"},
{file = "ruff-0.0.252-py3-none-win32.whl", hash = "sha256:89a897dc743f2fe063483ea666097e72e848f4bbe40493fe0533e61799959f6e"}, {file = "ruff-0.0.259-py3-none-win32.whl", hash = "sha256:38704f151323aa5858370a2f792e122cc25e5d1aabe7d42ceeab83da18f0b456"},
{file = "ruff-0.0.252-py3-none-win_amd64.whl", hash = "sha256:cdc89ad6ff88519b1fb1816ac82a9ad910762c90ff5fd64dda7691b72d36aff7"}, {file = "ruff-0.0.259-py3-none-win_amd64.whl", hash = "sha256:aa9449b898287e621942cc71b9327eceb8f0c357e4065fecefb707ef2d978df8"},
{file = "ruff-0.0.252-py3-none-win_arm64.whl", hash = "sha256:4b594a17cf53077165429486650658a0e1b2ac6ab88954f5afd50d2b1b5657a9"}, {file = "ruff-0.0.259-py3-none-win_arm64.whl", hash = "sha256:e4f39e18702de69faaaee3969934b92d7467285627f99a5b6ecd55a7d9f5d086"},
{file = "ruff-0.0.252.tar.gz", hash = "sha256:6992611ab7bdbe7204e4831c95ddd3febfeece2e6f5e44bbed044454c7db0f63"}, {file = "ruff-0.0.259.tar.gz", hash = "sha256:8b56496063ab3bfdf72339a5fbebb8bd46e5c5fee25ef11a9f03b208fa0562ec"},
] ]
[[package]] [[package]]
@ -3426,4 +3426,4 @@ user-search = ["pyicu"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.7.1" python-versions = "^3.7.1"
content-hash = "0a1dd4be3dff3c8cc71bd57a4eb48e1d92f155db7230e61fbb54f8af03619509" content-hash = "102eed4faa13eab195555ea070f235acd1e3f0ff9cf028afcac6c51b3e409071"

View File

@ -311,7 +311,7 @@ all = [
# We pin black so that our tests don't start failing on new releases. # We pin black so that our tests don't start failing on new releases.
isort = ">=5.10.1" isort = ">=5.10.1"
black = ">=22.3.0" black = ">=22.3.0"
ruff = "0.0.252" ruff = "0.0.259"
# Typechecking # Typechecking
mypy = "*" mypy = "*"

View File

@ -462,7 +462,7 @@ class FrozenEvent(EventBase):
# Signatures is a dict of dicts, and this is faster than doing a # Signatures is a dict of dicts, and this is faster than doing a
# copy.deepcopy # copy.deepcopy
signatures = { signatures = {
name: {sig_id: sig for sig_id, sig in sigs.items()} name: dict(sigs.items())
for name, sigs in event_dict.pop("signatures", {}).items() for name, sigs in event_dict.pop("signatures", {}).items()
} }
@ -510,7 +510,7 @@ class FrozenEventV2(EventBase):
# Signatures is a dict of dicts, and this is faster than doing a # Signatures is a dict of dicts, and this is faster than doing a
# copy.deepcopy # copy.deepcopy
signatures = { signatures = {
name: {sig_id: sig for sig_id, sig in sigs.items()} name: dict(sigs.items())
for name, sigs in event_dict.pop("signatures", {}).items() for name, sigs in event_dict.pop("signatures", {}).items()
} }

View File

@ -355,7 +355,7 @@ def serialize_event(
time_now_ms = int(time_now_ms) time_now_ms = int(time_now_ms)
# Should this strip out None's? # Should this strip out None's?
d = {k: v for k, v in e.get_dict().items()} d = dict(e.get_dict().items())
d["event_id"] = e.event_id d["event_id"] = e.event_id

View File

@ -1504,8 +1504,8 @@ class DatabasePool:
self.engine.lock_table(txn, "user_ips") self.engine.lock_table(txn, "user_ips")
for keyv, valv in zip(key_values, value_values): for keyv, valv in zip(key_values, value_values):
_keys = {x: y for x, y in zip(key_names, keyv)} _keys = dict(zip(key_names, keyv))
_vals = {x: y for x, y in zip(value_names, valv)} _vals = dict(zip(value_names, valv))
self.simple_upsert_txn_emulated(txn, table, _keys, _vals, lock=False) self.simple_upsert_txn_emulated(txn, table, _keys, _vals, lock=False)

View File

@ -27,6 +27,7 @@ from typing import (
Optional, Optional,
Set, Set,
Tuple, Tuple,
cast,
) )
import attr import attr
@ -1348,9 +1349,7 @@ class PersistEventsStore:
[event.event_id for event, _ in events_and_contexts], [event.event_id for event, _ in events_and_contexts],
) )
have_persisted: Dict[str, bool] = { have_persisted = dict(cast(Iterable[Tuple[str, bool]], txn))
event_id: outlier for event_id, outlier in txn
}
logger.debug( logger.debug(
"_update_outliers_txn: events=%s have_persisted=%s", "_update_outliers_txn: events=%s have_persisted=%s",

View File

@ -16,7 +16,17 @@
import logging import logging
from enum import Enum from enum import Enum
from itertools import chain from itertools import chain
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Optional,
Tuple,
Union,
cast,
)
from typing_extensions import Counter from typing_extensions import Counter
@ -523,7 +533,7 @@ class StatsStore(StateDeltasStore):
""", """,
(room_id,), (room_id,),
) )
membership_counts = {membership: cnt for membership, cnt in txn} membership_counts = dict(cast(Iterable[Tuple[str, int]], txn))
txn.execute( txn.execute(
""" """

View File

@ -41,6 +41,7 @@ from typing import (
Any, Any,
Collection, Collection,
Dict, Dict,
Iterable,
List, List,
Optional, Optional,
Set, Set,
@ -1343,7 +1344,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
GROUP BY type GROUP BY type
""" """
txn.execute(sql) txn.execute(sql)
min_positions = {typ: pos for typ, pos in txn} # Map from type -> min position min_positions = dict(
cast(Iterable[Tuple[str, int]], txn)
) # Map from type -> min position
# Ensure we do actually have some values here # Ensure we do actually have some values here
assert set(min_positions) == {"federation", "events"} assert set(min_positions) == {"federation", "events"}

View File

@ -412,7 +412,7 @@ class EventsWorkerStoreTestCase(BaseSlavedStoreTestCase):
self.get_success( self.get_success(
self.master_store.add_push_actions_to_staging( self.master_store.add_push_actions_to_staging(
event.event_id, event.event_id,
{user_id: actions for user_id, actions in push_actions}, dict(push_actions),
False, False,
"main", "main",
) )

View File

@ -983,7 +983,9 @@ def setup_test_homeserver(
dropped = True dropped = True
except psycopg2.OperationalError as e: except psycopg2.OperationalError as e:
warnings.warn( warnings.warn(
"Couldn't drop old db: " + str(e), category=UserWarning "Couldn't drop old db: " + str(e),
category=UserWarning,
stacklevel=2,
) )
time.sleep(0.5) time.sleep(0.5)
@ -991,7 +993,11 @@ def setup_test_homeserver(
db_conn.close() db_conn.close()
if not dropped: if not dropped:
warnings.warn("Failed to drop old DB.", category=UserWarning) warnings.warn(
"Failed to drop old DB.",
category=UserWarning,
stacklevel=2,
)
if not LEAVE_DB: if not LEAVE_DB:
# Register the cleanup hook # Register the cleanup hook