Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ccf935

Browse files
authored
Remove Python 3.4 support (#3147)
Closes #3123
1 parent 4697adc commit 9ccf935

55 files changed

Lines changed: 1004 additions & 1282 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ and optionally the lowest minor version, with the exception of the `2and3`
307307
directory which applies to both Python 2 and 3.
308308

309309
For example, stubs in the `3` directory will be applied to all versions of
310-
Python 3, though stubs in the `3.6` directory will only be applied to versions
311-
3.6 and above. However, stubs in the `2` directory will not be applied to
310+
Python 3, though stubs in the `3.7` directory will only be applied to versions
311+
3.7 and above. However, stubs in the `2` directory will not be applied to
312312
Python 3.
313313

314314
It is preferred to use a single stub in the more generic directory that
@@ -318,7 +318,7 @@ if the given library works on both Python 2 and Python 3, prefer to put your
318318
stubs in the `2and3` directory, unless the types are so different that the stubs
319319
become unreadable that way.
320320

321-
You can use checks like `if sys.version_info >= (3, 4):` to denote new
321+
You can use checks like `if sys.version_info >= (3, 8):` to denote new
322322
functionality introduced in a given Python version or solve type
323323
differences. When doing so, only use one-tuples or two-tuples. This is
324324
because:
@@ -331,17 +331,17 @@ because:
331331
regardless of the micro version used.
332332

333333
Because of this, if a given functionality was introduced in, say, Python
334-
3.4.4, your check:
334+
3.7.4, your check:
335335

336-
* should be expressed as `if sys.version_info >= (3, 4):`
337-
* should NOT be expressed as `if sys.version_info >= (3, 4, 4):`
338-
* should NOT be expressed as `if sys.version_info >= (3, 5):`
336+
* should be expressed as `if sys.version_info >= (3, 7):`
337+
* should NOT be expressed as `if sys.version_info >= (3, 7, 4):`
338+
* should NOT be expressed as `if sys.version_info >= (3, 8):`
339339

340340
This makes the type checker assume the functionality was also available
341-
in 3.4.0 - 3.4.3, which while *technically* incorrect is relatively
341+
in 3.7.0 - 3.7.3, which while *technically* incorrect is relatively
342342
harmless. This is a strictly better compromise than using the latter
343343
two forms, which would generate false positive errors for correct use
344-
under Python 3.4.4.
344+
under Python 3.7.4.
345345

346346
Note: in its current implementation, typeshed cannot contain stubs for
347347
multiple versions of the same third-party library. Prefer to generate

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For information on how to use `typeshed`, read below. Information for
1515
contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
1616
it before submitting pull requests.**
1717

18-
Typeshed supports Python versions 2.7 and 3.4 and up.
18+
Typeshed supports Python versions 2.7 and 3.5 and up.
1919

2020
## Using
2121

stdlib/2and3/binascii.pyi

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,15 @@
55
import sys
66
from typing import Union, Text
77

8-
98
if sys.version_info < (3,):
109
# Python 2 accepts unicode ascii pretty much everywhere.
11-
_Bytes = Union[bytes, Text]
12-
_Ascii = Union[bytes, Text]
13-
elif sys.version_info < (3, 3):
14-
# Python 3.2 and below only accepts bytes.
15-
_Bytes = bytes
16-
_Ascii = bytes
10+
_Bytes = Text
11+
_Ascii = Text
1712
else:
1813
# But since Python 3.3 ASCII-only unicode strings are accepted by the
1914
# a2b_* functions.
2015
_Bytes = bytes
21-
_Ascii = Union[bytes, Text]
16+
_Ascii = Union[bytes, str]
2217

2318
def a2b_uu(string: _Ascii) -> bytes: ...
2419
if sys.version_info >= (3, 7):

stdlib/2and3/smtpd.pyi

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class SMTPChannel(asynchat.async_chat):
1313
COMMAND: int
1414
DATA: int
1515

16-
if sys.version_info >= (3, 3):
17-
command_size_limits: DefaultDict[str, int]
18-
1916
if sys.version_info >= (3,):
17+
command_size_limits: DefaultDict[str, int]
2018
smtp_server: SMTPServer
2119
conn: socket.socket
2220
addr: Any
@@ -32,19 +30,14 @@ class SMTPChannel(asynchat.async_chat):
3230
command_size_limit: int
3331
data_size_limit: int
3432

35-
if sys.version_info >= (3, 5):
3633
enable_SMTPUTF8: bool
3734

38-
if sys.version_info >= (3, 3):
3935
@property
4036
def max_command_size_limit(self) -> int: ...
4137

42-
if sys.version_info >= (3, 5):
38+
if sys.version_info >= (3,):
4339
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...,
4440
map: Optional[asyncore._maptype] = ..., enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ...
45-
elif sys.version_info >= (3, 4):
46-
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...,
47-
map: Optional[asyncore._maptype] = ...) -> None: ...
4841
else:
4942
def __init__(self, server: SMTPServer, conn: socket.socket, addr: Any, data_size_limit: int = ...) -> None: ...
5043
def push(self, msg: bytes) -> None: ...
@@ -69,13 +62,10 @@ class SMTPServer(asyncore.dispatcher):
6962
data_size_limit: int
7063
enable_SMTPUTF8: bool
7164

