mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
bpo-39481: PEP 585 for a variety of modules (GH-19423)
- concurrent.futures - ctypes - http.cookies - multiprocessing - queue - tempfile - unittest.case - urllib.parse
This commit is contained in:
parent
e3ec44d692
commit
0361556537
15 changed files with 66 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
'''A multi-producer, multi-consumer queue.'''
|
||||
|
||||
import threading
|
||||
import types
|
||||
from collections import deque
|
||||
from heapq import heappush, heappop
|
||||
from time import monotonic as time
|
||||
|
@ -216,6 +217,8 @@ class Queue:
|
|||
def _get(self):
|
||||
return self.queue.popleft()
|
||||
|
||||
__class_getitem__ = classmethod(types.GenericAlias)
|
||||
|
||||
|
||||
class PriorityQueue(Queue):
|
||||
'''Variant of Queue that retrieves open entries in priority order (lowest first).
|
||||
|
@ -316,6 +319,8 @@ class _PySimpleQueue:
|
|||
'''Return the approximate size of the queue (not reliable!).'''
|
||||
return len(self._queue)
|
||||
|
||||
__class_getitem__ = classmethod(types.GenericAlias)
|
||||
|
||||
|
||||
if SimpleQueue is None:
|
||||
SimpleQueue = _PySimpleQueue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue