Skip to content

Commit bccc966

Browse files
committed
Updated docs.
1 parent cc058ce commit bccc966

File tree

9 files changed

+49
-162
lines changed

9 files changed

+49
-162
lines changed

doc-source/api/pagesizes/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
:mod:`domdf_python_tools.pagesizes`
33
=========================================
44

5+
.. automodule:: domdf_python_tools.pagesizes
6+
:no-members:
7+
8+
59
.. toctree::
610
:caption: Submodules
711
:glob:
812

913
*
10-
11-
.. automodule:: domdf_python_tools.pagesizes
12-
:undoc-members:

doc-source/autodoc_augment_defaults.py

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

doc-source/conf.py

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
import re
88
import sys
99

10-
# 3rd party
11-
from sphinx.locale import _
12-
1310
sys.path.append(os.path.abspath('.'))
1411
sys.path.append(os.path.abspath('..'))
1512

@@ -37,26 +34,27 @@
3734
package_root = "domdf_python_tools"
3835

3936
extensions = [
40-
'sphinx.ext.intersphinx',
41-
'sphinx.ext.autodoc',
42-
'sphinx.ext.mathjax',
43-
'sphinx.ext.viewcode',
44-
'sphinxcontrib.httpdomain',
45-
'sphinxcontrib.extras_require',
46-
'sphinx.ext.todo',
47-
'sphinxemoji.sphinxemoji',
37+
'autodocsumm',
4838
'notfound.extension',
49-
'sphinx_tabs.tabs',
39+
'seed_intersphinx_mapping',
5040
'sphinx-prompt',
41+
'sphinx.ext.autodoc',
42+
'sphinx.ext.autosectionlabel',
5143
'sphinx.ext.autosummary',
52-
'autodocsumm',
44+
'sphinx.ext.intersphinx',
45+
'sphinx.ext.mathjax',
46+
'sphinx.ext.todo',
47+
'sphinx.ext.viewcode',
48+
'sphinx_autodoc_typehints',
5349
'sphinx_copybutton',
50+
'sphinx_tabs.tabs',
51+
'sphinx_toolbox',
52+
'sphinx_toolbox.autodoc_augment_defaults',
5453
'sphinxcontrib.default_values',
54+
'sphinxcontrib.extras_require',
55+
'sphinxcontrib.httpdomain',
5556
'sphinxcontrib.toctree_plus',
56-
'seed_intersphinx_mapping',
57-
'autodoc_augment_defaults',
58-
'sphinx.ext.autosectionlabel',
59-
'sphinx_autodoc_typehints',
57+
'sphinxemoji.sphinxemoji',
6058
]
6159

6260
sphinxemoji_style = 'twemoji'
@@ -127,31 +125,3 @@
127125
"__hash__",
128126
]),
129127
}
130-
131-
132-
# Extensions to theme docs
133-
def setup(app):
134-
from sphinx.domains.python import PyField
135-
from sphinx.util.docfields import Field
136-
137-
app.add_object_type(
138-
'confval',
139-
'confval',
140-
objname='configuration value',
141-
indextemplate='pair: %s; configuration value',
142-
doc_field_types=[
143-
PyField(
144-
'type',
145-
label=_('Type'),
146-
has_arg=False,
147-
names=('type', ),
148-
bodyrolename='class',
149-
),
150-
Field(
151-
'default',
152-
label=_('Default'),
153-
has_arg=False,
154-
names=('default', ),
155-
),
156-
]
157-
)

doc-source/index.rst

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -116,34 +116,12 @@ Installation
116116

117117
.. start installation
118118
119-
.. tabs::
119+
.. installation:: domdf_python_tools
120+
:pypi:
121+
:github:
122+
:anaconda:
123+
:conda-channels: domdfcoding, conda-forge
120124

121-
.. tab:: from PyPI
122-
123-
.. prompt:: bash
124-
125-
python3 -m pip install domdf_python_tools --user
126-
127-
.. tab:: from Anaconda
128-
129-
First add the required channels
130-
131-
.. prompt:: bash
132-
133-
conda config --add channels http://conda.anaconda.org/domdfcoding
134-
conda config --add channels http://conda.anaconda.org/conda-forge
135-
136-
Then install
137-
138-
.. prompt:: bash
139-
140-
conda install domdf_python_tools
141-
142-
.. tab:: from GitHub
143-
144-
.. prompt:: bash
145-
146-
python3 -m pip install git+https://github.com/domdfcoding/domdf_python_tools@master --user
147125

148126
.. end installation
149127

doc-source/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
autodocsumm>=0.2.0
22
default_values>=0.0.8
3-
domdf_sphinx_theme>=0.0.11
3+
domdf_sphinx_theme>=0.1.0
44
extras_require
5-
pytz>=2019.1
6-
seed_intersphinx_mapping>=0.1.0
5+
seed_intersphinx_mapping>=0.1.1
76
sphinx>=3.0.3
87
sphinx-copybutton>=0.2.12
98
sphinx-notfound-page
109
sphinx-prompt>=1.2.0
1110
sphinx-tabs>=1.1.13
11+
sphinx-toolbox>=0.1.0
1212
sphinxcontrib-httpdomain>=1.7.0
1313
sphinxemoji>=0.1.6
14-
toctree_plus>=0.0.2
14+
toctree_plus>=0.0.3
1515
git+git://github.com/domdfcoding/sphinx-autodoc-typehints.git@typevar-as-pydata

