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

Commit a7293ef

Browse files
David RobertsonSean Quah
David Robertson
authored and
Sean Quah
committed
Bump black and click versions (#12320)
1 parent 4d693f9 commit a7293ef

File tree

16 files changed

+37
-30
lines changed

16 files changed

+37
-30
lines changed

changelog.d/12320.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump the version of `black` for compatibility with the latest `click` release.

contrib/jitsimeetbridge/jitsimeetbridge.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,15 @@ def advertiseSsrcs(self):
193193
time.sleep(7)
194194
print("SSRC spammer started")
195195
while self.running:
196-
ssrcMsg = "<presence to='%(tojid)s' xmlns='jabber:client'><x xmlns='http://jabber.org/protocol/muc'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://jitsi.org/jitsimeet' ver='0WkSdhFnAUxrz4ImQQLdB80GFlE='/><nick xmlns='http://jabber.org/protocol/nick'>%(nick)s</nick><stats xmlns='http://jitsi.org/jitmeet/stats'><stat name='bitrate_download' value='175'/><stat name='bitrate_upload' value='176'/><stat name='packetLoss_total' value='0'/><stat name='packetLoss_download' value='0'/><stat name='packetLoss_upload' value='0'/></stats><media xmlns='http://estos.de/ns/mjs'><source type='audio' ssrc='%(assrc)s' direction='sendre'/><source type='video' ssrc='%(vssrc)s' direction='sendre'/></media></presence>" % {
197-
"tojid": "%s@%s/%s" % (ROOMNAME, ROOMDOMAIN, self.shortJid),
198-
"nick": self.userId,
199-
"assrc": self.ssrcs["audio"],
200-
"vssrc": self.ssrcs["video"],
201-
}
196+
ssrcMsg = (
197+
"<presence to='%(tojid)s' xmlns='jabber:client'><x xmlns='http://jabber.org/protocol/muc'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://jitsi.org/jitsimeet' ver='0WkSdhFnAUxrz4ImQQLdB80GFlE='/><nick xmlns='http://jabber.org/protocol/nick'>%(nick)s</nick><stats xmlns='http://jitsi.org/jitmeet/stats'><stat name='bitrate_download' value='175'/><stat name='bitrate_upload' value='176'/><stat name='packetLoss_total' value='0'/><stat name='packetLoss_download' value='0'/><stat name='packetLoss_upload' value='0'/></stats><media xmlns='http://estos.de/ns/mjs'><source type='audio' ssrc='%(assrc)s' direction='sendre'/><source type='video' ssrc='%(vssrc)s' direction='sendre'/></media></presence>"
198+
% {
199+
"tojid": "%s@%s/%s" % (ROOMNAME, ROOMDOMAIN, self.shortJid),
200+
"nick": self.userId,
201+
"assrc": self.ssrcs["audio"],
202+
"vssrc": self.ssrcs["video"],
203+
}
204+
)
202205
res = self.sendIq(ssrcMsg)
203206
print("reply from ssrc announce: ", res)
204207
time.sleep(10)

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def exec_file(path_segments):
9595
# We pin black so that our tests don't start failing on new releases.
9696
CONDITIONAL_REQUIREMENTS["lint"] = [
9797
"isort==5.7.0",
98-
"black==21.12b0",
98+
"black==22.3.0",
9999
"flake8-comprehensions",
100100
"flake8-bugbear==21.3.2",
101101
"flake8",
@@ -128,7 +128,7 @@ def exec_file(path_segments):
128128
+ CONDITIONAL_REQUIREMENTS["test"]
129129
+ [
130130
# The following are used by the release script
131-
"click==7.1.2",
131+
"click==8.1.0",
132132
"redbaron==0.9.2",
133133
"GitPython==3.1.14",
134134
"commonmark==0.9.1",

synapse/api/constants.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
MAX_PDU_SIZE = 65536
2424

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

2828
# the maximum length for a room alias is 255 characters
2929
MAX_ALIAS_LENGTH = 255

synapse/appservice/scheduler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def _retry() -> None:
428428
"as-recoverer-%s" % (self.service.id,), self.retry
429429
)
430430

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

synapse/crypto/keyring.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(
182182
vk = get_verify_key(hs.signing_key)
183183
self._local_verify_keys[f"{vk.alg}:{vk.version}"] = FetchKeyResult(
184184
verify_key=vk,
185-
valid_until_ts=2 ** 63, # fake future timestamp
185+
valid_until_ts=2**63, # fake future timestamp
186186
)
187187

188188
async def verify_json_for_server(

synapse/events/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# the literal fields "foo\" and "bar" but will instead be treated as "foo\\.bar"
5050
SPLIT_FIELD_REGEX = re.compile(r"(?<!\\)\.")
5151

52-
CANONICALJSON_MAX_INT = (2 ** 53) - 1
52+
CANONICALJSON_MAX_INT = (2**53) - 1
5353
CANONICALJSON_MIN_INT = -CANONICALJSON_MAX_INT
5454

5555

synapse/http/proxyagent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
logger = logging.getLogger(__name__)
4343

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

4646

4747
@implementer(IAgent)

synapse/replication/http/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ async def send_request(*, instance_name: str = "master", **kwargs: Any) -> Any:
275275
if attempts > cls.RETRY_ON_CONNECT_ERROR_ATTEMPTS:
276276
raise
277277

278-
delay = 2 ** attempts
278+
delay = 2**attempts
279279
logger.warning(
280280
"%s request connection failed; retrying in %ds: %r",
281281
cls.NAME,

synapse/rest/media/v1/media_storage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class ReadableFileWrapper:
352352
`IConsumer`.
353353
"""
354354

355-
CHUNK_SIZE = 2 ** 14
355+
CHUNK_SIZE = 2**14
356356

357357
clock: Clock
358358
path: str

synapse/rest/media/v1/preview_html.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
logger = logging.getLogger(__name__)
2424

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

synapse/storage/database.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
from synapse.server import HomeServer
6464

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

6868
logger = logging.getLogger(__name__)
6969

synapse/util/patch_inline_callbacks.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,16 @@ def check_yield_points_inner(
217217
# We don't raise here as its perfectly valid for contexts to
218218
# change in a function, as long as it sets the correct context
219219
# on resolving (which is checked separately).
220-
err = "%s changed context from %s to %s, happened between lines %d and %d in %s" % (
221-
frame.f_code.co_name,
222-
expected_context,
223-
current_context(),
224-
last_yield_line_no,
225-
frame.f_lineno,
226-
frame.f_code.co_filename,
220+
err = (
221+
"%s changed context from %s to %s, happened between lines %d and %d in %s"
222+
% (
223+
frame.f_code.co_name,
224+
expected_context,
225+
current_context(),
226+
last_yield_line_no,
227+
frame.f_lineno,
228+
frame.f_code.co_filename,
229+
)
227230
)
228231
changes.append(err)
229232

synapse/util/retryutils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
RETRY_MULTIPLIER = 5
3131

3232
# a cap on the backoff. (Essentially none)
33-
MAX_RETRY_INTERVAL = 2 ** 62
33+
MAX_RETRY_INTERVAL = 2**62
3434

3535

3636
class NotRetryingDestination(Exception):

tests/handlers/test_federation.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ def test_valid_json(self) -> None:
496496
def test_invalid_numbers(self) -> None:
497497
"""Invalid values for an integer should be rejected, all floats should be rejected."""
498498
for value in [
499-
-(2 ** 53),
500-
2 ** 53,
499+
-(2**53),
500+
2**53,
501501
1.0,
502502
float("inf"),
503503
float("-inf"),
@@ -524,7 +524,7 @@ def test_invalid_nested(self) -> None:
524524
event_from_pdu_json(
525525
{
526526
"type": EventTypes.Message,
527-
"content": {"foo": [{"bar": 2 ** 56}]},
527+
"content": {"foo": [{"bar": 2**56}]},
528528
"room_id": "!room:test",
529529
"sender": "@user:test",
530530
"depth": 1,

tests/replication/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def assert_request_is_get_repl_stream_updates(
206206
path: bytes = request.path # type: ignore
207207
self.assertRegex(
208208
path,
209-
br"^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$"
209+
rb"^/_synapse/replication/get_repl_stream_updates/%s/[^/]+$"
210210
% (stream_name.encode("ascii"),),
211211
)
212212

0 commit comments

Comments
 (0)