Skip to content

Commit

Permalink
Use __all__ to advertise public API.
Browse files Browse the repository at this point in the history
Closes #324.

Note that non-public symbols are still accessible, and that some
applications, such as iPython, will ignore __all__ when offering
tab-completion suggestions.
  • Loading branch information
grahamgower committed Jun 24, 2021
1 parent 8ec4796 commit 215a041
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
23 changes: 23 additions & 0 deletions demes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,26 @@
dump_all,
)
from .ms import from_ms

__all__ = [
"__version__",
"Builder",
"Epoch",
"AsymmetricMigration",
"Pulse",
"Deme",
"Graph",
"Split",
"Branch",
"Merge",
"Admix",
"load_asdict",
"loads_asdict",
"load",
"loads",
"load_all",
"dump",
"dumps",
"dump_all",
"from_ms",
]
13 changes: 13 additions & 0 deletions demes/demes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@

from .load_dump import dumps as demes_dumps

__all__ = [
"Builder",
"Epoch",
"AsymmetricMigration",
"Pulse",
"Deme",
"Graph",
"Split",
"Branch",
"Merge",
"Admix",
]

Number = Union[int, float]
Name = str
Time = Number
Expand Down
2 changes: 2 additions & 0 deletions demes/hypothesis_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import demes

__all__ = ["graphs"]


def prec32(x):
"""truncate x to the nearest single-precision floating point number"""
Expand Down
11 changes: 11 additions & 0 deletions demes/load_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@

import demes

__all__ = [
"load_asdict",
"loads_asdict",
"load",
"loads",
"load_all",
"dump",
"dumps",
"dump_all",
]


@contextlib.contextmanager
def _open_file_polymorph(polymorph, mode="r"):
Expand Down
2 changes: 2 additions & 0 deletions demes/ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import demes
from .demes import finite, positive, non_negative, unit_interval

__all__ = ["from_ms"]

logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 215a041

Please sign in to comment.