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

Removed unused import symbols from stdlib stubs and fixed a few other… #4803

Merged
merged 1 commit into from
Dec 6, 2020
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
6 changes: 5 additions & 1 deletion stdlib/2/inspect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ def currentframe(depth: int = ...) -> FrameType: ...
def stack(context: int = ...) -> List[_FrameInfo]: ...
def trace(context: int = ...) -> List[_FrameInfo]: ...

# Create private type alias to avoid conflict with symbol of same
# name created in Attribute class.
_Object = object

class Attribute(NamedTuple):
name: str
kind: str
defining_class: type
object: object
object: _Object

def classify_class_attrs(cls: type) -> List[Attribute]: ...
2 changes: 1 addition & 1 deletion stdlib/2and3/contextlib.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from types import TracebackType
from typing import IO, Any, Callable, ContextManager, Generic, Iterable, Iterator, Optional, Type, TypeVar, overload
from typing import IO, Any, Callable, ContextManager, Iterable, Iterator, Optional, Type, TypeVar, overload

if sys.version_info >= (3, 5):
from typing import AsyncContextManager, AsyncIterator
Expand Down
2 changes: 1 addition & 1 deletion stdlib/2and3/plistlib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Optional, Text, Type, TypeVar, Union, overload
from typing import IO, Any, Dict as DictT, Mapping, MutableMapping, Optional, Text, Type, Union

if sys.version_info >= (3,):
from enum import Enum
Expand Down
2 changes: 1 addition & 1 deletion stdlib/2and3/socket.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import Any, BinaryIO, Iterable, List, Optional, Sequence, Text, TextIO, Tuple, TypeVar, Union, overload
from typing import Any, BinaryIO, Iterable, List, Optional, Text, TextIO, Tuple, TypeVar, Union, overload
from typing_extensions import Literal

# ----- Constants -----
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/futures.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from concurrent.futures._base import Error, Future as _ConcurrentFuture
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, Type, TypeVar, Union
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, TypeVar, Union

from .events import AbstractEventLoop

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/asyncio/trsock.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import socket
import sys
from types import TracebackType
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Sequence, Tuple, Type, Union, overload
from typing import Any, BinaryIO, Iterable, List, NoReturn, Optional, Tuple, Type, Union, overload

if sys.version_info >= (3, 8):
# These are based in socket, maybe move them out into _typeshed.pyi or such
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/concurrent/futures/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import sys
import threading
from abc import abstractmethod
from logging import Logger
from types import TracebackType
from typing import (
Any,
Callable,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/distutils/command/upload.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from distutils.config import PyPIRCCommand
from typing import ClassVar, List, Optional, Tuple
from typing import ClassVar, List

class upload(PyPIRCCommand):
description: ClassVar[str]
Expand Down
4 changes: 2 additions & 2 deletions stdlib/3/distutils/dist.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import AnyPath, SupportsWrite
from distutils.cmd import Command
from typing import IO, Any, AnyStr, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
from typing import IO, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union

class DistributionMetadata:
def __init__(self, path: Optional[Union[int, AnyPath]] = ...): ...
def __init__(self, path: Optional[Union[int, AnyPath]] = ...) -> None: ...
name: Optional[str]
version: Optional[str]
author: Optional[str]
Expand Down
1 change: 0 additions & 1 deletion stdlib/3/functools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ from typing import (
Mapping,
NamedTuple,
Optional,
Protocol,
Sequence,
Tuple,
Type,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/importlib/util.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def spec_from_loader(
) -> importlib.machinery.ModuleSpec: ...
def spec_from_file_location(
name: str,
location: Union[str, bytes, os.PathLike],
location: Union[str, bytes, os.PathLike[str], os.PathLike[bytes]],
*,
loader: Optional[importlib.abc.Loader] = ...,
submodule_search_locations: Optional[List[str]] = ...,
Expand Down
6 changes: 5 additions & 1 deletion stdlib/3/inspect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,14 @@ def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> Dict[str, Any]: .
# TODO can we be more specific than "object"?
def getcoroutinelocals(coroutine: object) -> Dict[str, Any]: ...

# Create private type alias to avoid conflict with symbol of same
# name created in Attribute class.
_Object = object

class Attribute(NamedTuple):
name: str
kind: str
defining_class: type
object: object
object: _Object

def classify_class_attrs(cls: type) -> List[Attribute]: ...
2 changes: 1 addition & 1 deletion stdlib/3/ntpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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, Tuple, TypeVar, overload
from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload

_T = TypeVar("_T")

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/os/path.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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, Tuple, TypeVar, overload
from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload

_T = TypeVar("_T")

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sys
from _typeshed import OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from types import TracebackType
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union, overload
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
from typing_extensions import Literal

if sys.version_info >= (3, 9):
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/posixpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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, Tuple, TypeVar, overload
from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload

_T = TypeVar("_T")

Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/resource.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from typing import NamedTuple, Optional, Tuple, overload
from typing import NamedTuple, Tuple, overload

RLIMIT_AS: int
RLIMIT_CORE: int
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/statistics.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sys
from _typeshed import SupportsLessThanT
from decimal import Decimal
from fractions import Fraction
from typing import Any, Hashable, Iterable, List, Optional, Protocol, SupportsFloat, Type, TypeVar, Union
from typing import Any, Hashable, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union

_T = TypeVar("_T")
# Most functions in this module accept homogeneous collections of one of these types
Expand Down
2 changes: 1 addition & 1 deletion stdlib/3/urllib/request.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm):
def is_authenticated(self, authuri: str) -> bool: ...

class AbstractBasicAuthHandler:
rx: ClassVar[Pattern] # undocumented
rx: ClassVar[Pattern[str]] # undocumented
def __init__(self, password_mgr: Optional[HTTPPasswordMgr] = ...) -> None: ...
def http_error_auth_reqed(self, authreq: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ...
def http_request(self, req: Request) -> Request: ... # undocumented
Expand Down