domdf_python_tools/secrets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
Functions for working with secrets, such as API tokens.
66
7-
..versionadded:: 0.4.6
7+
.. versionadded:: 0.4.6
88
"""
99
#
1010
# Copyright © 2020 Dominic Davis-Foster <[email protected]>
@@ -44,7 +44,7 @@ class Secret(str):
4444
>>> Secret("Barry as FLUFL") == "Barry as FLUFL"
4545
True
4646
47-
..versionadded:: 0.4.6
47+
.. versionadded:: 0.4.6
4848
"""
4949

5050
value: str #: The actual value of the secret.

domdf_python_tools/terminal.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ def get_terminal_size() -> Tuple[int, int]: # pragma: no cover
149149
150150
Works on Linux, macOS, Windows, and Cygwin.
151151
152-
Based on http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
153-
154-
:return: tuple_xy
152+
:return: Screen width and screen height.
155153
"""
156154

157155
current_os = platform.system()
@@ -249,7 +247,6 @@ class Echo:
249247
Context manager for echoing variable assignments (in CPython).
250248
251249
:param indent: The indentation of the dictionary of variable assignments.
252-
:type indent: str, optional
253250
"""
254251

255252
def __init__(self, indent: str = " "):
@@ -262,9 +259,17 @@ def __init__(self, indent: str = " "):
262259
self.parent_frame = inspect.currentframe().f_back # type: ignore # TODO
263260

264261
def __enter__(self):
262+
"""
263+
Called when entering the context manager.
264+
"""
265+
265266
self.locals_on_entry = self.parent_frame.f_locals.copy() # type: ignore
266267

267-
def __exit__(self, exc_t, exc_v, tb):
268+
def __exit__(self, *args, **kwargs):
269+
"""
270+
Called when exiting the context manager.
271+
"""
272+
268273
new_locals = {
269274
k: v
270275
for k,

domdf_python_tools/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def cmp(x, y) -> int:
140140
141141
Compare the two objects x and y and return an integer according to the outcome.
142142
143-
The return value is negative if x < y, zero if x == y and strictly positive if x > y.
143+
The return value is negative if ``x < y``, zero if ``x == y`` and strictly positive if ``x > y``.
144144
"""
145145

146146
return int((x > y) - (x < y))
@@ -199,7 +199,7 @@ def printt(obj: Any, *args, **kwargs) -> None:
199199
print(type(obj), *args, **kwargs)
200200

201201

202-
def stderr_writer(*args, **kwargs):
202+
def stderr_writer(*args, **kwargs) -> None:
203203
"""
204204
Write to stderr, flushing stdout beforehand and stderr afterwards.
205205
"""
@@ -239,7 +239,7 @@ def str2tuple(input_string: str, sep: str = ',') -> Tuple[int, ...]:
239239
240240
The input string must represent a comma-separated series of integers.
241241
242-
TODO: Allow custom types, not just ``int`` (making ``int`` the default)
242+
.. TODO:: Allow custom types, not just ``int`` (making ``int`` the default)
243243
244244
:param input_string: The string to be converted into a tuple
245245
:type input_string: str
@@ -277,9 +277,10 @@ def strtobool(val: Union[str, bool]) -> bool:
277277

278278
def enquote_value(value: Any) -> Union[str, bool, float]:
279279
"""
280-
Adds quotes to the given value, suitable for use in a templating system such as Jinja2.
280+
Adds quotes (``'``) to the given value, suitable for use in a templating system such as Jinja2.
281281
282-
floats, integers, booleans, None, and the strings "True", "False" and "None" are returned as-is.
282+
:class:`Floats <float>`, :class:`integers <int>`, :class:`booleans <bool>`, :py:obj:`None`,
283+
and the strings ``'True'``, ``'False'`` and ``'None'`` are returned as-is.
283284
284285
:param value: The value to enquote
285286
"""

domdf_python_tools/words.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
Functions for working with (English) words.
66
7-
..versionadded:: 0.4.5
7+
.. versionadded:: 0.4.5
88
"""
99
# stdlib
1010
#
@@ -44,7 +44,6 @@
4444
import domdf_python_tools
4545
from domdf_python_tools.paths import PathPlus
4646

47-
4847
__all__ = ["get_words_list", "get_random_word"]
4948

5049

@@ -60,7 +59,7 @@ def get_words_list(min_length: int = 0, max_length: int = -1) -> List[str]:
6059
6160
:return: The list of words meeting the above specifiers.
6261
63-
..versionadded:: 0.4.5
62+
.. versionadded:: 0.4.5
6463
"""
6564

6665
with importlib_resources.path(domdf_python_tools, "google-10000-english-no-swears.txt") as words_file_:
@@ -88,7 +87,7 @@ def get_random_word(min_length: int = 0, max_length: int = -1) -> str:
8887
8988
:return: A random word meeting the above specifiers.
9089
91-
..versionadded:: 0.4.5
90+
.. versionadded:: 0.4.5
9291
"""
9392

9493
words_list = get_words_list(min_length=min_length, max_length=max_length)

0 commit comments

Comments
 (0)