mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-21 19:32:13 +08:00
Fix abstract classes for Python 3 (#2239)
* add metaclass=ABCMeta to some classes * mark some more classes as explicitly abstract * make some more classes concrete
This commit is contained in:
@@ -3,17 +3,21 @@ from google.protobuf.internal.message_listener import MessageListener
|
||||
from google.protobuf.message import Message
|
||||
from typing import (
|
||||
MutableSequence, Sequence, TypeVar, Generic, Any, Iterator, Iterable,
|
||||
Union, Optional, Callable
|
||||
Union, Optional, Callable, overload, List
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
class BaseContainer(Generic[_T], MutableSequence[_T]):
|
||||
class BaseContainer(Sequence[_T]):
|
||||
def __init__(self, message_listener: MessageListener) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def sort(self, *, key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...) -> None: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, key: slice) -> List[_T]: ...
|
||||
|
||||
class RepeatedScalarFieldContainer(Generic[_T], BaseContainer[_T]):
|
||||
def __init__(self, message_listener: MessageListener, message_descriptor: Descriptor) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import Any, IO
|
||||
from typing import Any
|
||||
import io
|
||||
from . import _collections
|
||||
from . import exceptions
|
||||
from .connection import HTTPException as HTTPException, BaseSSLError as BaseSSLError
|
||||
@@ -22,7 +23,7 @@ class GzipDecoder:
|
||||
def __getattr__(self, name): ...
|
||||
def decompress(self, data): ...
|
||||
|
||||
class HTTPResponse(IO[Any]):
|
||||
class HTTPResponse(io.IOBase):
|
||||
CONTENT_DECODERS = ... # type: Any
|
||||
REDIRECT_STATUSES = ... # type: Any
|
||||
headers = ... # type: Any
|
||||
|
||||
5
third_party/3/pkg_resources.pyi
vendored
5
third_party/3/pkg_resources.pyi
vendored
@@ -5,6 +5,7 @@ from typing import (
|
||||
List, Union,
|
||||
TypeVar, overload,
|
||||
)
|
||||
from abc import ABCMeta
|
||||
import importlib.abc
|
||||
import sys
|
||||
import types
|
||||
@@ -248,9 +249,9 @@ class ExtractionError(Exception):
|
||||
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): ...
|
||||
class _Importer(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader, metaclass=ABCMeta): ...
|
||||
else:
|
||||
class _Importer(importlib.abc.InspectLoader): ...
|
||||
class _Importer(importlib.abc.InspectLoader, metaclass=ABCMeta): ...
|
||||
|
||||
def register_finder(importer_type: type,
|
||||
distribution_finder: _DistFinderType) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user