Skip to content

Commit ae63851

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2dc1f0c commit ae63851

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/rfc3986/normalizers.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,20 @@ def remove_dot_segments(s: str) -> str:
144144

145145
return "/".join(output)
146146

147+
147148
@t.overload
148149
def encode_component(uri_component: None, encoding: str) -> None:
149150
...
151+
152+
150153
@t.overload
151154
def encode_component(uri_component: str, encoding: str) -> str:
152155
...
153-
def encode_component(uri_component: t.Optional[str], encoding: str) -> t.Optional[str]:
156+
157+
158+
def encode_component(
159+
uri_component: t.Optional[str], encoding: str
160+
) -> t.Optional[str]:
154161
"""Encode the specific component in the provided encoding."""
155162
if uri_component is None:
156163
return uri_component

src/rfc3986/validators.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ def ensure_required_components_exist(
272272
raise exceptions.MissingComponentError(uri, *missing_components)
273273

274274

275-
def is_valid(value: t.Optional[str], matcher: t.Pattern[str], require: bool) -> bool:
275+
def is_valid(
276+
value: t.Optional[str], matcher: t.Pattern[str], require: bool
277+
) -> bool:
276278
"""Determine if a value is valid based on the provided matcher.
277279
278280
:param str value:
@@ -289,7 +291,9 @@ def is_valid(value: t.Optional[str], matcher: t.Pattern[str], require: bool) ->
289291
return value is None or bool(matcher.match(value))
290292

291293

292-
def authority_is_valid(authority: str, host: t.Optional[str] = None, require: bool = False) -> bool:
294+
def authority_is_valid(
295+
authority: str, host: t.Optional[str] = None, require: bool = False
296+
) -> bool:
293297
"""Determine if the authority string is valid.
294298
295299
:param str authority:
@@ -374,7 +378,9 @@ def query_is_valid(query: t.Optional[str], require: bool = False) -> bool:
374378
return is_valid(query, misc.QUERY_MATCHER, require)
375379

376380

377-
def fragment_is_valid(fragment: t.Optional[str], require: bool = False) -> bool:
381+
def fragment_is_valid(
382+
fragment: t.Optional[str], require: bool = False
383+
) -> bool:
378384
"""Determine if the fragment component is valid.
379385
380386
:param str fragment:
@@ -406,7 +412,9 @@ def valid_ipv4_host_address(host: str) -> bool:
406412
_SUBAUTHORITY_VALIDATORS = {"userinfo", "host", "port"}
407413

408414

409-
def subauthority_component_is_valid(uri: "uri.URIReference", component: str) -> bool:
415+
def subauthority_component_is_valid(
416+
uri: "uri.URIReference", component: str
417+
) -> bool:
410418
"""Determine if the userinfo, host, and port are valid."""
411419
try:
412420
subauthority_dict = uri.authority_info()
@@ -430,7 +438,9 @@ def subauthority_component_is_valid(uri: "uri.URIReference", component: str) ->
430438
return 0 <= port <= 65535
431439

432440

433-
def ensure_components_are_valid(uri: "uri.URIReference", validated_components: t.List[str]) -> None:
441+
def ensure_components_are_valid(
442+
uri: "uri.URIReference", validated_components: t.List[str]
443+
) -> None:
434444
"""Assert that all components are valid in the URI."""
435445
invalid_components: set[str] = set()
436446
for component in validated_components:

0 commit comments

Comments
 (0)