mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Use literal constant for QuotingType in csv Module (#13983)
This commit is contained in:
+5
-4
@@ -2,7 +2,7 @@ import csv
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Final, type_check_only
|
||||
from typing import Any, Final, Literal, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__version__: Final[str]
|
||||
@@ -15,9 +15,10 @@ if sys.version_info >= (3, 12):
|
||||
QUOTE_STRINGS: Final = 4
|
||||
QUOTE_NOTNULL: Final = 5
|
||||
|
||||
# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC`
|
||||
# However, using literals in situations like these can cause false-positives (see #7258)
|
||||
_QuotingType: TypeAlias = int
|
||||
if sys.version_info >= (3, 12):
|
||||
_QuotingType: TypeAlias = Literal[0, 1, 2, 3, 4, 5]
|
||||
else:
|
||||
_QuotingType: TypeAlias = Literal[0, 1, 2, 3]
|
||||
|
||||
class Error(Exception): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user