Commit 94e96d87 authored by TheClockTwister's avatar TheClockTwister
Browse files

ReadTheDocs documentation

parent e15eb555
......@@ -8,3 +8,5 @@
Top module doc string
from quart import request
import functools
class EasyRequest:
A helper class that make request handling easier, especially for beginners.
""" A helper class that make request handling easier
All attributes are assessable via the same syntax, while with Flask.request
or quart.request, you will have slightly different syntax when retrieving
different request attributes.
.. hint::
You only need to await attributes that need calculation, for example
evaluating the request body, like `.json` or `.form`.
.. code-block:: python
headers = EasyRequest.headers
params = EasyRequest.params
form = await EasyRequest.form # requires time for calculation
json = await EasyRequest.json # requires time for calculation
params = ...
headers = ...
__quart_request = ...
params: dict = ...
""" The URL parameters like Flask.request.params. """
headers: dict = ...
""" The request headers like Flask.request.headers. """
__quart_request: request = ...
""" The Flask.request. instance that is used in the current scope. """
def __load(self):
""" loads the content of Flask.request into this instance and returns it. """
def load(self):
self.__quart_request = request
self.params = dict(self.__quart_request.args)
self.headers = dict(self.__quart_request.headers)
return self
def __call__(self, f):
""" Decorates an endpoint function to use the EasyRequest with. """
async def decorated_function(*args2, **kwargs2):
f.__globals__[self.__class__.__name__] = self.__class__().load()
f.__globals__[self.__class__.__name__] = self.__class__().__load()
return await f(*args2, **kwargs2)
return decorated_function
async def form(self):
""" The request form data like Flask.request.form. """
return dict(await self.__quart_request.form)
async def json(self):
""" The request body data (as JSON) like Flask.request.form.
Be aware that in order for Flask.request.get_json() to return
a JSON dictionary, the ``Content-Type`` header must be set to
json = await self.__quart_request.get_json()
return {} if json is None else json
......@@ -11,7 +11,7 @@ from typing import Union, Dict
from import Quart
import hashlib
from .patches.hypercorn import run,Config
from .patches.hypercorn import run, Config
from .caching import Cache
from .compression import Compression
......@@ -149,10 +149,17 @@ class WebServer(Quart):
self._compression = compression
def _get_own_instance_path(self):
Since hypercorn needs the application's file and global variable name, an instance needs to know
it's own origin file and name. But since this class is not defined in the same file as it is called
or defined from, this method searches for the correct module/file and evaluates it's instance name. """
Retrieves the file and variable name of this instance to be used in the Hypercorn CLI.
Since hypercorn needs the application's file and global variable name, an instance needs to know
it's own origin file and name. But since this class is not defined in the same file as it is called
or defined from, this method searches for the correct module/file and evaluates it's instance name.
.. warning::
Deprecation warning: This method will be removed in future versions. Usage is highly discouraged.
self.logger.warning("_get_own_instance_path() is deprecated!")
for i in range(10):
# Minimal makefile for Sphinx documentation
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXBUILD ?= sphinx-build
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
* Various tweaks to the Read the Docs theme to better conform with Godot's
* visual identity. Many colors are also overridden to use CSS variables.
* This makes it possible to provide an automatically-used dark theme
* based on browser preferences.
:root {
--body-color: rgba(255, 255, 255, 0.85);
--content-wrap-background-color: #202326;
--content-background-color: #2e3236;
/* Decrease the logo opacity when using the dark theme to be less distracting */
--logo-opacity: 0.85;
--navbar-background-color: #25282b;
--navbar-background-color-hover: #333639;
--navbar-background-color-active: #111417;
--navbar-current-background-color: #333639;
--navbar-current-background-color-hover: #44474a;
--navbar-current-background-color-active: #222528;
--navbar-level-1-color: #27d513;
--navbar-level-2-color: #27d513;
--navbar-level-3-color: #27d513;
--navbar-heading-color: #ee7381;
--navbar-scrollbar-color: #be5460;
--navbar-scrollbar-hover-color: #963e48;
--navbar-scrollbar-active-color: #5f3034;
--navbar-scrollbar-background: #1c1e21;
--link-color: #8cf;
--link-color-hover: #9df;
--link-color-active: #6ad;
--link-color-visited: #cb99f6;
--external-reference-icon: url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyIiB3aWR0aD0iMTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjOGNmIj48cGF0aCBkPSJtNy41IDcuMXYzLjRoLTZ2LTZoMy40Ii8+PHBhdGggZD0ibTUuNzY1IDFoNS4yMzV2NS4zOWwtMS41NzMgMS41NDctMS4zMS0xLjMxLTIuNzI0IDIuNzIzLTIuNjktMi42ODggMi44MS0yLjgwOC0xLjMxMy0xLjMxeiIvPjwvZz48L3N2Zz4K");
--hr-color: #555;
--table-row-odd-background-color: #3b3e41;
--code-background-color: #434649;
--code-border-color: #585858;
--code-literal-color: #acacac;
--input-background-color: #333537;
--input-focus-border-color: #5f8cff;
--search-input-background-color: #43464a; /* derived from --input-background-color */
--search-match-color: #52b4ff; /* derived from --link-color */
--search-match-background-color: #414c56; /* derived from --link-color */
--search-active-color: #202326;
--search-credits-background-color: #202123; /* derived from --navbar-background-color */
--search-credits-color: #6b6b6b; /* derived from --footer-color */
--search-credits-link-color: #628fb1; /* derived from --link-color */
/* Colors taken from the Godot script editor with the Adaptive theme */
--highlight-background-color: #2c2f36;
--highlight-background-emph-color: #2d3444;
--highlight-default-color: rgba(255, 255, 255, 0.85);
--highlight-comment-color: rgba(204, 206, 211, 0.5);
--highlight-keyword-color: #ff7085;
--highlight-keyword2-color: #42ffc2;
--highlight-number-color: #a1ffe0;
--highlight-decorator-color: #abc8ff;
--highlight-type-color: #8effda;
--highlight-type2-color: #c6ffed;
--highlight-function-color: #57b3ff;
--highlight-operator-color: #abc8ff;
--highlight-string-color: #ffeca1;
--admonition-note-background-color: #303d4f;
--admonition-note-color: #bfeeff;
--admonition-note-title-background-color: #305070;
--admonition-note-title-color: #bfefff;
--admonition-attention-background-color: #444033;
--admonition-attention-color: #ffeeaf;
--admonition-attention-title-background-color: #665022;
--admonition-attention-title-color: #ffeeaf;
--admonition-danger-background-color: #433;
--admonition-danger-color: #fcc;
--admonition-danger-title-background-color: #633;
--admonition-danger-title-color: #fcc;
--admonition-tip-background-color: #28382d;
--admonition-tip-color: #dfd;
--admonition-tip-title-background-color: #336648;
--admonition-tip-title-color: #dfd;
--kbd-background-color: #595b5d;
--kbd-outline-color: #3d4144;
--kbd-shadow-color: #1e2023;
--kbd-text-color: #e2f2ff;
--btn-neutral-background-color: #404040;
--btn-neutral-hover-background-color: #505050;
--footer-color: #aaa;
.wy-nav-content {
margin: 0;
background: #2e3236 !important;
.wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo {
height: 150px;
#search-results .context {
color: var(--footer-color);
body {
color: #f1f7ff;
background: #202326 !important;
@media only screen and (min-width: 769px) {
.wy-body-for-nav {
/* Center the page on wide displays for better readability */
max-width: 1100px;
margin: 0 auto;
/* Code display tweaks */
.rst-content tt,
.rst-content code {
font-size: 14px;
background-color: var(--code-background-color);
border: 1px solid var(--code-border-color);
.rst-content tt.literal,
.rst-content code.literal {
color: var(--code-literal-color);
.rst-content div[class^="highlight"] {
border-color: var(--code-border-color);
.rst-content pre.literal-block,
.rst-content div[class^="highlight"] pre,
.rst-content .linenodiv pre {
/* Increase the font size and line height in code blocks */
font-size: 14px;
line-height: 1.5;
/* Code tab display tweaks */ .active.item,
.ui.segment {
background-color: var(--code-background-color);
/* Syntax highlighting */
.highlight {
background-color: var(--highlight-background-color);
/* Emphasized lines */
.highlight .hll {
background-color: var(--highlight-background-emph-color);
.highlight .gh,
.highlight .gu,
.highlight .go,
.highlight .gt {
color: var(--highlight-default-color);
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs {
color: var(--highlight-comment-color);
.highlight .bp,
.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt,
.highlight .ow {
color: var(--highlight-keyword-color);
.highlight .ch,
.highlight .cp {
color: var(--highlight-keyword2-color);
.highlight .m,
.highlight .mf,
.highlight .mi,
.highlight .il,
.highlight .mb,
.highlight .mh,
.highlight .mo {
color: var(--highlight-number-color);
.highlight .na,
.highlight .nd,
.highlight .ni,
.highlight .nl {
color: var(--highlight-decorator-color);
.highlight .nb,
.highlight .ne {
color: var(--highlight-type-color);
.highlight .nc,
.highlight .nn,
.highlight .no,
.highlight .nv,
.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .vm {
color: var(--highlight-type2-color);
.highlight .nf,
.highlight .fm,
.highlight .nt {
color: var(--highlight-function-color);
.highlight .o,
.highlight .si,
.highlight .sx,
.highlight .sr,
.highlight .ss {
color: var(--highlight-operator-color);
.highlight .cpf,
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sc,
.highlight .se,
.highlight .sa,
.highlight .sb,
.highlight .dl,
.highlight .sd,
.highlight .sh {
color: var(--highlight-string-color);
/* Keyboard shortcuts tweaks */
kbd, .kbd {
background-color: var(--kbd-background-color);
border: 1px solid var(--kbd-outline-color);
border-radius: 3px;
box-shadow: inset 0 -1px 0 var(--kbd-shadow-color);
color: var(--kbd-text-color);
display: inline-block;
font-size: 12px;
line-height: 11px;
padding: 4px 5px;
vertical-align: middle;
/* search */
.wy-side-nav-search {
background-color: var(--navbar-background-color);
.wy-side-nav-search > a:hover,
.wy-side-nav-search .wy-dropdown > a:hover {
background-color: var(--navbar-background-color-hover);
.wy-side-nav-search > a:active,
.wy-side-nav-search .wy-dropdown > a:active {
background-color: var(--navbar-background-color-active);
.wy-side-nav-search input[type="text"] {
background-color: var(--input-background-color);
color: var(--body-color);
/* Avoid reflowing when toggling the focus state */
border: 2px solid transparent;
box-shadow: none;
/* Make visual feedback instant */
transition: none;
font-size: 14px;
.wy-side-nav-search input[type="text"]:focus {
border: 2px solid var(--input-focus-border-color);
.wy-side-nav-search input[type="text"]::placeholder {
color: var(--body-color);
opacity: 0.55;
/* Navigation bar */
.wy-nav-side {
background-color: var(--navbar-background-color);
@media only screen and (min-width: 769px) {
.wy-nav-side {
/* Required to center the page on wide displays */
left: inherit;
/* AutoDoc Boxes Colors*/
.rst-content dl:not(.docutils) dt, .rst-content dl:not(.docutils) dl dt,
html.writer-html4 .rst-content dl:not(.docutils) > dt, html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) > dt,
html.writer-html4 .rst-content dl:not(.docutils) dl:not(.field-list) > dt, html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dl:not(.field-list) > dt {
border: none;
background: rgba(48, 168, 255, 0.08);
color: #6ab0de;
border-top: 3px solid #6ab0de;
.rst-content code, .rst-content tt {
color: #ff5757;
/* "Previous" & "Next" buttons */
.btn-neutral, .btn-neutral:visited {
background-color: #2e3236 !important;
color: #919293 !important;
border: 1px solid #919293;
border-radius: 0.4rem;
/* Sidebar menu */
.wy-menu-vertical li.current > a, .wy-menu-vertical li.on a {
color: aliceblue;
background: #25282b;
border: none !important;
.wy-menu-vertical a:hover {
background-color: #2d3135 !important;
.wy-menu-vertical li.current a {
color: aliceblue;
border-right: none;
.wy-menu-vertical li.toctree-l1.current > a, .wy-menu-vertical li.toctree-l1.current li.toctree-l2 > a,
.wy-menu-vertical li.toctree-l2.current > a, .wy-menu-vertical li.toctree-l2.current li.toctree-l3 > a,
.wy-menu-vertical li.toctree-l3.current > a, .wy-menu-vertical li.toctree-l3.current li.toctree-l4 > a,
.wy-menu-vertical li.toctree-l4.current > a, .wy-menu-vertical li.toctree-l4.current li.toctree-l5 > a {
background: #25282b;
color: #f0f8ff;
border: none !important;
.wy-menu-vertical li.current > a span.toctree-expand, .wy-menu-vertical li.on a span.toctree-expand {
color: aliceblue;
/* Tables */
.rst-content table.docutils, .wy-table-bordered-all {
color: aliceblue;
border: 1px solid;
border-color: #606162 !important;
.rst-content table.docutils td, .wy-table-bordered-all td {
border-color: #606162 !important;
color: aliceblue;
.rst-content table.docutils th {
color: aliceblue;
border-color: #606162 !important;
.rst-content table.docutils thead, .rst-content table.field-list thead, .wy-table thead {
border-bottom: 3px solid #606162;
.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td, .wy-table-backed, .wy-table-odd td, .wy-table-striped tr:nth-child(2n-1) td {
background-color: rgba(0, 0, 0, 0.08);
.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td, .wy-table-backed, .wy-table-odd td, .wy-table-striped tr:nth-child(2n-1) td {
background-color: rgba(255, 255, 255, 0.08);
/* Notes and stuff */
.rst-content .admonition, .rst-content .admonition-todo, .rst-content .attention, .rst-content .caution, .rst-content .danger, .rst-content .error, .rst-content .hint, .rst-content .important, .rst-content .note, .rst-content .seealso, .rst-content .tip, .rst-content .warning {
color: #dcdcdc;
.rst-content .admonition, .rst-content .admonition-todo, .rst-content .attention, .rst-content .caution, .rst-content .danger, .rst-content .error, .rst-content .hint, .rst-content .important, .rst-content .note, .rst-content .seealso, .rst-content .tip, .rst-content .warning,
.rst-content .note, .rst-content .seealso, .rst-content .wy-alert-info.admonition, .rst-content .wy-alert-info.admonition-todo, .rst-content .wy-alert-info.attention, .rst-content .wy-alert-info.caution, .rst-content .wy-alert-info.danger, .rst-content .wy-alert-info.error, .rst-content .wy-alert-info.hint, .rst-content .wy-alert-info.important, .rst-content .wy-alert-info.tip, .rst-content .wy-alert-info.warning, .wy-alert.wy-alert-info {
background: rgba(106, 176, 222, 0.16);
.rst-content .danger, .rst-content .error, .rst-content .wy-alert-danger.admonition, .rst-content .wy-alert-danger.admonition-todo, .rst-content .wy-alert-danger.attention, .rst-content .wy-alert-danger.caution, .rst-content .wy-alert-danger.hint, .rst-content .wy-alert-danger.important, .rst-content .wy-alert-danger.note, .rst-content .wy-alert-danger.seealso, .rst-content .wy-alert-danger.tip, .rst-content .wy-alert-danger.warning, .wy-alert.wy-alert-danger {
background: rgba(242, 159, 151, 0.16);
.rst-content .admonition-todo, .rst-content .attention, .rst-content .caution, .rst-content .warning, .rst-content .wy-alert-warning.admonition, .rst-content .wy-alert-warning.danger, .rst-content .wy-alert-warning.error, .rst-content .wy-alert-warning.hint, .rst-content .wy-alert-warning.important, .rst-content .wy-alert-warning.note, .rst-content .wy-alert-warning.seealso, .rst-content .wy-alert-warning.tip, .wy-alert.wy-alert-warning {
background: rgba(240, 179, 126, 0.16);
.rst-content .hint, .rst-content .important, .rst-content .tip, .rst-content .wy-alert-success.admonition, .rst-content .wy-alert-success.admonition-todo, .rst-content .wy-alert-success.attention, .rst-content .wy-alert-success.caution, .rst-content .wy-alert-success.danger, .rst-content .wy-alert-success.error, .rst-content .wy-alert-success.note, .rst-content .wy-alert-success.seealso, .rst-content .wy-alert-success.warning, .wy-alert.wy-alert-success {
background: rgba(26, 188, 156, 0.16);
# Configuration file for the Sphinx documentation builder.
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
import os, sys
import sphinx_rtd_theme
from recommonmark.parser import CommonMarkParser
sys.path.insert(0, os.path.abspath("../Python/Aeros"))
project = 'Aeros'
copyright = '2020, TheClockTwister'
author = 'TheClockTwister'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'recommonmark', # Markdown support (needs package "recommonmark")