Skip to content

Commit ac725d8

Browse files
committed
Updating docs
1 parent c985478 commit ac725d8

File tree

11 files changed

+88
-74
lines changed

11 files changed

+88
-74
lines changed

doc-source/api/bases.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
:mod:`domdf_python_tools.bases`
33
*********************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.bases
6+
:autosummary:
87
:members:
98
:undoc-members:

doc-source/api/dates.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
pytz >=2019.1
88

9-
.. contents:: Table of Contents
10-
119

1210
.. warning:: This module has not been fully tested. Use with caution.
1311

1412

1513
.. automodule:: domdf_python_tools.dates
14+
:autosummary:
1615
:members:
1716
:undoc-members:

doc-source/api/doctools.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
:mod:`domdf_python_tools.doctools`
33
**************************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.doctools
6+
:autosummary:
87
:members:
98
:undoc-members:

doc-source/api/pagesizes.rst

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

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.pagesizes
86
:members:
7+
:autosummary:
98
:undoc-members:
109

1110

@@ -14,6 +13,7 @@
1413

1514
.. automodule:: domdf_python_tools.pagesizes.classes
1615
:members:
16+
:autosummary:
1717
:undoc-members:
1818

1919

@@ -22,6 +22,7 @@
2222

2323
.. automodule:: domdf_python_tools.pagesizes.sizes
2424
:members:
25+
:autosummary:
2526
:undoc-members:
2627

2728

@@ -30,13 +31,14 @@
3031

3132
.. automodule:: domdf_python_tools.pagesizes.units
3233
:members:
34+
:autosummary:
3335
:undoc-members:
3436

3537

36-
3738
:mod:`domdf_python_tools.pagesizes.utils`
3839
----------------------------------------------
3940

4041
.. automodule:: domdf_python_tools.pagesizes.utils
4142
:members:
43+
:autosummary:
4244
:undoc-members:

doc-source/api/paths.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
:mod:`domdf_python_tools.paths`
33
**********************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.paths
86
:members:
7+
:autosummary:
98
:undoc-members:

doc-source/api/terminal.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
:mod:`domdf_python_tools.terminal`
33
***********************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.terminal
86
:members:
7+
:autosummary:
98
:undoc-members:

doc-source/api/terminal_colours.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
:mod:`domdf_python_tools.terminal_colours`
33
*******************************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.terminal_colours
86
:members:

doc-source/api/utils.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
:mod:`domdf_python_tools.utils`
33
*********************************
44

5-
.. contents:: Table of Contents
6-
75
.. automodule:: domdf_python_tools.utils
86
:members:
7+
:autosummary:
98
:undoc-members:

doc-source/requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
autodocsumm
22
extras_require
3-
pytz >=2019.1
4-
sphinx >=3.0.3
5-
sphinx-copybutton >=0.2.12
3+
pytz>=2019.1
4+
sphinx-copybutton>=0.2.12
65
sphinx-notfound-page
7-
sphinx-prompt >=1.2.0
8-
sphinx-tabs >=1.1.13
9-
sphinx_autodoc_typehints >=1.11.0
10-
sphinx_rtd_theme
11-
sphinxcontrib-httpdomain >=1.7.0
12-
sphinxemoji >=0.1.6
6+
sphinx-prompt>=1.2.0
7+
sphinx-tabs>=1.1.13
8+
sphinx>=3.0.3
9+
sphinx_autodoc_typehints>=1.11.0
10+
sphinx_rtd_theme<0.4
11+
sphinxcontrib-httpdomain>=1.7.0
12+
sphinxemoji>=0.1.6

domdf_python_tools/terminal_colours.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,23 @@ def clear_line(mode: int = 2) -> str:
9292
return CSI + str(mode) + 'K'
9393

9494

95-
class Color(str):
95+
class Colour(str):
96+
"""
97+
An ANSI escape sequence representing a colour.
98+
99+
:param style: Escape sequence representing the style.
100+
:type style: str
101+
:param stack: The stack to place the escape sequence on.
102+
:type stack: str
103+
:param reset: The escape requence the reset the style.
104+
:type reset: str
105+
"""
106+
96107
style: str
97108
reset: str
98109
stack: List[str]
99110

100-
def __new__(cls, style: str, stack: List[str], reset: str) -> "Color":
111+
def __new__(cls, style: str, stack: List[str], reset: str) -> "Colour":
101112
color = super().__new__(cls, style) # type: ignore
102113
color.style = style
103114
color.stack = stack
@@ -119,17 +130,25 @@ def __call__(self, text) -> str:
119130

120131

121132
class AnsiCodes(ABC):
133+
"""
134+
Abstract base class for ANSI Codes.
135+
"""
136+
122137
_stack: List[str]
123138
_reset: str
124139

125140
def __init__(self) -> None:
126-
# the subclasses declare class attributes which are numbers.
127-
# Upon instantiation we define instance attributes, which are the same
128-
# as the class attributes but wrapped with the ANSI escape sequence
141+
"""
142+
The subclasses declare class attributes which are numbers.
143+
144+
Upon instantiation we define instance attributes, which are the same
145+
as the class attributes but wrapped with the ANSI escape sequence.
146+
"""
147+
129148
for name in dir(self):
130149
if not name.startswith('_'):
131150
value = getattr(self, name)
132-
setattr(self, name, Color(code_to_chars(value), self._stack, self._reset))
151+
setattr(self, name, Colour(code_to_chars(value), self._stack, self._reset))
133152

134153

135154
class AnsiCursor:
@@ -202,6 +221,7 @@ class AnsiFore(AnsiCodes):
202221
ANSI Colour Codes for foreground colour.
203222
204223
Valid values are:
224+
205225
* BLACK
206226
* RED
207227
* GREEN
@@ -250,6 +270,7 @@ class AnsiBack(AnsiCodes):
250270
ANSI Colour Codes for background colour.
251271
252272
Valid values are:
273+
253274
* BLACK
254275
* RED
255276
* GREEN
@@ -298,6 +319,7 @@ class AnsiStyle(AnsiCodes):
298319
ANSI Colour Codes for text style.
299320
300321
Valid values are:
322+
301323
* BRIGHT
302324
* DIM
303325
* NORMAL
@@ -323,5 +345,3 @@ class AnsiStyle(AnsiCodes):
323345
fore_stack.append(Fore.RESET)
324346
back_stack.append(Back.RESET)
325347
style_stack.append(Style.NORMAL)
326-
327-
Fore.GREEN("Hello World")

0 commit comments

Comments
 (0)