Skip to content

Commit 5369282

Browse files
committed
Updated docs.
1 parent c90e59e commit 5369282

File tree

18 files changed

+241
-189
lines changed

18 files changed

+241
-189
lines changed

doc-source/api/words.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
.. automodulesumm:: domdf_python_tools.words
99

10+
.. autovariable:: domdf_python_tools.words.CR
11+
.. autovariable:: domdf_python_tools.words.LF
12+
.. autovariable:: domdf_python_tools.words.TAB
13+
1014
.. autovariable:: domdf_python_tools.words.ascii_digits
1115
.. autovariable:: domdf_python_tools.words.greek_uppercase
1216
.. autovariable:: domdf_python_tools.words.greek_lowercase

domdf_python_tools/bases.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ class UserList(MutableSequence[_T]):
132132
133133
Class that simulates a list. The instance’s contents are kept in a regular list,
134134
which is accessible via the :attr:`~.UserList.data` attribute of UserList instances.
135-
The instance’s contents are initially set to a copy of list, defaulting to the
136-
empty list ``[]``.
135+
The instance’s contents are initially set to a copy of list, defaulting to the empty list ``[]``.
136+
137+
.. versionadded:: 0.10.0
137138
138139
:param initlist: Values to initialise the :class:`~domdf_python_tools.bases.UserList` with.
139140
:default initlist: ``[]``
140141
141-
142142
.. admonition:: Subclassing requirements
143143
144144
Subclasses of UserList are expected to offer a constructor which can be called with
@@ -150,8 +150,6 @@ class UserList(MutableSequence[_T]):
150150
If a derived class does not wish to comply with this requirement, all of the special
151151
methods supported by this class will need to be overridden; please consult the
152152
sources for information about the methods which need to be provided in that case.
153-
154-
.. versionadded:: 0.10.0
155153
"""
156154

157155
#: A real list object used to store the contents of the :class:`~domdf_python_tools.bases.UserList`.
@@ -371,11 +369,11 @@ def extend(self, other: Iterable[_T]) -> None:
371369
@prettify_docstrings
372370
class UserFloat(Real):
373371
"""
374-
Class that simulates a float.
375-
376-
:param value: Values to initialise the :class:`~domdf_python_tools.bases.UserFloat` with.
372+
Class which simulates a float.
377373
378374
.. versionadded:: 1.6.0
375+
376+
:param value: Values to initialise the :class:`~domdf_python_tools.bases.UserFloat` with.
379377
"""
380378

381379
def __init__(self, value: Union[SupportsFloat, SupportsIndex, str, bytes, bytearray] = 0.0):
@@ -471,6 +469,16 @@ def __trunc__(self) -> int:
471469
return float(self).__trunc__()
472470

473471
def __round__(self, ndigits: Optional[int] = None) -> Union[int, float]: # type: ignore
472+
"""
473+
Round the :class:`~.UserFloat` to ``ndigits`` decimal places, defaulting to ``0``.
474+
475+
If ``ndigits`` is omitted or :py:obj:`None`, returns an :class:`int`,
476+
otherwise returns a :class:`float`.
477+
Rounds half toward even.
478+
479+
:param ndigits:
480+
"""
481+
474482
return float(self).__round__(ndigits)
475483

476484
def __eq__(self, other: object) -> bool:
@@ -548,9 +556,11 @@ def __bool__(self) -> bool:
548556

549557
def __complex__(self) -> complex:
550558
"""
551-
Returrn :func:`complex(self) <complex>``.
559+
Return :class:`complex(self) <complex>`.
560+
561+
.. code-block:: python
552562
553-
``complex(self) == complex(float(self), 0)``
563+
complex(self) == complex(float(self), 0)
554564
"""
555565

556566
return super().__complex__()

domdf_python_tools/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ def calc_easter(year: int) -> datetime.date:
243243
"""
244244
Returns the date of Easter in the given year.
245245
246-
:param year:
247-
248246
.. versionadded:: 1.4.0
247+
248+
:param year:
249249
"""
250250

251251
a = year % 19

domdf_python_tools/doctools.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,13 @@ def wrapper(target: F) -> F:
307307

308308
def _do_prettify(obj: Type, base: Type, new_docstrings: Dict[str, str]):
309309
"""
310-
Perform the actual prettification for :func`~.prettify_docstrings`.
310+
Perform the actual prettifying for :func`~.prettify_docstrings`.
311+
312+
.. versionadded:: 0.8.0
311313
312314
:param obj:
313315
:param base:
314316
:param new_docstrings:
315-
316-
:rtype:
317-
318-
.. versionadded:: 0.8.0
319317
"""
320318

321319
for attr_name in new_docstrings:
@@ -349,11 +347,9 @@ def prettify_docstrings(obj: Type) -> Type:
349347
"""
350348
Decorator to prettify the default :class:`object` docstrings for use in Sphinx documentation.
351349
352-
:param obj: The object to prettify the method docstrings for.
353-
354-
:rtype:
355-
356350
.. versionadded:: 0.8.0
351+
352+
:param obj: The object to prettify the method docstrings for.
357353
"""
358354

359355
repr_docstring = f"Return a string representation of the :class:`~{obj.__module__}.{obj.__name__}`."

domdf_python_tools/import_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ def discover_entry_points(
148148
"""
149149
Returns a list of entry points in the given category, optionally filtered by ``match_func``.
150150
151+
.. versionadded:: 1.1.0
152+
151153
:param group_name: The entry point group name, e.g. ``'entry_points'``.
152154
:param match_func: Function taking an object and returning :py:obj:`True`
153155
if the object is to be included in the output.
154156
:default match_func: :py:obj:`None`, which includes all objects.
155157
156158
:return: List of matching objects.
157-
158-
.. versionadded:: 1.1.0
159159
"""
160160

161161
matching_objects = []

0 commit comments

Comments
 (0)