Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions nx_parallel/interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from operator import attrgetter
import networkx as nx
from nx_parallel import algorithms

Expand Down Expand Up @@ -66,14 +65,6 @@ def __str__(self):
return f"Parallel{self.graph_object}"


def assign_algorithms(cls):
"""Class decorator to assign algorithms to the class attributes."""
for attr in ALGORITHMS:
setattr(cls, attr, attrgetter(attr)(algorithms))
return cls


@assign_algorithms
class BackendInterface:
"""BackendInterface class for parallel algorithms."""

Expand All @@ -94,3 +85,7 @@ def convert_to_nx(result, *, name=None):
if isinstance(result, ParallelGraph):
return result.graph_object
return result


for attr in ALGORITHMS:
setattr(BackendInterface, attr, getattr(algorithms, attr))
Loading