ialdev-core 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_core-0.2.1/PKG-INFO +91 -0
- ialdev_core-0.2.1/README.md +48 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/pyproject.toml +7 -8
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/cache.py +1 -1
- ialdev_core-0.2.1/src/iad/core/data/__init__.py +1 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/array.py +3 -3
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/label.py +2 -2
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/pdtools.py +6 -6
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/events.py +5 -4
- ialdev_core-0.2.1/src/iad/core/fs/__init__.py +3 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/fs}/env.py +4 -4
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/fs}/filesproc.py +12 -7
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/fs}/paths.py +3 -3
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/logs.py +1 -1
- ialdev_core-0.2.1/src/iad/core/param/__init__.py +1 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/param/confargparse.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/param/paramaze.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/strings.py +4 -4
- {ialdev_core-0.1.0/src/iad/core/param → ialdev_core-0.2.1/src/iad/core}/tbox.py +4 -4
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/wrap.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/conftest.py +2 -2
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_array.py +2 -2
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_binar.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_filesproc.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_nptools.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_paths.py +1 -1
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_pdtools.py +3 -3
- {ialdev_core-0.1.0/tests/param → ialdev_core-0.2.1/tests}/test_tbox.py +1 -1
- ialdev_core-0.1.0/PKG-INFO +0 -73
- ialdev_core-0.1.0/README.md +0 -29
- ialdev_core-0.1.0/src/iad/core/dotstyle.py +0 -99
- ialdev_core-0.1.0/src/iad/core/param/__init__.py +0 -17
- ialdev_core-0.1.0/src/iad/core/pydantools/__init__.py +0 -5
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/__init__.py +0 -32
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/__init__.py +0 -0
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/hacks.py +0 -76
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/old_enums.py +0 -37
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/representers.py +0 -92
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/types.py +0 -122
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/compat/yaml_lib.py +0 -104
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/__init__.py +0 -1
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/semver.py +0 -152
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/ext/versioned_model.py +0 -113
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/main.py +0 -30
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/mixin.py +0 -281
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/model.py +0 -20
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/py.typed +0 -1
- ialdev_core-0.1.0/src/iad/core/pydantools/fixed_pydantic_yaml/version.py +0 -1
- ialdev_core-0.1.0/src/iad/core/pydantools/models.py +0 -560
- ialdev_core-0.1.0/tests/param/__init__.py +0 -0
- ialdev_core-0.1.0/tests/param/data/dump.json +0 -1
- ialdev_core-0.1.0/tests/param/data/dump.yaml +0 -4
- ialdev_core-0.1.0/tests/param/data/example_yaml.yml +0 -41
- ialdev_core-0.1.0/tests/param/test_param.py +0 -99
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/__init__.py +0 -1
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/recursive.yaml +0 -5
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_advanced_yaml.py +0 -40
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_basic.py +0 -67
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_io.py +0 -52
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_resursive.py +0 -27
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_secret_types.py +0 -60
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_sorting.py +0 -17
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_types.py +0 -71
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/test_versioned.py +0 -72
- ialdev_core-0.1.0/tests/pydantools_merged/fixed_pydantic_yaml/versioned.yaml +0 -2
- ialdev_core-0.1.0/tests/test_dotstyle.py +0 -268
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/.gitignore +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/.pixi/config.toml +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/__init__.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/codetools.py +0 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/binary.py +0 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/nptools.py +0 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/unc_panda.py +0 -0
- {ialdev_core-0.1.0/src/iad/core → ialdev_core-0.2.1/src/iad/core/data}/units.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/datatools.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/docs/locators.ipynb +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/fnctools.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/one_dark.puml +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/regexp.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/src/iad/core/short.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/array.ipynb +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/data/.env +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/dot_styles_examples.ipynb +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_cachepipe.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_codetools.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_coltools.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_datatools.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_events.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_regexp.py +0 -0
- {ialdev_core-0.1.0 → ialdev_core-0.2.1}/tests/test_shorts.py +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ialdev-core
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more
|
|
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.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Requires-Dist: pandas>=2.1.0
|
|
19
|
+
Requires-Dist: numpy>=2.0
|
|
20
|
+
Requires-Dist: pyyaml>=5.4.0
|
|
21
|
+
Requires-Dist: ruamel.yaml>=0.15.0
|
|
22
|
+
Requires-Dist: regex>=2021.0.0
|
|
23
|
+
Requires-Dist: rapidfuzz>=3.0
|
|
24
|
+
Requires-Dist: tqdm>=4.60.0
|
|
25
|
+
Requires-Dist: frozendict>=2.0.0
|
|
26
|
+
Requires-Dist: python-box>=6.0.0
|
|
27
|
+
Requires-Dist: joblib>=1.0.0
|
|
28
|
+
Requires-Dist: configargparse>=1.0.0
|
|
29
|
+
Requires-Dist: deprecated>=1.2.0
|
|
30
|
+
Requires-Dist: semver>=2.13.0
|
|
31
|
+
Requires-Dist: uncertainties>=3.1.0
|
|
32
|
+
Requires-Dist: pint>=0.20.0
|
|
33
|
+
Requires-Dist: zfpy
|
|
34
|
+
Requires-Dist: xxhash>=3.0.0
|
|
35
|
+
Requires-Dist: toolz>=0.11.0
|
|
36
|
+
Requires-Dist: numba>=0.55.0
|
|
37
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
38
|
+
Requires-Dist: python-dotenv>=0.19.0
|
|
39
|
+
Project-URL: Homepage, https://github.com/ipcoder/ialdev/tree/master/algutils
|
|
40
|
+
Project-URL: Issues, https://github.com/ipcoder/ialdev/issues
|
|
41
|
+
Project-URL: Repository, https://github.com/ipcoder/ialdev
|
|
42
|
+
|
|
43
|
+
# ialdev-core
|
|
44
|
+
|
|
45
|
+
Core utilities for the `iad` toolbox, published as `ialdev-core` and imported as `iad.core`.
|
|
46
|
+
|
|
47
|
+
Use this package when you need the shared building blocks used by the other `ialdev-*` libraries: collection helpers, typed dictionaries, path transformations, file discovery, caching, logging, event timing, decorators, and NumPy/Pandas utility functions.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install ialdev-core
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.1.0`.
|
|
56
|
+
|
|
57
|
+
## Highlights
|
|
58
|
+
|
|
59
|
+
- `iad.core.short`: scalar/list normalization and keyword filtering (`as_list`, `as_iter`, `drop_undef`).
|
|
60
|
+
- `iad.core.tbox`: `TBox`, a convenience wrapper around `python-box`.
|
|
61
|
+
- `iad.core.fs`: path normalization, file discovery, locators, and transformable path templates.
|
|
62
|
+
- `iad.core.cache`: pickle-based caches and cached processing pipes.
|
|
63
|
+
- `iad.core.data`: NumPy/Pandas helpers, labels, units, binary packing, and table utilities.
|
|
64
|
+
- `iad.core.events`: timers, progress helpers, and joblib/tqdm integration.
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from iad.core import as_list, drop_undef
|
|
70
|
+
from iad.core.tbox import TBox
|
|
71
|
+
|
|
72
|
+
names = as_list("sample")
|
|
73
|
+
config = TBox(drop_undef(root="/data", cache=None, batch=8))
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from iad.core.fs.filesproc import Locator
|
|
78
|
+
from iad.core.fs.paths import TransPath
|
|
79
|
+
|
|
80
|
+
locator = Locator("/data/project")
|
|
81
|
+
path_template = TransPath("{scene}/{frame}.png")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install -e .
|
|
88
|
+
pixi run test
|
|
89
|
+
pixi run lint
|
|
90
|
+
```
|
|
91
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ialdev-core
|
|
2
|
+
|
|
3
|
+
Core utilities for the `iad` toolbox, published as `ialdev-core` and imported as `iad.core`.
|
|
4
|
+
|
|
5
|
+
Use this package when you need the shared building blocks used by the other `ialdev-*` libraries: collection helpers, typed dictionaries, path transformations, file discovery, caching, logging, event timing, decorators, and NumPy/Pandas utility functions.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install ialdev-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Python `>=3.10`, NumPy `>=2.0`, and pandas `>=2.1.0`.
|
|
14
|
+
|
|
15
|
+
## Highlights
|
|
16
|
+
|
|
17
|
+
- `iad.core.short`: scalar/list normalization and keyword filtering (`as_list`, `as_iter`, `drop_undef`).
|
|
18
|
+
- `iad.core.tbox`: `TBox`, a convenience wrapper around `python-box`.
|
|
19
|
+
- `iad.core.fs`: path normalization, file discovery, locators, and transformable path templates.
|
|
20
|
+
- `iad.core.cache`: pickle-based caches and cached processing pipes.
|
|
21
|
+
- `iad.core.data`: NumPy/Pandas helpers, labels, units, binary packing, and table utilities.
|
|
22
|
+
- `iad.core.events`: timers, progress helpers, and joblib/tqdm integration.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from iad.core import as_list, drop_undef
|
|
28
|
+
from iad.core.tbox import TBox
|
|
29
|
+
|
|
30
|
+
names = as_list("sample")
|
|
31
|
+
config = TBox(drop_undef(root="/data", cache=None, batch=8))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from iad.core.fs.filesproc import Locator
|
|
36
|
+
from iad.core.fs.paths import TransPath
|
|
37
|
+
|
|
38
|
+
locator = Locator("/data/project")
|
|
39
|
+
path_template = TransPath("{scene}/{frame}.png")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Development
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install -e .
|
|
46
|
+
pixi run test
|
|
47
|
+
pixi run lint
|
|
48
|
+
```
|
|
@@ -4,13 +4,13 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ialdev-core"
|
|
7
|
-
version = "0.1
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
license = {text = "MIT"}
|
|
12
12
|
authors = [
|
|
13
|
-
{name = "
|
|
13
|
+
{name = "ipcoder"}
|
|
14
14
|
]
|
|
15
15
|
classifiers = [
|
|
16
16
|
"Development Status :: 4 - Beta",
|
|
@@ -25,10 +25,9 @@ classifiers = [
|
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
dependencies = [
|
|
28
|
-
"ialdev-io",
|
|
29
28
|
"pydantic>=2.0",
|
|
30
|
-
"pandas>=1.
|
|
31
|
-
"numpy>=
|
|
29
|
+
"pandas>=2.1.0",
|
|
30
|
+
"numpy>=2.0",
|
|
32
31
|
"pyyaml>=5.4.0",
|
|
33
32
|
"ruamel.yaml>=0.15.0",
|
|
34
33
|
"regex>=2021.0.0",
|
|
@@ -51,9 +50,9 @@ dependencies = [
|
|
|
51
50
|
]
|
|
52
51
|
|
|
53
52
|
[project.urls]
|
|
54
|
-
Homepage = "https://github.com/
|
|
55
|
-
Repository = "https://github.com/
|
|
56
|
-
Issues = "https://github.com/
|
|
53
|
+
Homepage = "https://github.com/ipcoder/ialdev/tree/master/algutils"
|
|
54
|
+
Repository = "https://github.com/ipcoder/ialdev"
|
|
55
|
+
Issues = "https://github.com/ipcoder/ialdev/issues"
|
|
57
56
|
|
|
58
57
|
# Distribution name (ialdev-core) ≠ import name (iad.core)
|
|
59
58
|
[tool.flit.module]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Numeric, pandas, labeled-data, units, and binary helpers."""
|
|
@@ -11,10 +11,10 @@ import numpy as np
|
|
|
11
11
|
import numba
|
|
12
12
|
from numbers import Number
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
14
|
+
from ..codetools import NamedObj
|
|
15
|
+
from .. import as_list
|
|
16
16
|
from . import nptools as npt
|
|
17
|
-
from
|
|
17
|
+
from ..datatools import rm_keys
|
|
18
18
|
|
|
19
19
|
__all__ = ['DForm', 'Array', 'FormArray', 'form_array', 'Color', '_wC2G']
|
|
20
20
|
|
|
@@ -7,9 +7,9 @@ from typing import Dict, Sequence, Any, Collection, NamedTuple, Iterable
|
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from .. import as_list
|
|
11
11
|
from .nptools import Array
|
|
12
|
-
from
|
|
12
|
+
from ..strings import compact_repr
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class Keys(pd.core.indexes.frozen.FrozenList): # TODO: Merge Keys into Labeled?
|
|
@@ -19,10 +19,10 @@ import pandas as pd
|
|
|
19
19
|
from IPython import display as ipy_disp
|
|
20
20
|
from pandas.core.dtypes.common import is_list_like
|
|
21
21
|
|
|
22
|
-
from
|
|
23
|
-
from . import
|
|
24
|
-
from
|
|
25
|
-
from
|
|
22
|
+
from .. import strings as stt, codetools as cdt, wrap
|
|
23
|
+
from . import nptools as npt
|
|
24
|
+
from ..datatools import select_from, issubset_report
|
|
25
|
+
from ..short import as_list, unless_subset
|
|
26
26
|
|
|
27
27
|
# https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
|
|
28
28
|
# Copy-on-Write will become the new default in pandas 3.0. This means than chained indexing will never work.
|
|
@@ -185,7 +185,7 @@ class Parallel:
|
|
|
185
185
|
:return: resulted table (same class as df)
|
|
186
186
|
"""
|
|
187
187
|
import joblib as jb
|
|
188
|
-
from
|
|
188
|
+
from ..events import tqdm_joblib
|
|
189
189
|
|
|
190
190
|
par = self.jobs if isinstance(self.jobs, dict) else dict(
|
|
191
191
|
backend='loky',
|
|
@@ -2004,7 +2004,7 @@ def path_fixer(root, fixer_name, cols='path') -> Callable[[pd.DataFrame], pd.Dat
|
|
|
2004
2004
|
|
|
2005
2005
|
cols = set(as_list(cols))
|
|
2006
2006
|
|
|
2007
|
-
from
|
|
2007
|
+
from ..fs import filesproc as proc
|
|
2008
2008
|
fixer = {
|
|
2009
2009
|
'add': proc.root_adder,
|
|
2010
2010
|
'crop': proc.root_cropper
|
|
@@ -605,7 +605,7 @@ class Dump(dict):
|
|
|
605
605
|
self.configure()
|
|
606
606
|
|
|
607
607
|
def configure(self, new_config=None):
|
|
608
|
-
from .paths import TransPath
|
|
608
|
+
from .fs.paths import TransPath
|
|
609
609
|
# TODO add
|
|
610
610
|
# 1) support to selective config along the tree
|
|
611
611
|
# 2) clearer way to configure
|
|
@@ -620,7 +620,6 @@ class Dump(dict):
|
|
|
620
620
|
|
|
621
621
|
def __call__(self, data=None, labels: dict = None, **kwargs):
|
|
622
622
|
import os
|
|
623
|
-
from iad.io import imsave
|
|
624
623
|
|
|
625
624
|
if not self.active or data is None:
|
|
626
625
|
return self.labels
|
|
@@ -640,8 +639,10 @@ class Dump(dict):
|
|
|
640
639
|
if os.path.isfile(path) and not self.config.exist_ok:
|
|
641
640
|
raise FileExistsError(f"File {path} already exists")
|
|
642
641
|
path.parent.mkdir(mode=0o777, parents=True, exist_ok=True)
|
|
643
|
-
|
|
644
|
-
|
|
642
|
+
writer = getattr(self.config, 'writer', None)
|
|
643
|
+
if writer is None:
|
|
644
|
+
raise RuntimeError("Dump requires config.writer callable to save data")
|
|
645
|
+
writer(path, data)
|
|
645
646
|
|
|
646
647
|
def fork(self, other: dict):
|
|
647
648
|
return Dump(config=self.config, root=self.root, labels=other | self.labels, scheme=self.scheme)
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
import dotenv
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from .filesproc import Locator
|
|
7
7
|
|
|
8
8
|
env_log = logging.getLogger('env')
|
|
9
9
|
|
|
@@ -172,7 +172,7 @@ class EnvLoc:
|
|
|
172
172
|
|
|
173
173
|
@classmethod
|
|
174
174
|
def _process_dotenv(cls, env_file, override=None):
|
|
175
|
-
from
|
|
175
|
+
from .filesproc import represents_path, normalize
|
|
176
176
|
|
|
177
177
|
def same_value(v1, v2):
|
|
178
178
|
"""Return true if two values are the same.
|
|
@@ -234,10 +234,10 @@ class EnvLoc:
|
|
|
234
234
|
if not Path(env_path).is_file():
|
|
235
235
|
if not fail: return None
|
|
236
236
|
raise FileNotFoundError(f'Not found dotenv defined in {ENV_FILE_VAR}="{env_path}"')
|
|
237
|
-
env_log.debug(f'dotenv set by the
|
|
237
|
+
env_log.debug(f'dotenv set by the environment variable {ENV_FILE_VAR}={env_path}')
|
|
238
238
|
elif not (env_path := dotenv.find_dotenv(usecwd=True)): # try first search from the current dir
|
|
239
239
|
msg = f'Getting default .env after not found at CDW: {os.getcwd()}'
|
|
240
|
-
env_log.
|
|
240
|
+
env_log.debug(msg)
|
|
241
241
|
if not fail: return None
|
|
242
242
|
raise FileNotFoundError(msg)
|
|
243
243
|
return env_path
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"""
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import logging
|
|
5
6
|
import os
|
|
6
7
|
import re
|
|
7
8
|
import sys
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from typing import List, Tuple, Union, Iterable, Callable, Literal, Type, Any, Generator
|
|
10
11
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
import logging
|
|
12
|
+
from ..datatools import unique as unique_filter
|
|
13
|
+
from ..events import Timer
|
|
14
|
+
from ..short import as_iter
|
|
15
15
|
|
|
16
16
|
PathT = Union[Path, str]
|
|
17
17
|
UNDEF = object()
|
|
@@ -129,9 +129,14 @@ def compress_numpy_file(file, clean=True):
|
|
|
129
129
|
:param clean: remove the sources
|
|
130
130
|
"""
|
|
131
131
|
import numpy as np
|
|
132
|
-
from iad.io.imread import imread
|
|
133
132
|
file = Path(file)
|
|
134
|
-
np.
|
|
133
|
+
loaded = np.load(file, allow_pickle=True)
|
|
134
|
+
if isinstance(loaded, np.lib.npyio.NpzFile):
|
|
135
|
+
with loaded:
|
|
136
|
+
payload = {key: loaded[key] for key in loaded.files}
|
|
137
|
+
else:
|
|
138
|
+
payload = {file.stem: loaded}
|
|
139
|
+
np.savez_compressed(file.with_suffix('.npz'), **payload)
|
|
135
140
|
if clean:
|
|
136
141
|
os.remove(file)
|
|
137
142
|
|
|
@@ -810,7 +815,7 @@ def glob_folders(folders, file_pattern) -> Iterable[str]:
|
|
|
810
815
|
:param file_pattern: glob pattern for path under the folder
|
|
811
816
|
:return: Iterator over the files found
|
|
812
817
|
"""
|
|
813
|
-
from
|
|
818
|
+
from .. import as_list
|
|
814
819
|
from more_itertools import collapse
|
|
815
820
|
|
|
816
821
|
return list(collapse(
|
|
@@ -5,7 +5,7 @@ from typing import Any, Callable, Literal, Sequence
|
|
|
5
5
|
|
|
6
6
|
import regex as re
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from ..regexp import format_to_regex, regex_to_format, is_regex, partition
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def ng(name=None, exp=None, /, **kw):
|
|
@@ -329,7 +329,7 @@ class Form:
|
|
|
329
329
|
|
|
330
330
|
def _repr_parts_tree(self, indent=' ' * 4, head='Form:\n'):
|
|
331
331
|
"""String representing parsed tree of parts"""
|
|
332
|
-
from
|
|
332
|
+
from ..strings import indent_lines
|
|
333
333
|
|
|
334
334
|
return head + '\n'.join(indent_lines(
|
|
335
335
|
p._repr_parts_tree(indent=indent, head=head) if isinstance(p, Form) else p
|
|
@@ -516,7 +516,7 @@ class TransPath:
|
|
|
516
516
|
if no_tag and not self.has_unnamed:
|
|
517
517
|
raise ValueError("Unnamed tag is not defined but requested!")
|
|
518
518
|
if no_tag is True:
|
|
519
|
-
from
|
|
519
|
+
from ..datatools import split_dict
|
|
520
520
|
labels, no_tag = split_dict(labels, lambda k, v: k in self.expected_tags)
|
|
521
521
|
no_tag = no_tag or None
|
|
522
522
|
if no_tag:
|
|
@@ -40,7 +40,7 @@ def _add_levels_attrs(obj: T) -> T:
|
|
|
40
40
|
|
|
41
41
|
def module_log_file(file: str | Path):
|
|
42
42
|
"""Constructs default log file name from module file"""
|
|
43
|
-
from .
|
|
43
|
+
from .fs import Locator
|
|
44
44
|
out_folder = Locator('/tmp/ramdisk', '/tmp', envar='TEMP').first_existing()
|
|
45
45
|
if not out_folder:
|
|
46
46
|
from tempfile import mkdtemp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Parameter definitions, CLI/YAML config parsing, and related helpers."""
|
|
@@ -67,11 +67,11 @@ def short_form(s: str, head=0, tail=0):
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
def smart_warp(s, width=80, **splitters):
|
|
70
|
-
"""
|
|
70
|
+
r"""
|
|
71
71
|
Warp string py applying `splitters` in order to limit each line by requested `width`.
|
|
72
72
|
|
|
73
73
|
Every splitter must be a regular expression to use by `re.split(splitter, line, maxsplit=1)`
|
|
74
|
-
If splitters not provided, defaults are used:
|
|
74
|
+
If splitters are not provided, defaults are used:
|
|
75
75
|
::
|
|
76
76
|
|
|
77
77
|
splitters = dict(
|
|
@@ -201,8 +201,8 @@ def compact_repr(v, max_len=60) -> str:
|
|
|
201
201
|
:param max_len: maximal length of the resulting string
|
|
202
202
|
:return: str
|
|
203
203
|
"""
|
|
204
|
-
from .units import Quantity
|
|
205
|
-
from .nptools import array_info_str, np
|
|
204
|
+
from .data.units import Quantity
|
|
205
|
+
from .data.nptools import array_info_str, np
|
|
206
206
|
import pandas as pd
|
|
207
207
|
|
|
208
208
|
def crop(s, mx):
|
|
@@ -6,9 +6,9 @@ import pandas as pd
|
|
|
6
6
|
import pydantic.v1 as pydantic
|
|
7
7
|
from box import Box
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
9
|
+
from .datatools import complete_missing, UndefCond, UndefTypes
|
|
10
|
+
from .strings import compact_repr, hash_str
|
|
11
|
+
from .wrap import name_tuple
|
|
12
12
|
|
|
13
13
|
__all__ = ['TBox', 'UndefCond']
|
|
14
14
|
|
|
@@ -151,7 +151,7 @@ class TBox(Box):
|
|
|
151
151
|
|
|
152
152
|
def to_yaml(self, filename=None, *, default_flow_style=False,
|
|
153
153
|
encoding="utf-8", errors="strict", **yaml_kwargs):
|
|
154
|
-
from
|
|
154
|
+
from .fs import prepare_parent_folder, Path
|
|
155
155
|
|
|
156
156
|
par = self.copy() # type: TBox
|
|
157
157
|
for k, v in par.items(True):
|
|
@@ -15,8 +15,8 @@ def multi_label_data_table():
|
|
|
15
15
|
|
|
16
16
|
"""
|
|
17
17
|
import numpy as np
|
|
18
|
-
from iad.core.pdtools import DataTable, pd
|
|
19
|
-
from iad.core.label import Keys
|
|
18
|
+
from iad.core.data.pdtools import DataTable, pd
|
|
19
|
+
from iad.core.data.label import Keys
|
|
20
20
|
|
|
21
21
|
shape = (10, 10)
|
|
22
22
|
imL, imR = (np.ones(shape) * 1, np.ones(shape) * 2)
|
|
@@ -4,9 +4,9 @@ import numpy as np
|
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
|
-
from iad.core import pdtools as pdt
|
|
8
|
-
from iad.core.label import Keys
|
|
9
|
-
from iad.core.pdtools import add_row
|
|
7
|
+
from iad.core.data import pdtools as pdt
|
|
8
|
+
from iad.core.data.label import Keys
|
|
9
|
+
from iad.core.data.pdtools import add_row
|
|
10
10
|
from iad.core.wrap import name_tuple
|
|
11
11
|
|
|
12
12
|
|
ialdev_core-0.1.0/PKG-INFO
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: ialdev-core
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: iad.core — algorithmic utilities: data tools, parameters, paths, caching, and more
|
|
5
|
-
Author-email: Your Name <your.email@example.com>
|
|
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.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Requires-Dist: ialdev-io
|
|
18
|
-
Requires-Dist: pydantic>=2.0
|
|
19
|
-
Requires-Dist: pandas>=1.3.0
|
|
20
|
-
Requires-Dist: numpy>=1.20.0
|
|
21
|
-
Requires-Dist: pyyaml>=5.4.0
|
|
22
|
-
Requires-Dist: ruamel.yaml>=0.15.0
|
|
23
|
-
Requires-Dist: regex>=2021.0.0
|
|
24
|
-
Requires-Dist: rapidfuzz>=3.0
|
|
25
|
-
Requires-Dist: tqdm>=4.60.0
|
|
26
|
-
Requires-Dist: frozendict>=2.0.0
|
|
27
|
-
Requires-Dist: python-box>=6.0.0
|
|
28
|
-
Requires-Dist: joblib>=1.0.0
|
|
29
|
-
Requires-Dist: configargparse>=1.0.0
|
|
30
|
-
Requires-Dist: deprecated>=1.2.0
|
|
31
|
-
Requires-Dist: semver>=2.13.0
|
|
32
|
-
Requires-Dist: uncertainties>=3.1.0
|
|
33
|
-
Requires-Dist: pint>=0.20.0
|
|
34
|
-
Requires-Dist: zfpy
|
|
35
|
-
Requires-Dist: xxhash>=3.0.0
|
|
36
|
-
Requires-Dist: toolz>=0.11.0
|
|
37
|
-
Requires-Dist: numba>=0.55.0
|
|
38
|
-
Requires-Dist: scikit-learn>=1.0.0
|
|
39
|
-
Requires-Dist: python-dotenv>=0.19.0
|
|
40
|
-
Project-URL: Homepage, https://github.com/yourusername/toolbox
|
|
41
|
-
Project-URL: Issues, https://github.com/yourusername/toolbox/issues
|
|
42
|
-
Project-URL: Repository, https://github.com/yourusername/toolbox
|
|
43
|
-
|
|
44
|
-
# algutils
|
|
45
|
-
|
|
46
|
-
Algorithmic utilities: data tools, I/O, parameters, paths, caching, image transforms, and math (hist, geom, regress).
|
|
47
|
-
|
|
48
|
-
Extracted from the toolbox project as a standalone, installable package.
|
|
49
|
-
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# From this directory (editable)
|
|
54
|
-
pip install -e .
|
|
55
|
-
|
|
56
|
-
# With optional extras
|
|
57
|
-
pip install -e ".[io,units,dev]"
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Usage
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
from algutils import logger, as_list
|
|
64
|
-
from algutils.param import TBox, YamlModel
|
|
65
|
-
from algutils.io.format import FileFormat
|
|
66
|
-
from algutils.io.imread import imread
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Development
|
|
70
|
-
|
|
71
|
-
- **pixi**: `pixi install` then `pixi run test` or `pixi run lint`
|
|
72
|
-
- **pip**: `pip install -e ".[dev]"` then `pytest src/algutils -v`
|
|
73
|
-
|