stouputils 1.16.2__tar.gz → 1.17.0__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.
- {stouputils-1.16.2 → stouputils-1.17.0}/PKG-INFO +4 -2
- {stouputils-1.16.2 → stouputils-1.17.0}/README.md +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/pyproject.toml +4 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/__init__.py +1 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/__init__.pyi +1 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/all_doctests.py +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/collections.py +34 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/collections.pyi +21 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/decorators.py +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/image.py +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/image.pyi +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/io.py +1 -1
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/io.pyi +1 -1
- stouputils-1.17.0/stouputils/lock/__init__.py +36 -0
- stouputils-1.17.0/stouputils/lock/__init__.pyi +5 -0
- stouputils-1.17.0/stouputils/lock/base.py +536 -0
- stouputils-1.17.0/stouputils/lock/base.pyi +169 -0
- stouputils-1.17.0/stouputils/lock/queue.py +377 -0
- stouputils-1.17.0/stouputils/lock/queue.pyi +131 -0
- stouputils-1.17.0/stouputils/lock/re_entrant.py +115 -0
- stouputils-1.17.0/stouputils/lock/re_entrant.pyi +81 -0
- stouputils-1.17.0/stouputils/lock/redis_fifo.py +299 -0
- stouputils-1.17.0/stouputils/lock/redis_fifo.pyi +123 -0
- stouputils-1.17.0/stouputils/lock/shared.py +30 -0
- stouputils-1.17.0/stouputils/lock/shared.pyi +16 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/__main__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/_deprecated.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/_deprecated.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/all_doctests.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/__init__.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/automatic_docs.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/automatic_docs.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/__init__.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/config.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/config.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/image.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/image.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/video.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/applications/upscaler/video.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/archive.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/archive.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/backup.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/backup.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/__init__.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/cd_utils.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/cd_utils.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/github.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/github.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/pypi.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/pypi.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/pyproject.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/pyproject.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/stubs.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/continuous_delivery/stubs.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/ctx.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/ctx.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/config/get.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/config/set.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/auto_contrast.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/axis_flip.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/bias_field_correction.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/binary_threshold.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/blur.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/brightness.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/canny.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/clahe.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/common.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/contrast.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/curvature_flow_filter.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/denoise.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/histogram_equalization.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/invert.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/laplacian.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/median_blur.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/noise.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/normalize.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/random_erase.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/resize.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/rotation.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/salt_pepper.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/sharpening.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/shearing.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/threshold.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/translation.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image/zoom.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image_augmentation.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/image_preprocess.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/prosthesis_detection.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/data_processing/technique.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/dataset.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/dataset_loader.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/grouping_strategy.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/image_loader.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/dataset/xy_tuple.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/metric_dictionnary.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/metric_utils.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/mlflow_utils.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/abstract_model.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/all.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/base_keras.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/all.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/convnext.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/densenet.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/efficientnet.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/mobilenet.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/resnet.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/squeezenet.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/vgg.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras/xception.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/losses/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/keras_utils/visualizations.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/model_interface.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/models/sandbox.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/range_tuple.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/scripts/augment_dataset.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/scripts/exhaustive_process.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/scripts/preprocess_dataset.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/scripts/routine.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/data_science/utils.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/decorators.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/__init__.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/__init__.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/common.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/common.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/downloader.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/downloader.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/linux.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/linux.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/main.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/main.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/windows.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/installer/windows.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/parallel.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/parallel.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/print.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/print.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/py.typed +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/typing.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/typing.pyi +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/version_pkg.py +0 -0
- {stouputils-1.16.2 → stouputils-1.17.0}/stouputils/version_pkg.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: stouputils
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.17.0
|
|
4
4
|
Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
|
|
5
5
|
Keywords: utilities,tools,helpers,development,python
|
|
6
6
|
Author: Stoupy51
|
|
@@ -32,12 +32,14 @@ Requires-Dist: sphinx-design ; extra == 'docs'
|
|
|
32
32
|
Requires-Dist: sphinx-treeview ; extra == 'docs'
|
|
33
33
|
Requires-Dist: sphinx-breeze-theme ; extra == 'docs'
|
|
34
34
|
Requires-Dist: pydata-sphinx-theme ; extra == 'docs'
|
|
35
|
+
Requires-Dist: redis[hiredis] ; extra == 'redis'
|
|
35
36
|
Requires-Python: >=3.12
|
|
36
37
|
Project-URL: Homepage, https://stoupy51.github.io/stouputils
|
|
37
38
|
Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
|
|
38
39
|
Project-URL: Source, https://github.com/Stoupy51/stouputils
|
|
39
40
|
Provides-Extra: data-science
|
|
40
41
|
Provides-Extra: docs
|
|
42
|
+
Provides-Extra: redis
|
|
41
43
|
Description-Content-Type: text/markdown
|
|
42
44
|
|
|
43
45
|
|
|
@@ -93,7 +95,7 @@ Start now by installing the package: `pip install stouputils`.<br>
|
|
|
93
95
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.io.html">io.py</a> <span class="comment"># 💾 Utilities for file management <span class="paren">(json_dump, json_load, csv_dump, csv_load, read_file, super_copy, super_open, clean_path, ...)</span></span>
|
|
94
96
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.parallel.html">parallel.py</a> <span class="comment"># 🔀 Utility functions for parallel processing <span class="paren">(multiprocessing, multithreading, run_in_subprocess)</span></span>
|
|
95
97
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.image.html">image.py</a> <span class="comment"># 🖼️ Little utilities for image processing <span class="paren">(image_resize, auto_crop, numpy_to_gif, numpy_to_obj)</span></span>
|
|
96
|
-
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.collections.html">collections.py</a> <span class="comment"># 🧰 Utilities for collection manipulation <span class="paren">(unique_list, sort_dict_keys, upsert_in_dataframe, array_to_disk)</span></span>
|
|
98
|
+
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.collections.html">collections.py</a> <span class="comment"># 🧰 Utilities for collection manipulation <span class="paren">(unique_list, at_least_n, sort_dict_keys, upsert_in_dataframe, array_to_disk)</span></span>
|
|
97
99
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.typing.html">typing.py</a> <span class="comment"># 📝 Utilities for typing enhancements <span class="paren">(IterAny, JsonDict, JsonList, ..., convert_to_serializable)</span></span>
|
|
98
100
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.all_doctests.html">all_doctests.py</a> <span class="comment"># ✅ Run all doctests for all modules in a given directory <span class="paren">(launch_tests, test_module_with_progress)</span></span>
|
|
99
101
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.backup.html">backup.py</a> <span class="comment"># 💾 Utilities for backup management <span class="paren">(delta backup, consolidate)</span></span>
|
|
@@ -51,7 +51,7 @@ Start now by installing the package: `pip install stouputils`.<br>
|
|
|
51
51
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.io.html">io.py</a> <span class="comment"># 💾 Utilities for file management <span class="paren">(json_dump, json_load, csv_dump, csv_load, read_file, super_copy, super_open, clean_path, ...)</span></span>
|
|
52
52
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.parallel.html">parallel.py</a> <span class="comment"># 🔀 Utility functions for parallel processing <span class="paren">(multiprocessing, multithreading, run_in_subprocess)</span></span>
|
|
53
53
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.image.html">image.py</a> <span class="comment"># 🖼️ Little utilities for image processing <span class="paren">(image_resize, auto_crop, numpy_to_gif, numpy_to_obj)</span></span>
|
|
54
|
-
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.collections.html">collections.py</a> <span class="comment"># 🧰 Utilities for collection manipulation <span class="paren">(unique_list, sort_dict_keys, upsert_in_dataframe, array_to_disk)</span></span>
|
|
54
|
+
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.collections.html">collections.py</a> <span class="comment"># 🧰 Utilities for collection manipulation <span class="paren">(unique_list, at_least_n, sort_dict_keys, upsert_in_dataframe, array_to_disk)</span></span>
|
|
55
55
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.typing.html">typing.py</a> <span class="comment"># 📝 Utilities for typing enhancements <span class="paren">(IterAny, JsonDict, JsonList, ..., convert_to_serializable)</span></span>
|
|
56
56
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.all_doctests.html">all_doctests.py</a> <span class="comment"># ✅ Run all doctests for all modules in a given directory <span class="paren">(launch_tests, test_module_with_progress)</span></span>
|
|
57
57
|
├── <a href="https://stoupy51.github.io/stouputils/latest/modules/stouputils.backup.html">backup.py</a> <span class="comment"># 💾 Utilities for backup management <span class="paren">(delta backup, consolidate)</span></span>
|
|
@@ -8,7 +8,7 @@ module-root = ""
|
|
|
8
8
|
|
|
9
9
|
[project]
|
|
10
10
|
name = "stouputils"
|
|
11
|
-
version = "1.
|
|
11
|
+
version = "1.17.0"
|
|
12
12
|
description = "Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more."
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
keywords = ["utilities", "tools", "helpers", "development", "python"]
|
|
@@ -53,6 +53,9 @@ data_science = [
|
|
|
53
53
|
"scikit-learn",
|
|
54
54
|
"PyWavelets",
|
|
55
55
|
]
|
|
56
|
+
redis = [
|
|
57
|
+
"redis[hiredis]",
|
|
58
|
+
]
|
|
56
59
|
|
|
57
60
|
[project.urls]
|
|
58
61
|
Homepage = "https://stoupy51.github.io/stouputils"
|
|
@@ -99,7 +99,7 @@ def launch_tests(root_dir: str, strict: bool = True, pattern: str = "*") -> int:
|
|
|
99
99
|
import fnmatch
|
|
100
100
|
modules_file_paths = [
|
|
101
101
|
path for path in modules_file_paths
|
|
102
|
-
if fnmatch.fnmatch(path
|
|
102
|
+
if fnmatch.fnmatch(path, pattern)
|
|
103
103
|
]
|
|
104
104
|
if not modules_file_paths:
|
|
105
105
|
raise ValueError(f"No modules matching pattern '{pattern}' found in '{relative_path(root_dir)}'")
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
This module provides utilities for collection manipulation:
|
|
3
3
|
|
|
4
4
|
- unique_list: Remove duplicates from a list while preserving order using object id, hash or str
|
|
5
|
+
- at_least_n: Check if at least n elements in an iterable satisfy a given predicate
|
|
5
6
|
- sort_dict_keys: Sort dictionary keys using a given order list (ascending or descending)
|
|
6
7
|
- upsert_in_dataframe: Insert or update a row in a Polars DataFrame based on primary keys
|
|
7
8
|
- array_to_disk: Easily handle large numpy arrays on disk using zarr for efficient storage and access.
|
|
@@ -15,7 +16,7 @@ import atexit
|
|
|
15
16
|
import os
|
|
16
17
|
import shutil
|
|
17
18
|
import tempfile
|
|
18
|
-
from collections.abc import Iterable
|
|
19
|
+
from collections.abc import Callable, Iterable
|
|
19
20
|
from typing import TYPE_CHECKING, Any, Literal, TypeVar
|
|
20
21
|
|
|
21
22
|
# Lazy imports for typing
|
|
@@ -77,6 +78,38 @@ def unique_list[T](list_to_clean: Iterable[T], method: Literal["id", "hash", "st
|
|
|
77
78
|
# Return the cleaned list
|
|
78
79
|
return result
|
|
79
80
|
|
|
81
|
+
|
|
82
|
+
def at_least_n(iterable: Iterable[T], predicate: Callable[[T], bool], n: int) -> bool:
|
|
83
|
+
""" Return True if at least n elements in iterable satisfy predicate.
|
|
84
|
+
It's like the built-in any() but for at least n matches.
|
|
85
|
+
|
|
86
|
+
Stops iterating as soon as n matches are found (short-circuit evaluation).
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
iterable (Iterable[T]): The iterable to check.
|
|
90
|
+
predicate (Callable[[T], bool]): The predicate to apply to items.
|
|
91
|
+
n (int): Minimum number of matches required.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
bool: True if at least n elements satisfy predicate, otherwise False.
|
|
95
|
+
|
|
96
|
+
Examples:
|
|
97
|
+
>>> at_least_n([1, 2, 3, 4, *[i for i in range(5, int(1e5))]], lambda x: x % 2 == 0, 2)
|
|
98
|
+
True
|
|
99
|
+
>>> at_least_n([1, 3, 5, 7], lambda x: x % 2 == 0, 1)
|
|
100
|
+
False
|
|
101
|
+
"""
|
|
102
|
+
if n <= 0:
|
|
103
|
+
return True
|
|
104
|
+
count: int = 0
|
|
105
|
+
for item in iterable:
|
|
106
|
+
if predicate(item):
|
|
107
|
+
count += 1
|
|
108
|
+
if count >= n:
|
|
109
|
+
return True
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
|
|
80
113
|
def sort_dict_keys[T](dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
81
114
|
""" Sort dictionary keys using a given order list (reverse optional)
|
|
82
115
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import polars as pl
|
|
2
2
|
import zarr
|
|
3
|
-
from collections.abc import Iterable
|
|
3
|
+
from collections.abc import Callable as Callable, Iterable
|
|
4
4
|
from numpy.typing import NDArray as NDArray
|
|
5
5
|
from typing import Any, Literal, TypeVar
|
|
6
6
|
|
|
@@ -31,6 +31,26 @@ def unique_list[T](list_to_clean: Iterable[T], method: Literal['id', 'hash', 'st
|
|
|
31
31
|
\t\t>>> unique_list([s1, s2, s1, s1, s3, s2, s3], method="str")
|
|
32
32
|
\t\t[{1, 2, 3}, {2, 3, 4}]
|
|
33
33
|
\t'''
|
|
34
|
+
def at_least_n(iterable: Iterable[T], predicate: Callable[[T], bool], n: int) -> bool:
|
|
35
|
+
""" Return True if at least n elements in iterable satisfy predicate.
|
|
36
|
+
\tIt's like the built-in any() but for at least n matches.
|
|
37
|
+
|
|
38
|
+
\tStops iterating as soon as n matches are found (short-circuit evaluation).
|
|
39
|
+
|
|
40
|
+
\tArgs:
|
|
41
|
+
\t\titerable\t(Iterable[T]):\t\t\tThe iterable to check.
|
|
42
|
+
\t\tpredicate\t(Callable[[T], bool]):\tThe predicate to apply to items.
|
|
43
|
+
\t\tn\t\t\t(int):\t\t\t\t\tMinimum number of matches required.
|
|
44
|
+
|
|
45
|
+
\tReturns:
|
|
46
|
+
\t\tbool: True if at least n elements satisfy predicate, otherwise False.
|
|
47
|
+
|
|
48
|
+
\tExamples:
|
|
49
|
+
\t\t>>> at_least_n([1, 2, 3, 4, *[i for i in range(5, int(1e5))]], lambda x: x % 2 == 0, 2)
|
|
50
|
+
\t\tTrue
|
|
51
|
+
\t\t>>> at_least_n([1, 3, 5, 7], lambda x: x % 2 == 0, 1)
|
|
52
|
+
\t\tFalse
|
|
53
|
+
\t"""
|
|
34
54
|
def sort_dict_keys[T](dictionary: dict[T, Any], order: list[T], reverse: bool = False) -> dict[T, Any]:
|
|
35
55
|
''' Sort dictionary keys using a given order list (reverse optional)
|
|
36
56
|
|
|
@@ -211,7 +211,7 @@ def timeout(
|
|
|
211
211
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
212
212
|
# Check if we can use signal-based timeout (Unix only)
|
|
213
213
|
import os
|
|
214
|
-
use_signal: bool = os.name !=
|
|
214
|
+
use_signal: bool = os.name != "nt" # Not Windows
|
|
215
215
|
|
|
216
216
|
if use_signal:
|
|
217
217
|
try:
|
|
@@ -401,7 +401,7 @@ def numpy_to_obj(
|
|
|
401
401
|
|
|
402
402
|
# Apply marching cubes algorithm to extract mesh
|
|
403
403
|
verts, faces, _, _ = cast(
|
|
404
|
-
tuple[NDArray[np.floating], NDArray[np.integer], NDArray[np.floating], NDArray[np.floating]],
|
|
404
|
+
"tuple[NDArray[np.floating], NDArray[np.integer], NDArray[np.floating], NDArray[np.floating]]",
|
|
405
405
|
measure.marching_cubes(volume, level=threshold, step_size=step_size, allow_degenerate=False) # type: ignore
|
|
406
406
|
)
|
|
407
407
|
|
|
@@ -3,7 +3,7 @@ from .io import super_open as super_open
|
|
|
3
3
|
from .print import debug as debug, info as info
|
|
4
4
|
from PIL import Image
|
|
5
5
|
from collections.abc import Callable
|
|
6
|
-
from numpy.typing import NDArray
|
|
6
|
+
from numpy.typing import NDArray as NDArray
|
|
7
7
|
from typing import Any, TypeVar
|
|
8
8
|
|
|
9
9
|
PIL_Image_or_NDArray = TypeVar('PIL_Image_or_NDArray', bound='Image.Image | NDArray[np.number]')
|
|
@@ -338,7 +338,7 @@ def super_copy(src: str, dst: str, create_dir: bool = True, symlink: bool = Fals
|
|
|
338
338
|
src (str): The source path
|
|
339
339
|
dst (str): The destination path
|
|
340
340
|
create_dir (bool): Whether to create the directory if it doesn't exist (default: True)
|
|
341
|
-
symlink (bool): Whether to create a symlink instead of copying (Linux only
|
|
341
|
+
symlink (bool): Whether to create a symlink instead of copying (Linux only)
|
|
342
342
|
Returns:
|
|
343
343
|
str: The destination path
|
|
344
344
|
"""
|
|
@@ -144,7 +144,7 @@ def super_copy(src: str, dst: str, create_dir: bool = True, symlink: bool = Fals
|
|
|
144
144
|
\t\tsrc (str): The source path
|
|
145
145
|
\t\tdst (str): The destination path
|
|
146
146
|
\t\tcreate_dir (bool): Whether to create the directory if it doesn't exist (default: True)
|
|
147
|
-
\t\tsymlink (bool): Whether to create a symlink instead of copying (Linux only
|
|
147
|
+
\t\tsymlink (bool): Whether to create a symlink instead of copying (Linux only)
|
|
148
148
|
\tReturns:
|
|
149
149
|
\t\tstr: The destination path
|
|
150
150
|
\t"""
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
""" Inter-process locks implementing First-In-First-Out (FIFO).
|
|
2
|
+
|
|
3
|
+
Source:
|
|
4
|
+
- https://en.wikipedia.org/wiki/File_locking
|
|
5
|
+
- https://en.wikipedia.org/wiki/Starvation_%28computer_science%29
|
|
6
|
+
- https://en.wikipedia.org/wiki/FIFO_and_LIFO_accounting
|
|
7
|
+
|
|
8
|
+
Provides three classes:
|
|
9
|
+
|
|
10
|
+
- LockFifo: basic cross-process lock using filesystem (POSIX via fcntl, Windows via msvcrt).
|
|
11
|
+
- RLockFifo: reentrant per-(process,thread) lock built on top of LockFifo.
|
|
12
|
+
- RedisLockFifo: distributed lock using redis (optional dependency).
|
|
13
|
+
|
|
14
|
+
Usage
|
|
15
|
+
-----
|
|
16
|
+
>>> import stouputils as stp
|
|
17
|
+
>>> with stp.LockFifo("some_directory/my.lock", timeout=5):
|
|
18
|
+
... pass
|
|
19
|
+
|
|
20
|
+
>>> with stp.RLockFifo("some_directory/my_r.lock", timeout=5):
|
|
21
|
+
... pass
|
|
22
|
+
|
|
23
|
+
>>> def _redis_example():
|
|
24
|
+
... with stp.RedisLockFifo("my_redis_lock", timeout=5):
|
|
25
|
+
... pass
|
|
26
|
+
>>> import os
|
|
27
|
+
>>> if os.name != "nt":
|
|
28
|
+
... _redis_example()
|
|
29
|
+
"""
|
|
30
|
+
# Imports
|
|
31
|
+
from .base import *
|
|
32
|
+
from .queue import *
|
|
33
|
+
from .re_entrant import *
|
|
34
|
+
from .redis_fifo import *
|
|
35
|
+
from .shared import *
|
|
36
|
+
|