Skip to content
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
4 changes: 3 additions & 1 deletion stdlib/2/collections.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are not exported.
# These are exported.
from typing import (
AbstractSet as Set,
AbstractSet,
Any,
Callable as Callable,
Container as Container,
Expand Down Expand Up @@ -30,6 +30,8 @@ from typing import (
overload,
)

Set = AbstractSet

_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")
Expand Down
6 changes: 5 additions & 1 deletion stdlib/2/future_builtins.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from itertools import ifilter as filter, imap as map, izip as zip
from itertools import ifilter, imap, izip
from typing import Any

filter = ifilter
map = imap
zip = izip

def ascii(obj: Any) -> str: ...
def hex(x: int) -> str: ...
def oct(x: int) -> str: ...
3 changes: 2 additions & 1 deletion stdlib/2/md5.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Stubs for Python 2.7 md5 stdlib module

from hashlib import md5 as md5, md5 as new
from hashlib import md5 as md5

new = md5
blocksize: int
digest_size: int
8 changes: 6 additions & 2 deletions stdlib/2/os/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from _typeshed import AnyPath, FileDescriptorLike
from builtins import OSError as error
from builtins import OSError
from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
from typing import (
Expand Down Expand Up @@ -35,6 +35,8 @@ _T = TypeVar("_T")

# ----- os variables -----

error = OSError

if sys.version_info >= (3, 2):
supports_bytes_environ: bool

Expand Down Expand Up @@ -152,7 +154,9 @@ TMP_MAX: int # Undocumented, but used by tempfile

# ----- os classes (structures) -----
if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike

PathLike = _PathLike # See comment in builtins

class _StatVFS(NamedTuple):
f_bsize: int
Expand Down
6 changes: 5 additions & 1 deletion stdlib/2and3/_dummy_threading.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class Event:
def wait(self, timeout: Optional[float] = ...) -> bool: ...

if sys.version_info >= (3, 8):
from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask
import _thread

# don't ask...
_ExceptHookArgs = _thread.ExceptHookArgs
ExceptHookArgs = _thread._ExceptHookArgs

excepthook: Callable[[_ExceptHookArgs], Any]

Expand Down
6 changes: 5 additions & 1 deletion stdlib/2and3/threading.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class Event:
def wait(self, timeout: Optional[float] = ...) -> bool: ...

if sys.version_info >= (3, 8):
from _thread import ExceptHookArgs as _ExceptHookArgs, _ExceptHookArgs as ExceptHookArgs # don't ask
import _thread

# don't ask...
_ExceptHookArgs = _thread.ExceptHookArgs
ExceptHookArgs = _thread._ExceptHookArgs

excepthook: Callable[[_ExceptHookArgs], Any]

Expand Down
4 changes: 3 additions & 1 deletion stdlib/3/collections/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import typing
from typing import (
AbstractSet as Set,
AbstractSet,
Any,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Expand Down Expand Up @@ -36,6 +36,8 @@ from typing import (
overload,
)

Set = AbstractSet

if sys.version_info >= (3, 6):
from typing import AsyncGenerator as AsyncGenerator, Collection as Collection

Expand Down
8 changes: 6 additions & 2 deletions stdlib/3/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from _typeshed import (
OpenBinaryModeWriting,
OpenTextMode,
)
from builtins import OSError as error
from builtins import OSError
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, times_result
from typing import (
Expand Down Expand Up @@ -46,6 +46,8 @@ _T = TypeVar("_T")

# ----- os variables -----

error = OSError

supports_bytes_environ: bool

supports_dir_fd: Set[Callable[..., Any]]
Expand Down Expand Up @@ -268,7 +270,9 @@ class stat_result:
st_type: int

if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins
from builtins import _PathLike

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this blank line helps readability.

PathLike = _PathLike # See comment in builtins

_FdOrAnyPath = Union[int, AnyPath]

Expand Down
4 changes: 3 additions & 1 deletion stdlib/3/platform.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import sys

if sys.version_info < (3, 9):
from os import devnull as DEV_NULL
import os

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blank line here.

DEV_NULL = os.devnull
from typing import NamedTuple, Optional, Tuple

if sys.version_info >= (3, 8):
Expand Down
4 changes: 3 additions & 1 deletion third_party/2/six/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import typing
import unittest
from __builtin__ import unichr as unichr
from functools import wraps as wraps
from StringIO import StringIO as BytesIO, StringIO as StringIO
from StringIO import StringIO as StringIO
from typing import (
Any,
AnyStr,
Expand All @@ -29,6 +29,8 @@ from typing import (

from . import moves

BytesIO = StringIO

_T = TypeVar("_T")
_K = TypeVar("_K")
_V = TypeVar("_V")
Expand Down
37 changes: 24 additions & 13 deletions third_party/2/six/moves/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
#
# Note: Commented out items means they weren't implemented at the time.
# Uncomment them when the modules have been added to the typeshed.
import __builtin__ as builtins
from __builtin__ import (
intern as intern,
raw_input as input,
reduce as reduce,
reload as reload_module,
xrange as range,
xrange as xrange,
)
from cStringIO import StringIO as cStringIO
from itertools import ifilter as filter, ifilterfalse as filterfalse, imap as map, izip as zip, izip_longest as zip_longest
from os import getcwd as getcwdb, getcwdu as getcwd
from pipes import quote as shlex_quote
import __builtin__
import itertools
import os
import pipes
from __builtin__ import intern as intern, reduce as reduce, xrange as xrange
from cStringIO import StringIO as _cStringIO
from StringIO import StringIO as StringIO
from UserDict import UserDict as UserDict
from UserList import UserList as UserList
Expand Down Expand Up @@ -65,3 +58,21 @@ from . import (
)

# import SimpleXMLRPCServer as xmlrpc_server

builtins = __builtin__
input = __builtin__.raw_input
reload_module = __builtin__.reload
range = __builtin__.xrange

cStringIO = _cStringIO

filter = itertools.ifilter
filterfalse = itertools.ifilterfalse
map = itertools.imap
zip = itertools.izip
zip_longest = itertools.izip_longest

getcwdb = os.getcwd
getcwd = os.getcwdu

shlex_quote = pipes.quote
3 changes: 2 additions & 1 deletion third_party/2/six/moves/urllib/parse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ from urllib import (
splittag as splittag,
splituser as splituser,
unquote as unquote,
unquote as unquote_to_bytes,
unquote_plus as unquote_plus,
urlencode as urlencode,
)
Expand All @@ -27,3 +26,5 @@ from urlparse import (
uses_query as uses_query,
uses_relative as uses_relative,
)

unquote_to_bytes = unquote
13 changes: 9 additions & 4 deletions third_party/3/six/moves/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# Note: Commented out items means they weren't implemented at the time.
# Uncomment them when the modules have been added to the typeshed.
from builtins import filter as filter, input as input, map as map, range as range, range as xrange, zip as zip
import importlib
import shlex
from builtins import filter as filter, input as input, map as map, range as range, zip as zip
from collections import UserDict as UserDict, UserList as UserList, UserString as UserString
from functools import reduce as reduce
from importlib import reload as reload_module
from io import StringIO as StringIO, StringIO as cStringIO
from io import StringIO as StringIO
from itertools import filterfalse as filterfalse, zip_longest as zip_longest
from os import getcwd as getcwd, getcwdb as getcwdb
from shlex import quote as shlex_quote
from sys import intern as intern

# import tkinter.font as tkinter_font
Expand Down Expand Up @@ -58,3 +58,8 @@ from . import (

# import xmlrpc.client as xmlrpc_client
# import xmlrpc.server as xmlrpc_server

xrange = range
reload_module = importlib.reload
cStringIO = StringIO
shlex_quote = shlex.quote