ialdev-dataman 0.1.0__tar.gz → 0.2.1__tar.gz
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.
- ialdev_dataman-0.2.1/PKG-INFO +82 -0
- ialdev_dataman-0.2.1/README.md +50 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/docs/use_cases.md +1 -1
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/pyproject.toml +12 -4
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/__init__.py +1 -1
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/caster.py +3 -3
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/collect.py +1 -1
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/labeled.py +1 -1
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/scan.py +3 -3
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/transtools.py +3 -2
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/env.py +1 -1
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/models.py +1 -1
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/__init__.py +5 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/__init__.py +32 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/hacks.py +76 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/old_enums.py +37 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/representers.py +92 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/types.py +122 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/yaml_lib.py +104 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/ext/__init__.py +1 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/ext/semver.py +152 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/ext/versioned_model.py +113 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/main.py +30 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/mixin.py +281 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/model.py +20 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/py.typed +1 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/version.py +1 -0
- ialdev_dataman-0.2.1/src/iad/dataman/pydantools/models.py +560 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/resman.py +3 -3
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/test_scheme.py +2 -2
- ialdev_dataman-0.2.1/tests/datasets/data/res/source_2.src.yml +0 -0
- ialdev_dataman-0.2.1/tests/pydantools/data/dump.json +1 -0
- ialdev_dataman-0.2.1/tests/pydantools/data/dump.yaml +4 -0
- ialdev_dataman-0.2.1/tests/pydantools/data/example_yaml.yml +41 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/__init__.py +1 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/recursive.yaml +5 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_advanced_yaml.py +40 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_basic.py +67 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_io.py +52 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_resursive.py +27 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_secret_types.py +60 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_sorting.py +17 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_types.py +71 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/test_versioned.py +72 -0
- ialdev_dataman-0.2.1/tests/pydantools/fixed_pydantic_yaml/versioned.yaml +2 -0
- ialdev_dataman-0.2.1/tests/pydantools/test_models.py +99 -0
- ialdev_dataman-0.1.0/PKG-INFO +0 -33
- ialdev_dataman-0.1.0/README.md +0 -5
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/docs/use_cases.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/__init__.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/datacast/transforms.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/src/iad/dataman/factories.py +0 -0
- /ialdev_dataman-0.1.0/tests/datacast/data/res/source_1.src.yml → /ialdev_dataman-0.2.1/src/iad/dataman/pydantools/fixed_pydantic_yaml/compat/__init__.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/conftest.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/datasets/toy/datasource.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/datasource.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/FT3D.col.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/FT3D.ds.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/FT3D.scm.yml +0 -0
- {ialdev_dataman-0.1.0/tests/datasets → ialdev_dataman-0.2.1/tests/datacast}/data/res/source_1.src.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/source_2.src.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/test_FT3D.src.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/res/toy_split.ds.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/data/scheme.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datacast/test_collect.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/datasets/toy/datasource.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/datasource.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/res/FT3D.col.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/res/FT3D.ds.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/res/FT3D.scm.yml +0 -0
- /ialdev_dataman-0.1.0/tests/datasets/data/res/source_2.src.yml → /ialdev_dataman-0.2.1/tests/datasets/data/res/source_1.src.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/res/test_FT3D.src.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/res/toy_split.ds.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/data/scheme.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/test_datasets.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/datasets/test_models.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/resman/data/res/nested/wind.dply.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/resman/data/res/nested/windtwo.dply.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/resman/data/res/wind.dply.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/resman/test_resource.py +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test.env +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/StereoImage_1058262900228717.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/bench/tiny/metrics_94362.hdf +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/evals/tiny/Adirondack##1#1#1/conf#NU40#0.0#6de6#L.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/evals/tiny/Adirondack##1#1#1/disp#NU40#0.0#6de6#L.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/evals/tiny/Piano##1#1#1/conf#NU40#0.0#6de6#L.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/evals/tiny/Piano##1#1#1/disp#NU40#0.0#6de6#L.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/calib.txt +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/disp0GT.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/disp1GT.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/im0.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/im0_gray.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/im1.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/im1_gray.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/mask0nocc.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Adirondack/mask1nocc.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/calib.txt +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/disp0GT.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/disp1GT.tif +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/im0.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/im0_gray.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/im1.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/im1_gray.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/mask0nocc.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/Piano/mask1nocc.jpg +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/data/tiny_stereo/datasource.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/benchmarks/tiny.bmk.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/collections/tiny.col.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/collections/tiny_2.col.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/datasets/tiny.ds.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/issues/categorical/issue.xlsx +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/issues/selector_issues.csv +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/depth/Monkaa_output_from_NU.scm.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/depth/labels.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/depth/repos/bench_evals.scm.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/depth/repos/bench_results.scm.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/labels.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/schemes/tiny.scm.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/trainings/test_training_config.trn.yml +0 -0
- {ialdev_dataman-0.1.0 → ialdev_dataman-0.2.1}/tests/test_resources/resources/trainings/test_training_curriculum_config.trn.yml +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ialdev-dataman
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Imported as `iad.dataman` — data casting, resource models, and dataset bridge
|
|
5
|
+
Author: ipcoder
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Requires-Dist: ialdev-core
|
|
16
|
+
Requires-Dist: ialdev-io
|
|
17
|
+
Requires-Dist: ialdev-img
|
|
18
|
+
Requires-Dist: ialdev-maths
|
|
19
|
+
Requires-Dist: pandas>=2.0.0
|
|
20
|
+
Requires-Dist: numpy>=2.0
|
|
21
|
+
Requires-Dist: pydantic>=2.0
|
|
22
|
+
Requires-Dist: pyyaml>=5.4.0
|
|
23
|
+
Requires-Dist: regex>=2021.0.0
|
|
24
|
+
Requires-Dist: tqdm>=4.60.0
|
|
25
|
+
Requires-Dist: pytest>=7.0.0 ; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=3.0.0 ; extra == "dev"
|
|
27
|
+
Project-URL: Homepage, https://github.com/ipcoder/ialdev/tree/master/dataman
|
|
28
|
+
Project-URL: Issues, https://github.com/ipcoder/ialdev/issues
|
|
29
|
+
Project-URL: Repository, https://github.com/ipcoder/ialdev
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
|
|
32
|
+
# ialdev-dataman
|
|
33
|
+
|
|
34
|
+
Dataset management and data casting tools for the `iad` toolbox, published as `ialdev-dataman` and imported as `iad.dataman`.
|
|
35
|
+
|
|
36
|
+
Use this package to describe datasets with resource models, discover YAML-backed dataset definitions, build data collections, apply read/transformation pipelines, and create sink repositories for generated outputs.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install ialdev-dataman
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.0.0`.
|
|
45
|
+
|
|
46
|
+
## Highlights
|
|
47
|
+
|
|
48
|
+
- Dataset resource models: `DataSourceRM`, `SchemeRM`, `DatasetRM`, and `CollectionRM`.
|
|
49
|
+
- Factory helpers: `create_caster`, `create_collection`, and `create_sink`.
|
|
50
|
+
- Data collection APIs: `DataCollection`, `SinkRepo`, `CollectTable`, and `CollectSeries`.
|
|
51
|
+
- YAML/Pydantic helpers through `iad.dataman.pydantools`.
|
|
52
|
+
- Transform utilities for reading files into structured tables and applying image/data transforms.
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from iad.dataman import create_caster, create_collection
|
|
58
|
+
|
|
59
|
+
caster = create_caster(
|
|
60
|
+
source="/data/images",
|
|
61
|
+
scheme="{scene}/{frame}.png",
|
|
62
|
+
filters={"scene": "scene_001"},
|
|
63
|
+
)
|
|
64
|
+
collection = create_collection(datasets=[caster])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from iad.dataman.models import DataSourceRM, DatasetRM, SchemeRM
|
|
69
|
+
from iad.dataman.resman import ModelsManager
|
|
70
|
+
|
|
71
|
+
manager = ModelsManager()
|
|
72
|
+
manager.register_models(DataSourceRM, SchemeRM, DatasetRM)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from iad.dataman.pydantools import YamlModel
|
|
77
|
+
|
|
78
|
+
class DatasetConfig(YamlModel):
|
|
79
|
+
name: str
|
|
80
|
+
root: str
|
|
81
|
+
```
|
|
82
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# ialdev-dataman
|
|
2
|
+
|
|
3
|
+
Dataset management and data casting tools for the `iad` toolbox, published as `ialdev-dataman` and imported as `iad.dataman`.
|
|
4
|
+
|
|
5
|
+
Use this package to describe datasets with resource models, discover YAML-backed dataset definitions, build data collections, apply read/transformation pipelines, and create sink repositories for generated outputs.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install ialdev-dataman
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.0.0`.
|
|
14
|
+
|
|
15
|
+
## Highlights
|
|
16
|
+
|
|
17
|
+
- Dataset resource models: `DataSourceRM`, `SchemeRM`, `DatasetRM`, and `CollectionRM`.
|
|
18
|
+
- Factory helpers: `create_caster`, `create_collection`, and `create_sink`.
|
|
19
|
+
- Data collection APIs: `DataCollection`, `SinkRepo`, `CollectTable`, and `CollectSeries`.
|
|
20
|
+
- YAML/Pydantic helpers through `iad.dataman.pydantools`.
|
|
21
|
+
- Transform utilities for reading files into structured tables and applying image/data transforms.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from iad.dataman import create_caster, create_collection
|
|
27
|
+
|
|
28
|
+
caster = create_caster(
|
|
29
|
+
source="/data/images",
|
|
30
|
+
scheme="{scene}/{frame}.png",
|
|
31
|
+
filters={"scene": "scene_001"},
|
|
32
|
+
)
|
|
33
|
+
collection = create_collection(datasets=[caster])
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from iad.dataman.models import DataSourceRM, DatasetRM, SchemeRM
|
|
38
|
+
from iad.dataman.resman import ModelsManager
|
|
39
|
+
|
|
40
|
+
manager = ModelsManager()
|
|
41
|
+
manager.register_models(DataSourceRM, SchemeRM, DatasetRM)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from iad.dataman.pydantools import YamlModel
|
|
46
|
+
|
|
47
|
+
class DatasetConfig(YamlModel):
|
|
48
|
+
name: str
|
|
49
|
+
root: str
|
|
50
|
+
```
|
|
@@ -12,7 +12,7 @@ Resource types implemented as subclasses of pydantic model ``ResourseModel``
|
|
|
12
12
|
|
|
13
13
|
```python
|
|
14
14
|
from iad.dataman.resman import ResourceModel, locatable
|
|
15
|
-
from iad.core.env import EnvLoc
|
|
15
|
+
from iad.core.fs.env import EnvLoc
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@locatable(EnvLoc.RESOURCES / 'houses')
|
|
@@ -4,11 +4,14 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ialdev-dataman"
|
|
7
|
-
version = "0.1
|
|
8
|
-
description = "iad.dataman — data casting, resource models, and dataset bridge"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Imported as `iad.dataman` — data casting, resource models, and dataset bridge"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "ipcoder"}
|
|
14
|
+
]
|
|
12
15
|
classifiers = [
|
|
13
16
|
"Development Status :: 4 - Beta",
|
|
14
17
|
"Intended Audience :: Developers",
|
|
@@ -24,8 +27,8 @@ dependencies = [
|
|
|
24
27
|
"ialdev-io",
|
|
25
28
|
"ialdev-img",
|
|
26
29
|
"ialdev-maths",
|
|
27
|
-
"pandas>=
|
|
28
|
-
"numpy>=
|
|
30
|
+
"pandas>=2.0.0",
|
|
31
|
+
"numpy>=2.0",
|
|
29
32
|
"pydantic>=2.0",
|
|
30
33
|
"pyyaml>=5.4.0",
|
|
31
34
|
"regex>=2021.0.0",
|
|
@@ -38,6 +41,11 @@ dev = [
|
|
|
38
41
|
"pytest-cov>=3.0.0",
|
|
39
42
|
]
|
|
40
43
|
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/ipcoder/ialdev/tree/master/dataman"
|
|
46
|
+
Repository = "https://github.com/ipcoder/ialdev"
|
|
47
|
+
Issues = "https://github.com/ipcoder/ialdev/issues"
|
|
48
|
+
|
|
41
49
|
[tool.flit.module]
|
|
42
50
|
name = "iad.dataman"
|
|
43
51
|
|
|
@@ -4,7 +4,7 @@ from .models import DataSourceRM, SchemeRM, DatasetRM, CollectionRM, DSample, di
|
|
|
4
4
|
from .factories import create_caster, create_collection, create_sink
|
|
5
5
|
from .datacast.collect import DataCollection, SinkRepo
|
|
6
6
|
|
|
7
|
-
__version__ = "0.
|
|
7
|
+
__version__ = "0.2.0"
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"__version__",
|
|
@@ -8,12 +8,12 @@ from pydantic.v1 import PrivateAttr
|
|
|
8
8
|
import regex as re # Using more advanced regex package!
|
|
9
9
|
import yaml
|
|
10
10
|
|
|
11
|
-
from iad.
|
|
11
|
+
from iad.dataman.pydantools import YamlModel
|
|
12
12
|
from iad.core import logger, as_list
|
|
13
13
|
from iad.core.cache import CachedPipe, CacheMode, Pickle, CacheInvalidError, NoSerial
|
|
14
14
|
from iad.core.datatools import Filter
|
|
15
15
|
from iad.core.events import Timer
|
|
16
|
-
from iad.core.filesproc import Path, root_cropper, root_adder, normalize
|
|
16
|
+
from iad.core.fs.filesproc import Path, root_cropper, root_adder, normalize
|
|
17
17
|
from iad.core.fnctools import express_to_kw_func
|
|
18
18
|
from .scan import GuideScan
|
|
19
19
|
|
|
@@ -238,7 +238,7 @@ class DataCaster:
|
|
|
238
238
|
_log.warning(f"{self} found no matching files!")
|
|
239
239
|
|
|
240
240
|
if cfg := self.config.sample:
|
|
241
|
-
from iad.core.pdtools import sample
|
|
241
|
+
from iad.core.data.pdtools import sample
|
|
242
242
|
ds = sample(ds, **(cfg if isinstance(cfg, dict) else cfg.dict()))
|
|
243
243
|
return ds
|
|
244
244
|
|
|
@@ -10,7 +10,7 @@ with Timer(f" ← {__file__} imports", "timing", min=0.1, pre=f' → importing i
|
|
|
10
10
|
|
|
11
11
|
# utils import
|
|
12
12
|
from iad.core import as_list, logger, drop_undef, as_iter
|
|
13
|
-
import iad.core.pdtools as pdt
|
|
13
|
+
import iad.core.data.pdtools as pdt
|
|
14
14
|
from iad.core.cache import CacheMode, Cacher
|
|
15
15
|
|
|
16
16
|
# internal imports
|
|
@@ -48,7 +48,7 @@ class LabelRules:
|
|
|
48
48
|
@staticmethod
|
|
49
49
|
def load_domains(path=None):
|
|
50
50
|
"""Load domains conventions"""
|
|
51
|
-
from iad.core.
|
|
51
|
+
from iad.core.tbox import TBox
|
|
52
52
|
from iad.dataman.env import EnvLoc
|
|
53
53
|
# Consider: is that the right approach ? What if RES_LOC missing and path is None?
|
|
54
54
|
path = path or (EnvLoc.RESOURCES / 'schemes').first_file('labels.yml')
|
|
@@ -8,10 +8,10 @@ import pydantic.v1 as pydantic
|
|
|
8
8
|
import regex as re
|
|
9
9
|
from pydantic.v1 import PrivateAttr
|
|
10
10
|
|
|
11
|
-
from iad.
|
|
11
|
+
from iad.dataman.pydantools import YamlModel
|
|
12
12
|
from iad.core import logger
|
|
13
|
-
from iad.core.filesproc import normalize
|
|
14
|
-
from iad.core.paths import TransPath
|
|
13
|
+
from iad.core.fs.filesproc import normalize
|
|
14
|
+
from iad.core.fs.paths import TransPath
|
|
15
15
|
|
|
16
16
|
_log = logger('datacast.scan')
|
|
17
17
|
|
|
@@ -7,9 +7,10 @@ from typing import Union, Callable, Iterable, Literal, Any, Collection, get_args
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
import pandas as pd
|
|
9
9
|
|
|
10
|
-
from iad.core import as_list
|
|
10
|
+
from iad.core import as_list
|
|
11
|
+
import iad.core.data.pdtools as pdt
|
|
11
12
|
from iad.core.fnctools import O, Namespace
|
|
12
|
-
from iad.core.label import Labels
|
|
13
|
+
from iad.core.data.label import Labels
|
|
13
14
|
from iad.core.wrap import name_tuple
|
|
14
15
|
|
|
15
16
|
EMPTY_CELL = (None, pd.NA, np.nan)
|
|
@@ -230,7 +230,7 @@ class Selection:
|
|
|
230
230
|
if isinstance(v, str):
|
|
231
231
|
if re.fullmatch(r'\d+(\.\d*)?%', v):
|
|
232
232
|
v = float(v[:-1]) / 100
|
|
233
|
-
elif re.fullmatch('\([\w, +-]+\)', v):
|
|
233
|
+
elif re.fullmatch(r'\([\w, +-]+\)', v):
|
|
234
234
|
v = eval('slice' + v)
|
|
235
235
|
else:
|
|
236
236
|
ValueError(f'Invalid sample selection value: "{v}"')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""YAML-enabled Pydantic models."""
|
|
2
|
+
|
|
3
|
+
from .version import __version__
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"__version__",
|
|
8
|
+
"SemVer",
|
|
9
|
+
"yaml",
|
|
10
|
+
"VersionedYamlModel",
|
|
11
|
+
"YamlEnum", # deprecated class
|
|
12
|
+
"YamlInt",
|
|
13
|
+
"YamlIntEnum",
|
|
14
|
+
"YamlModel",
|
|
15
|
+
"YamlModelMixin",
|
|
16
|
+
"YamlModelMixinConfig",
|
|
17
|
+
"YamlStr",
|
|
18
|
+
"YamlStrEnum",
|
|
19
|
+
]
|
|
20
|
+
from .main import (
|
|
21
|
+
SemVer,
|
|
22
|
+
VersionedYamlModel,
|
|
23
|
+
YamlEnum,
|
|
24
|
+
YamlInt,
|
|
25
|
+
YamlIntEnum,
|
|
26
|
+
YamlModel,
|
|
27
|
+
YamlModelMixin,
|
|
28
|
+
YamlModelMixinConfig,
|
|
29
|
+
YamlStr,
|
|
30
|
+
YamlStrEnum,
|
|
31
|
+
yaml,
|
|
32
|
+
)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Module for some hacks that are needed to work around the YAML library interfaces.
|
|
2
|
+
|
|
3
|
+
Mainy, this defines "safe" representers for common types that Pydantic is able to parse.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__all__ = ["inject_all"]
|
|
7
|
+
|
|
8
|
+
from typing import List, Type
|
|
9
|
+
|
|
10
|
+
from .representers import register_str_like, register_int_like
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_str_like_types() -> List[Type]:
|
|
14
|
+
"""Returns many string-like types from stdlib and Pydantic."""
|
|
15
|
+
|
|
16
|
+
# flake8: noqa
|
|
17
|
+
|
|
18
|
+
from uuid import UUID
|
|
19
|
+
from pathlib import (
|
|
20
|
+
Path,
|
|
21
|
+
PosixPath,
|
|
22
|
+
PurePath,
|
|
23
|
+
PurePosixPath,
|
|
24
|
+
PureWindowsPath,
|
|
25
|
+
WindowsPath,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
from pydantic.v1 import types, networks
|
|
29
|
+
|
|
30
|
+
def _chk(x) -> bool:
|
|
31
|
+
try:
|
|
32
|
+
return issubclass(x, (str, Path, PurePath, UUID))
|
|
33
|
+
except Exception:
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
# Get most candidates
|
|
37
|
+
candidates = (
|
|
38
|
+
list(locals().values())
|
|
39
|
+
+ [getattr(types, v) for v in types.__all__]
|
|
40
|
+
+ [getattr(networks, v) for v in networks.__all__]
|
|
41
|
+
)
|
|
42
|
+
str_like = [v for v in candidates if _chk(v)]
|
|
43
|
+
|
|
44
|
+
# SecretStr, SecretBytes are stringified as "**********" by Pydantic
|
|
45
|
+
str_like += [types.SecretStr, types.SecretBytes]
|
|
46
|
+
return str_like
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_int_like_types() -> List[Type]:
|
|
50
|
+
"""Returns many int-like types from stdlib and Pydantic."""
|
|
51
|
+
|
|
52
|
+
from pydantic.v1 import types
|
|
53
|
+
|
|
54
|
+
def _chk(x) -> bool:
|
|
55
|
+
try:
|
|
56
|
+
return issubclass(x, (int))
|
|
57
|
+
except Exception:
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
candidates = list(locals().values()) + [getattr(types, v) for v in types.__all__]
|
|
61
|
+
int_like = [v for v in candidates if _chk(v)]
|
|
62
|
+
return int_like
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def inject_all():
|
|
66
|
+
"""Injects all necessary "hacks" into the namespace.
|
|
67
|
+
|
|
68
|
+
What this currently does:
|
|
69
|
+
- Registers many str-like and int-like types (from Pydantic and the standard
|
|
70
|
+
library) to be representable in YAML.
|
|
71
|
+
"""
|
|
72
|
+
# Add representers for string-like and int-like values.
|
|
73
|
+
for cls in get_str_like_types():
|
|
74
|
+
register_str_like(cls, method=str)
|
|
75
|
+
for cls in get_int_like_types():
|
|
76
|
+
register_int_like(cls, method=int)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Old class for YamlEnum that is now deprecated (and marked as such)."""
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from inspect import isabstract
|
|
5
|
+
|
|
6
|
+
from deprecated import deprecated
|
|
7
|
+
|
|
8
|
+
from .representers import register_str_like
|
|
9
|
+
|
|
10
|
+
__all__ = ["YamlEnum"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@deprecated(version="0.5.0", reason="Use the `YamlStrEnum` class instead.")
|
|
14
|
+
class YamlEnum(Enum):
|
|
15
|
+
"""This class is DEPRECATED, please use `pydantic_yaml.YamlStrEnum` instead.
|
|
16
|
+
|
|
17
|
+
Enumeration that serializes as the proper underlying object type.
|
|
18
|
+
|
|
19
|
+
You can use this instead of `enum.Enum`, for example:
|
|
20
|
+
class MyEnum(str, YamlEnum):
|
|
21
|
+
val1 = "Value 1"
|
|
22
|
+
val2 = "Value 2"
|
|
23
|
+
|
|
24
|
+
Note
|
|
25
|
+
----
|
|
26
|
+
This is actually a lie, it only supports `str` enums for now. Oops.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init_subclass__(cls):
|
|
30
|
+
if not isabstract(cls):
|
|
31
|
+
register_str_like(cls)
|
|
32
|
+
|
|
33
|
+
def __repr__(self) -> str:
|
|
34
|
+
return repr(self.value)
|
|
35
|
+
|
|
36
|
+
def __str__(self) -> str:
|
|
37
|
+
return str(self.value)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Representers for dumping common objects to YAML."""
|
|
2
|
+
|
|
3
|
+
from functools import partial
|
|
4
|
+
from typing import Any, Callable, TypeVar
|
|
5
|
+
|
|
6
|
+
from .yaml_lib import yaml, dumper_classes, representer_classes
|
|
7
|
+
|
|
8
|
+
CType = TypeVar("CType")
|
|
9
|
+
|
|
10
|
+
__all__ = ["register_str_like", "register_int_like"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def dump_as_str(dumper: yaml.Dumper, data: Any, method: Callable[[Any], str] = str):
|
|
14
|
+
"""Represents an object as a string in YAML.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
dumper : yaml.Dumper
|
|
19
|
+
The dumper instance, such as `yaml.SafeDumper()`.
|
|
20
|
+
data
|
|
21
|
+
The object to dump. Ideally this is string-like.
|
|
22
|
+
method : callable
|
|
23
|
+
A method that converts `data` to a string. Default is `str`.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
node
|
|
28
|
+
The YAML internal node representation.
|
|
29
|
+
"""
|
|
30
|
+
return dumper.represent_str(method(data))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def dump_as_int(dumper: yaml.Dumper, data: Any, method: Callable[[Any], int] = int):
|
|
34
|
+
"""Represents an object as an integer in YAML.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
dumper : yaml.Dumper
|
|
39
|
+
The dumper instance, such as `yaml.SafeDumper()`.
|
|
40
|
+
data
|
|
41
|
+
The object to dump. Ideally this is int-like.
|
|
42
|
+
method : callable
|
|
43
|
+
A method that converts `data` to an integer. Default is `int`.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
node
|
|
48
|
+
The YAML internal node representation.
|
|
49
|
+
"""
|
|
50
|
+
return dumper.represent_int(method(data))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def register_str_like(cls: CType, method: Callable[[Any], str] = str) -> CType:
|
|
54
|
+
"""Registers `cls` to be dumped to YAML as a string.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
cls : Type
|
|
59
|
+
The class to represent.
|
|
60
|
+
method : callable
|
|
61
|
+
A method that converts objects of type `cls` to a string.
|
|
62
|
+
Default is `str`.
|
|
63
|
+
|
|
64
|
+
Returns
|
|
65
|
+
-------
|
|
66
|
+
cls
|
|
67
|
+
This is the same as the input `cls`.
|
|
68
|
+
"""
|
|
69
|
+
for x_cls in dumper_classes + representer_classes:
|
|
70
|
+
x_cls.add_representer(cls, partial(dump_as_str, method=method))
|
|
71
|
+
return cls
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def register_int_like(cls: CType, method: Callable[[Any], int] = int) -> CType:
|
|
75
|
+
"""Registers `cls` to be dumped to YAML as an integer.
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
cls : Type
|
|
80
|
+
The class to represent.
|
|
81
|
+
method : callable
|
|
82
|
+
A method that converts objects of type `cls` to an integer.
|
|
83
|
+
Default is `int`.
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
cls
|
|
88
|
+
This is the same as the input `cls`.
|
|
89
|
+
"""
|
|
90
|
+
for x_cls in dumper_classes + representer_classes:
|
|
91
|
+
x_cls.add_representer(cls, partial(dump_as_int, method=method))
|
|
92
|
+
return cls
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Defines useful types for building your own YAML-compatible types."""
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from inspect import isabstract
|
|
5
|
+
from typing import Dict, Tuple, Union
|
|
6
|
+
|
|
7
|
+
from .representers import register_int_like, register_str_like
|
|
8
|
+
from .yaml_lib import yaml_safe_dump
|
|
9
|
+
|
|
10
|
+
__all__ = ["YamlInt", "YamlIntEnum", "YamlStr", "YamlStrEnum"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class YamlStr(str):
|
|
14
|
+
"""A `str` subclass that serializes to YAML as an integer."""
|
|
15
|
+
|
|
16
|
+
def __init_subclass__(cls):
|
|
17
|
+
"""Adds a representer when defining a subclass."""
|
|
18
|
+
res = super().__init_subclass__()
|
|
19
|
+
if not isabstract(cls):
|
|
20
|
+
register_str_like(cls, method=cls._to_yaml_str)
|
|
21
|
+
return res
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def _to_yaml_str(cls, v) -> str:
|
|
25
|
+
"""Represent a value of this type as a string."""
|
|
26
|
+
return str(v)
|
|
27
|
+
|
|
28
|
+
def __str__(self) -> str:
|
|
29
|
+
"""This just returns the wrapped string."""
|
|
30
|
+
return super().__str__()
|
|
31
|
+
|
|
32
|
+
def __repr__(self) -> str:
|
|
33
|
+
"""Repr string that keeps the class type. You may redefine this."""
|
|
34
|
+
return type(self).__qualname__ + "(" + super().__repr__() + ")"
|
|
35
|
+
|
|
36
|
+
def __getnewargs__(self) -> Tuple[str]:
|
|
37
|
+
"""Implementation to prevent Enum from sabotaging us.
|
|
38
|
+
|
|
39
|
+
I'm not joking! See `_make_class_unpicklable()` from `enum.py`
|
|
40
|
+
"""
|
|
41
|
+
return super().__getnewargs__()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class YamlInt(int):
|
|
45
|
+
"""An `int` subclass that serializes to YAML as an integer."""
|
|
46
|
+
|
|
47
|
+
def __init_subclass__(cls):
|
|
48
|
+
"""Adds a representer when defining a subclass."""
|
|
49
|
+
res = super().__init_subclass__()
|
|
50
|
+
if not isabstract(cls):
|
|
51
|
+
register_int_like(cls, method=cls._to_yaml_int)
|
|
52
|
+
return res
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def _to_yaml_int(cls, v) -> int:
|
|
56
|
+
"""Represent a value of this type as an integer."""
|
|
57
|
+
return int(v)
|
|
58
|
+
|
|
59
|
+
def __int__(self) -> int:
|
|
60
|
+
return super().__int__()
|
|
61
|
+
|
|
62
|
+
def __str__(self) -> str:
|
|
63
|
+
"""This returns the wrapped int."""
|
|
64
|
+
return super().__str__()
|
|
65
|
+
|
|
66
|
+
def __repr__(self) -> str:
|
|
67
|
+
"""Repr string that keeps the class type. You may redefine this."""
|
|
68
|
+
return type(self).__qualname__ + "(" + super().__repr__() + ")"
|
|
69
|
+
|
|
70
|
+
def __getnewargs__(self) -> Tuple[int]:
|
|
71
|
+
"""Implementation to prevent Enum from sabotaging us.
|
|
72
|
+
|
|
73
|
+
I'm not joking! See `_make_class_unpicklable()` from `enum.py`
|
|
74
|
+
"""
|
|
75
|
+
return super().__getnewargs__()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class YamlStrEnum(YamlStr, Enum):
|
|
79
|
+
"""String-valued enum that serializes to YAML directly as a string.
|
|
80
|
+
|
|
81
|
+
This also checks that your enum can properly be serialized.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def __init_subclass__(cls):
|
|
85
|
+
res = super().__init_subclass__()
|
|
86
|
+
if not isabstract(cls):
|
|
87
|
+
vals: Dict[str, cls] = dict(cls.__members__)
|
|
88
|
+
yaml_safe_dump(vals)
|
|
89
|
+
return res
|
|
90
|
+
|
|
91
|
+
def __str__(self) -> str:
|
|
92
|
+
"""This returns the wrapped string."""
|
|
93
|
+
return str.__str__(self)
|
|
94
|
+
|
|
95
|
+
def __repr__(self) -> str:
|
|
96
|
+
"""Repr string that keeps the class type. You may redefine this."""
|
|
97
|
+
return type(self).__qualname__ + "(" + str.__repr__(self) + ")"
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class YamlIntEnum(YamlInt, Enum):
|
|
101
|
+
"""Integer-valued enum that serializes to YAML directly as an integer.
|
|
102
|
+
|
|
103
|
+
This also checks that your enum can properly be serialized.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
def __init_subclass__(cls):
|
|
107
|
+
res = super().__init_subclass__()
|
|
108
|
+
if not isabstract(cls):
|
|
109
|
+
vals: Dict[str, cls] = dict(cls.__members__)
|
|
110
|
+
yaml_safe_dump(vals)
|
|
111
|
+
return res
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
|
|
116
|
+
class A(YamlStrEnum):
|
|
117
|
+
a = "a"
|
|
118
|
+
b = "b"
|
|
119
|
+
|
|
120
|
+
class X(YamlIntEnum):
|
|
121
|
+
x1 = 1
|
|
122
|
+
x2 = 2
|