Skip to content

Commit

Permalink
Remove singleton pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-f-cruz committed Sep 5, 2024
1 parent 8f522c7 commit 0760773
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
12 changes: 0 additions & 12 deletions src/aind_behavior_services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,3 @@ def get_commit_hash(repository: Optional[PathLike] = None) -> str:
return repo.head.commit.hexsha
except git.InvalidGitRepositoryError as e:
raise e("Not a git repository. Please run from the root of the repository.") from e


def singleton(class_):
# from https://stackoverflow.com/questions/6760685/what-is-the-best-way-of-implementing-singleton-in-python
instances = {}

def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]

return getinstance
2 changes: 0 additions & 2 deletions src/aind_behavior_services/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
)
from aind_behavior_services.aind_services import data_mapper
from aind_behavior_services.aind_services.watchdog import Watchdog
from aind_behavior_services.base import singleton
from aind_behavior_services.db_utils import SubjectDataBase, SubjectEntry
from aind_behavior_services.utils import format_datetime, run_bonsai_process

Expand All @@ -32,7 +31,6 @@
TTaskLogic = TypeVar("TTaskLogic", bound=AindBehaviorTaskLogicModel) # pylint: disable=invalid-name


@singleton
class Launcher(Generic[TRig, TSession, TTaskLogic]):
RIG_DIR = "Rig"
SUBJECT_DIR = "Subjects"
Expand Down

0 comments on commit 0760773

Please sign in to comment.