Skip to content

Commit

Permalink
fix tests but undo magic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Oct 18, 2024
1 parent 3622ab1 commit 0a989ca
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 47 deletions.
92 changes: 46 additions & 46 deletions znflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,40 +217,40 @@ def __getattribute__(self, __name: str) -> Any:
"Connection does not support further attributes to its result."
) from e

def __eq__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __eq__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__eq__(other)
# return resolve(self).__eq__(other)

def __lt__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __lt__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__lt__(other)
# return resolve(self).__lt__(other)

def __le__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __le__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__le__(other)
# return resolve(self).__le__(other)

def __gt__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __gt__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__gt__(other)
# return resolve(self).__gt__(other)

def __ge__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __ge__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__ge__(other)
# return resolve(self).__ge__(other)

def __iter__(self):
from znflow import resolve
# def __iter__(self):
# from znflow import resolve

return resolve(self).__iter__()
# return resolve(self).__iter__()


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -363,37 +363,37 @@ def __radd__(self, other):
"""Enable 'sum([a, b], [])'"""
return self if other == [] else self.__add__(other)

def __eq__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __eq__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__eq__(other)
# return resolve(self).__eq__(other)

def __lt__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __lt__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__lt__(other)
# return resolve(self).__lt__(other)

def __le__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __le__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__le__(other)
# return resolve(self).__le__(other)

def __gt__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __gt__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__gt__(other)
# return resolve(self).__gt__(other)

def __ge__(self, other) -> bool:
"""Overwrite for dynamic break points."""
from znflow import resolve
# def __ge__(self, other) -> bool:
# """Overwrite for dynamic break points."""
# from znflow import resolve

return resolve(self).__ge__(other)
# return resolve(self).__ge__(other)

def __iter__(self):
from znflow import resolve
# def __iter__(self):
# from znflow import resolve

return resolve(self).__iter__()
# return resolve(self).__iter__()
4 changes: 3 additions & 1 deletion znflow/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ def add_node(self, node_for_adding, this_uuid=None, **attr):
self._update_function_future_arguments(node_for_adding)

def add_connections(self, u_of_edge, v_of_edge, **attr):
log.debug(f"Add edge between {u_of_edge=} and {v_of_edge=}.")
with contextlib.suppress(TypeError):
# zninit does not like __repr__
log.debug(f"Add edge between {u_of_edge=} and {v_of_edge=}.")
if isinstance(u_of_edge, Connection) and isinstance(v_of_edge, NodeBaseMixin):
if u_of_edge.uuid not in self:
if u_of_edge._external_:
Expand Down

0 comments on commit 0a989ca

Please sign in to comment.