Remove Python 2 support from some third-party distributions (#7466)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Sebastian Rittau
2022-03-09 19:19:22 +01:00
committed by GitHub
parent 4e87b9058f
commit c3907ab26b
49 changed files with 10 additions and 557 deletions
-119
View File
@@ -1,119 +0,0 @@
from __future__ import print_function
import types
import typing
import unittest
from __builtin__ import unichr as unichr
from functools import wraps as wraps
from StringIO import StringIO as StringIO
from typing import (
Any,
AnyStr,
Callable,
ItemsView,
Iterable,
KeysView,
Mapping,
NoReturn,
Pattern,
Text,
TypeVar,
ValuesView,
overload,
)
from typing_extensions import Literal
from . import moves
BytesIO = StringIO
_T = TypeVar("_T")
_K = TypeVar("_K")
_V = TypeVar("_V")
__author__: str
__version__: str
PY2: Literal[True]
PY3: Literal[False]
PY34: Literal[False]
string_types: tuple[type[str], type[unicode]]
integer_types: tuple[type[int], type[long]]
class_types: tuple[type[type[Any]], type[types.ClassType]]
text_type: type[unicode]
binary_type: type[str]
MAXSIZE: int
def advance_iterator(it: typing.Iterator[_T]) -> _T: ...
next = advance_iterator
def callable(obj: object) -> bool: ...
def get_unbound_function(unbound: types.MethodType) -> types.FunctionType: ...
def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
def create_unbound_method(func: types.FunctionType, cls: type | types.ClassType) -> types.MethodType: ...
class Iterator:
def next(self) -> Any: ...
def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
def get_method_self(meth: types.MethodType) -> object | None: ...
def get_function_closure(fun: types.FunctionType) -> tuple[types._Cell, ...] | None: ...
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
def get_function_defaults(fun: types.FunctionType) -> tuple[Any, ...] | None: ...
def get_function_globals(fun: types.FunctionType) -> dict[str, Any]: ...
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[tuple[_K, _V]]: ...
# def iterlists
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...
def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
def b(s: str) -> str: ...
def u(s: str) -> unicode: ...
int2byte = chr
def byte2int(bs: str) -> int: ...
def indexbytes(buf: str, i: int) -> int: ...
def iterbytes(buf: str) -> typing.Iterator[int]: ...
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str = ...) -> None: ...
def reraise(tp: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None = ...) -> NoReturn: ...
def exec_(_code_: unicode | types.CodeType, _globs_: dict[str, Any] = ..., _locs_: dict[str, Any] = ...): ...
def raise_from(value: BaseException | type[BaseException], from_value: BaseException | None) -> NoReturn: ...
print_ = print
def with_metaclass(meta: type, *bases: type) -> type: ...
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
def ensure_binary(s: bytes | Text, encoding: str = ..., errors: str = ...) -> bytes: ...
def ensure_str(s: bytes | Text, encoding: str = ..., errors: str = ...) -> str: ...
def ensure_text(s: bytes | Text, encoding: str = ..., errors: str = ...) -> Text: ...
def python_2_unicode_compatible(klass: _T) -> _T: ...
class _LazyDescr(object):
name: str
def __init__(self, name: str) -> None: ...
def __get__(self, obj: object | None, type: type[Any] | None = ...) -> Any: ...
class MovedModule(_LazyDescr):
mod: str
def __init__(self, name: str, old: str, new: str | None = ...) -> None: ...
def __getattr__(self, attr: str) -> Any: ...
class MovedAttribute(_LazyDescr):
mod: str
attr: str
def __init__(self, name: str, old_mod: str, new_mod: str, old_attr: str | None = ..., new_attr: str | None = ...) -> None: ...
def add_move(move: MovedModule | MovedAttribute) -> None: ...
def remove_move(name: str) -> None: ...
@@ -1 +0,0 @@
from BaseHTTPServer import *
@@ -1 +0,0 @@
from CGIHTTPServer import *
@@ -1 +0,0 @@
from SimpleHTTPServer import *
-78
View File
@@ -1,78 +0,0 @@
# Stubs for six.moves
#
# 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__
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
from UserString import UserString as UserString
# import Tkinter as tkinter
# import Dialog as tkinter_dialog
# import FileDialog as tkinter_filedialog
# import ScrolledText as tkinter_scrolledtext
# import SimpleDialog as tkinter_simpledialog
# import Tix as tkinter_tix
# import ttk as tkinter_ttk
# import Tkconstants as tkinter_constants
# import Tkdnd as tkinter_dnd
# import tkColorChooser as tkinter_colorchooser
# import tkCommonDialog as tkinter_commondialog
# import tkFileDialog as tkinter_tkfiledialog
# import tkFont as tkinter_font
# import tkMessageBox as tkinter_messagebox
# import tkSimpleDialog as tkinter_tksimpledialog
# import email.MIMEBase as email_mime_base
# import email.MIMEMultipart as email_mime_multipart
# import email.MIMENonMultipart as email_mime_nonmultipart
# import gdbm as dbm_gnu
from . import (
BaseHTTPServer,
CGIHTTPServer,
SimpleHTTPServer,
_dummy_thread,
_thread,
configparser,
copyreg as copyreg,
cPickle,
email_mime_text,
html_entities,
html_parser,
http_client,
http_cookiejar,
http_cookies,
queue,
reprlib,
socketserver,
urllib,
urllib_error,
urllib_parse,
urllib_robotparser,
xmlrpc_client,
)
# 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
@@ -1 +0,0 @@
from dummy_thread import *
-1
View File
@@ -1 +0,0 @@
from thread import *
-1
View File
@@ -1 +0,0 @@
from cPickle import *
@@ -1 +0,0 @@
from collections import *
@@ -1 +0,0 @@
from ConfigParser import *
-1
View File
@@ -1 +0,0 @@
from copy_reg import *
@@ -1 +0,0 @@
from email.mime.base import *
@@ -1 +0,0 @@
from email.mime.multipart import *
@@ -1 +0,0 @@
from email.mime.nonmultipart import *
@@ -1 +0,0 @@
from email.MIMEText import *
@@ -1 +0,0 @@
from htmlentitydefs import *
@@ -1 +0,0 @@
from HTMLParser import *
@@ -1 +0,0 @@
from httplib import *
@@ -1 +0,0 @@
from cookielib import *
@@ -1 +0,0 @@
from Cookie import *
-1
View File
@@ -1 +0,0 @@
from Queue import *
-1
View File
@@ -1 +0,0 @@
from repr import *
@@ -1 +0,0 @@
from SocketServer import *
@@ -1,5 +0,0 @@
import six.moves.urllib.error as error
import six.moves.urllib.parse as parse
import six.moves.urllib.request as request
import six.moves.urllib.response as response
import six.moves.urllib.robotparser as robotparser
@@ -1,2 +0,0 @@
from urllib import ContentTooShortError as ContentTooShortError
from urllib2 import HTTPError as HTTPError, URLError as URLError
@@ -1,29 +0,0 @@
from urllib import (
quote as quote,
quote_plus as quote_plus,
splitquery as splitquery,
splittag as splittag,
splituser as splituser,
unquote as unquote,
unquote_plus as unquote_plus,
urlencode as urlencode,
)
from urlparse import (
ParseResult as ParseResult,
SplitResult as SplitResult,
parse_qs as parse_qs,
parse_qsl as parse_qsl,
urldefrag as urldefrag,
urljoin as urljoin,
urlparse as urlparse,
urlsplit as urlsplit,
urlunparse as urlunparse,
urlunsplit as urlunsplit,
uses_fragment as uses_fragment,
uses_netloc as uses_netloc,
uses_params as uses_params,
uses_query as uses_query,
uses_relative as uses_relative,
)
unquote_to_bytes = unquote
@@ -1,39 +0,0 @@
from urllib import (
FancyURLopener as FancyURLopener,
URLopener as URLopener,
getproxies as getproxies,
pathname2url as pathname2url,
proxy_bypass as proxy_bypass,
url2pathname as url2pathname,
urlcleanup as urlcleanup,
urlretrieve as urlretrieve,
)
from urllib2 import (
AbstractBasicAuthHandler as AbstractBasicAuthHandler,
AbstractDigestAuthHandler as AbstractDigestAuthHandler,
BaseHandler as BaseHandler,
CacheFTPHandler as CacheFTPHandler,
FileHandler as FileHandler,
FTPHandler as FTPHandler,
HTTPBasicAuthHandler as HTTPBasicAuthHandler,
HTTPCookieProcessor as HTTPCookieProcessor,
HTTPDefaultErrorHandler as HTTPDefaultErrorHandler,
HTTPDigestAuthHandler as HTTPDigestAuthHandler,
HTTPErrorProcessor as HTTPErrorProcessor,
HTTPHandler as HTTPHandler,
HTTPPasswordMgr as HTTPPasswordMgr,
HTTPPasswordMgrWithDefaultRealm as HTTPPasswordMgrWithDefaultRealm,
HTTPRedirectHandler as HTTPRedirectHandler,
HTTPSHandler as HTTPSHandler,
OpenerDirector as OpenerDirector,
ProxyBasicAuthHandler as ProxyBasicAuthHandler,
ProxyDigestAuthHandler as ProxyDigestAuthHandler,
ProxyHandler as ProxyHandler,
Request as Request,
UnknownHandler as UnknownHandler,
build_opener as build_opener,
install_opener as install_opener,
parse_http_list as parse_http_list,
parse_keqv_list as parse_keqv_list,
urlopen as urlopen,
)
@@ -1 +0,0 @@
from urllib import addbase as addbase, addclosehook as addclosehook, addinfo as addinfo, addinfourl as addinfourl
@@ -1 +0,0 @@
from robotparser import RobotFileParser as RobotFileParser
@@ -1 +0,0 @@
from .urllib.error import *
@@ -1 +0,0 @@
from .urllib.parse import *
@@ -1 +0,0 @@
from .urllib.request import *
@@ -1 +0,0 @@
from .urllib.response import *
@@ -1 +0,0 @@
from robotparser import *
@@ -1 +0,0 @@
from xmlrpclib import *
-1
View File
@@ -1,2 +1 @@
version = "1.16.*"
python2 = true