typeshed: remove crufty comments (#4699)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-10-23 00:40:06 -07:00
committed by GitHub
parent 3de732e188
commit 6ff5b88ca7
270 changed files with 16 additions and 684 deletions

View File

@@ -1,5 +1,3 @@
# Stubs for _imp (Python 3.6)
import types
from importlib.machinery import ModuleSpec
from typing import Any, List

View File

@@ -1,5 +1,3 @@
"""Stub file for the '_json' module."""
from typing import Any, Callable, Dict, Optional, Tuple
class make_encoder:

View File

@@ -1,5 +1,3 @@
# Stubs for _operator (Python 3.5)
# In reality the import is the other way around, but this way we can keep the operator stub in 2and3
from operator import (
abs as abs,

View File

@@ -1,5 +1,3 @@
# Stubs for _posixsubprocess
# NOTE: These are incomplete!
from typing import Callable, Sequence, Tuple

View File

@@ -1,5 +1,3 @@
"""Stub file for the '_stat' module."""
SF_APPEND: int
SF_ARCHIVED: int
SF_IMMUTABLE: int

View File

@@ -1,4 +1,3 @@
# Source: https://github.com/python/cpython/blob/master/Lib/_threading_local.py
from typing import Any, Dict, Tuple
from weakref import ReferenceType

View File

@@ -1,11 +1,9 @@
from typing import Any, Callable, Type, TypeVar
# Stubs for abc.
_T = TypeVar("_T")
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
# Thesee definitions have special processing in mypy
# These definitions have special processing in mypy
class ABCMeta(type):
def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ...

View File

@@ -1,5 +1,3 @@
"""Stub file for the 'atexit' module."""
from typing import Any, Callable
def _clear() -> None: ...

View File

@@ -1,6 +1,3 @@
# True and False are deliberately omitted because they are keywords in
# Python 3, and stub files conform to Python 3 syntax.
import sys
from _typeshed import (
AnyPath,

View File

@@ -1,6 +1,3 @@
# Stubs for collections.abc (introduced from Python 3.3)
#
# https://docs.python.org/3.3/whatsnew/3.3.html#collections
import sys
from . import (

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.archive_util
from typing import Optional
def make_archive(

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.bcppcompiler
from distutils.ccompiler import CCompiler
class BCPPCompiler(CCompiler): ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.ccompiler
from typing import Any, Callable, List, Optional, Tuple, Union
_Macro = Union[Tuple[str], Tuple[str, Optional[str]]]

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.core
from distutils.cmd import Command as Command
from distutils.dist import Distribution as Distribution
from distutils.extension import Extension as Extension

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.cygwinccompiler
from distutils.unixccompiler import UnixCCompiler
class CygwinCCompiler(UnixCCompiler): ...

View File

@@ -1,3 +1 @@
# Stubs for distutils.debug
DEBUG: bool

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.dep_util
from typing import List, Tuple
def newer(source: str, target: str) -> bool: ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.dir_util
from typing import List
def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> List[str]: ...

View File

@@ -1,4 +1,3 @@
# Stubs for distutils.dist
from distutils.cmd import Command
from typing import Any, Dict, Iterable, Mapping, Optional, Tuple, Type

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.fancy_getopt
from typing import Any, List, Mapping, Optional, Tuple, Union, overload
_Option = Tuple[str, Optional[str], str]

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.file_util
from typing import Optional, Sequence, Tuple
def copy_file(

View File

@@ -1,3 +1 @@
# Stubs for distutils.filelist
class FileList: ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.msvccompiler
from distutils.ccompiler import CCompiler
class MSVCCompiler(CCompiler): ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.spawn
from typing import List, Optional
def spawn(cmd: List[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.sysconfig
from distutils.ccompiler import CCompiler
from typing import Mapping, Optional, Union

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.text_file
from typing import IO, List, Optional, Tuple, Union
class TextFile:

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.unixccompiler
from distutils.ccompiler import CCompiler
class UnixCCompiler(CCompiler): ...

View File

@@ -1,5 +1,3 @@
# Stubs for distutils.util
from typing import Any, Callable, List, Mapping, Optional, Tuple
def get_platform() -> str: ...

View File

@@ -1,5 +1,3 @@
# Stubs for email (Python 3.4)
from email.message import Message
from email.policy import Policy
from typing import IO, Callable

View File

@@ -1,5 +1,3 @@
# Stubs for email.charset (Python 3.4)
from typing import Any, Iterator, List, Optional
QP: int # undocumented

View File

@@ -1,5 +1,3 @@
# Stubs for email.contentmanager (Python 3.4)
from email.message import Message
from typing import Any, Callable

View File

@@ -1,5 +1,3 @@
# Stubs for email.encoders (Python 3.4)
from email.message import Message
def encode_base64(msg: Message) -> None: ...

View File

@@ -1,5 +1,3 @@
# Stubs for email.errors (Python 3.4)
class MessageError(Exception): ...
class MessageParseError(MessageError): ...
class HeaderParseError(MessageParseError): ...

View File

@@ -1,5 +1,3 @@
# Stubs for email.generator (Python 3.4)
from email.message import Message
from email.policy import Policy
from typing import BinaryIO, Optional, TextIO

View File

@@ -1,5 +1,3 @@
# Stubs for email.header (Python 3.4)
from email.charset import Charset
from typing import Any, List, Optional, Tuple, Union

View File

@@ -1,5 +1,3 @@
# Stubs for email.headerregistry (Python 3.4)
from datetime import datetime as _datetime
from email.errors import MessageDefect
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.iterators (Python 3.4)
from email.message import Message
from typing import Iterator, Optional

View File

@@ -1,5 +1,3 @@
# Stubs for email.message (Python 3.4)
from email.charset import Charset
from email.contentmanager import ContentManager
from email.errors import MessageDefect

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.application (Python 3.4)
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.audio (Python 3.4)
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.base (Python 3.4)
import email.message
import sys
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.image (Python 3.4)
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.message (Python 3.4)
import sys
from email.message import Message
from email.mime.nonmultipart import MIMENonMultipart

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.multipart (Python 3.4)
import sys
from email.message import Message
from email.mime.base import MIMEBase

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.nonmultipart (Python 3.4)
from email.mime.base import MIMEBase
class MIMENonMultipart(MIMEBase): ...

View File

@@ -1,5 +1,3 @@
# Stubs for email.mime.text (Python 3.4)
import sys
from email.mime.nonmultipart import MIMENonMultipart
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.parser (Python 3.4)
import email.feedparser
from email.message import Message
from email.policy import Policy

View File

@@ -1,5 +1,3 @@
# Stubs for email.policy (Python 3.4)
from abc import abstractmethod
from email.contentmanager import ContentManager
from email.errors import MessageDefect

View File

@@ -1,5 +1,3 @@
# Stubs for email.utils (Python 3.4)
import datetime
from email.charset import Charset
from typing import List, Optional, Tuple, Union

View File

@@ -1,6 +1,3 @@
# This comment serves as a workaround for timothycrosley/isort#1027 and can
# be removed when a release with a fix was released.
import codecs
from typing import Any

View File

@@ -1,4 +1,3 @@
# NB: third_party/2/enum.pyi and stdlib/3.4/enum.pyi must remain consistent!
import sys
from abc import ABCMeta
from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union

View File

@@ -1,8 +1,3 @@
# Stubs for fnmatch
# Based on http://docs.python.org/3.2/library/fnmatch.html and
# python-lib/fnmatch.py
from typing import AnyStr, Iterable, List
def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ...

View File

@@ -1,5 +1,3 @@
# Stubs for gc
import sys
from typing import Any, Dict, List, Optional, Tuple

View File

@@ -1,7 +1,3 @@
# Stubs for getopt
# Based on http://docs.python.org/3.2/library/getopt.html
from typing import List, Tuple
def getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ...

View File

@@ -1,5 +1,3 @@
# Stubs for getpass
from typing import Optional, TextIO
def getpass(prompt: str = ..., stream: Optional[TextIO] = ...) -> str: ...

View File

@@ -1,6 +1,3 @@
# Stubs for glob
# Based on http://docs.python.org/3/library/glob.html
import sys
from typing import AnyStr, Iterator, List, Union

View File

@@ -1,5 +1,3 @@
# Stubs for hashlib
import sys
from _typeshed import ReadableBuffer
from typing import AbstractSet, Optional

View File

@@ -1,7 +1,3 @@
# Stubs for heapq
# Based on http://docs.python.org/3.2/library/heapq.html
from typing import Any, Callable, Iterable, List, Optional, TypeVar
_T = TypeVar("_T")

View File

@@ -1,5 +1,3 @@
# Stubs for http.cookies (Python 3.5)
import sys
from typing import Any, Dict, Generic, List, Mapping, Optional, TypeVar, Union

View File

@@ -1,5 +1,3 @@
# Stubs for http.server (Python 3.4)
import email.message
import socketserver
import sys

View File

@@ -1,7 +1,3 @@
# Stubs for itertools
# Based on http://docs.python.org/3.2/library/itertools.html
import sys
from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Tuple, TypeVar, overload
from typing_extensions import Literal

View File

@@ -1,5 +1,3 @@
# Stubs for nntplib (Python 3)
import datetime
import socket
import ssl

View File

@@ -1,4 +1,3 @@
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
import os
import sys
from _typeshed import AnyPath, BytesPath, StrPath

View File

@@ -1,7 +1,3 @@
# Stubs for pipes
# Based on http://docs.python.org/3.5/library/pipes.html
import os
class Template:

View File

@@ -1,5 +1,3 @@
# Stubs for platform (Python 3.5)
import sys
if sys.version_info < (3, 9):

View File

@@ -1,7 +1,3 @@
# Stubs for queue
# NOTE: These are incomplete!
import sys
from threading import Condition, Lock
from typing import Any, Generic, Optional, TypeVar

View File

@@ -1,11 +1,3 @@
# Stubs for random
# Ron Murawski <ron@horizonchess.com>
# Updated by Jukka Lehtosalo
# based on http://docs.python.org/3.2/library/random.html
# ----- random classes -----
import _random
import sys
from typing import AbstractSet, Any, Callable, Iterable, List, MutableSequence, Optional, Sequence, Tuple, TypeVar, Union

View File

@@ -1,10 +1,3 @@
# Stubs for re
# Ron Murawski <ron@horizonchess.com>
# 'bytes' support added by Jukka Lehtosalo
# based on: http://docs.python.org/3.2/library/re.html
# and http://hg.python.org/cpython/file/618ea5612e83/Lib/re.py
import sys
from typing import Any, AnyStr, Callable, Iterator, List, Optional, Tuple, Union, overload

View File

@@ -1,5 +1,3 @@
# Stubs for reprlib (Python 3)
from array import array
from typing import Any, Callable, Deque, Dict, FrozenSet, List, Set, Tuple

View File

@@ -1,5 +1,3 @@
# Stubs for resource
import sys
from typing import NamedTuple, Optional, Tuple

View File

@@ -1,5 +1,3 @@
"""Stub file for the 'signal' module."""
import sys
from enum import IntEnum
from types import FrameType

View File

@@ -1,6 +1,3 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
import sys
import types
from socket import SocketType

View File

@@ -1,5 +1,3 @@
# Source: https://github.com/python/cpython/blob/master/Lib/sre_constants.py
from typing import Any, Dict, List, Optional, Union
MAGIC: int

View File

@@ -1,5 +1,3 @@
# Source: https://github.com/python/cpython/blob/master/Lib/sre_parse.py
import sys
from sre_constants import _NamedIntConstant as _NIC, error as _Error
from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload

View File

@@ -1,7 +1,3 @@
# Stubs for stat
# Based on http://docs.python.org/3.2/library/stat.html
import sys
def S_ISDIR(mode: int) -> bool: ...

View File

@@ -1,5 +1,3 @@
# Stubs for statistics
import sys
from decimal import Decimal
from fractions import Fraction

View File

@@ -1,7 +1,3 @@
# Stubs for string
# Based on http://docs.python.org/3.2/library/string.html
from typing import Any, Iterable, Mapping, Optional, Sequence, Tuple, Union
ascii_letters: str

View File

@@ -1,5 +1,3 @@
# Stubs for symbol (Python 3)
import sys
from typing import Dict

View File

@@ -1,8 +1,3 @@
# Stubs for sys
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/sys.html
import sys
from builtins import object as _object
from importlib.abc import MetaPathFinder, PathEntryFinder

View File

@@ -1,5 +1,3 @@
# Stubs for tracemalloc (Python 3.4+)
import sys
from typing import List, Optional, Sequence, Tuple, Union, overload

View File

@@ -1,8 +1,3 @@
# Stubs for types
# Note, all classes "defined" here require special handling.
# TODO parts of this should be conditional on version
import sys
from typing import (
Any,
@@ -25,6 +20,8 @@ from typing import (
# reasons exists in its own stub file (with ModuleSpec and Loader).
from _importlib_modulespec import ModuleType as ModuleType # Exported
# Note, all classes "defined" here require special handling.
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)

View File

@@ -1,5 +1,3 @@
# Stubs for unittest
from typing import Optional
from unittest.async_case import *
from unittest.case import *

View File

@@ -1,4 +1,3 @@
# undocumented
from typing import Any, List, Sequence, Tuple, TypeVar
_T = TypeVar("_T")

View File

@@ -1,4 +1,3 @@
# Stubs for urllib.parse
import sys
from typing import Any, AnyStr, Callable, Dict, Generic, List, Mapping, NamedTuple, Optional, Sequence, Tuple, Union, overload

View File

@@ -1,5 +1,3 @@
# private module, we only expose what's needed
from email.message import Message
from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable, List, Optional, Tuple, Type, TypeVar

View File

@@ -1,5 +1,3 @@
# Stubs for urllib.robotparser (Python 3.4)
import sys
from typing import Iterable, List, NamedTuple, Optional

View File

@@ -1,5 +1,3 @@
# Stubs for zipapp (Python 3.5+)
import sys
from pathlib import Path
from typing import BinaryIO, Callable, Optional, Union