Skip to content

Commit 5e44454

Browse files
committed
Fix lint
1 parent 5eb3896 commit 5e44454

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/hyperlink/_url.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
Iterable[Tuple[Text, Optional[Text]]],
7171
]
7272
T = TypeVar("T")
73+
# Literal is not available in all pythons so we only bring it in for mypy.
74+
if TYPE_CHECKING:
75+
from typing import Literal
7376

7477

7578
# from boltons.typeutils
@@ -2416,26 +2419,26 @@ def __dir__(self):
24162419

24172420
# # End Twisted Compat Code
24182421

2419-
# Add some overloads so that parse gives a better return value.
2420-
# Literal is not available in all pythons so we only bring it in for mypy.
2421-
if TYPE_CHECKING:
2422-
from typing import Literal
24232422

2423+
# Add some overloads so that parse gives a better return value.
24242424
@overload
24252425
def parse(url, decoded, lazy=False):
24262426
# type: (Text, Literal[False], bool) -> URL
24272427
"""Passing decoded=False returns URL."""
24282428

2429+
24292430
@overload
24302431
def parse(url, decoded=True, lazy=False):
24312432
# type: (Text, Literal[True], bool) -> DecodedURL
24322433
"""Passing decoded=True (or the default value) returns DecodedURL."""
24332434

2435+
24342436
@overload
24352437
def parse(url, decoded=True, lazy=False):
24362438
# type: (Text, bool, bool) -> Union[URL, DecodedURL]
24372439
"""If decoded is not a literal we don't know the return type."""
24382440

2441+
24392442
def parse(url, decoded=True, lazy=False):
24402443
# type: (Text, bool, bool) -> Union[URL, DecodedURL]
24412444
"""

0 commit comments

Comments
 (0)