72-
if sys.version_info >= (3, 5):
65+
if sys.version_info >= (3,):
7366
def __init__(self, localaddr: _Address, remoteaddr: _Address,
7467
data_size_limit: int = ..., map: Optional[asyncore._maptype] = ...,
7568
enable_SMTPUTF8: bool = ..., decode_data: bool = ...) -> None: ...
76-
elif sys.version_info >= (3, 4):
77-
def __init__(self, localaddr: _Address, remoteaddr: _Address,
78-
data_size_limit: int = ..., map: Optional[asyncore._maptype] = ...) -> None: ...
7969
else:
8070
def __init__(self, localaddr: _Address, remoteaddr: _Address,
8171
data_size_limit: int = ...) -> None: ...

stdlib/2and3/ssl.pyi

Lines changed: 68 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ def wrap_socket(sock: socket.socket, keyfile: Optional[str] = ...,
4848
ciphers: Optional[str] = ...) -> SSLSocket: ...
4949

5050

51-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
52-
def create_default_context(purpose: Any = ..., *,
53-
cafile: Optional[str] = ...,
54-
capath: Optional[str] = ...,
55-
cadata: Union[str, bytes, None] = ...) -> SSLContext: ...
51+
def create_default_context(
52+
purpose: Any = ...,
53+
*,
54+
cafile: Optional[str] = ...,
55+
capath: Optional[str] = ...,
56+
cadata: Union[str, bytes, None] = ...,
57+
) -> SSLContext: ...
5658

5759
if sys.version_info >= (3, 4):
5860
def _create_unverified_context(protocol: int = ..., *,
@@ -80,39 +82,35 @@ def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ...,
8082
ca_certs: Optional[str] = ...) -> str: ...
8183
def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ...
8284
def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ...
83-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
84-
DefaultVerifyPaths = NamedTuple('DefaultVerifyPaths',
85-
[('cafile', str), ('capath', str),
86-
('openssl_cafile_env', str),
87-
('openssl_cafile', str),
88-
('openssl_capath_env', str),
89-
('openssl_capath', str)])
90-
def get_default_verify_paths() -> DefaultVerifyPaths: ...
85+
DefaultVerifyPaths = NamedTuple('DefaultVerifyPaths',
86+
[('cafile', str), ('capath', str),
87+
('openssl_cafile_env', str),
88+
('openssl_cafile', str),
89+
('openssl_capath_env', str),
90+
('openssl_capath', str)])
91+
def get_default_verify_paths() -> DefaultVerifyPaths: ...
9192

9293
if sys.platform == 'win32':
93-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
94-
def enum_certificates(store_name: str) -> _EnumRetType: ...
95-
def enum_crls(store_name: str) -> _EnumRetType: ...
94+
def enum_certificates(store_name: str) -> _EnumRetType: ...
95+
def enum_crls(store_name: str) -> _EnumRetType: ...
9696

9797

9898
CERT_NONE: int
9999
CERT_OPTIONAL: int
100100
CERT_REQUIRED: int
101101

102-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
103-
VERIFY_DEFAULT: int
104-
VERIFY_CRL_CHECK_LEAF: int
105-
VERIFY_CRL_CHECK_CHAIN: int
106-
VERIFY_X509_STRICT: int
107-
VERIFY_X509_TRUSTED_FIRST: int
102+
VERIFY_DEFAULT: int
103+
VERIFY_CRL_CHECK_LEAF: int
104+
VERIFY_CRL_CHECK_CHAIN: int
105+
VERIFY_X509_STRICT: int
106+
VERIFY_X509_TRUSTED_FIRST: int
108107

