Skip to content

Commit e660e16

Browse files
pre-commit-ci[bot]Joshua Trzebiatowski
authored and
Joshua Trzebiatowski
committed
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5f4c7c5 commit e660e16

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

src/check_jsonschema/cli/main_command.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from ..catalog import CUSTOM_SCHEMA_NAMES, SCHEMA_CATALOG
1212
from ..checker import SchemaChecker
13-
from ..formats import KNOWN_FORMATS, RegexVariantName
13+
from ..formats import KNOWN_FORMATS, RegexVariantName, EmailVariantName
1414
from ..instance_loader import InstanceLoader
1515
from ..parsers import SUPPORTED_FILE_FORMATS
1616
from ..reporter import REPORTER_BY_NAME, Reporter
@@ -283,7 +283,7 @@ def main(
283283
else:
284284
args.disable_formats = normalized_disable_formats
285285

286-
args.format_email = RegexVariantName(format_email)
286+
args.format_email = EmailVariantName(format_email)
287287
args.format_regex = RegexVariantName(format_regex)
288288
args.disable_cache = no_cache
289289
args.default_filetype = default_filetype

src/check_jsonschema/formats/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
import jsonschema.validators
1010
import regress
1111

12-
from .implementations import validate_rfc3339, validate_rfc5321, validate_rfc6531, validate_time
12+
from .implementations import (
13+
validate_rfc3339,
14+
validate_rfc5321,
15+
validate_rfc6531,
16+
validate_time,
17+
)
1318

1419
# all known format strings except for a selection from draft3 which have either
1520
# been renamed or removed:

src/check_jsonschema/formats/implementations/rfc5321.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
\[[\t -Z^-~]*]
1616
)
1717
$
18-
""",
18+
""",
1919
re.VERBOSE | re.ASCII,
2020
)
2121

@@ -31,9 +31,7 @@ def validate(email_str: object) -> bool:
3131
import timeit
3232

3333
N = 100_000
34-
tests = (
35-
("basic", "[email protected]"),
36-
)
34+
tests = (("basic", "[email protected]"),)
3735

3836
print("benchmarking")
3937
for name, val in tests:

src/check_jsonschema/formats/implementations/rfc6531.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
^
66
# local part
77
(
8-
([0-9a-z!#$%&'*+-\/=?^_`\{|\}~\u{80}-\u{10FFFF}]+(\.[0-9a-z!#$%&'*+-\/=?^_`\{|\}~\u{80}-\u{10FFFF}]+)*)
8+
([0-9a-z!#$%&'*+-\/=?^_`\{|\}~\u0080-\U0010FFFF]+(\.[0-9a-z!#$%&'*+-\/=?^_`\{|\}~\u0080-\U0010FFFF]+)*)
99
|
1010
# quoted string
11-
("(
12-
[\x20-\x21\x23-\x5B\x5D-\x7E\u{80}-\u{10FFFF}]
13-
|
14-
\\[\x20-\x7E]
15-
)*")
16-
)(?<!.{64,})
11+
"([\x20-\x21\x23-\x5B\x5D-\x7E\u0080-\U0010FFFF]|\\[\x20-\x7E])*"
12+
)
1713
@
1814
# Domain/address
1915
(
@@ -36,11 +32,11 @@
3632
)\])
3733
|
3834
# Domain
39-
((?!.{256,})(([0-9a-z\u{80}-\u{10FFFF}]([0-9a-z-\u{80}-\u{10FFFF}]*[0-9a-z\u{80}-\u{10FFFF}])?))(\.([0-9a-z\u{80}-\u{10FFFF}]([0-9a-z-\u{80}-\u{10FFFF}]*[0-9a-z\u{80}-\u{10FFFF}])?))*)
35+
((?!.{256,})(([0-9a-z\u0080-\U0010FFFF]([0-9a-z-\u0080-\U0010FFFF]*[0-9a-z\u0080-\U0010FFFF])?))(\.([0-9a-z\u0080-\U0010FFFF]([0-9a-z-\u0080-\U0010FFFF]*[0-9a-z\u0080-\U0010FFFF])?))*)
4036
)
4137
$
42-
""",
43-
re.VERBOSE | re.ASCII,
38+
""",
39+
re.VERBOSE | re.UNICODE,
4440
)
4541

4642

@@ -55,9 +51,7 @@ def validate(email_str: object) -> bool:
5551
import timeit
5652

5753
N = 100_000
58-
tests = (
59-
("basic", "[email protected]"),
60-
)
54+
tests = (("basic", "[email protected]"),)
6155

6256
print("benchmarking")
6357
for name, val in tests:

0 commit comments

Comments
 (0)