Skip to main content

Simple module to create queues

Project description

PyQueue
A simple module lib to queue your lists!

Usage:

# List: The list you are going to transform into a queue
# Length: The maximum size of the queue
# Input: The input from the user (can be a input('')) or an str

Queue(list, length, input)
# Returns the simple queue

Queue(list, length, input).input()
# Returns the element that was added

Queue(list, length, input).output()
# Returns the element that was removed

Queue(list, length, input).infos() # or .info()
# Returns the queue, the input and the output of the queue.

How it works

  • Insert the wanted string onto the list if the maximum size of the list is less than the wanted size.
  • If the size of the list is greater than the wanted size, pop out the last queue element and insert the wanted string.

TODO:

  • Add .create() function
    • will create 2 buffers for temporary usage.
    • e.g: Queue(q, 3, in).create(1)
      • creates a new buffer inside the Queue class itself
      • can use .input(), .output() and .infos()
      • cannot be referenced outside the Queue class.
  • Double-Reference return Methods
    • allows the user to reference Queue without needing to print() it.
      • also allows the user to reference Queue with print().

graph TD
    A[Read the input] -->|Verify if the size is less than the wanted|B(Insert string on the first position)
    B --> C{Check the queue}
    C -->|If the size is less|D[Insert at 0 and move the rest]
    C -->|If size is greater|E[Insert at 0 and pop the last]
    E --> F
    D --> F
    F{Rest of args}
    F --> |.input|H(print the new element)
    F --> |.output|G(print the removed element)
    F --> |info / infos|I(print the queue, the input and the output)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

queuepy-1.0.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file queuepy-1.0.1.tar.gz.

File metadata

  • Download URL: queuepy-1.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for queuepy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d2b70f7f35465a4da7f11ef7ea89d02d7a883a13ba6898fa202d56fddf80716d
MD5 da03359bb55560b606ecda0fff60aebd
BLAKE2b-256 9d19fac48120f4515307903ac9cad2aae315518f96f10335bc17b08ffe993d70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page