Skip to content

Commit

Permalink
Sync typeshed (#10495)
Browse files Browse the repository at this point in the history
Source commit:
python/typeshed@17bc1d8

This doesn't include some recent typeshed commits. In particular, this is from before
the split of stdlib stubs to Python 2 and 3 variants. This way we can more easily narrow
down issues it might have caused.
  • Loading branch information
JukkaL authored May 17, 2021
1 parent 0ce3eb9 commit 675ae1a
Show file tree
Hide file tree
Showing 38 changed files with 1,150 additions and 1,079 deletions.
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/@python2/os/path.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath
from genericpath import exists as exists
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload

_T = TypeVar("_T")
Expand Down Expand Up @@ -40,6 +39,7 @@ else:
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
# So, fall back to Any
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
def exists(path: AnyPath) -> bool: ...
def lexists(path: AnyPath) -> bool: ...

# These return float if os.stat_float_times() == True,
Expand Down
10 changes: 4 additions & 6 deletions mypy/typeshed/stdlib/@python2/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from types import CodeType, FrameType, TracebackType
# Definitions of special type checking related constructs. Their definitions
# are not used, so their value does not matter.

overload = object()
Any = object()

class TypeVar:
Expand Down Expand Up @@ -40,6 +39,7 @@ Final: _SpecialForm = ...
_F = TypeVar("_F", bound=Callable[..., Any])

def final(f: _F) -> _F: ...
def overload(f: _F) -> _F: ...

Literal: _SpecialForm = ...
# TypedDict is a (non-subscriptable) special form.
Expand All @@ -63,11 +63,9 @@ _KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers.
_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
_T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant.
_TC = TypeVar("_TC", bound=Type[object])
_C = TypeVar("_C", bound=Callable[..., Any])

no_type_check = object()

def no_type_check_decorator(decorator: _C) -> _C: ...
def no_type_check(f: _F) -> _F: ...
def no_type_check_decorator(decorator: _F) -> _F: ...

# Type aliases and type constructors

Expand Down Expand Up @@ -492,4 +490,4 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...

# This itself is only available during type checking
def type_check_only(func_or_cls: _C) -> _C: ...
def type_check_only(func_or_cls: _F) -> _F: ...
Loading

0 comments on commit 675ae1a

Please sign in to comment.