Skip to content

Commit 0af2c0c

Browse files
committed
make api_utils.py private and write docs
1 parent aabba6c commit 0af2c0c

11 files changed

Lines changed: 559 additions & 498 deletions

File tree

docs/api/qbreader.api_utils.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/api/qbreader.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Submodules
77
.. toctree::
88
:maxdepth: 4
99

10-
qbreader.api_utils
1110
qbreader.asynchronous
1211
qbreader.synchronous
1312
qbreader.types

docs/conf.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@
3232
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
3333
default_role = "py:obj"
3434

35+
highlight_language = "python3"
36+
37+
autodoc_member_order = "bysource"
38+
autodoc_type_aliases = {
39+
"Async": "qbreader.asynchronous.Async",
40+
"Sync": "qbreader.synchronous.Sync",
41+
"Tossup": "qbreader.types.Tossup",
42+
"Bonus": "qbreader.types.Bonus",
43+
"Category": "qbreader.types.Category",
44+
"Subcategory": "qbreader.types.Subcategory",
45+
"Difficulty": "qbreader.types.Difficulty",
46+
"QueryResponse": "qbreader.types.QueryResponse",
47+
"Directive": "qbreader.types.Directive",
48+
"AnswerJudgement": "qbreader.types.AnswerJudgement",
49+
"Packet": "qbreader.types.Packet",
50+
}
3551

3652
# -- Options for HTML output -------------------------------------------------
3753
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

docs/index.rst

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,45 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to python-qbreader's documentation!
7-
===========================================
6+
python-qbreader
7+
===============
88

99
.. toctree::
1010
:hidden:
1111
:caption: API Reference
1212

1313
qbreader <api/qbreader>
1414

15-
Indices and tables
16-
==================
15+
.. toctree::
16+
:hidden:
17+
:caption: Indices
18+
19+
genindex
20+
modindex
21+
22+
``qbreader`` is a Python wrapper to the qbreader_ API as well as a general quizbowl library. It provides
23+
both asynchronous and synchronous interfaces to the API along with functionality for representing questions.
24+
25+
A small example
26+
---------------
27+
28+
.. code:: python
29+
30+
>>> from qbreader import Sync as qbr # synchronous interface
31+
>>> tossup = qbr.random_tossup()[0]
32+
>>> tossup.question
33+
'Tim Peters wrote 19 “guiding principles” of this programming language, which include the maxim “Complex is better than complicated.” The “pandas” library was written for this language. Unicode string values had to be defined with a “u” in version 2 of this language. Libraries in this language include Tkinter, Tensorflow, (*) NumPy (“numb pie”) and SciPy (“sigh pie”). The framework Django was written in this language. This language uses “duck typing.” Variables in this language are often named “spam” and “eggs.” Guido van Rossum invented, for 10 points, what programming language named for a British comedy troupe?'
34+
>>> tossup.answer
35+
'Python'
36+
>>> tossup.category
37+
<Category.SCIENCE: 'Science'>
38+
>>> tossup.subcategory
39+
<Subcategory.OTHER_SCIENCE: 'Other Science'>
40+
>>> tossup.difficulty
41+
<Difficulty.HS_HARD: '4'>
42+
>>> tossup.set
43+
'2022 Prison Bowl'
44+
>>> (tossup.packet_number, tossup.question_number)
45+
(4, 20)
1746
18-
* :ref:`genindex`
19-
* :ref:`modindex`
20-
* :ref:`search`
47+
.. _qbreader: https://www.qbreader.org/

qbreader/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import importlib.metadata
44

5-
import qbreader.synchronous as Sync
65
from qbreader.asynchronous import Async
6+
from qbreader.synchronous import Sync
77
from qbreader.types import (
88
AnswerJudgement,
99
Bonus,

qbreader/asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import aiohttp
66

7-
import qbreader.api_utils as api_utils
7+
import qbreader._api_utils as api_utils
88
from qbreader._consts import BASE_URL
99
from qbreader.types import (
1010
AnswerJudgement,

0 commit comments

Comments
 (0)