Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bundled typeshed #86

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions typeshed_client/typeshed/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ antigravity: 2.7-
argparse: 2.7-
array: 2.7-
ast: 2.7-
asynchat: 2.7-
asynchat: 2.7-3.11
asyncio: 3.4-
asyncio.mixins: 3.10-
asyncio.exceptions: 3.8-
Expand All @@ -72,7 +72,7 @@ asyncio.taskgroups: 3.11-
asyncio.threads: 3.9-
asyncio.timeouts: 3.11-
asyncio.trsock: 3.8-
asyncore: 2.7-
asyncore: 2.7-3.11
atexit: 2.7-
audioop: 2.7-
base64: 2.7-
Expand Down Expand Up @@ -112,7 +112,7 @@ dbm: 2.7-
decimal: 2.7-
difflib: 2.7-
dis: 2.7-
distutils: 2.7-
distutils: 2.7-3.11
distutils.command.bdist_msi: 2.7-3.10
distutils.command.bdist_wininst: 2.7-3.9
doctest: 2.7-
Expand Down Expand Up @@ -147,7 +147,7 @@ html: 3.0-
http: 3.0-
imaplib: 2.7-
imghdr: 2.7-
imp: 2.7-
imp: 2.7-3.11
importlib: 2.7-
importlib.metadata: 3.8-
importlib.metadata._meta: 3.10-
Expand Down Expand Up @@ -228,7 +228,7 @@ shlex: 2.7-
shutil: 2.7-
signal: 2.7-
site: 2.7-
smtpd: 2.7-
smtpd: 2.7-3.11
smtplib: 2.7-
sndhdr: 2.7-
socket: 2.7-
Expand Down
51 changes: 43 additions & 8 deletions typeshed_client/typeshed/_ast.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import sys
import typing_extensions
from typing import Any, ClassVar
from typing_extensions import Literal, TypeAlias
from typing_extensions import Literal

PyCF_ONLY_AST: Literal[1024]
if sys.version_info >= (3, 8):
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]

_Identifier: TypeAlias = str
_Identifier: typing_extensions.TypeAlias = str

class AST:
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -59,31 +60,43 @@ class Expression(mod):
class stmt(AST): ...

class FunctionDef(stmt):
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
elif sys.version_info >= (3, 10):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
name: _Identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
returns: expr | None
if sys.version_info >= (3, 12):
type_params: list[type_param]

class AsyncFunctionDef(stmt):
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
elif sys.version_info >= (3, 10):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
name: _Identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
returns: expr | None
if sys.version_info >= (3, 12):
type_params: list[type_param]

class ClassDef(stmt):
if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "bases", "keywords", "body", "decorator_list", "type_params")
elif sys.version_info >= (3, 10):
__match_args__ = ("name", "bases", "keywords", "body", "decorator_list")
name: _Identifier
bases: list[expr]
keywords: list[keyword]
body: list[stmt]
decorator_list: list[expr]
if sys.version_info >= (3, 12):
type_params: list[type_param]

class Return(stmt):
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -366,10 +379,10 @@ class Attribute(expr):
ctx: expr_context

if sys.version_info >= (3, 9):
_Slice: TypeAlias = expr
_Slice: typing_extensions.TypeAlias = expr
else:
class slice(AST): ...
_Slice: TypeAlias = slice
_Slice: typing_extensions.TypeAlias = slice

class Slice(_Slice):
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -526,7 +539,7 @@ if sys.version_info >= (3, 10):

class pattern(AST): ...
# Without the alias, Pyright complains variables named pattern are recursively defined
_Pattern: TypeAlias = pattern
_Pattern: typing_extensions.TypeAlias = pattern

class match_case(AST):
__match_args__ = ("pattern", "guard", "body")
Expand Down Expand Up @@ -571,3 +584,25 @@ if sys.version_info >= (3, 10):
class MatchOr(pattern):
__match_args__ = ("patterns",)
patterns: list[pattern]

if sys.version_info >= (3, 12):
class type_param(AST): ...

class TypeVar(type_param):
__match_args__ = ("name", "bound")
name: _Identifier
bound: expr | None

class ParamSpec(type_param):
__match_args__ = ("name",)
name: _Identifier

class TypeVarTuple(type_param):
__match_args__ = ("name",)
name: _Identifier

class TypeAlias(stmt):
__match_args__ = ("name", "typeparams", "value")
name: Name
type_params: list[type_param]
value: expr
15 changes: 14 additions & 1 deletion typeshed_client/typeshed/_collections_abc.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from abc import abstractmethod
from types import MappingProxyType
from typing import ( # noqa: Y022,Y038
from typing import ( # noqa: Y022,Y038,Y057
AbstractSet as Set,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
Expand All @@ -23,11 +24,13 @@ from typing import ( # noqa: Y022,Y038
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Protocol,
Reversible as Reversible,
Sequence as Sequence,
Sized as Sized,
TypeVar,
ValuesView as ValuesView,
runtime_checkable,
)
from typing_extensions import final

Expand Down Expand Up @@ -58,12 +61,15 @@ __all__ = [
"MutableSequence",
"ByteString",
]
if sys.version_info >= (3, 12):
__all__ += ["Buffer"]

_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers.
_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.

@final
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 10):
@property
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...
Expand All @@ -76,6 +82,13 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented

@final
class dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]): # undocumented
def __eq__(self, __value: object) -> bool: ...
if sys.version_info >= (3, 10):
@property
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...

if sys.version_info >= (3, 12):
@runtime_checkable
class Buffer(Protocol):
@abstractmethod
def __buffer__(self, __flags: int) -> memoryview: ...
4 changes: 4 additions & 0 deletions typeshed_client/typeshed/_csv.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from _typeshed import SupportsWrite
from collections.abc import Iterable, Iterator
from typing import Any
Expand All @@ -9,6 +10,9 @@ QUOTE_ALL: Literal[1]
QUOTE_MINIMAL: Literal[0]
QUOTE_NONE: Literal[3]
QUOTE_NONNUMERIC: Literal[2]
if sys.version_info >= (3, 12):
QUOTE_STRINGS: Literal[4]
QUOTE_NOTNULL: Literal[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)
Expand Down
Loading