-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acd7b04
commit 4baf4ee
Showing
7 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install the dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install sphinx sphinx-rtd-theme m2r2 | ||
- name: Build the site | ||
run: | | ||
sphinx-build -M html . ./build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./docs/build/html | ||
|
||
deploy: | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fastqueue API Reference | ||
-------------------------------- | ||
|
||
.. autoclass:: fastqueue.Queue | ||
:members: | ||
|
||
.. autoclass:: fastqueue.QueueC | ||
:members: | ||
|
||
.. autoclass:: fastqueue.LockQueue | ||
:inherited-members: | ||
:members: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath(".")) | ||
|
||
project = "fastqueue" | ||
copyright = "2023, Matthew Taylor" | ||
author = "Matthew Taylor" | ||
|
||
extensions = ["sphinx.ext.autodoc", "m2r2"] | ||
|
||
source_suffix = [".rst", ".md"] | ||
|
||
templates_path = ["_templates"] | ||
|
||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
html_theme = "sphinx_rtd_theme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
from typing import Any, Iterable, Optional | ||
|
||
|
||
class Queue: | ||
|
||
def __init__(self, iterable: Optional[Iterable] = None) -> None: | ||
"""Initialize the Queue object. | ||
:param iterable (Optional[Iterable], optional): An iterable to | ||
initialize the Queue with. Defaults to None | ||
:param self: | ||
""" | ||
pass | ||
|
||
def enqueue(self, item: Any) -> None: | ||
"""Add an item to the front of the Queue. | ||
:param item: (Any): The item to be added to the Queue. | ||
:param self: | ||
""" | ||
pass | ||
|
||
def dequeue(self): | ||
"""Remove and return an item from the end of the Queue. | ||
:return: The item removed from the Queue. | ||
""" | ||
pass | ||
|
||
def extend(self, items: Iterable[Any]) -> None: | ||
"""Enqueue a sequence of elements from an iterator. | ||
:param items: (Iterable[Any]): An iterable containing the | ||
elements to be enqueued. | ||
:param self: | ||
""" | ||
pass | ||
|
||
def __len__(self) -> int: | ||
pass | ||
|
||
def is_empty(self) -> bool: | ||
"""Returns whether the Queue is empty. | ||
:return: True if the Queue is empty, False otherwise. | ||
""" | ||
pass | ||
|
||
def __getitem__(self, index: int): | ||
pass | ||
|
||
def __setitem__(self, index: int, item: Any) -> None: | ||
pass | ||
|
||
def __contains__(self, item: Any) -> bool: | ||
pass | ||
|
||
def copy(self): | ||
"""Return a shallow copy of the Queue. | ||
:return: A shallow copy of the Queue object. | ||
""" | ||
pass | ||
|
||
def __copy__(self): | ||
"""Return a shallow copy of the Queue. | ||
:return: A shallow copy of the Queue object. | ||
""" | ||
pass | ||
|
||
|
||
class QueueC: | ||
def __init__(self, iterable: Optional[Iterable] = None) -> None: | ||
"""Initialize the Queue object. | ||
:param iterable (Optional[Iterable], optional): An iterable to | ||
initialize the Queue with. Defaults to None | ||
:param self: | ||
""" | ||
pass | ||
|
||
def enqueue(self, item: Any) -> None: | ||
"""Add an item to the front of the Queue. | ||
:param item: (Any): The item to be added to the Queue. | ||
:param self: | ||
""" | ||
pass | ||
|
||
def dequeue(self): | ||
"""Remove and return an item from the end of the Queue. | ||
:return: The item removed from the Queue. | ||
""" | ||
pass | ||
|
||
def extend(self, items: Iterable[Any]) -> None: | ||
"""Enqueue a sequence of elements from an iterator. | ||
:param items: (Iterable[Any]): An iterable containing the | ||
elements to be enqueued. | ||
:param self: | ||
""" | ||
pass | ||
|
||
def __len__(self) -> int: | ||
pass | ||
|
||
def is_empty(self) -> bool: | ||
"""Returns whether the Queue is empty. | ||
:return: True if the Queue is empty, False otherwise. | ||
""" | ||
pass | ||
|
||
def __getitem__(self, index: int): | ||
pass | ||
|
||
def __setitem__(self, index: int, item: Any) -> None: | ||
pass | ||
|
||
def __contains__(self, item: Any) -> bool: | ||
pass | ||
|
||
def copy(self): | ||
"""Return a shallow copy of the Queue. | ||
:return: A shallow copy of the Queue object. | ||
""" | ||
pass | ||
|
||
def __copy__(self): | ||
"""Return a shallow copy of the Queue. | ||
:return: A shallow copy of the Queue object. | ||
""" | ||
pass | ||
|
||
|
||
class LockQueue(Queue): | ||
def __init__(self, iterable: Optional[Iterable] = None) -> None: | ||
"""Initialize the LockQueue object. | ||
:param iterable (Optional[Iterable], optional): An iterable to | ||
initialize the LockQueue with. Defaults to None | ||
:param self: | ||
""" | ||
pass | ||
|
||
def get(self): | ||
"""Return the first element of the LockQueue, None if no element exists. | ||
:return: The first element of the LockQueue, or None if the LockQueue | ||
is empty. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
fastqueue docs | ||
======================================== | ||
|
||
Fast Python queues | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
readme | ||
api | ||
|
||
|
||
* :ref:`genindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
pip install sphinx sphinx-rtd-theme m2r2 | ||
|
||
sphinx-build -M html . ./build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
README | ||
---------- | ||
|
||
.. mdinclude:: ../README.md |