Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor ipaddress and email.utils; renorm ipv4 and ipv6 types based on updated ipaddress corrections (SYN-5490, SYN-7937) #3902

Merged
merged 22 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ef6ab1a
Preliminary updates based on CPython 3.11.10 changes (SYN-5490, SYN-7…
vEpiphyte Sep 9, 2024
2a5c099
Merge branch 'master' into feat_python311_compat
vEpiphyte Sep 9, 2024
08c2926
Fix pycodestyle issues with ipaddress
vEpiphyte Sep 9, 2024
d414420
Merge branch 'feat_python311_compat' of github.com:vertexproject/syna…
vEpiphyte Sep 9, 2024
7843c76
Merge branch 'master' into feat_python311_compat
vEpiphyte Sep 13, 2024
ae36db5
Vendor in email.utils and email._parseaddr; account for syntax errors…
vEpiphyte Sep 13, 2024
ab04f8a
Add model migration
vEpiphyte Sep 14, 2024
91ff632
Cleanup imports / comments
vEpiphyte Sep 14, 2024
d413350
Add changelogs
vEpiphyte Sep 14, 2024
e85b9e0
move ipv4 test
vEpiphyte Sep 14, 2024
8a37de9
Merge branch 'master' into feat_python311_compat
vEpiphyte Sep 20, 2024
ed18677
Fix maxvers
vEpiphyte Sep 20, 2024
1a1ccdd
Add unit tests for ipaddress and email.utils
vEpiphyte Sep 20, 2024
c785347
Apply suggestions from code review
vEpiphyte Sep 20, 2024
78826f1
Apply suggestions from code review
vEpiphyte Sep 20, 2024
4e90dd7
Vendor part of test/test_email/test_email.py
vEpiphyte Sep 20, 2024
3293b5d
Move lib.test to lib.tests for pytest help.
vEpiphyte Sep 22, 2024
02169a1
Revert "Move lib.test to lib.tests for pytest help."
vEpiphyte Sep 22, 2024
1481b46
change the circleci test globbing for vendor test files.
vEpiphyte Sep 22, 2024
37c0768
Remove old OSX from cpython vendored tests, mark unittest entrypoints…
vEpiphyte Sep 23, 2024
07344cc
Merge branch 'master' into feat_python311_compat
vEpiphyte Sep 24, 2024
752e875
Comment out unused functionality from email.utils
vEpiphyte Sep 24, 2024
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
Prev Previous commit
Next Next commit
Fix pycodestyle issues with ipaddress
  • Loading branch information
vEpiphyte committed Sep 9, 2024
commit 08c2926e037d22df2492c7b42e96617ec4b4de37
12 changes: 6 additions & 6 deletions synapse/vendor/cpython/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _count_righthand_zero_bits(number, bits):
"""
if number == 0:
return bits
return min(bits, (~number & (number-1)).bit_length())
return min(bits, (~number & (number - 1)).bit_length())


def summarize_address_range(first, last):
Expand Down Expand Up @@ -1690,7 +1690,7 @@ def _ip_int_from_string(cls, ip_str):
# leading or trailing zero part.
_max_parts = cls._HEXTET_COUNT + 1
if len(parts) > _max_parts:
msg = "At most %d colons permitted in %r" % (_max_parts-1, ip_str)
msg = "At most %d colons permitted in %r" % (_max_parts - 1, ip_str)
raise AddressValueError(msg)

# Disregarding the endpoints, find '::' with nothing in between.
Expand Down Expand Up @@ -1723,7 +1723,7 @@ def _ip_int_from_string(cls, ip_str):
parts_skipped = cls._HEXTET_COUNT - (parts_hi + parts_lo)
if parts_skipped < 1:
msg = "Expected at most %d other parts with '::' in %r"
raise AddressValueError(msg % (cls._HEXTET_COUNT-1, ip_str))
raise AddressValueError(msg % (cls._HEXTET_COUNT - 1, ip_str))
else:
# Otherwise, allocate the entire address to parts_hi. The
# endpoints could still be empty, but _parse_hextet() will check
Expand Down Expand Up @@ -1850,7 +1850,7 @@ def _string_from_ip_int(cls, ip_int=None):
raise ValueError('IPv6 address is too large')

hex_str = '%032x' % ip_int
hextets = ['%x' % int(hex_str[x:x+4], 16) for x in range(0, 32, 4)]
hextets = ['%x' % int(hex_str[x:x + 4], 16) for x in range(0, 32, 4)]

hextets = cls._compress_hextets(hextets)
return ':'.join(hextets)
Expand All @@ -1874,7 +1874,7 @@ def _explode_shorthand_ip_string(self):

ip_int = self._ip_int_from_string(ip_str)
hex_str = '%032x' % ip_int
parts = [hex_str[x:x+4] for x in range(0, 32, 4)]
parts = [hex_str[x:x + 4] for x in range(0, 32, 4)]
if isinstance(self, (_BaseNetwork, IPv6Interface)):
return '%s/%d' % (':'.join(parts), self._prefixlen)
return ':'.join(parts)
Expand Down Expand Up @@ -2363,4 +2363,4 @@ class _IPv6Constants:


IPv6Address._constants = _IPv6Constants
IPv6Network._constants = _IPv6Constants
IPv6Network._constants = _IPv6Constants