Skip to content

Commit

Permalink
Applies black Bump from 23.10.1 to 24.2.0 (element-hq#16936)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevisGordan committed Mar 20, 2024
1 parent 6272437 commit 5c71b50
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions synapse/http/servlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def parse_integer(
default: Optional[int] = None,
required: bool = False,
negative: bool = False,
) -> int:
...
) -> int: ...


def parse_integer(
Expand Down Expand Up @@ -131,8 +130,7 @@ def parse_integer_from_args(
default: Optional[int] = None,
required: bool = False,
negative: bool = False,
) -> Optional[int]:
...
) -> Optional[int]: ...


def parse_integer_from_args(
Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/admin/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from typing import TYPE_CHECKING, Tuple

from synapse.api.constants import Direction
from synapse.api.errors import Codes, NotFoundError, SynapseError
from synapse.api.errors import NotFoundError, SynapseError
from synapse.federation.transport.server import Authenticator
from synapse.http.servlet import RestServlet, parse_enum, parse_integer, parse_string
from synapse.http.site import SynapseRequest
Expand Down
2 changes: 0 additions & 2 deletions synapse/rest/admin/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ async def on_POST(
errcode=Codes.INVALID_PARAM,
)


# This check is useless, we keep it for the legacy endpoint only.
if server_name is not None and self.server_name != server_name:
raise SynapseError(HTTPStatus.BAD_REQUEST, "Can only delete local media")
Expand Down Expand Up @@ -425,7 +424,6 @@ async def on_DELETE(
start = parse_integer(request, "from", default=0, negative=False)
limit = parse_integer(request, "limit", default=100, negative=False)


# If neither `order_by` nor `dir` is set, set the default order
# to newest media is on top for backward compatibility.
if b"order_by" not in request.args and b"dir" not in request.args:
Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/admin/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
limit = parse_integer(request, "limit", default=100, negative=False)
from_ts = parse_integer(request, "from_ts", default=0, negative=False)
until_ts = parse_integer(request, "until_ts", negative=False)

if until_ts is not None:
if until_ts <= from_ts:
raise SynapseError(
Expand Down
3 changes: 2 additions & 1 deletion tests/rest/admin/test_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def test_missing_parameter(self) -> None:
self.assertEqual(400, channel.code, msg=channel.json_body)
self.assertEqual(Codes.MISSING_PARAM, channel.json_body["errcode"])
self.assertEqual(
"Missing required integer query parameter before_ts", channel.json_body["error"]
"Missing required integer query parameter before_ts",
channel.json_body["error"],
)

def test_invalid_parameter(self) -> None:
Expand Down

0 comments on commit 5c71b50

Please sign in to comment.