-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaks `daft.py` into submodules. Signed-off-by: nstarman <nstarman@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
241 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Code for Daft""" | ||
|
||
from importlib.metadata import version as get_distribution | ||
|
||
from . import _core, _exceptions, _utils | ||
from ._core import PGM, Node, Edge, Plate, Text | ||
from ._exceptions import SameLocationError | ||
from ._utils import _rendering_context, _pop_multiple | ||
|
||
__version__ = get_distribution("daft") | ||
__all__ = [] | ||
__all__ += _core.__all__ | ||
__all__ += _exceptions.__all__ | ||
__all__ += _utils.__all__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Daft errors""" | ||
|
||
__all__: list[str] = [] | ||
|
||
|
||
class SameLocationError(Exception): | ||
""" | ||
Exception to notify if two nodes are in the same position in the plot. | ||
:param edge: | ||
The Edge object whose nodes are being added. | ||
""" | ||
|
||
def __init__(self, edge): | ||
self.message = ( | ||
"Attempted to add edge between `{}` and `{}` but they " | ||
+ "share the same location." | ||
).format(edge.node1.name, edge.node2.name) | ||
super().__init__(self.message) |
Oops, something went wrong.