109108
PROTOCOL_SSLv23: int
110109
PROTOCOL_SSLv2: int
111110
PROTOCOL_SSLv3: int
112111
PROTOCOL_TLSv1: int
113-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
114-
PROTOCOL_TLSv1_1: int
115-
PROTOCOL_TLSv1_2: int
112+
PROTOCOL_TLSv1_1: int
113+
PROTOCOL_TLSv1_2: int
116114
if sys.version_info >= (3, 5):
117115
PROTOCOL_TLS: int
118116
if sys.version_info >= (3, 6):
@@ -123,18 +121,16 @@ OP_ALL: int
123121
OP_NO_SSLv2: int
124122
OP_NO_SSLv3: int
125123
OP_NO_TLSv1: int
126-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
127-
OP_NO_TLSv1_1: int
128-
OP_NO_TLSv1_2: int
124+
OP_NO_TLSv1_1: int
125+
OP_NO_TLSv1_2: int
129126
OP_CIPHER_SERVER_PREFERENCE: int
130127
OP_SINGLE_DH_USE: int
131128
OP_SINGLE_ECDH_USE: int
132129
OP_NO_COMPRESSION: int
133130
if sys.version_info >= (3, 6):
134131
OP_NO_TICKET: int
135132

136-
if sys.version_info < (3,) or sys.version_info >= (3, 5):
137-
HAS_ALPN: int
133+
HAS_ALPN: int
138134
HAS_ECDH: bool
139135
HAS_SNI: bool
140136
HAS_NPN: bool
@@ -144,41 +140,40 @@ OPENSSL_VERSION: str
144140
OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int]
145141
OPENSSL_VERSION_NUMBER: int
146142

147-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
148-
ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int
149-
ALERT_DESCRIPTION_INTERNAL_ERROR: int
150-
ALERT_DESCRIPTION_ACCESS_DENIED: int
151-
ALERT_DESCRIPTION_BAD_CERTIFICATE: int
152-
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE: int
153-
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE: int
154-
ALERT_DESCRIPTION_BAD_RECORD_MAC: int
155-
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED: int
156-
ALERT_DESCRIPTION_CERTIFICATE_REVOKED: int
157-
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN: int
158-
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE: int
159-
ALERT_DESCRIPTION_CLOSE_NOTIFY: int
160-
ALERT_DESCRIPTION_DECODE_ERROR: int
161-
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE: int
162-
ALERT_DESCRIPTION_DECRYPT_ERROR: int
163-
ALERT_DESCRIPTION_ILLEGAL_PARAMETER: int
164-
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY: int
165-
ALERT_DESCRIPTION_NO_RENEGOTIATION: int
166-
ALERT_DESCRIPTION_PROTOCOL_VERSION: int
167-
ALERT_DESCRIPTION_RECORD_OVERFLOW: int
168-
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE: int
169-
ALERT_DESCRIPTION_UNKNOWN_CA: int
170-
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY: int
171-
ALERT_DESCRIPTION_UNRECOGNIZED_NAME: int
172-
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: int
173-
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: int
174-
ALERT_DESCRIPTION_USER_CANCELLED: int
143+
ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int
144+
ALERT_DESCRIPTION_INTERNAL_ERROR: int
145+
ALERT_DESCRIPTION_ACCESS_DENIED: int
146+
ALERT_DESCRIPTION_BAD_CERTIFICATE: int
147+
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE: int
148+
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE: int
149+
ALERT_DESCRIPTION_BAD_RECORD_MAC: int
150+
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED: int
151+
ALERT_DESCRIPTION_CERTIFICATE_REVOKED: int
152+
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN: int
153+
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE: int
154+
ALERT_DESCRIPTION_CLOSE_NOTIFY: int
155+
ALERT_DESCRIPTION_DECODE_ERROR: int
156+
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE: int
157+
ALERT_DESCRIPTION_DECRYPT_ERROR: int
158+
ALERT_DESCRIPTION_ILLEGAL_PARAMETER: int
159+
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY: int
160+
ALERT_DESCRIPTION_NO_RENEGOTIATION: int
161+
ALERT_DESCRIPTION_PROTOCOL_VERSION: int
162+
ALERT_DESCRIPTION_RECORD_OVERFLOW: int
163+
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE: int
164+
ALERT_DESCRIPTION_UNKNOWN_CA: int
165+
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY: int
166+
ALERT_DESCRIPTION_UNRECOGNIZED_NAME: int
167+
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE: int
168+
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION: int
169+
ALERT_DESCRIPTION_USER_CANCELLED: int
175170

