court-queue
This library was created for modeling and simulating non-linear, snake-like queues as observed in high-density environments such as airports, stadiums, theme parks, courts, and other crowd-controlled areas. Traditional queue structures typically operate in a simple, linear order; however, non-linear queues take a more spatially efficient, serpentine form, allowing for greater throughput within confined spaces while preserving orderly progression.
Installation
You can install court-queue via pip:
pip install court-queue
Usage
You can create the queue from a predefined, static 2D array (matrix)
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix)
print(x)
Output
[[1, 2, 3], [6, 5, 4], [7, 8, 9]]
You can show all details
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(x)
Output
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ 9 │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
You can dequeue values
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(x)
x.dequeue()
print(x)
Output
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ 9 │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 2 │ 3 │ 4 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 7 │ 6 │ 5 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 8 │ 9 │ │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
You can enqueue values
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, None]]
x = courtQueue(static_matrix, detail=True)
print(x)
x.enqueue(9)
print(x)
Output
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ 9 │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
You can create the queue from scratch
from court_queue import courtQueue
x = courtQueue(rows=3, columns=3, detail=True)
print(x)
for i in range(9):
x.enqueue(i + 1)
print(x)
Output
╒══════════╤══╤══╤══╤══════════╕
│ <- EXIT │ │ │ │ <- ENTER │
├──────────┼──┼──┼──┼──────────┤
│ ENTER -> │ │ │ │ EXIT ^ │
├──────────┼──┼──┼──┼──────────┤
│ ^ EXIT │ │ │ │ <- ENTER │
╘══════════╧══╧══╧══╧══════════╛
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ 9 │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
You can show how many values are in the queue
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(len(x))
Output
9
You can check whether the queue is empty
from court_queue import courtQueue
static_matrix = [[None, None, None], [None, None, None], [None, None, None]]
x = courtQueue(static_matrix, detail=True)
print(x.isEmpty())
x.enqueue(1)
print(x.isEmpty())
Output
True
False
You can check whether the queue is full
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(x.isFull())
x.dequeue()
print(x.isFull())
Output
True
False
You can check the next value to be dequeued using peek or top
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(x.peek())
print(x.top())
Output
1
1
You can clear all the values from the queue
from court_queue import courtQueue
static_matrix = [[1, 2, 3], [6, 5, 4], [7, 8, 9]]
x = courtQueue(static_matrix, detail=True)
print(x)
x.clear()
print(x)
Output
╒══════════╤═══╤═══╤═══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │ <- ENTER │
├──────────┼───┼───┼───┼──────────┤
│ ENTER -> │ 6 │ 5 │ 4 │ EXIT ^ │
├──────────┼───┼───┼───┼──────────┤
│ ^ EXIT │ 7 │ 8 │ 9 │ <- ENTER │
╘══════════╧═══╧═══╧═══╧══════════╛
╒══════════╤══╤══╤══╤══════════╕
│ <- EXIT │ │ │ │ <- ENTER │
├──────────┼──┼──┼──┼──────────┤
│ ENTER -> │ │ │ │ EXIT ^ │
├──────────┼──┼──┼──┼──────────┤
│ ^ EXIT │ │ │ │ <- ENTER │
╘══════════╧══╧══╧══╧══════════╛
License
This project is licensed under the MIT LICENSE - see the LICENSE for more details.
Metadata
Release files for court-queue 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| court-queue-1.0.4.tar.gz | 5.6 kB | Without provenance | Details for court-queue-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| court_queue-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for court_queue-1.0.4-py3-none-any.whl |
Total release size: 11.7 kB
Release files / court-queue-1.0.4.tar.gz
| Download URL | court-queue-1.0.4.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13f25dc6e0542c746476801c6b74bdf0f229ee6e226e48b1cc8f479cd6051e9e
|
|
BLAKE2b-256 checksum How to use checksums |
c2bc644910f4abf009aad449c69cfba6f52cbe3cdc2af123d2b8cde2b9dfdf46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Release files / court_queue-1.0.4-py3-none-any.whl
| Download URL | court_queue-1.0.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
defddf1899ddf500c6e89efe2d3307ab64bc1145bb336d00b51d9fec97974c9d
|
|
BLAKE2b-256 checksum How to use checksums |
25188b558d50a2a4de32c62cbc57e326f8ecbed96e4c7f04008c21c59a0804ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.2
|
Security for court-queue 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.