hydraflow 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hydraflow/config.py CHANGED
@@ -33,23 +33,34 @@ def iter_params(config: object, prefix: str = "") -> Iterator[tuple[str, Any]]:
33
33
  if not isinstance(config, (DictConfig, ListConfig)):
34
34
  config = OmegaConf.create(config) # type: ignore
35
35
 
36
+ yield from _iter_params(config, prefix)
37
+
38
+
39
+ def _iter_params(config: object, prefix: str = "") -> Iterator[tuple[str, Any]]:
36
40
  if isinstance(config, DictConfig):
37
41
  for key, value in config.items():
38
- if isinstance(value, ListConfig) and not any(
39
- isinstance(v, (DictConfig, ListConfig)) for v in value
40
- ):
42
+ if _is_param(value):
41
43
  yield f"{prefix}{key}", value
42
44
 
43
- elif isinstance(value, (DictConfig, ListConfig)):
44
- yield from iter_params(value, f"{prefix}{key}.")
45
-
46
45
  else:
47
- yield f"{prefix}{key}", value
46
+ yield from _iter_params(value, f"{prefix}{key}.")
48
47
 
49
48
  elif isinstance(config, ListConfig):
50
49
  for index, value in enumerate(config):
51
- if isinstance(value, (DictConfig, ListConfig)):
52
- yield from iter_params(value, f"{prefix}{index}.")
50
+ if _is_param(value):
51
+ yield f"{prefix}{index}", value
53
52
 
54
53
  else:
55
- yield f"{prefix}{index}", value
54
+ yield from _iter_params(value, f"{prefix}{index}.")
55
+
56
+
57
+ def _is_param(value: object) -> bool:
58
+ """Check if the given value is a parameter."""
59
+ if isinstance(value, DictConfig):
60
+ return False
61
+
62
+ if isinstance(value, ListConfig):
63
+ if any(isinstance(v, (DictConfig, ListConfig)) for v in value):
64
+ return False
65
+
66
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hydraflow
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
5
5
  Project-URL: Documentation, https://github.com/daizutabi/hydraflow
6
6
  Project-URL: Source, https://github.com/daizutabi/hydraflow
@@ -1,9 +1,9 @@
1
1
  hydraflow/__init__.py,sha256=PzziOG9RnGAVbl9Yz4ScvsL8nfkjsuN0alMKRvZT-_Y,442
2
- hydraflow/config.py,sha256=BcyOYvdiqSCsmUMA_EvnWPXuW0fC5cT-Q2ilBk9-5gc,1863
2
+ hydraflow/config.py,sha256=wI8uNuD2D-hIf4BAhEYJaMC6EyO-erKopy_ia_b1pYA,2048
3
3
  hydraflow/context.py,sha256=MqkEhKEZL_N3eb3v5u9D4EqKkiSmiPyXXafhPkALRlg,5129
4
4
  hydraflow/mlflow.py,sha256=_Los9E38eG8sTiN8bGwZmvjCrS0S-wSGiA4fyhQM3Zw,2251
5
5
  hydraflow/runs.py,sha256=NT7IzE-Pf7T2Ey-eWEPZzQQaX4Gt_RKDKSn2pj2yzGc,14304
6
- hydraflow-0.2.0.dist-info/METADATA,sha256=dfQ2_-Nk79yVazy5BHasYK681kiG1z-_i4VxWT8fJjg,4224
7
- hydraflow-0.2.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
8
- hydraflow-0.2.0.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
9
- hydraflow-0.2.0.dist-info/RECORD,,
6
+ hydraflow-0.2.1.dist-info/METADATA,sha256=4C_hnw1gMb8WUQXyqj4q8eA1IVbp0wZuLGGthIk1G7U,4224
7
+ hydraflow-0.2.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
8
+ hydraflow-0.2.1.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
9
+ hydraflow-0.2.1.dist-info/RECORD,,