pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/0361556537686f857f1025ead75e6af4ca7cc94a

bpo-39481: PEP 585 for a variety of modules (GH-19423) · python/cpython@0361556 · GitHub
Skip to content

Commit 0361556

Browse files
authored
bpo-39481: PEP 585 for a variety of modules (GH-19423)
- concurrent.futures - ctypes - http.cookies - multiprocessing - queue - tempfile - unittest.case - urllib.parse
1 parent e3ec44d commit 0361556

15 files changed

Lines changed: 66 additions & 1 deletion

File tree

Lib/concurrent/futures/_base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import logging
88
import threading
99
import time
10+
import types
1011

1112
FIRST_COMPLETED = 'FIRST_COMPLETED'
1213
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
@@ -544,6 +545,8 @@ def set_exception(self, exception):
544545
self._condition.notify_all()
545546
self._invoke_callbacks()
546547

548+
__class_getitem__ = classmethod(types.GenericAlias)
549+
547550
class Executor(object):
548551
"""This is an abstract base class for concrete asynchronous executors."""
549552

Lib/concurrent/futures/thread.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import itertools
1111
import queue
1212
import threading
13+
import types
1314
import weakref
1415
import os
1516

@@ -57,6 +58,8 @@ def run(self):
5758
else:
5859
self.future.set_result(result)
5960

61+
__class_getitem__ = classmethod(types.GenericAlias)
62+
6063

6164
def _worker(executor_reference, work_queue, initializer, initargs):
6265
if initializer is not None:

Lib/ctypes/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""create and manipulate C data types in Python"""
22

33
import os as _os, sys as _sys
4+
import types as _types
45

56
__version__ = "1.1.0"
67

@@ -450,6 +451,8 @@ def __getitem__(self, name):
450451
def LoadLibrary(self, name):
451452
return self._dlltype(name)
452453

454+
__class_getitem__ = classmethod(_types.GenericAlias)
455+
453456
cdll = LibraryLoader(CDLL)
454457
pydll = LibraryLoader(PyDLL)
455458

Lib/http/cookies.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
#
132132
import re
133133
import string
134+
import types
134135

135136
__all__ = ["CookieError", "BaseCookie", "SimpleCookie"]
136137

@@ -419,6 +420,8 @@ def OutputString(self, attrs=None):
419420
# Return the result
420421
return _semispacejoin(result)
421422

423+
__class_getitem__ = classmethod(types.GenericAlias)
424+
422425

423426
#
424427
# Pattern for finding cookie

Lib/multiprocessing/managers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import array
2222
import queue
2323
import time
24+
import types
2425
import os
2526
from os import getpid
2627

@@ -1129,6 +1130,8 @@ def set(self, value):
11291130
return self._callmethod('set', (value,))
11301131
value = property(get, set)
11311132

1133+
__class_getitem__ = classmethod(types.GenericAlias)
1134+
11321135

11331136
BaseListProxy = MakeProxyType('BaseListProxy', (
11341137
'__add__', '__contains__', '__delitem__', '__getitem__', '__len__',

Lib/multiprocessing/pool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import threading
2121
import time
2222
import traceback
23+
import types
2324
import warnings
2425
from queue import Empty
2526

@@ -780,6 +781,8 @@ def _set(self, i, obj):
780781
del self._cache[self._job]
781782
self._pool = None
782783

784+
__class_getitem__ = classmethod(types.GenericAlias)
785+
783786
AsyncResult = ApplyResult # create alias -- see #17805
784787

785788
#

Lib/multiprocessing/queues.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import threading
1515
import collections
1616
import time
17+
import types
1718
import weakref
1819
import errno
1920

@@ -366,3 +367,5 @@ def put(self, obj):
366367
else:
367368
with self._wlock:
368369
self._writer.send_bytes(obj)
370+
371+
__class_getitem__ = classmethod(types.GenericAlias)

Lib/multiprocessing/shared_memory.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import errno
1515
import struct
1616
import secrets
17+
import types
1718

1819
if os.name == "nt":
1920
import _winapi
@@ -508,3 +509,5 @@ def index(self, value):
508509
return position
509510
else:
510511
raise ValueError(f"{value!r} not in this container")
512+
513+
__class_getitem__ = classmethod(types.GenericAlias)

Lib/queue.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'''A multi-producer, multi-consumer queue.'''
22

33
import threading
4+
import types
45
from collections import deque
56
from heapq import heappush, heappop
67
from time import monotonic as time
@@ -216,6 +217,8 @@ def _put(self, item):
216217
def _get(self):
217218
return self.queue.popleft()
218219

220+
__class_getitem__ = classmethod(types.GenericAlias)
221+
219222

220223
class PriorityQueue(Queue):
221224
'''Variant of Queue that retrieves open entries in priority order (lowest first).
@@ -316,6 +319,8 @@ def qsize(self):
316319
'''Return the approximate size of the queue (not reliable!).'''
317320
return len(self._queue)
318321

322+
__class_getitem__ = classmethod(types.GenericAlias)
323+
319324

320325
if SimpleQueue is None:
321326
SimpleQueue = _PySimpleQueue

Lib/tempfile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,3 +829,5 @@ def __exit__(self, exc, value, tb):
829829
def cleanup(self):
830830
if self._finalizer.detach():
831831
self._rmtree(self.name)
832+
833+
__class_getitem__ = classmethod(_types.GenericAlias)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy