Skip to content

Commit

Permalink
create docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewAndreTaylor committed Aug 24, 2024
1 parent acd7b04 commit 4baf4ee
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/deploy.yml
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
13 changes: 13 additions & 0 deletions docs/api.rst
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:

18 changes: 18 additions & 0 deletions docs/conf.py
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"
157 changes: 157 additions & 0 deletions docs/fastqueue.py
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
18 changes: 18 additions & 0 deletions docs/index.rst
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`
5 changes: 5 additions & 0 deletions docs/makedocs.sh
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
4 changes: 4 additions & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
README
----------

.. mdinclude:: ../README.md

0 comments on commit 4baf4ee

Please sign in to comment.