Skip to content

Commit

Permalink
feat(config): add "reinit" parameter to initialize method
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jun 21, 2023
1 parent e82f270 commit 57e93cb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/hyfi/__global__/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def init_workspace(
global_workspace_name: str = "",
num_workers: int = -1,
log_level: str = "",
reinit: bool = False,
autotime: bool = True,
retina: bool = True,
verbose: Union[bool, int] = False,
Expand Down Expand Up @@ -199,9 +200,13 @@ def init_workspace(
# Set the retina matplotlib formats.
if retina:
NBs.set_matplotlib_formats("retina")
self.initialize()
self.initialize(reinit=reinit)

def initialize(self, config: Union[DictConfig, Dict, None] = None):
def initialize(
self,
config: Union[DictConfig, Dict, None] = None,
reinit: bool = False,
):
"""
Initialize hyfi.
Expand All @@ -213,8 +218,8 @@ def initialize(self, config: Union[DictConfig, Dict, None] = None):
"""
"""Initialize hyfi config"""
# Returns the current value of the __initilized__ attribute.
# if self.__initilized__:
# return
if self.__initilized__ and not reinit:
return
__hydra_config__.hyfi_config_module = self.hyfi_config_module
__hydra_config__.hyfi_config_path = self.hyfi_config_path
__hydra_config__.hyfi_user_config_path = self.hyfi_user_config_path
Expand Down

0 comments on commit 57e93cb

Please sign in to comment.