Skip to content

Commit d21a5bb

Browse files
committed
Hide Literal under if TYPE_CHECKING.
1 parent 8f55285 commit d21a5bb

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

parsel/selector.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
Any,
99
Dict,
1010
List,
11-
Literal,
1211
Mapping,
1312
Optional,
1413
Pattern,
@@ -27,16 +26,18 @@
2726

2827

2928
if typing.TYPE_CHECKING:
30-
# requires Python 3.8
31-
from typing import SupportsIndex
29+
# both require Python 3.8
30+
from typing import Literal, SupportsIndex
31+
32+
# simplified _OutputMethodArg from types-lxml
33+
_TostringMethodType = Literal[
34+
"html",
35+
"xml",
36+
]
3237

3338

3439
_SelectorType = TypeVar("_SelectorType", bound="Selector")
3540
_ParserType = Union[etree.XMLParser, etree.HTMLParser]
36-
_TostringMethodType = Literal[ # simplified _OutputMethodArg from types-lxml
37-
"html",
38-
"xml",
39-
]
4041

4142
lxml_version = parse_version(etree.__version__)
4243
lxml_huge_tree_version = parse_version("4.2")
@@ -346,8 +347,8 @@ def __init__(
346347
self._csstranslator: OriginalGenericTranslator = typing.cast(
347348
OriginalGenericTranslator, _ctgroup[st]["_csstranslator"]
348349
)
349-
self._tostring_method: _TostringMethodType = typing.cast(
350-
_TostringMethodType, _ctgroup[st]["_tostring_method"]
350+
self._tostring_method: "_TostringMethodType" = typing.cast(
351+
"_TostringMethodType", _ctgroup[st]["_tostring_method"]
351352
)
352353

353354
if text is not None:

0 commit comments

Comments
 (0)