From fee8bfb1df68eb32bc22c0b8052ac4c7f9026255 Mon Sep 17 00:00:00 2001 From: Niko Yasui Date: Thu, 31 Oct 2024 16:29:22 -0600 Subject: [PATCH 1/3] refactor: renamed all files to underscore_case --- ml_experiment/Scheduler.py | 2 +- ml_experiment/{DefinitionPart.py => definition_part.py} | 2 +- .../{ExperimentDefinition.py => experiment_definition.py} | 2 +- .../metadata/{MetadataTable.py => metadata_table.py} | 0 ...{MetadataTableRegistry.py => metadata_table_registry.py} | 2 +- tests/acceptance/my_experiment.py | 2 +- tests/acceptance/test_softmaxAC_mc.py | 6 +++--- tests/metadata/test_MetadataTableRegistry.py | 4 ++-- tests/test_DefinitionPart.py | 2 +- tests/test_ExperimentDefinition.py | 4 ++-- tests/test_generate_configurations.py | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) rename ml_experiment/{DefinitionPart.py => definition_part.py} (97%) rename ml_experiment/{ExperimentDefinition.py => experiment_definition.py} (95%) rename ml_experiment/metadata/{MetadataTable.py => metadata_table.py} (100%) rename ml_experiment/metadata/{MetadataTableRegistry.py => metadata_table_registry.py} (98%) diff --git a/ml_experiment/Scheduler.py b/ml_experiment/Scheduler.py index de40ec1..c1ea1e3 100644 --- a/ml_experiment/Scheduler.py +++ b/ml_experiment/Scheduler.py @@ -10,7 +10,7 @@ from itertools import product from multiprocessing.pool import Pool import subprocess -from ml_experiment.metadata.MetadataTableRegistry import MetadataTableRegistry +from ml_experiment.metadata.metadata_table_registry import MetadataTableRegistry class RunSpec(NamedTuple): part_name: str diff --git a/ml_experiment/DefinitionPart.py b/ml_experiment/definition_part.py similarity index 97% rename from ml_experiment/DefinitionPart.py rename to ml_experiment/definition_part.py index d39f34b..2148ab7 100644 --- a/ml_experiment/DefinitionPart.py +++ b/ml_experiment/definition_part.py @@ -6,7 +6,7 @@ import ml_experiment._utils.sqlite as sqlu from ml_experiment._utils.path import get_results_path -from ml_experiment.metadata.MetadataTableRegistry import MetadataTableRegistry +from ml_experiment.metadata.metadata_table_registry import MetadataTableRegistry ValueType = int | float | str | bool diff --git a/ml_experiment/ExperimentDefinition.py b/ml_experiment/experiment_definition.py similarity index 95% rename from ml_experiment/ExperimentDefinition.py rename to ml_experiment/experiment_definition.py index cb13225..a95ae1b 100644 --- a/ml_experiment/ExperimentDefinition.py +++ b/ml_experiment/experiment_definition.py @@ -2,7 +2,7 @@ import os import sqlite3 -from ml_experiment.metadata.MetadataTable import MetadataTable +from ml_experiment.metadata.metadata_table import MetadataTable from ml_experiment._utils.path import get_results_path class ExperimentDefinition: diff --git a/ml_experiment/metadata/MetadataTable.py b/ml_experiment/metadata/metadata_table.py similarity index 100% rename from ml_experiment/metadata/MetadataTable.py rename to ml_experiment/metadata/metadata_table.py diff --git a/ml_experiment/metadata/MetadataTableRegistry.py b/ml_experiment/metadata/metadata_table_registry.py similarity index 98% rename from ml_experiment/metadata/MetadataTableRegistry.py rename to ml_experiment/metadata/metadata_table_registry.py index c07fc86..63f4727 100644 --- a/ml_experiment/metadata/MetadataTableRegistry.py +++ b/ml_experiment/metadata/metadata_table_registry.py @@ -3,7 +3,7 @@ from typing import Dict, Iterable from ml_experiment._utils.maybe import Maybe -from ml_experiment.metadata.MetadataTable import MetadataTable, ValueType +from ml_experiment.metadata.metadata_table import MetadataTable, ValueType class MetadataTableRegistry: def __init__(self): diff --git a/tests/acceptance/my_experiment.py b/tests/acceptance/my_experiment.py index 1d863f0..5588eb7 100644 --- a/tests/acceptance/my_experiment.py +++ b/tests/acceptance/my_experiment.py @@ -2,7 +2,7 @@ import os import random -from ml_experiment.ExperimentDefinition import ExperimentDefinition +from ml_experiment.experiment_definition import ExperimentDefinition parser = argparse.ArgumentParser() parser.add_argument("--part", type=str, required=True) diff --git a/tests/acceptance/test_softmaxAC_mc.py b/tests/acceptance/test_softmaxAC_mc.py index e1f6184..9f668d5 100644 --- a/tests/acceptance/test_softmaxAC_mc.py +++ b/tests/acceptance/test_softmaxAC_mc.py @@ -1,9 +1,9 @@ import os import pytest -from ml_experiment.ExperimentDefinition import ExperimentDefinition -from ml_experiment.DefinitionPart import DefinitionPart -from ml_experiment.Scheduler import LocalRunConfig, Scheduler +from ml_experiment.experiment_definition import ExperimentDefinition +from ml_experiment.definition_part import DefinitionPart +from ml_experiment.Scheduler import LocalRunConfig, RunSpec, Scheduler @pytest.fixture diff --git a/tests/metadata/test_MetadataTableRegistry.py b/tests/metadata/test_MetadataTableRegistry.py index 07904f7..2d86ba4 100644 --- a/tests/metadata/test_MetadataTableRegistry.py +++ b/tests/metadata/test_MetadataTableRegistry.py @@ -1,8 +1,8 @@ import os import sqlite3 -from ml_experiment.DefinitionPart import DefinitionPart -from ml_experiment.metadata.MetadataTableRegistry import MetadataTableRegistry +from ml_experiment.definition_part import DefinitionPart +from ml_experiment.metadata.metadata_table_registry import MetadataTableRegistry def test_get_parts(tmp_path): diff --git a/tests/test_DefinitionPart.py b/tests/test_DefinitionPart.py index c89a5f4..72ca82c 100644 --- a/tests/test_DefinitionPart.py +++ b/tests/test_DefinitionPart.py @@ -1,4 +1,4 @@ -from ml_experiment.DefinitionPart import DefinitionPart +from ml_experiment.definition_part import DefinitionPart def test_add_sweepable_property(): diff --git a/tests/test_ExperimentDefinition.py b/tests/test_ExperimentDefinition.py index 787fa14..0686ab3 100644 --- a/tests/test_ExperimentDefinition.py +++ b/tests/test_ExperimentDefinition.py @@ -1,7 +1,7 @@ import os -from ml_experiment.DefinitionPart import DefinitionPart -from ml_experiment.ExperimentDefinition import ExperimentDefinition +from ml_experiment.definition_part import DefinitionPart +from ml_experiment.experiment_definition import ExperimentDefinition def test_ExperimentDefinition(tmp_path): diff --git a/tests/test_generate_configurations.py b/tests/test_generate_configurations.py index f6b14d0..84290eb 100644 --- a/tests/test_generate_configurations.py +++ b/tests/test_generate_configurations.py @@ -1,4 +1,4 @@ -from ml_experiment import DefinitionPart as dp +from ml_experiment import definition_part as dp def init_esarsa_mc(tmp_path, alphas: list[float], epsilons: list[float], n_steps: list[int]): From 6e1c7096e8fb1cb99d3ec1a7d977c6348cfd16bb Mon Sep 17 00:00:00 2001 From: Niko Yasui Date: Thu, 31 Oct 2024 16:32:05 -0600 Subject: [PATCH 2/3] refactor: moved definition_part tests to tests/definition_part --- tests/definition_part/__init__.py | 0 tests/{ => definition_part}/test_DefinitionPart.py | 0 tests/{ => definition_part}/test_generate_configurations.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/definition_part/__init__.py rename tests/{ => definition_part}/test_DefinitionPart.py (100%) rename tests/{ => definition_part}/test_generate_configurations.py (100%) diff --git a/tests/definition_part/__init__.py b/tests/definition_part/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_DefinitionPart.py b/tests/definition_part/test_DefinitionPart.py similarity index 100% rename from tests/test_DefinitionPart.py rename to tests/definition_part/test_DefinitionPart.py diff --git a/tests/test_generate_configurations.py b/tests/definition_part/test_generate_configurations.py similarity index 100% rename from tests/test_generate_configurations.py rename to tests/definition_part/test_generate_configurations.py From a47ab3b3eb22a5241bf8baa038e6148357258df0 Mon Sep 17 00:00:00 2001 From: Niko Yasui Date: Fri, 1 Nov 2024 10:24:13 -0600 Subject: [PATCH 3/3] style: remove unused import --- tests/acceptance/test_softmaxAC_mc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/test_softmaxAC_mc.py b/tests/acceptance/test_softmaxAC_mc.py index 9f668d5..9869bd3 100644 --- a/tests/acceptance/test_softmaxAC_mc.py +++ b/tests/acceptance/test_softmaxAC_mc.py @@ -1,9 +1,9 @@ import os import pytest -from ml_experiment.experiment_definition import ExperimentDefinition from ml_experiment.definition_part import DefinitionPart -from ml_experiment.Scheduler import LocalRunConfig, RunSpec, Scheduler +from ml_experiment.experiment_definition import ExperimentDefinition +from ml_experiment.Scheduler import LocalRunConfig, Scheduler @pytest.fixture