176171
if sys.version_info < (3,):
177172
class _ASN1Object(NamedTuple('_ASN1Object', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)])): ...
178173
class Purpose(_ASN1Object):
179174
SERVER_AUTH: ClassVar[Purpose]
180175
CLIENT_AUTH: ClassVar[Purpose]
181-
if sys.version_info >= (3, 4):
176+
else:
182177
class _ASN1Object(NamedTuple('_ASN1Object', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)])): ...
183178
class Purpose(_ASN1Object, enum.Enum):
184179
SERVER_AUTH = ...
@@ -202,12 +197,10 @@ class SSLSocket(socket.socket):
202197
def shared_cipher(self) -> Optional[List[Tuple[str, int, int]]]: ...
203198
def compression(self) -> Optional[str]: ...
204199
def get_channel_binding(self, cb_type: str = ...) -> Optional[bytes]: ...
205-
if sys.version_info < (3,) or sys.version_info >= (3, 5):
206-
def selected_alpn_protocol(self) -> Optional[str]: ...
200+
def selected_alpn_protocol(self) -> Optional[str]: ...
207201
def selected_npn_protocol(self) -> Optional[str]: ...
208202
def unwrap(self) -> socket.socket: ...
209-
if sys.version_info < (3,) or sys.version_info >= (3, 5):
210-
def version(self) -> Optional[str]: ...
203+
def version(self) -> Optional[str]: ...
211204
def pending(self) -> int: ...
212205

213206

@@ -223,37 +216,30 @@ if sys.version_info >= (3, 7):
223216

224217

225218
class SSLContext:
226-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
227-
check_hostname: bool
219+
check_hostname: bool
228220
options: int
229221
@property
230222
def protocol(self) -> int: ...
231-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
232-
verify_flags: int
223+
verify_flags: int
233224
verify_mode: int
234225
if sys.version_info >= (3, 5):
235226
def __init__(self, protocol: int = ...) -> None: ...
236227
else:
237228
def __init__(self, protocol: int) -> None: ...
238-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
239-
def cert_store_stats(self) -> Dict[str, int]: ...
229+
def cert_store_stats(self) -> Dict[str, int]: ...
240230
def load_cert_chain(self, certfile: str, keyfile: Optional[str] = ...,
241231
password: _PasswordType = ...) -> None: ...
242-
if sys.version_info < (3,) or sys.version_info >= (3, 4):
243-
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
244-
def load_verify_locations(self, cafile: Optional[str] = ...,
245-
capath: Optional[str] = ...,
246-
cadata: Union[str, bytes, None] = ...) -> None: ...
247-
def get_ca_certs(self,
248-
binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ...
249-
else:
250-
def load_verify_locations(self,
251-
cafile: Optional[str] = ...,
252-
capath: Optional[str] = ...) -> None: ...
232+
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
233+
def load_verify_locations(
234+
self,
235+
cafile: Optional[str] = ...,
236+
capath: Optional[str] = ...,
237+
cadata: Union[str, bytes, None] = ...,
238+
) -> None: ...
239+
def get_ca_certs(self, binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ...
253240
def set_default_verify_paths(self) -> None: ...
254241
def set_ciphers(self, ciphers: str) -> None: ...
255-
if sys.version_info < (3,) or sys.version_info >= (3, 5):
256-
def set_alpn_protocols(self, protocols: List[str]) -> None: ...
242+
def set_alpn_protocols(self, protocols: List[str]) -> None: ...
257243
def set_npn_protocols(self, protocols: List[str]) -> None: ...
258244
def set_servername_callback(self,
259245
server_name_callback: Optional[_SrvnmeCbType]) -> None: ...

stdlib/2and3/tarfile.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ class TarFile(Iterable[TarInfo]):
109109
def extract(self, member: Union[str, TarInfo], path: _Path = ...,
110110
set_attrs: bool = ...,
111111
*, numeric_owner: bool = ...) -> None: ...
112-
elif sys.version_info >= (3,):
113-
def extract(self, member: Union[str, TarInfo], path: _Path = ...,
114-
set_attrs: bool = ...) -> None: ...
115112
else:
116113
def extract(self, member: Union[str, TarInfo],
117114
path: _Path = ...) -> None: ...

stdlib/2and3/webbrowser.pyi

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ class Galeon(UnixBrowser):
5656
remote_action_newwin: str
5757
background: bool
5858

59-
if sys.version_info[:2] == (2, 7) or sys.version_info >= (3, 3):
60-
class Chrome(UnixBrowser):
61-
remote_args: List[str]
62-
remote_action: str
63-
remote_action_newwin: str
64-
remote_action_newtab: str
65-
background: bool
59+
class Chrome(UnixBrowser):
60+
remote_args: List[str]
61+
remote_action: str
62+
remote_action_newwin: str
63+
remote_action_newtab: str
64+
background: bool
6665

6766
class Opera(UnixBrowser):
6867
raise_opts: List[str]

0 commit comments

Comments
 (0)