mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Add @disjoint_base decorator in the stdlib (#14599)
And fix some other new stubtest finds.
This commit is contained in:
+11
-4
@@ -4,7 +4,7 @@ from collections.abc import Callable, Generator, Iterable, Sequence
|
||||
from re import Pattern
|
||||
from token import *
|
||||
from typing import Any, Final, NamedTuple, TextIO, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import TypeAlias, disjoint_base
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
# Avoid double assignment to Final name by imports, which pyright objects to.
|
||||
@@ -115,9 +115,16 @@ class _TokenInfo(NamedTuple):
|
||||
end: _Position
|
||||
line: str
|
||||
|
||||
class TokenInfo(_TokenInfo):
|
||||
@property
|
||||
def exact_type(self) -> int: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
class TokenInfo(_TokenInfo):
|
||||
@property
|
||||
def exact_type(self) -> int: ...
|
||||
|
||||
else:
|
||||
@disjoint_base
|
||||
class TokenInfo(_TokenInfo):
|
||||
@property
|
||||
def exact_type(self) -> int: ...
|
||||
|
||||
# Backwards compatible tokens can be sequences of a shorter length too
|
||||
_Token: TypeAlias = TokenInfo | Sequence[int | str | _Position]
|
||||
|
||||
Reference in New Issue
Block a user