⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.30
Server IP:
45.79.8.107
Server:
Linux localhost 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.2-1ubuntu2.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3.10
/
__pycache__
/
View File Name :
queue.cpython-310.pyc
o }5h, @ s d Z ddlZddlZddlmZ ddlmZmZ ddlm Z zddl mZ W n ey1 dZY nw g dZ zddl mZ W n eyO G d d d eZY nw G dd deZG d d dZG dd deZG dd deZG dd dZedu r~eZdS dS )z'A multi-producer, multi-consumer queue. N)deque)heappushheappop) monotonic)SimpleQueue)EmptyFullQueue PriorityQueue LifoQueuer )r c @ e Zd ZdZdS )r z4Exception raised by Queue.get(block=0)/get_nowait().N__name__ __module____qualname____doc__ r r /usr/lib/python3.10/queue.pyr r c @ r )r z4Exception raised by Queue.put(block=0)/put_nowait().Nr r r r r r r r c @ s e Zd ZdZd!ddZdd Zdd Zd d Zdd Zd d Z d"ddZ d"ddZdd Zdd Z dd Zdd Zdd Zdd ZeejZdS )#r zjCreate a queue object with a given maximum size. If maxsize is <= 0, the queue size is infinite. r c C sN || _ | | t | _t| j| _t| j| _t| j| _d| _ d S Nr ) maxsize_init threadingLockmutex Condition not_emptynot_fullall_tasks_doneunfinished_tasksselfr r r r __init__" s zQueue.__init__c C s^ | j " | jd }|dkr|dk rtd| j || _W d dS 1 s(w Y dS )a. Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises a ValueError if called more times than there were items placed in the queue. r z!task_done() called too many timesN)r r ValueError notify_all)r! unfinishedr r r task_done9 s "zQueue.task_donec C sR | j | jr| j | jsW d dS W d dS 1 s"w Y dS )a Blocks until all items in the Queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. N)r r waitr! r r r joinO s "z Queue.joinc C s2 | j | W d S 1 sw Y dS )9Return the approximate size of the queue (not reliable!).Nr _qsizer) r r r qsize\ s $zQueue.qsizec C s4 | j | W d S 1 sw Y dS )a Return True if the queue is empty, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() == 0 as a direct substitute, but be aware that either approach risks a race condition where a queue can grow before the result of empty() or qsize() can be used. To create code that needs to wait for all queued tasks to be completed, the preferred technique is to use the join() method. Nr, r) r r r emptya s $zQueue.emptyc C sH | j d| j k o| kn W d S 1 sw Y dS )aO Return True if the queue is full, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() >= n as a direct substitute, but be aware that either approach risks a race condition where a queue can shrink before the result of full() or qsize() can be used. r N)r r r- r) r r r fullo s $z Queue.fullTNc C s | j o | jdkrY|s| | jkrtnD|du r-| | jkr,| j | | jks n,|dk r5tdt | }| | jkrY|t }|dkrLt| j | | | jksA| | | jd7 _| j W d dS 1 suw Y dS )a Put an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until a free slot is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Full exception if no free slot was available within that time. Otherwise ('block' is false), put an item on the queue if a free slot is immediately available, else raise the Full exception ('timeout' is ignored in that case). r N''timeout' must be a non-negative number r# )r r r- r r( r$ time_putr r notify)r! itemblocktimeoutendtime remainingr r r putz s0 "z Queue.putc C s | j T |s | stn8|du r| s| j | rn&|dk r'tdt | }| sE|t }|dkr;t| j | | r0| }| j |W d S 1 sZw Y dS ) Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until an item is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Empty exception if no item was available within that time. Otherwise ('block' is false), return an item if one is immediately available, else raise the Empty exception ('timeout' is ignored in that case). Nr r1 r2 ) r r- r r( r$ r3 _getr r5 )r! r7 r8 r9 r: r6 r r r get s. $z Queue.getc C | j |ddS )zPut an item into the queue without blocking. Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception. Fr7 r; r! r6 r r r put_nowait zQueue.put_nowaitc C | j ddS zRemove and return an item from the queue without blocking. Only get an item if one is immediately available. Otherwise raise the Empty exception. Fr@ r> r) r r r get_nowait zQueue.get_nowaitc C s t | _d S N)r queuer r r r r s zQueue._initc C t | jS rJ lenrK r) r r r r- zQueue._qsizec C | j | d S rJ rK appendrB r r r r4 z Queue._putc C | j S rJ )rK popleftr) r r r r= rO z Queue._get)r TN)r r r r r" r' r* r. r/ r0 r; r> rC rH r r- r4 r= classmethodtypesGenericAlias__class_getitem__r r r r r s" r c @ 0 e Zd ZdZdd Zdd Zdd Zdd Zd S )r zVariant of Queue that retrieves open entries in priority order (lowest first). Entries are typically tuples of the form: (priority number, data). c C g | _ d S rJ rK r r r r r rO zPriorityQueue._initc C rL rJ rM r) r r r r- rO zPriorityQueue._qsizec C s t | j| d S rJ )r rK rB r r r r4 rS zPriorityQueue._putc C rL rJ )r rK r) r r r r= rO zPriorityQueue._getNr r r r r r- r4 r= r r r r r s r c @ r[ )r zBVariant of Queue that retrieves most recently added entries first.c C r\ rJ r] r r r r r rO zLifoQueue._initc C rL rJ rM r) r r r r- rO zLifoQueue._qsizec C rP rJ rQ rB r r r r4 rS zLifoQueue._putc C rT rJ )rK popr) r r r r= rO zLifoQueue._getNr^ r r r r r s r c @ sV e Zd ZdZdd ZdddZddd Zd d Zdd Zdd Z dd Z eej ZdS )_PySimpleQueuezYSimple, unbounded FIFO queue. This pure Python implementation is not reentrant. c C s t | _td| _d S r )r _queuer Semaphore_countr) r r r r" s z_PySimpleQueue.__init__TNc C s | j | | j dS )zPut the item on the queue. The optional 'block' and 'timeout' arguments are ignored, as this method never blocks. They are provided for compatibility with the Queue class. N)ra rR rc release)r! r6 r7 r8 r r r r; s z_PySimpleQueue.putc C s4 |dur|dk rt d| j||st| j S )r<