elm.web.website_crawl.PeekablePriorityQueue

class PeekablePriorityQueue(maxsize=0)[source]

Bases: PriorityQueue

A priority queue that allows peeking at the next item

Methods

empty()

Return True if the queue is empty, False otherwise.

full()

Return True if there are maxsize items in the queue.

get()

Remove and return an item from the queue.

get_nowait()

Remove and return an item from the queue.

join()

Block until all items in the queue have been gotten and processed.

peek()

Peek at the next item in the queue without removing it

put(item)

Put an item into the queue.

put_nowait(item)

Put an item into the queue without blocking.

qsize()

Number of items in the queue.

task_done()

Indicate that a formerly enqueued task is complete.

Attributes

maxsize

Number of items allowed in the queue.

peek()[source]

Peek at the next item in the queue without removing it

empty()

Return True if the queue is empty, False otherwise.

full()

Return True if there are maxsize items in the queue.

Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True.

async get()

Remove and return an item from the queue.

If queue is empty, wait until an item is available.

get_nowait()

Remove and return an item from the queue.

Return an item if one is immediately available, else raise QueueEmpty.

async join()

Block 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 calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.

property maxsize

Number of items allowed in the queue.

async put(item)

Put an item into the queue.

Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.

put_nowait(item)

Put an item into the queue without blocking.

If no free slot is immediately available, raise QueueFull.

qsize()

Number of items in the queue.

task_done()

Indicate that a formerly enqueued task is complete.

Used by queue consumers. 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 ValueError if called more times than there were items placed in the queue.