8000 Use literal constant for `QuotingType` in `csv` Module (#13983) · python/typeshed@ffc5acb · GitHub
[go: up one dir, main page]

Skip to content

Commit ffc5acb

Browse files
authored
Use literal constant for QuotingType in csv Module (#13983)
1 parent 6308997 commit ffc5acb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

stdlib/_csv.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import csv
22
import sys
33
from _typeshed import SupportsWrite
44
from collections.abc import Iterable
5-
from typing import Any, Final, type_check_only
5+
from typing import Any, Final, Literal, type_check_only
66
from typing_extensions import Self, TypeAlias
77

88
__version__: Final[str]
@@ -15,9 +15,10 @@ if sys.version_info >= (3, 12):
1515
QUOTE_STRINGS: Final = 4
1616
QUOTE_NOTNULL: Final = 5
1717

18-
# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC`
19-
# However, using literals in situations like these can cause false-positives (see #7258)
20-
_QuotingType: TypeAlias = int
18+
if sys.version_info >= (3, 12):
19+
_QuotingType: TypeAlias = Literal[0, 1, 2, 3, 4, 5]
20+
else:
21+
_QuotingType: TypeAlias = Literal[0, 1, 2, 3]
2122

2223
class Error(Exception): ...
2324

0 commit comments

Comments
 (0)
0