Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ad14071

Browse files
dependabot[bot]hughns
authored andcommitted
Bump ruff from 0.0.277 to 0.0.286 (#16198)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 7a9835a commit ad14071

File tree

19 files changed

+67
-53
lines changed

19 files changed

+67
-53
lines changed

poetry.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ all = [
312312
# This helps prevents merge conflicts when running a batch of dependabot updates.
313313
isort = ">=5.10.1"
314314
black = ">=22.7.0"
315-
ruff = "0.0.277"
315+
ruff = "0.0.286"
316316

317317
# Typechecking
318318
lxml-stubs = ">=0.4.0"

synapse/config/_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ def parse_size(value: Union[str, int]) -> int:
186186
TypeError, if given something other than an integer or a string
187187
ValueError: if given a string not of the form described above.
188188
"""
189-
if type(value) is int:
189+
if type(value) is int: # noqa: E721
190190
return value
191-
elif type(value) is str:
191+
elif isinstance(value, str):
192192
sizes = {"K": 1024, "M": 1024 * 1024}
193193
size = 1
194194
suffix = value[-1]
@@ -218,9 +218,9 @@ def parse_duration(value: Union[str, int]) -> int:
218218
TypeError, if given something other than an integer or a string
219219
ValueError: if given a string not of the form described above.
220220
"""
221-
if type(value) is int:
221+
if type(value) is int: # noqa: E721
222222
return value
223-
elif type(value) is str:
223+
elif isinstance(value, str):
224224
second = 1000
225225
minute = 60 * second
226226
hour = 60 * minute

synapse/config/appservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class AppServiceConfig(Config):
3434
def read_config(self, config: JsonDict, **kwargs: Any) -> None:
3535
self.app_service_config_files = config.get("app_service_config_files", [])
3636
if not isinstance(self.app_service_config_files, list) or not all(
37-
type(x) is str for x in self.app_service_config_files
37+
isinstance(x, str) for x in self.app_service_config_files
3838
):
3939
raise ConfigError(
4040
"Expected '%s' to be a list of AS config files:"

synapse/event_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,11 @@ def _check_power_levels(
852852
"kick",
853853
"invite",
854854
}:
855-
if type(v) is not int:
855+
if type(v) is not int: # noqa: E721
856856
raise SynapseError(400, f"{v!r} must be an integer.")
857857
if k in {"events", "notifications", "users"}:
858858
if not isinstance(v, collections.abc.Mapping) or not all(
859-
type(v) is int for v in v.values()
859+
type(v) is int for v in v.values() # noqa: E721
860860
):
861861
raise SynapseError(
862862
400,

synapse/events/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ def _copy_power_level_value_as_integer(
702702
:raises TypeError: if `old_value` is neither an integer nor a base-10 string
703703
representation of an integer.
704704
"""
705-
if type(old_value) is int:
705+
if type(old_value) is int: # noqa: E721
706706
power_levels[key] = old_value
707707
return
708708

@@ -730,7 +730,7 @@ def validate_canonicaljson(value: Any) -> None:
730730
* Floats
731731
* NaN, Infinity, -Infinity
732732
"""
733-
if type(value) is int:
733+
if type(value) is int: # noqa: E721
734734
if value < CANONICALJSON_MIN_INT or CANONICALJSON_MAX_INT < value:
735735
raise SynapseError(400, "JSON integer out of range", Codes.BAD_JSON)
736736

synapse/events/validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ def _validate_retention(self, event: EventBase) -> None:
151151
max_lifetime = event.content.get("max_lifetime")
152152

153153
if min_lifetime is not None:
154-
if type(min_lifetime) is not int:
154+
if type(min_lifetime) is not int: # noqa: E721
155155
raise SynapseError(
156156
code=400,
157157
msg="'min_lifetime' must be an integer",
158158
errcode=Codes.BAD_JSON,
159159
)
160160

161161
if max_lifetime is not None:
162-
if type(max_lifetime) is not int:
162+
if type(max_lifetime) is not int: # noqa: E721
163163
raise SynapseError(
164164
code=400,
165165
msg="'max_lifetime' must be an integer",

synapse/federation/federation_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def event_from_pdu_json(pdu_json: JsonDict, room_version: RoomVersion) -> EventB
280280
_strip_unsigned_values(pdu_json)
281281

282282
depth = pdu_json["depth"]
283-
if type(depth) is not int:
283+
if type(depth) is not int: # noqa: E721
284284
raise SynapseError(400, "Depth %r not an intger" % (depth,), Codes.BAD_JSON)
285285

286286
if depth < 0:

synapse/federation/federation_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ def from_json_dict(cls, d: JsonDict) -> "TimestampToEventResponse":
18911891
)
18921892

18931893
origin_server_ts = d.get("origin_server_ts")
1894-
if type(origin_server_ts) is not int:
1894+
if type(origin_server_ts) is not int: # noqa: E721
18951895
raise ValueError(
18961896
"Invalid response: 'origin_server_ts' must be a int but received %r"
18971897
% origin_server_ts

synapse/handlers/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def maybe_schedule_expiry(self, event: EventBase) -> None:
379379
"""
380380

381381
expiry_ts = event.content.get(EventContentFields.SELF_DESTRUCT_AFTER)
382-
if type(expiry_ts) is not int or event.is_state():
382+
if type(expiry_ts) is not int or event.is_state(): # noqa: E721
383383
return
384384

385385
# _schedule_expiry_for_event won't actually schedule anything if there's already

0 commit comments

Comments
 (0)