Make html, ipaddress, reprlib and winreg only available on Python 3 (#5502)

None of these are available in Python 2.7.
This commit is contained in:
Jukka Lehtosalo
2021-05-19 12:16:10 +01:00
committed by GitHub
parent b08a2e6dea
commit e5459900c0
7 changed files with 4 additions and 326 deletions

View File

@@ -1,4 +0,0 @@
from typing import AnyStr
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
def unescape(s: AnyStr) -> AnyStr: ...

View File

@@ -1,6 +0,0 @@
from typing import Dict
name2codepoint: Dict[str, int]
html5: Dict[str, str]
codepoint2name: Dict[int, str]
entitydefs: Dict[str, str]

View File

@@ -1,30 +0,0 @@
from _markupbase import ParserBase
from typing import List, Optional, Tuple
class HTMLParser(ParserBase):
def __init__(self, *, convert_charrefs: bool = ...) -> None: ...
def feed(self, data: str) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...
def getpos(self) -> Tuple[int, int]: ...
def get_starttag_text(self) -> Optional[str]: ...
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None: ...
def handle_endtag(self, tag: str) -> None: ...
def handle_startendtag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None: ...
def handle_data(self, data: str) -> None: ...
def handle_entityref(self, name: str) -> None: ...
def handle_charref(self, name: str) -> None: ...
def handle_comment(self, data: str) -> None: ...
def handle_decl(self, decl: str) -> None: ...
def handle_pi(self, data: str) -> None: ...
def unknown_decl(self, data: str) -> None: ...
CDATA_CONTENT_ELEMENTS: Tuple[str, ...]
def check_for_whole_start_tag(self, i: int) -> int: ... # undocumented
def clear_cdata_mode(self) -> None: ... # undocumented
def goahead(self, end: bool) -> None: ... # undocumented
def parse_bogus_comment(self, i: int, report: bool = ...) -> int: ... # undocumented
def parse_endtag(self, i: int) -> int: ... # undocumented
def parse_html_declaration(self, i: int) -> int: ... # undocumented
def parse_pi(self, i: int) -> int: ... # undocumented
def parse_starttag(self, i: int) -> int: ... # undocumented
def set_cdata_mode(self, elem: str) -> None: ... # undocumented

View File

@@ -1,148 +0,0 @@
from typing import Any, Container, Generic, Iterable, Iterator, Optional, SupportsInt, Tuple, TypeVar, overload
# Undocumented length constants
IPV4LENGTH: int
IPV6LENGTH: int
_A = TypeVar("_A", IPv4Address, IPv6Address)
_N = TypeVar("_N", IPv4Network, IPv6Network)
_T = TypeVar("_T")
def ip_address(address: object) -> Any: ... # morally Union[IPv4Address, IPv6Address]
def ip_network(address: object, strict: bool = ...) -> Any: ... # morally Union[IPv4Network, IPv6Network]
def ip_interface(address: object) -> Any: ... # morally Union[IPv4Interface, IPv6Interface]
class _IPAddressBase:
def __eq__(self, other: Any) -> bool: ...
def __ge__(self: _T, other: _T) -> bool: ...
def __gt__(self: _T, other: _T) -> bool: ...
def __le__(self: _T, other: _T) -> bool: ...
def __lt__(self: _T, other: _T) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
@property
def compressed(self) -> str: ...
@property
def exploded(self) -> str: ...
@property
def reverse_pointer(self) -> str: ...
@property
def version(self) -> int: ...
class _BaseAddress(_IPAddressBase, SupportsInt):
def __init__(self, address: object) -> None: ...
def __add__(self: _T, other: int) -> _T: ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __sub__(self: _T, other: int) -> _T: ...
@property
def is_global(self) -> bool: ...
@property
def is_link_local(self) -> bool: ...
@property
def is_loopback(self) -> bool: ...
@property
def is_multicast(self) -> bool: ...
@property
def is_private(self) -> bool: ...
@property
def is_reserved(self) -> bool: ...
@property
def is_unspecified(self) -> bool: ...
@property
def max_prefixlen(self) -> int: ...
@property
def packed(self) -> bytes: ...
class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
network_address: _A
netmask: _A
def __init__(self, address: object, strict: bool = ...) -> None: ...
def __contains__(self, other: Any) -> bool: ...
def __getitem__(self, n: int) -> _A: ...
def __iter__(self) -> Iterator[_A]: ...
def address_exclude(self: _T, other: _T) -> Iterator[_T]: ...
@property
def broadcast_address(self) -> _A: ...
def compare_networks(self: _T, other: _T) -> int: ...
def hosts(self) -> Iterator[_A]: ...
@property
def is_global(self) -> bool: ...
@property
def is_link_local(self) -> bool: ...
@property
def is_loopback(self) -> bool: ...
@property
def is_multicast(self) -> bool: ...
@property
def is_private(self) -> bool: ...
@property
def is_reserved(self) -> bool: ...
@property
def is_unspecified(self) -> bool: ...
@property
def max_prefixlen(self) -> int: ...
@property
def num_addresses(self) -> int: ...
def overlaps(self, other: _BaseNetwork[_A]) -> bool: ...
@property
def prefixlen(self) -> int: ...
def subnets(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> Iterator[_T]: ...
def supernet(self: _T, prefixlen_diff: int = ..., new_prefix: Optional[int] = ...) -> _T: ...
@property
def with_hostmask(self) -> str: ...
@property
def with_netmask(self) -> str: ...
@property
def with_prefixlen(self) -> str: ...
@property
def hostmask(self) -> _A: ...
class _BaseInterface(_BaseAddress, Generic[_A, _N]):
hostmask: _A
netmask: _A
network: _N
@property
def ip(self) -> _A: ...
@property
def with_hostmask(self) -> str: ...
@property
def with_netmask(self) -> str: ...
@property
def with_prefixlen(self) -> str: ...
class IPv4Address(_BaseAddress): ...
class IPv4Network(_BaseNetwork[IPv4Address]): ...
class IPv4Interface(IPv4Address, _BaseInterface[IPv4Address, IPv4Network]): ...
class IPv6Address(_BaseAddress):
@property
def ipv4_mapped(self) -> Optional[IPv4Address]: ...
@property
def is_site_local(self) -> bool: ...
@property
def sixtofour(self) -> Optional[IPv4Address]: ...
@property
def teredo(self) -> Optional[Tuple[IPv4Address, IPv4Address]]: ...
class IPv6Network(_BaseNetwork[IPv6Address]):
@property
def is_site_local(self) -> bool: ...
class IPv6Interface(IPv6Address, _BaseInterface[IPv6Address, IPv6Network]): ...
def v4_int_to_packed(address: int) -> bytes: ...
def v6_int_to_packed(address: int) -> bytes: ...
@overload
def summarize_address_range(first: IPv4Address, last: IPv4Address) -> Iterator[IPv4Network]: ...
@overload
def summarize_address_range(first: IPv6Address, last: IPv6Address) -> Iterator[IPv6Network]: ...
def collapse_addresses(addresses: Iterable[_N]) -> Iterator[_N]: ...
@overload
def get_mixed_type_key(obj: _A) -> Tuple[int, _A]: ...
@overload
def get_mixed_type_key(obj: IPv4Network) -> Tuple[int, IPv4Address, IPv4Address]: ...
@overload
def get_mixed_type_key(obj: IPv6Network) -> Tuple[int, IPv6Address, IPv6Address]: ...
class AddressValueError(ValueError): ...
class NetmaskValueError(ValueError): ...

View File

@@ -1,36 +0,0 @@
from array import array
from typing import Any, Callable, Deque, Dict, FrozenSet, List, Set, Tuple
_ReprFunc = Callable[[Any], str]
def recursive_repr(fillvalue: str = ...) -> Callable[[_ReprFunc], _ReprFunc]: ...
class Repr:
maxlevel: int
maxdict: int
maxlist: int
maxtuple: int
maxset: int
maxfrozenset: int
maxdeque: int
maxarray: int
maxlong: int
maxstring: int
maxother: int
def __init__(self) -> None: ...
def repr(self, x: Any) -> str: ...
def repr1(self, x: Any, level: int) -> str: ...
def repr_tuple(self, x: Tuple[Any, ...], level: int) -> str: ...
def repr_list(self, x: List[Any], level: int) -> str: ...
def repr_array(self, x: array[Any], level: int) -> str: ...
def repr_set(self, x: Set[Any], level: int) -> str: ...
def repr_frozenset(self, x: FrozenSet[Any], level: int) -> str: ...
def repr_deque(self, x: Deque[Any], level: int) -> str: ...
def repr_dict(self, x: Dict[Any, Any], level: int) -> str: ...
def repr_str(self, x: str, level: int) -> str: ...
def repr_int(self, x: int, level: int) -> str: ...
def repr_instance(self, x: Any, level: int) -> str: ...
aRepr: Repr
def repr(x: object) -> str: ...

View File

@@ -1,98 +0,0 @@
from types import TracebackType
from typing import Any, Optional, Tuple, Type, Union
_KeyType = Union[HKEYType, int]
def CloseKey(__hkey: _KeyType) -> None: ...
def ConnectRegistry(__computer_name: Optional[str], __key: _KeyType) -> HKEYType: ...
def CreateKey(__key: _KeyType, __sub_key: Optional[str]) -> HKEYType: ...
def CreateKeyEx(key: _KeyType, sub_key: Optional[str], reserved: int = ..., access: int = ...) -> HKEYType: ...
def DeleteKey(__key: _KeyType, __sub_key: str) -> None: ...
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = ..., reserved: int = ...) -> None: ...
def DeleteValue(__key: _KeyType, __value: str) -> None: ...
def EnumKey(__key: _KeyType, __index: int) -> str: ...
def EnumValue(__key: _KeyType, __index: int) -> Tuple[str, Any, int]: ...
def ExpandEnvironmentStrings(__str: str) -> str: ...
def FlushKey(__key: _KeyType) -> None: ...
def LoadKey(__key: _KeyType, __sub_key: str, __file_name: str) -> None: ...
def OpenKey(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = ..., access: int = ...) -> HKEYType: ...
def QueryInfoKey(__key: _KeyType) -> Tuple[int, int, int]: ...
def QueryValue(__key: _KeyType, __sub_key: Optional[str]) -> str: ...
def QueryValueEx(__key: _KeyType, __name: str) -> Tuple[Any, int]: ...
def SaveKey(__key: _KeyType, __file_name: str) -> None: ...
def SetValue(__key: _KeyType, __sub_key: str, __type: int, __value: str) -> None: ...
def SetValueEx(
__key: _KeyType, __value_name: Optional[str], __reserved: Any, __type: int, __value: Union[str, int]
) -> None: ... # reserved is ignored
def DisableReflectionKey(__key: _KeyType) -> None: ...
def EnableReflectionKey(__key: _KeyType) -> None: ...
def QueryReflectionKey(__key: _KeyType) -> bool: ...
HKEY_CLASSES_ROOT: int
HKEY_CURRENT_USER: int
HKEY_LOCAL_MACHINE: int
HKEY_USERS: int
HKEY_PERFORMANCE_DATA: int
HKEY_CURRENT_CONFIG: int
HKEY_DYN_DATA: int
KEY_ALL_ACCESS: int
KEY_WRITE: int
KEY_READ: int
KEY_EXECUTE: int
KEY_QUERY_VALUE: int
KEY_SET_VALUE: int
KEY_CREATE_SUB_KEY: int
KEY_ENUMERATE_SUB_KEYS: int
KEY_NOTIFY: int
KEY_CREATE_LINK: int
KEY_WOW64_64KEY: int
KEY_WOW64_32KEY: int
REG_BINARY: int
REG_DWORD: int
REG_DWORD_LITTLE_ENDIAN: int
REG_DWORD_BIG_ENDIAN: int
REG_EXPAND_SZ: int
REG_LINK: int
REG_MULTI_SZ: int
REG_NONE: int
REG_QWORD: int
REG_QWORD_LITTLE_ENDIAN: int
REG_RESOURCE_LIST: int
REG_FULL_RESOURCE_DESCRIPTOR: int
REG_RESOURCE_REQUIREMENTS_LIST: int
REG_SZ: int
REG_CREATED_NEW_KEY: int # undocumented
REG_LEGAL_CHANGE_FILTER: int # undocumented
REG_LEGAL_OPTION: int # undocumented
REG_NOTIFY_CHANGE_ATTRIBUTES: int # undocumented
REG_NOTIFY_CHANGE_LAST_SET: int # undocumented
REG_NOTIFY_CHANGE_NAME: int # undocumented
REG_NOTIFY_CHANGE_SECURITY: int # undocumented
REG_NO_LAZY_FLUSH: int # undocumented
REG_OPENED_EXISTING_KEY: int # undocumented
REG_OPTION_BACKUP_RESTORE: int # undocumented
REG_OPTION_CREATE_LINK: int # undocumented
REG_OPTION_NON_VOLATILE: int # undocumented
REG_OPTION_OPEN_LINK: int # undocumented
REG_OPTION_RESERVED: int # undocumented
REG_OPTION_VOLATILE: int # undocumented
REG_REFRESH_HIVE: int # undocumented
REG_WHOLE_HIVE_VOLATILE: int # undocumented
error = OSError
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
class HKEYType:
def __bool__(self) -> bool: ...
def __int__(self) -> int: ...
def __enter__(self) -> HKEYType: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...