Skip to content

Commit

Permalink
change importlib to import
Browse files Browse the repository at this point in the history
  • Loading branch information
porteratzo committed Jan 25, 2024
1 parent 7b1556e commit 35e298c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions openfl/experimental/runtime/local_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,11 @@ def __init__(self, collaborator_actor, collaborator):
collaborator_actor: The collaborator actor.
collaborator: The collaborator.
"""
interface_module = importlib.import_module(
"openfl.experimental.interface"
)
collaborator_class = getattr(interface_module, "Collaborator")
from openfl.experimental.interface import Collaborator
all_methods = [
method
for method in dir(collaborator_class)
if callable(getattr(collaborator_class, method))
for method in dir(Collaborator)
if callable(getattr(Collaborator, method))
]
external_methods = [
method for method in all_methods if (method[0] != "_")
Expand Down Expand Up @@ -223,9 +220,8 @@ def append(
private_attributes_callable (Callable): A callable that sets the private attributes of the collaborator.
**kwargs: Additional keyword arguments.
"""
interface_module = importlib.import_module("openfl.experimental.interface")
collaborator_class = getattr(interface_module, "Collaborator")
self.collaborators[name] = collaborator_class(
from openfl.experimental.interface import Collaborator
self.collaborators[name] = Collaborator(
name=name,
private_attributes_callable=private_attributes_callable,
**kwargs,
Expand Down

0 comments on commit 35e298c

Please sign in to comment.