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

Bump black and click versions #12320

Merged
merged 5 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12320.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump the version of `black` for compatibility with the latest `click` release.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def exec_file(path_segments):
# We pin black so that our tests don't start failing on new releases.
CONDITIONAL_REQUIREMENTS["lint"] = [
"isort==5.7.0",
"black==21.12b0",
"black==22.3.0",
"flake8-comprehensions",
"flake8-bugbear==21.3.2",
"flake8",
Expand Down
2 changes: 1 addition & 1 deletion synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
MAX_PDU_SIZE = 65536

# the "depth" field on events is limited to 2**63 - 1
MAX_DEPTH = 2 ** 63 - 1
MAX_DEPTH = 2**63 - 1

# the maximum length for a room alias is 255 characters
MAX_ALIAS_LENGTH = 255
Expand Down
2 changes: 1 addition & 1 deletion synapse/appservice/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def _retry() -> None:
"as-recoverer-%s" % (self.service.id,), self.retry
)

delay = 2 ** self.backoff_counter
delay = 2**self.backoff_counter
logger.info("Scheduling retries on %s in %fs", self.service.id, delay)
self.clock.call_later(delay, _retry)

Expand Down
2 changes: 1 addition & 1 deletion synapse/crypto/keyring.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def __init__(
vk = get_verify_key(hs.signing_key)
self._local_verify_keys[f"{vk.alg}:{vk.version}"] = FetchKeyResult(
verify_key=vk,
valid_until_ts=2 ** 63, # fake future timestamp
valid_until_ts=2**63, # fake future timestamp
)

async def verify_json_for_server(
Expand Down
2 changes: 1 addition & 1 deletion synapse/events/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# the literal fields "foo\" and "bar" but will instead be treated as "foo\\.bar"
SPLIT_FIELD_REGEX = re.compile(r"(?<!\\)\.")

CANONICALJSON_MAX_INT = (2 ** 53) - 1
CANONICALJSON_MAX_INT = (2**53) - 1
CANONICALJSON_MIN_INT = -CANONICALJSON_MAX_INT


Expand Down
2 changes: 1 addition & 1 deletion synapse/http/proxyagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

logger = logging.getLogger(__name__)

_VALID_URI = re.compile(br"\A[\x21-\x7e]+\Z")
_VALID_URI = re.compile(rb"\A[\x21-\x7e]+\Z")


@implementer(IAgent)
Expand Down
2 changes: 1 addition & 1 deletion synapse/replication/http/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async def send_request(*, instance_name: str = "master", **kwargs: Any) -> Any:
if attempts > cls.RETRY_ON_CONNECT_ERROR_ATTEMPTS:
raise

delay = 2 ** attempts
delay = 2**attempts
logger.warning(
"%s request connection failed; retrying in %ds: %r",
cls.NAME,
Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/media/v1/media_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class ReadableFileWrapper:
`IConsumer`.
"""

CHUNK_SIZE = 2 ** 14
CHUNK_SIZE = 2**14

clock: Clock
path: str
Expand Down
4 changes: 2 additions & 2 deletions synapse/rest/media/v1/preview_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
logger = logging.getLogger(__name__)

_charset_match = re.compile(
br'<\s*meta[^>]*charset\s*=\s*"?([a-z0-9_-]+)"?', flags=re.I
rb'<\s*meta[^>]*charset\s*=\s*"?([a-z0-9_-]+)"?', flags=re.I
)
_xml_encoding_match = re.compile(
br'\s*<\s*\?\s*xml[^>]*encoding="([a-z0-9_-]+)"', flags=re.I
rb'\s*<\s*\?\s*xml[^>]*encoding="([a-z0-9_-]+)"', flags=re.I
)
_content_type_match = re.compile(r'.*; *charset="?(.*?)"?(;|$)', flags=re.I)

Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
from synapse.server import HomeServer

# python 3 does not have a maximum int value
MAX_TXN_ID = 2 ** 63 - 1
MAX_TXN_ID = 2**63 - 1

logger = logging.getLogger(__name__)

Expand Down
17 changes: 10 additions & 7 deletions synapse/util/patch_inline_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,16 @@ def check_yield_points_inner(
# We don't raise here as its perfectly valid for contexts to
# change in a function, as long as it sets the correct context
# on resolving (which is checked separately).
err = "%s changed context from %s to %s, happened between lines %d and %d in %s" % (
frame.f_code.co_name,
expected_context,
current_context(),
last_yield_line_no,
frame.f_lineno,
frame.f_code.co_filename,
err = (
"%s changed context from %s to %s, happened between lines %d and %d in %s"
% (
frame.f_code.co_name,
expected_context,
current_context(),
last_yield_line_no,
frame.f_lineno,
frame.f_code.co_filename,
)
)
changes.append(err)

Expand Down
2 changes: 1 addition & 1 deletion synapse/util/retryutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
RETRY_MULTIPLIER = 5

# a cap on the backoff. (Essentially none)
MAX_RETRY_INTERVAL = 2 ** 62
MAX_RETRY_INTERVAL = 2**62


class NotRetryingDestination(Exception):
Expand Down
6 changes: 3 additions & 3 deletions tests/handlers/test_federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ def test_valid_json(self) -> None:
def test_invalid_numbers(self) -> None:
"""Invalid values for an integer should be rejected, all floats should be rejected."""
for value in [
-(2 ** 53),
2 ** 53,
-(2**53),
2**53,
1.0,
float("inf"),
float("-inf"),
Expand All @@ -524,7 +524,7 @@ def test_invalid_nested(self) -> None:
event_from_pdu_json(
{
"type": EventTypes.Message,
"content": {"foo": [{"bar": 2 ** 56}]},
"content": {"foo": [{"bar": 2**56}]},
"room_id": "!room:test",
"sender": "@user:test",
"depth": 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/replication/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def assert_request_is_get_repl_stream_updates(
path: bytes = request.path # type: ignore
self.assertRegex(
path,
br"^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$"
rb"^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$"
% (stream_name.encode("ascii"),),
)

Expand Down