mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
build(deps): bump black from 21.12b0 to 22.3.0 (#3950)
* build(deps): bump black from 21.12b0 to 22.3.0 Bumps [black](https://github.com/psf/black) from 21.12b0 to 22.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/commits/22.3.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * apply new black styles, fix docs * try upgrading pip before fastapi tests Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
This commit is contained in:
@@ -246,6 +246,9 @@ jobs:
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: upgrade pip
|
||||
run: pip install -U pip setuptools wheel
|
||||
|
||||
- name: install
|
||||
run: make install-testing
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ flake8-quotes==3.3.1
|
||||
hypothesis==6.31.6
|
||||
markdown-include==0.6.0
|
||||
mdx-truly-sane-lists==1.2
|
||||
mkdocs==1.2.3
|
||||
mkdocs==1.3.0
|
||||
mkdocs-exclude==1.0.2
|
||||
mkdocs-material==8.2.3
|
||||
mkdocs-material==8.2.8
|
||||
sqlalchemy
|
||||
orjson
|
||||
ujson
|
||||
|
||||
@@ -122,7 +122,7 @@ def int_domain_regex() -> Pattern[str]:
|
||||
class AnyUrl(str):
|
||||
strip_whitespace = True
|
||||
min_length = 1
|
||||
max_length = 2 ** 16
|
||||
max_length = 2**16
|
||||
allowed_schemes: Optional[Collection[str]] = None
|
||||
tld_required: bool = False
|
||||
user_required: bool = False
|
||||
@@ -386,7 +386,7 @@ def stricturl(
|
||||
*,
|
||||
strip_whitespace: bool = True,
|
||||
min_length: int = 1,
|
||||
max_length: int = 2 ** 16,
|
||||
max_length: int = 2**16,
|
||||
tld_required: bool = True,
|
||||
host_required: bool = True,
|
||||
allowed_schemes: Optional[Collection[str]] = None,
|
||||
|
||||
+12
-12
@@ -1010,18 +1010,18 @@ class PaymentCardNumber(str):
|
||||
|
||||
BYTE_SIZES = {
|
||||
'b': 1,
|
||||
'kb': 10 ** 3,
|
||||
'mb': 10 ** 6,
|
||||
'gb': 10 ** 9,
|
||||
'tb': 10 ** 12,
|
||||
'pb': 10 ** 15,
|
||||
'eb': 10 ** 18,
|
||||
'kib': 2 ** 10,
|
||||
'mib': 2 ** 20,
|
||||
'gib': 2 ** 30,
|
||||
'tib': 2 ** 40,
|
||||
'pib': 2 ** 50,
|
||||
'eib': 2 ** 60,
|
||||
'kb': 10**3,
|
||||
'mb': 10**6,
|
||||
'gb': 10**9,
|
||||
'tb': 10**12,
|
||||
'pb': 10**15,
|
||||
'eb': 10**18,
|
||||
'kib': 2**10,
|
||||
'mib': 2**20,
|
||||
'gib': 2**30,
|
||||
'tib': 2**40,
|
||||
'pib': 2**50,
|
||||
'eib': 2**60,
|
||||
}
|
||||
BYTE_SIZES.update({k.lower()[0]: v for k, v in BYTE_SIZES.items() if 'i' not in k})
|
||||
byte_string_re = re.compile(r'^\s*(\d*\.?\d+)\s*(\w+)?', re.IGNORECASE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
black==21.12b0
|
||||
black==22.3.0
|
||||
flake8==4.0.1
|
||||
flake8-quotes==3.3.1
|
||||
hypothesis==6.31.6
|
||||
|
||||
@@ -63,8 +63,8 @@ def test_large_any_str():
|
||||
a: bytes
|
||||
b: str
|
||||
|
||||
content_bytes = b'x' * (2 ** 16 + 1)
|
||||
content_str = 'x' * (2 ** 16 + 1)
|
||||
content_bytes = b'x' * (2**16 + 1)
|
||||
content_str = 'x' * (2**16 + 1)
|
||||
m = Model(a=content_bytes, b=content_str)
|
||||
assert m.a == content_bytes
|
||||
assert m.b == content_str
|
||||
|
||||
+2
-2
@@ -433,13 +433,13 @@ def test_with_declared_hash():
|
||||
x: int
|
||||
|
||||
def __hash__(self):
|
||||
return self.x ** 2
|
||||
return self.x**2
|
||||
|
||||
class Bar(Foo):
|
||||
y: int
|
||||
|
||||
def __hash__(self):
|
||||
return self.y ** 3
|
||||
return self.y**3
|
||||
|
||||
class Buz(Bar):
|
||||
z: int
|
||||
|
||||
@@ -114,7 +114,7 @@ def test_ipv6address_success(value):
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 or IPv6 address', 'type': 'value_error.ipvanyaddress'}],
|
||||
),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 or IPv6 address', 'type': 'value_error.ipvanyaddress'}],
|
||||
),
|
||||
],
|
||||
@@ -141,7 +141,7 @@ def test_ipaddress_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ipv4',), 'msg': 'value is not a valid IPv4 address', 'type': 'value_error.ipv4address'}]),
|
||||
(
|
||||
2 ** 32 + 1,
|
||||
2**32 + 1,
|
||||
[{'loc': ('ipv4',), 'msg': 'value is not a valid IPv4 address', 'type': 'value_error.ipv4address'}],
|
||||
),
|
||||
(
|
||||
@@ -172,7 +172,7 @@ def test_ipv4address_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ipv6',), 'msg': 'value is not a valid IPv6 address', 'type': 'value_error.ipv6address'}]),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ipv6',), 'msg': 'value is not a valid IPv6 address', 'type': 'value_error.ipv6address'}],
|
||||
),
|
||||
(
|
||||
@@ -203,7 +203,7 @@ def test_ipv6address_fails(value, errors):
|
||||
('192.168.0.0/24', IPv4Network),
|
||||
('192.168.128.0/30', IPv4Network),
|
||||
('2001:db00::0/120', IPv6Network),
|
||||
(2 ** 32 - 1, IPv4Network), # no mask equals to mask /32
|
||||
(2**32 - 1, IPv4Network), # no mask equals to mask /32
|
||||
(20_282_409_603_651_670_423_947_251_286_015, IPv6Network), # /128
|
||||
(b'\xff\xff\xff\xff', IPv4Network), # /32
|
||||
(b'\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', IPv6Network),
|
||||
@@ -224,7 +224,7 @@ def test_ipnetwork_success(value, cls):
|
||||
[
|
||||
('192.168.0.0/24', IPv4Network),
|
||||
('192.168.128.0/30', IPv4Network),
|
||||
(2 ** 32 - 1, IPv4Network), # no mask equals to mask /32
|
||||
(2**32 - 1, IPv4Network), # no mask equals to mask /32
|
||||
(b'\xff\xff\xff\xff', IPv4Network), # /32
|
||||
(('192.168.0.0', 24), IPv4Network),
|
||||
(IPv4Network('192.168.0.0/24'), IPv4Network),
|
||||
@@ -270,7 +270,7 @@ def test_ip_v6_network_success(value, cls):
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 or IPv6 network', 'type': 'value_error.ipvanynetwork'}],
|
||||
),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 or IPv6 network', 'type': 'value_error.ipvanynetwork'}],
|
||||
),
|
||||
],
|
||||
@@ -297,7 +297,7 @@ def test_ipnetwork_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ip',), 'msg': 'value is not a valid IPv4 network', 'type': 'value_error.ipv4network'}]),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 network', 'type': 'value_error.ipv4network'}],
|
||||
),
|
||||
(
|
||||
@@ -328,7 +328,7 @@ def test_ip_v4_network_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ip',), 'msg': 'value is not a valid IPv6 network', 'type': 'value_error.ipv6network'}]),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv6 network', 'type': 'value_error.ipv6network'}],
|
||||
),
|
||||
(
|
||||
@@ -362,8 +362,8 @@ def test_ip_v6_network_fails(value, errors):
|
||||
('192.168.128.1/30', IPv4Interface),
|
||||
('2001:db00::0/120', IPv6Interface),
|
||||
('2001:db00::1/120', IPv6Interface),
|
||||
(2 ** 32 - 1, IPv4Interface), # no mask equals to mask /32
|
||||
(2 ** 32 - 1, IPv4Interface), # so ``strict`` has no effect
|
||||
(2**32 - 1, IPv4Interface), # no mask equals to mask /32
|
||||
(2**32 - 1, IPv4Interface), # so ``strict`` has no effect
|
||||
(20_282_409_603_651_670_423_947_251_286_015, IPv6Interface), # /128
|
||||
(20_282_409_603_651_670_423_947_251_286_014, IPv6Interface),
|
||||
(b'\xff\xff\xff\xff', IPv4Interface), # /32
|
||||
@@ -394,8 +394,8 @@ def test_ipinterface_success(value, cls):
|
||||
('192.168.0.1/24', IPv4Interface),
|
||||
('192.168.128.0/30', IPv4Interface),
|
||||
('192.168.128.1/30', IPv4Interface),
|
||||
(2 ** 32 - 1, IPv4Interface), # no mask equals to mask /32
|
||||
(2 ** 32 - 1, IPv4Interface), # so ``strict`` has no effect
|
||||
(2**32 - 1, IPv4Interface), # no mask equals to mask /32
|
||||
(2**32 - 1, IPv4Interface), # so ``strict`` has no effect
|
||||
(b'\xff\xff\xff\xff', IPv4Interface), # /32
|
||||
(b'\xff\xff\xff\xff', IPv4Interface),
|
||||
(('192.168.0.0', 24), IPv4Interface),
|
||||
@@ -467,7 +467,7 @@ def test_ip_v6_interface_success(value, cls):
|
||||
],
|
||||
),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[
|
||||
{
|
||||
'loc': ('ip',),
|
||||
@@ -500,7 +500,7 @@ def test_ipinterface_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ip',), 'msg': 'value is not a valid IPv4 interface', 'type': 'value_error.ipv4interface'}]),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv4 interface', 'type': 'value_error.ipv4interface'}],
|
||||
),
|
||||
],
|
||||
@@ -527,7 +527,7 @@ def test_ip_v4_interface_fails(value, errors):
|
||||
),
|
||||
(-1, [{'loc': ('ip',), 'msg': 'value is not a valid IPv6 interface', 'type': 'value_error.ipv6interface'}]),
|
||||
(
|
||||
2 ** 128 + 1,
|
||||
2**128 + 1,
|
||||
[{'loc': ('ip',), 'msg': 'value is not a valid IPv6 interface', 'type': 'value_error.ipv6interface'}],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -799,7 +799,7 @@ def test_str_constrained_types(field_type, expected_schema):
|
||||
@pytest.mark.parametrize(
|
||||
'field_type,expected_schema',
|
||||
[
|
||||
(AnyUrl, {'title': 'A', 'type': 'string', 'format': 'uri', 'minLength': 1, 'maxLength': 2 ** 16}),
|
||||
(AnyUrl, {'title': 'A', 'type': 'string', 'format': 'uri', 'minLength': 1, 'maxLength': 2**16}),
|
||||
(
|
||||
stricturl(min_length=5, max_length=10),
|
||||
{'title': 'A', 'type': 'string', 'format': 'uri', 'minLength': 5, 'maxLength': 10},
|
||||
|
||||
+4
-4
@@ -1144,7 +1144,7 @@ def test_dict():
|
||||
([1, 2, '3'], [1, 2, '3']),
|
||||
((1, 2, '3'), [1, 2, '3']),
|
||||
({1, 2, '3'}, list({1, 2, '3'})),
|
||||
((i ** 2 for i in range(5)), [0, 1, 4, 9, 16]),
|
||||
((i**2 for i in range(5)), [0, 1, 4, 9, 16]),
|
||||
((deque((1, 2, 3)), list(deque((1, 2, 3))))),
|
||||
),
|
||||
)
|
||||
@@ -1184,7 +1184,7 @@ def test_ordered_dict():
|
||||
([1, 2, '3'], (1, 2, '3')),
|
||||
((1, 2, '3'), (1, 2, '3')),
|
||||
({1, 2, '3'}, tuple({1, 2, '3'})),
|
||||
((i ** 2 for i in range(5)), (0, 1, 4, 9, 16)),
|
||||
((i**2 for i in range(5)), (0, 1, 4, 9, 16)),
|
||||
(deque([1, 2, 3]), (1, 2, 3)),
|
||||
),
|
||||
)
|
||||
@@ -1210,7 +1210,7 @@ def test_tuple_fails(value):
|
||||
(
|
||||
([1, 2, '3'], int, (1, 2, 3)),
|
||||
((1, 2, '3'), int, (1, 2, 3)),
|
||||
((i ** 2 for i in range(5)), int, (0, 1, 4, 9, 16)),
|
||||
((i**2 for i in range(5)), int, (0, 1, 4, 9, 16)),
|
||||
(('a', 'b', 'c'), str, ('a', 'b', 'c')),
|
||||
),
|
||||
)
|
||||
@@ -1250,7 +1250,7 @@ def test_tuple_variable_len_fails(value, cls, exc):
|
||||
({1, 2, 2, '3'}, {1, 2, '3'}),
|
||||
((1, 2, 2, '3'), {1, 2, '3'}),
|
||||
([1, 2, 2, '3'], {1, 2, '3'}),
|
||||
({i ** 2 for i in range(5)}, {0, 1, 4, 9, 16}),
|
||||
({i**2 for i in range(5)}, {0, 1, 4, 9, 16}),
|
||||
),
|
||||
)
|
||||
def test_set_success(value, result):
|
||||
|
||||
Reference in New Issue
Block a user