Skip to content

Commit 57569c7

Browse files
committed
Ensure all modules have __all__ defined.
1 parent 117f3a9 commit 57569c7

File tree

13 files changed

+110
-0
lines changed

13 files changed

+110
-0
lines changed

domdf_python_tools/bases.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
# 3rd party
3333
import pydash # type: ignore
3434

35+
__all__ = ["Dictable", "NamedList", "namedlist"]
36+
3537

3638
class Dictable(Iterable):
3739
"""

domdf_python_tools/dates.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
from collections import OrderedDict
3636
from typing import Optional, Union
3737

38+
__all__ = [
39+
"current_tzinfo",
40+
"set_timezone",
41+
"utc_timestamp_to_datetime",
42+
"months",
43+
"parse_month",
44+
"get_month_number",
45+
"check_date",
46+
]
47+
48+
3849
try:
3950

4051
# 3rd party
@@ -84,6 +95,10 @@ def get_timezone(tz: str, date: Optional[datetime.datetime] = None) -> Optional[
8495

8596
return pytz.timezone(tz).localize(d).tzinfo
8697

98+
99+
__all__.extend(["get_utc_offset", "get_timezone"])
100+
101+
87102
except ImportError as e: # pragma: no cover
88103

89104
# stdlib

domdf_python_tools/doctools.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131
from textwrap import dedent
3232
from typing import Any, Callable, Optional, Sequence, Type, TypeVar, Union
3333

34+
__all__ = [
35+
"F",
36+
"deindent_string",
37+
"document_object_from_another",
38+
"append_doctring_from_another",
39+
"make_sphinx_links",
40+
"is_documented_by",
41+
"append_docstring_from",
42+
"sphinxify_docstring",
43+
]
44+
45+
3446
F = TypeVar('F', bound=Callable[..., Any])
3547

3648

domdf_python_tools/import_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
from types import ModuleType
5151
from typing import Any, Callable, List, Optional, Type
5252

53+
__all__ = ["discover"]
54+
5355

5456
def discover(
5557
package: ModuleType,

domdf_python_tools/paths.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@
4444
# this package
4545
from domdf_python_tools.typing import PathLike
4646

47+
__all__ = [
48+
"append",
49+
"copytree",
50+
"delete",
51+
"maybe_make",
52+
"parent_path",
53+
"read",
54+
"relpath",
55+
"write",
56+
"clean_writer",
57+
"make_executable",
58+
"PathPlus",
59+
"PosixPathPlus",
60+
"WindowsPathPlus",
61+
]
62+
4763

4864
def append(var: str, filename: PathLike, **kwargs) -> int:
4965
"""

domdf_python_tools/secrets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
# MA 02110-1301, USA.
2626
#
2727

28+
__all__ = ["Secret"]
29+
2830

2931
class Secret(str):
3032
"""

domdf_python_tools/terminal.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@
7070
import textwrap
7171
from typing import Any, Optional, Tuple
7272

73+
__all__ = [
74+
"clear",
75+
"br",
76+
"interrupt",
77+
"overtype",
78+
"get_terminal_size",
79+
"Echo",
80+
]
81+
7382

7483
def clear() -> None:
7584
"""

domdf_python_tools/terminal_colours.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@
6565
from colorama import init # type: ignore
6666
from typing_extensions import Final
6767

68+
__all__ = [
69+
"CSI",
70+
"OSC",
71+
"BEL",
72+
"code_to_chars",
73+
"set_title",
74+
"clear_screen",
75+
"clear_line",
76+
"Colour",
77+
"AnsiCodes",
78+
"AnsiCursor",
79+
"AnsiFore",
80+
"AnsiBack",
81+
"AnsiStyle",
82+
"Fore",
83+
"Back",
84+
"Style",
85+
"Cursor",
86+
]
87+
6888
init()
6989

7090
CSI: Final[str] = "\033["

domdf_python_tools/testing.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Handy functions for testing code.
66
77
Requires `pytest <https://docs.pytest.org/en/stable/>`_ to be installed.
8+
9+
.. versionadded:: 0.4.9
810
"""
911
#
1012
# Copyright © 2020 Dominic Davis-Foster <[email protected]>
@@ -38,6 +40,16 @@
3840
# this package
3941
from domdf_python_tools.utils import Len
4042

43+
__all__ = [
44+
"generate_truthy_values",
45+
"generate_falsy_values",
46+
"testing_boolean_values",
47+
"whitespace",
48+
"whitespace_perms_list",
49+
"whitespace_perms",
50+
"count",
51+
]
52+
4153

4254
def generate_truthy_values(extra_truthy: Sequence = (), ratio: float = 1) -> Iterator[Any]:
4355
"""
@@ -47,6 +59,8 @@ def generate_truthy_values(extra_truthy: Sequence = (), ratio: float = 1) -> Ite
4759
4860
:param extra_truthy: Additional values that should be considered :py:obj:`True`.
4961
:param ratio: The ratio of the number of values to select to the total number of values.
62+
63+
.. versionadded:: 0.4.9
5064
"""
5165

5266
truthy_values = [
@@ -81,6 +95,8 @@ def generate_falsy_values(extra_falsy: Sequence = (), ratio: float = 1) -> Itera
8195
8296
:param extra_falsy: Additional values that should be considered :py:obj:`True`.
8397
:param ratio: The ratio of the number of values to select to the total number of values.
98+
99+
.. versionadded:: 0.4.9
84100
"""
85101

86102
falsy_values = [
@@ -124,6 +140,8 @@ def testing_boolean_values(
124140
:param extra_truthy: Additional values that should be considered :py:obj:`True`.
125141
:param extra_falsy: Additional values that should be considered :py:obj:`False`.
126142
:param ratio: The ratio of the number of values to select to the total number of values.
143+
144+
.. versionadded:: 0.4.9
127145
"""
128146

129147
truthy = generate_truthy_values(extra_truthy, ratio)
@@ -157,6 +175,8 @@ def whitespace_perms(ratio: float = 0.5) -> MarkDecorator:
157175
The single parametrized argument is ``char``.
158176
159177
:param ratio: The ratio of the number of permutations to select to the total number of permutations.
178+
179+
.. versionadded:: 0.4.9
160180
"""
161181

162182
perms = whitespace_perms_list()
@@ -173,6 +193,8 @@ def count(stop: int, start: int = 0, step: int = 1) -> MarkDecorator:
173193
:param stop: The stop value passed to :class:`range`.
174194
:param start: The start value passed to :class:`range`.
175195
:param step: The step passed to :class:`range`.
196+
197+
.. versionadded:: 0.4.9
176198
"""
177199

178200
return pytest.mark.parametrize("count", range(start, stop, step))

domdf_python_tools/typing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
from decimal import Decimal
3030
from typing import Any, Type, Union
3131

32+
__all__ = ["PathLike", "AnyNumber", "check_membership"]
33+
34+
3235
#: Type hint for objects that represent filesystem paths.
3336
PathLike = Union[str, pathlib.Path, os.PathLike]
3437

0 commit comments

Comments
 (0)