@@ -272,7 +272,9 @@ def ensure_required_components_exist(
272
272
raise exceptions .MissingComponentError (uri , * missing_components )
273
273
274
274
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 :
276
278
"""Determine if a value is valid based on the provided matcher.
277
279
278
280
:param str value:
@@ -289,7 +291,9 @@ def is_valid(value: t.Optional[str], matcher: t.Pattern[str], require: bool) ->
289
291
return value is None or bool (matcher .match (value ))
290
292
291
293
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 :
293
297
"""Determine if the authority string is valid.
294
298
295
299
:param str authority:
@@ -374,7 +378,9 @@ def query_is_valid(query: t.Optional[str], require: bool = False) -> bool:
374
378
return is_valid (query , misc .QUERY_MATCHER , require )
375
379
376
380
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 :
378
384
"""Determine if the fragment component is valid.
379
385
380
386
:param str fragment:
@@ -406,7 +412,9 @@ def valid_ipv4_host_address(host: str) -> bool:
406
412
_SUBAUTHORITY_VALIDATORS = {"userinfo" , "host" , "port" }
407
413
408
414
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 :
410
418
"""Determine if the userinfo, host, and port are valid."""
411
419
try :
412
420
subauthority_dict = uri .authority_info ()
@@ -430,7 +438,9 @@ def subauthority_component_is_valid(uri: "uri.URIReference", component: str) ->
430
438
return 0 <= port <= 65535
431
439
432
440
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 :
434
444
"""Assert that all components are valid in the URI."""
435
445
invalid_components : set [str ] = set ()
436
446
for component in validated_components :
0 commit comments