Skip to content

Commit

Permalink
Updated typeshed stubs to the latest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
msfterictraut committed Jun 20, 2023
1 parent eff69f5 commit d12ad6e
Show file tree
Hide file tree
Showing 166 changed files with 4,037 additions and 1,538 deletions.
2 changes: 1 addition & 1 deletion packages/pyright-internal/typeshed-fallback/commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6a94c9d677db9e9f85d764cc46294fd5c5e2a4b8
4290a25727800902d1733bf41fbc4300d2567c70
29 changes: 20 additions & 9 deletions packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
add_help: bool = True,
allow_abbrev: bool = True,
) -> None: ...
# Ignore errors about overlapping overloads

@overload
def parse_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ... # type: ignore[misc]
def parse_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> Namespace: ... # type: ignore[misc]
@overload
def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
@overload
Expand Down Expand Up @@ -209,16 +209,27 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def print_help(self, file: IO[str] | None = None) -> None: ...
def format_usage(self) -> str: ...
def format_help(self) -> str: ...
def parse_known_args(
self, args: Sequence[str] | None = None, namespace: Namespace | None = None
) -> tuple[Namespace, list[str]]: ...
@overload
def parse_known_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> tuple[Namespace, list[str]]: ... # type: ignore[misc]
@overload
def parse_known_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
@overload
def parse_known_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ...
def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ...
def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ...
def error(self, message: str) -> NoReturn: ...
def parse_intermixed_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> Namespace: ...
def parse_known_intermixed_args(
self, args: Sequence[str] | None = None, namespace: Namespace | None = None
) -> tuple[Namespace, list[str]]: ...
@overload
def parse_intermixed_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> Namespace: ... # type: ignore[misc]
@overload
def parse_intermixed_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
@overload
def parse_intermixed_args(self, *, namespace: _N) -> _N: ...
@overload
def parse_known_intermixed_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> tuple[Namespace, list[str]]: ... # type: ignore[misc]
@overload
def parse_known_intermixed_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
@overload
def parse_known_intermixed_args(self, *, namespace: _N) -> tuple[_N, list[str]]: ...
# undocumented
def _get_optional_actions(self) -> list[Action]: ...
def _get_positional_actions(self) -> list[Action]: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import dis
import enum
import sys
import types
from _typeshed import StrPath
from collections import OrderedDict
from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine, Generator, Mapping, Sequence, Set as AbstractSet
from types import (
Expand Down Expand Up @@ -177,7 +178,7 @@ if sys.version_info >= (3, 11):
@overload
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ...

def getmodulename(path: str) -> str | None: ...
def getmodulename(path: StrPath) -> str | None: ...
def ismodule(object: object) -> TypeGuard[ModuleType]: ...
def isclass(object: object) -> TypeGuard[type[Any]]: ...
def ismethod(object: object) -> TypeGuard[MethodType]: ...
Expand Down
5 changes: 3 additions & 2 deletions packages/pyright-internal/typeshed-fallback/stdlib/shutil.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import os
import sys
from _typeshed import BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Sequence
from tarfile import _TarfileFilter
from typing import Any, AnyStr, NamedTuple, Protocol, TypeVar, overload
from typing_extensions import TypeAlias

Expand Down Expand Up @@ -192,9 +193,9 @@ def register_archive_format(
) -> None: ...
def unregister_archive_format(name: str) -> None: ...

if sys.version_info >= (3, 12):
if sys.version_info >= (3, 8):
def unpack_archive(
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: str | None = None
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: _TarfileFilter | None = None
) -> None: ...

else:
Expand Down
90 changes: 83 additions & 7 deletions packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
from types import TracebackType
from typing import IO, ClassVar, Protocol, overload
from typing_extensions import Literal, Self
from typing_extensions import Literal, Self, TypeAlias

__all__ = [
"TarFile",
Expand All @@ -26,6 +26,21 @@ __all__ = [
"DEFAULT_FORMAT",
"open",
]
if sys.version_info >= (3, 12):
__all__ += [
"fully_trusted_filter",
"data_filter",
"tar_filter",
"FilterError",
"AbsoluteLinkError",
"OutsideDestinationError",
"SpecialFileError",
"AbsolutePathError",
"LinkOutsideDestinationError",
]

_FilterFunction: TypeAlias = Callable[[TarInfo, str], TarInfo | None]
_TarfileFilter: TypeAlias = Literal["fully_trusted", "tar", "data"] | _FilterFunction

class _Fileobj(Protocol):
def read(self, __size: int) -> bytes: ...
Expand Down Expand Up @@ -125,6 +140,7 @@ class TarFile:
debug: int | None
errorlevel: int | None
offset: int # undocumented
extraction_filter: _FilterFunction | None
def __init__(
self,
name: StrOrBytesPath | None = None,
Expand Down Expand Up @@ -275,12 +291,32 @@ class TarFile:
def getnames(self) -> _list[str]: ...
def list(self, verbose: bool = True, *, members: _list[TarInfo] | None = None) -> None: ...
def next(self) -> TarInfo | None: ...
def extractall(
self, path: StrOrBytesPath = ".", members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False
) -> None: ...
def extract(
self, member: str | TarInfo, path: StrOrBytesPath = "", set_attrs: bool = True, *, numeric_owner: bool = False
) -> None: ...
if sys.version_info >= (3, 8):
def extractall(
self,
path: StrOrBytesPath = ".",
members: Iterable[TarInfo] | None = None,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
def extract(
self,
member: str | TarInfo,
path: StrOrBytesPath = "",
set_attrs: bool = True,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
) -> None: ...
else:
def extractall(
self, path: StrOrBytesPath = ".", members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False
) -> None: ...
def extract(
self, member: str | TarInfo, path: StrOrBytesPath = "", set_attrs: bool = True, *, numeric_owner: bool = False
) -> None: ...

def _extract_member(
self, tarinfo: TarInfo, targetpath: str, set_attrs: bool = True, numeric_owner: bool = False
) -> None: ... # undocumented
Expand Down Expand Up @@ -324,6 +360,31 @@ class StreamError(TarError): ...
class ExtractError(TarError): ...
class HeaderError(TarError): ...

if sys.version_info >= (3, 8):
class FilterError(TarError):
# This attribute is only set directly on the subclasses, but the documentation guarantees
# that it is always present on FilterError.
tarinfo: TarInfo

class AbsolutePathError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...

class OutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...

class SpecialFileError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...

class AbsoluteLinkError(FilterError):
def __init__(self, tarinfo: TarInfo) -> None: ...

class LinkOutsideDestinationError(FilterError):
def __init__(self, tarinfo: TarInfo, path: str) -> None: ...

def fully_trusted_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def tar_filter(member: TarInfo, dest_path: str) -> TarInfo: ...
def data_filter(member: TarInfo, dest_path: str) -> TarInfo: ...

class TarInfo:
name: str
path: str
Expand Down Expand Up @@ -353,6 +414,21 @@ class TarInfo:
def linkpath(self) -> str: ...
@linkpath.setter
def linkpath(self, linkname: str) -> None: ...
if sys.version_info >= (3, 8):
def replace(
self,
*,
name: str = ...,
mtime: int = ...,
mode: int = ...,
linkname: str = ...,
uid: int = ...,
gid: int = ...,
uname: str = ...,
gname: str = ...,
deep: bool = True,
) -> Self: ...

def get_info(self) -> Mapping[str, str | int | bytes | Mapping[str, str]]: ...
if sys.version_info >= (3, 8):
def tobuf(self, format: int | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: ...
Expand Down
21 changes: 21 additions & 0 deletions packages/pyright-internal/typeshed-fallback/stdlib/tempfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ else:
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
*,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
errors: str | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeWriting,
buffering: Literal[-1, 1] = -1,
Expand Down Expand Up @@ -260,6 +271,16 @@ else:
dir: GenericPath[AnyStr] | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
*,
buffering: Literal[0],
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
) -> io.FileIO: ...
@overload
def TemporaryFile(
mode: OpenBinaryModeUpdating = "w+b",
buffering: Literal[-1, 1] = -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class ZoneInfo(tzinfo):
@classmethod
def no_cache(cls, key: str) -> Self: ...
@classmethod
def from_file(cls, __fobj: _IOBytes, key: str | None = ...) -> Self: ...
def from_file(cls, __fobj: _IOBytes, key: str | None = None) -> Self: ...
@classmethod
def clear_cache(cls, *, only_keys: Iterable[str] | None = ...) -> None: ...
def clear_cache(cls, *, only_keys: Iterable[str] | None = None) -> None: ...
def tzname(self, __dt: datetime | None) -> str | None: ...
def utcoffset(self, __dt: datetime | None) -> timedelta | None: ...
def dst(self, __dt: datetime | None) -> timedelta | None: ...
Expand All @@ -30,7 +30,7 @@ class ZoneInfo(tzinfo):
def reset_tzpath(to: Sequence[StrPath] | None = None) -> None: ...
def available_timezones() -> set[str]: ...

TZPATH: Sequence[str]
TZPATH: tuple[str, ...]

class ZoneInfoNotFoundError(KeyError): ...
class InvalidTZPathWarning(RuntimeWarning): ...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "1.8.*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from webob.datetime_utils import (
UTC as UTC,
day as day,
hour as hour,
minute as minute,
month as month,
second as second,
week as week,
year as year,
)
from webob.request import LegacyRequest as LegacyRequest, Request as Request
from webob.response import Response as Response
from webob.util import html_escape as html_escape
Loading

0 comments on commit d12ad6e

Please sign in to comment.