From d9ed3b08783c83df5e27ec5b208dbd7215e4956b Mon Sep 17 00:00:00 2001 From: voetberg Date: Thu, 4 Apr 2024 13:21:17 -0500 Subject: [PATCH] Update pr with all bones updates, update linter to fix check results --- .github/workflows/lint.yml | 4 ++-- src/data/data.py | 2 +- src/plots/__init__.py | 4 ---- src/plots/plot.py | 13 +++++-------- src/utils/defaults.py | 6 +++--- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d8bad0c..8af095c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,9 +18,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 + pip install ruff - name: Lint code - run: flake8 . + run: ruff check --fix # Add other steps as needed, such as running additional linters or formatters \ No newline at end of file diff --git a/src/data/data.py b/src/data/data.py index fbd87fb..a839811 100644 --- a/src/data/data.py +++ b/src/data/data.py @@ -14,7 +14,7 @@ def _load_simulator(self, name): try: simulator_path = os.environ[f"{Defaults['common']['sim_location']}:{name}"] except KeyError as e: - raise RuntimeError(f"Simulator cannot be found using env var {e}. Hint: have you registed your simulation with utils.register_simulator?") + raise RuntimeError(f"Simulator cannot be found using env var {e}. Hint: have you registered your simulation with utils.register_simulator?") new_class = os.path.dirname(simulator_path) sys.path.insert(1, new_class) diff --git a/src/plots/__init__.py b/src/plots/__init__.py index 4810846..b8536cc 100644 --- a/src/plots/__init__.py +++ b/src/plots/__init__.py @@ -1,7 +1,3 @@ -from typing import TypeVar -from src.plots.plot import Display - -display = TypeVar("display", Display) Plots = { } \ No newline at end of file diff --git a/src/plots/plot.py b/src/plots/plot.py index ff385cb..3f16c81 100644 --- a/src/plots/plot.py +++ b/src/plots/plot.py @@ -3,22 +3,19 @@ import matplotlib.pyplot as plt from matplotlib import rcParams -from src.data import data -from src.models import model - -from src.utils.config import get_item, get_section +from utils.config import get_item, get_section class Display: - def __init__(self, model:model, data:data, save:bool, show:bool, out_path:Optional[str]): + def __init__(self, model, data, save:bool, show:bool, out_path:Optional[str]): self.save = save self.show = show self.out_path = out_path.rstrip("/") if self.save: assert self.out_path is not None, "out_path required to save files." - if not os.path.exists(os.path.dirname(out_path)): - os.makedirs(os.path.dirname(out_path)) - + if not os.path.exists(os.path.dirname(out_path)): + os.makedirs(os.path.dirname(out_path)) + self.model = model self._data_setup(data) self._common_settings() diff --git a/src/utils/defaults.py b/src/utils/defaults.py index e251dd8..1023c61 100644 --- a/src/utils/defaults.py +++ b/src/utils/defaults.py @@ -1,8 +1,8 @@ Defaults = { "common":{ - "out_dir":"./DeepDiagonisticsResources/results/", - "temp_config": "./DeepDiagonisticsResources/temp/temp_config.yml", - "sim_location": "DeepDiagonisticsResources_Simulators" + "out_dir":"./DeepDiagnosticsResources/results/", + "temp_config": "./DeepDiagnosticsResources/temp/temp_config.yml", + "sim_location": "DeepDiagnosticsResources_Simulators" }, "model": { "model_engine": "SBIModel"