stouputils 1.19.4__tar.gz → 1.19.5__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.19.4 → stouputils-1.19.5}/PKG-INFO +1 -1
- {stouputils-1.19.4 → stouputils-1.19.5}/pyproject.toml +1 -1
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/subprocess.py +31 -34
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/subprocess.pyi +7 -7
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/print.py +54 -75
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/print.pyi +26 -21
- {stouputils-1.19.4 → stouputils-1.19.5}/README.md +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/__main__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/_deprecated.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/_deprecated.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/all_doctests.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/all_doctests.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/automatic_docs.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/automatic_docs.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/config.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/config.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/image.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/image.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/video.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/applications/upscaler/video.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/archive.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/archive.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/backup.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/backup.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/collections.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/collections.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/cd_utils.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/cd_utils.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/github.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/github.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/pypi.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/pypi.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/pyproject.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/pyproject.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/stubs.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/continuous_delivery/stubs.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/ctx.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/ctx.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/config/get.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/config/set.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/auto_contrast.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/axis_flip.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/bias_field_correction.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/binary_threshold.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/blur.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/brightness.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/canny.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/clahe.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/common.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/contrast.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/curvature_flow_filter.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/denoise.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/histogram_equalization.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/invert.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/laplacian.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/median_blur.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/noise.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/normalize.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/random_erase.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/resize.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/rotation.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/salt_pepper.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/sharpening.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/shearing.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/threshold.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/translation.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/zoom.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image_augmentation.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image_preprocess.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/prosthesis_detection.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/technique.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/dataset.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/dataset_loader.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/grouping_strategy.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/image_loader.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/xy_tuple.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/metric_dictionnary.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/metric_utils.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/mlflow_utils.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/abstract_model.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/all.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/base_keras.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/all.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/convnext.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/densenet.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/efficientnet.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/mobilenet.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/resnet.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/squeezenet.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/vgg.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/xception.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/losses/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/visualizations.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/model_interface.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/sandbox.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/range_tuple.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/augment_dataset.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/exhaustive_process.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/preprocess_dataset.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/routine.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/utils.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/decorators.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/decorators.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/image.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/image.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/common.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/common.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/downloader.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/downloader.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/linux.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/linux.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/main.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/main.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/windows.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/installer/windows.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/io.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/io.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/base.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/base.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/queue.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/queue.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/re_entrant.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/re_entrant.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/redis_fifo.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/redis_fifo.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/shared.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/lock/shared.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/__init__.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/__init__.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/capturer.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/capturer.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/common.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/common.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/multi.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/parallel/multi.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/py.typed +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/typing.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/typing.pyi +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/version_pkg.py +0 -0
- {stouputils-1.19.4 → stouputils-1.19.5}/stouputils/version_pkg.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: stouputils
|
|
3
|
-
Version: 1.19.
|
|
3
|
+
Version: 1.19.5
|
|
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
|
|
@@ -8,7 +8,7 @@ module-root = ""
|
|
|
8
8
|
|
|
9
9
|
[project]
|
|
10
10
|
name = "stouputils"
|
|
11
|
-
version = "1.19.
|
|
11
|
+
version = "1.19.5"
|
|
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"]
|
|
@@ -38,7 +38,7 @@ def run_in_subprocess[R](
|
|
|
38
38
|
*args (Any): Positional arguments to pass to the function.
|
|
39
39
|
timeout (float | None): Maximum time in seconds to wait for the subprocess.
|
|
40
40
|
If None, wait indefinitely. If the subprocess exceeds this time, it will be terminated.
|
|
41
|
-
no_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget).
|
|
41
|
+
no_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget) and return the Process object.
|
|
42
42
|
capture_output (bool): If True, capture the subprocess' stdout/stderr and relay it
|
|
43
43
|
in real time to the parent's stdout. This enables seeing print() output
|
|
44
44
|
from the subprocess in the main process.
|
|
@@ -60,10 +60,10 @@ def run_in_subprocess[R](
|
|
|
60
60
|
25
|
|
61
61
|
|
|
62
62
|
> # Function with multiple arguments
|
|
63
|
-
> def add(a: int, b: int) -> int:
|
|
64
|
-
. return a + b
|
|
65
|
-
> run_in_subprocess(add, 10, 20)
|
|
66
|
-
|
|
63
|
+
> def add(a: int, b: int, c: int) -> int:
|
|
64
|
+
. return a + b + c
|
|
65
|
+
> run_in_subprocess(add, 10, 20, c=30)
|
|
66
|
+
60
|
|
67
67
|
|
|
68
68
|
> # Function with keyword arguments
|
|
69
69
|
> def greet(name: str, greeting: str = "Hello") -> str:
|
|
@@ -89,10 +89,19 @@ def run_in_subprocess[R](
|
|
|
89
89
|
process: mp.Process = mp.Process(
|
|
90
90
|
target=_subprocess_wrapper,
|
|
91
91
|
args=(result_queue, func, args, kwargs),
|
|
92
|
-
kwargs={"
|
|
92
|
+
kwargs={"capturer": capturer}
|
|
93
93
|
)
|
|
94
94
|
process.start()
|
|
95
95
|
|
|
96
|
+
# Function to kill the process safely
|
|
97
|
+
def kill_process() -> None:
|
|
98
|
+
if process.is_alive():
|
|
99
|
+
process.terminate()
|
|
100
|
+
time.sleep(0.5)
|
|
101
|
+
if process.is_alive():
|
|
102
|
+
process.kill()
|
|
103
|
+
process.join()
|
|
104
|
+
|
|
96
105
|
# For capture_output we must close the parent's copy of the write fd and start listener
|
|
97
106
|
if capturer is not None:
|
|
98
107
|
capturer.parent_close_write()
|
|
@@ -101,36 +110,24 @@ def run_in_subprocess[R](
|
|
|
101
110
|
# Detach process if no_join (fire-and-forget)
|
|
102
111
|
if result_queue is None:
|
|
103
112
|
# If capturing, leave listener running in background (daemon)
|
|
104
|
-
return
|
|
113
|
+
return process # type: ignore
|
|
105
114
|
|
|
106
115
|
# Use a single try/finally to ensure we always drain the listener once
|
|
107
116
|
# and avoid repeating join calls in multiple branches.
|
|
108
117
|
try:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
process.kill()
|
|
117
|
-
process.join()
|
|
118
|
-
raise TimeoutError(f"Subprocess exceeded timeout of {timeout} seconds and was terminated")
|
|
119
|
-
|
|
120
|
-
# Retrieve the payload if present
|
|
121
|
-
result_payload: JsonDict | None = result_queue.get_nowait() if not result_queue.empty() else None
|
|
118
|
+
try:
|
|
119
|
+
result_payload: JsonDict = result_queue.get(timeout=timeout)
|
|
120
|
+
except Exception as e:
|
|
121
|
+
# Queue.get timed out or failed
|
|
122
|
+
raise TimeoutError(f"Subprocess exceeded timeout of {timeout} seconds and was terminated") from e
|
|
123
|
+
finally:
|
|
124
|
+
kill_process()
|
|
122
125
|
|
|
123
126
|
# If the child sent a structured exception, raise it with the formatted traceback
|
|
124
|
-
if
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return result_payload["result"]
|
|
129
|
-
|
|
130
|
-
# Raise an error according to the exit code presence
|
|
131
|
-
if process.exitcode != 0:
|
|
132
|
-
raise RuntimeError(f"Subprocess failed with exit code {process.exitcode}")
|
|
133
|
-
raise RuntimeError("Subprocess did not return any result")
|
|
127
|
+
if result_payload.pop("ok", False) is False:
|
|
128
|
+
raise RemoteSubprocessError(**result_payload)
|
|
129
|
+
else:
|
|
130
|
+
return result_payload["result"]
|
|
134
131
|
|
|
135
132
|
# Finally, ensure we drain/join the listener if capturing output
|
|
136
133
|
finally:
|
|
@@ -144,7 +141,7 @@ def _subprocess_wrapper[R](
|
|
|
144
141
|
func: Callable[..., R],
|
|
145
142
|
args: tuple[Any, ...],
|
|
146
143
|
kwargs: dict[str, Any],
|
|
147
|
-
|
|
144
|
+
capturer: CaptureOutput | None = None
|
|
148
145
|
) -> None:
|
|
149
146
|
""" Wrapper function to execute the target function and store the result in the queue.
|
|
150
147
|
|
|
@@ -155,12 +152,12 @@ def _subprocess_wrapper[R](
|
|
|
155
152
|
func (Callable): The target function to execute.
|
|
156
153
|
args (tuple): Positional arguments for the function.
|
|
157
154
|
kwargs (dict): Keyword arguments for the function.
|
|
158
|
-
|
|
155
|
+
capturer (CaptureOutput | None): Optional CaptureOutput instance for stdout capture.
|
|
159
156
|
"""
|
|
160
157
|
try:
|
|
161
158
|
# If a CaptureOutput instance was passed, redirect stdout/stderr to the pipe.
|
|
162
|
-
if
|
|
163
|
-
|
|
159
|
+
if capturer is not None:
|
|
160
|
+
capturer.redirect()
|
|
164
161
|
|
|
165
162
|
# Execute the target function and put the result in the queue
|
|
166
163
|
result: R = func(*args, **kwargs)
|
|
@@ -24,7 +24,7 @@ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | No
|
|
|
24
24
|
\t\t*args (Any): Positional arguments to pass to the function.
|
|
25
25
|
\t\ttimeout (float | None): Maximum time in seconds to wait for the subprocess.
|
|
26
26
|
\t\t\tIf None, wait indefinitely. If the subprocess exceeds this time, it will be terminated.
|
|
27
|
-
\t\tno_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget).
|
|
27
|
+
\t\tno_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget) and return the Process object.
|
|
28
28
|
\t\tcapture_output (bool): If True, capture the subprocess\' stdout/stderr and relay it
|
|
29
29
|
\t\t\tin real time to the parent\'s stdout. This enables seeing print() output
|
|
30
30
|
\t\t\tfrom the subprocess in the main process.
|
|
@@ -46,10 +46,10 @@ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | No
|
|
|
46
46
|
\t\t\t25
|
|
47
47
|
|
|
48
48
|
\t\t\t> # Function with multiple arguments
|
|
49
|
-
\t\t\t> def add(a: int, b: int) -> int:
|
|
50
|
-
\t\t\t. return a + b
|
|
51
|
-
\t\t\t> run_in_subprocess(add, 10, 20)
|
|
52
|
-
\t\t\
|
|
49
|
+
\t\t\t> def add(a: int, b: int, c: int) -> int:
|
|
50
|
+
\t\t\t. return a + b + c
|
|
51
|
+
\t\t\t> run_in_subprocess(add, 10, 20, c=30)
|
|
52
|
+
\t\t\t60
|
|
53
53
|
|
|
54
54
|
\t\t\t> # Function with keyword arguments
|
|
55
55
|
\t\t\t> def greet(name: str, greeting: str = "Hello") -> str:
|
|
@@ -60,7 +60,7 @@ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | No
|
|
|
60
60
|
\t\t\t> # With timeout to prevent hanging
|
|
61
61
|
\t\t\t> run_in_subprocess(some_gpu_func, data, timeout=300.0)
|
|
62
62
|
\t'''
|
|
63
|
-
def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tuple[Any, ...], kwargs: dict[str, Any],
|
|
63
|
+
def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tuple[Any, ...], kwargs: dict[str, Any], capturer: CaptureOutput | None = None) -> None:
|
|
64
64
|
""" Wrapper function to execute the target function and store the result in the queue.
|
|
65
65
|
|
|
66
66
|
\tMust be at module level to be pickable on Windows (spawn context).
|
|
@@ -70,5 +70,5 @@ def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tupl
|
|
|
70
70
|
\t\tfunc (Callable): The target function to execute.
|
|
71
71
|
\t\targs (tuple): Positional arguments for the function.
|
|
72
72
|
\t\tkwargs (dict): Keyword arguments for the function.
|
|
73
|
-
\t\
|
|
73
|
+
\t\tcapturer (CaptureOutput | None): Optional CaptureOutput instance for stdout capture.
|
|
74
74
|
\t"""
|
|
@@ -375,49 +375,29 @@ def info(
|
|
|
375
375
|
else:
|
|
376
376
|
print(message, *values, RESET, file=file, **print_kwargs)
|
|
377
377
|
|
|
378
|
-
def debug(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
378
|
+
def debug(*values: Any, flush: bool = True, color: str = CYAN, text: str = "DEBUG", **print_kwargs: Any) -> None:
|
|
379
379
|
""" Print a debug message looking like "[DEBUG HH:MM:SS] message" in cyan by default. """
|
|
380
|
-
|
|
381
|
-
print_kwargs["text"] = "DEBUG"
|
|
382
|
-
if "color" not in print_kwargs:
|
|
383
|
-
print_kwargs["color"] = CYAN
|
|
384
|
-
info(*values, flush=flush, **print_kwargs)
|
|
380
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
385
381
|
|
|
386
|
-
def alt_debug(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
382
|
+
def alt_debug(*values: Any, flush: bool = True, color: str = BLUE, text: str = "DEBUG", **print_kwargs: Any) -> None:
|
|
387
383
|
""" Print a debug message looking like "[DEBUG HH:MM:SS] message" in blue by default. """
|
|
388
|
-
|
|
389
|
-
print_kwargs["text"] = "DEBUG"
|
|
390
|
-
if "color" not in print_kwargs:
|
|
391
|
-
print_kwargs["color"] = BLUE
|
|
392
|
-
info(*values, flush=flush, **print_kwargs)
|
|
384
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
393
385
|
|
|
394
|
-
def suggestion(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
386
|
+
def suggestion(*values: Any, flush: bool = True, color: str = CYAN, text: str = "SUGGESTION", **print_kwargs: Any) -> None:
|
|
395
387
|
""" Print a suggestion message looking like "[SUGGESTION HH:MM:SS] message" in cyan by default. """
|
|
396
|
-
|
|
397
|
-
print_kwargs["text"] = "SUGGESTION"
|
|
398
|
-
if "color" not in print_kwargs:
|
|
399
|
-
print_kwargs["color"] = CYAN
|
|
400
|
-
info(*values, flush=flush, **print_kwargs)
|
|
388
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
401
389
|
|
|
402
|
-
def progress(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
390
|
+
def progress(*values: Any, flush: bool = True, color: str = MAGENTA, text: str = "PROGRESS", **print_kwargs: Any) -> None:
|
|
403
391
|
""" Print a progress message looking like "[PROGRESS HH:MM:SS] message" in magenta by default. """
|
|
404
|
-
|
|
405
|
-
print_kwargs["text"] = "PROGRESS"
|
|
406
|
-
if "color" not in print_kwargs:
|
|
407
|
-
print_kwargs["color"] = MAGENTA
|
|
408
|
-
info(*values, flush=flush, **print_kwargs)
|
|
392
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
409
393
|
|
|
410
|
-
def warning(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
394
|
+
def warning(*values: Any, flush: bool = True, color: str = YELLOW, text: str = "WARNING", **print_kwargs: Any) -> None:
|
|
411
395
|
""" Print a warning message looking like "[WARNING HH:MM:SS] message" in yellow by default and in sys.stderr. """
|
|
412
396
|
if "file" not in print_kwargs:
|
|
413
397
|
print_kwargs["file"] = sys.stderr
|
|
414
|
-
|
|
415
|
-
print_kwargs["text"] = "WARNING"
|
|
416
|
-
if "color" not in print_kwargs:
|
|
417
|
-
print_kwargs["color"] = YELLOW
|
|
418
|
-
info(*values, flush=flush, **print_kwargs)
|
|
398
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
419
399
|
|
|
420
|
-
def error(*values: Any, exit: bool = False, flush: bool = True, **print_kwargs: Any) -> None:
|
|
400
|
+
def error(*values: Any, exit: bool = False, flush: bool = True, color: str = RED, text: str = "ERROR", **print_kwargs: Any) -> None:
|
|
421
401
|
""" Print an error message (in sys.stderr and in red by default)
|
|
422
402
|
and optionally ask the user to continue or stop the program.
|
|
423
403
|
|
|
@@ -425,6 +405,9 @@ def error(*values: Any, exit: bool = False, flush: bool = True, **print_kwargs:
|
|
|
425
405
|
values (Any): Values to print (like the print function)
|
|
426
406
|
exit (bool): Whether to ask the user to continue or stop the program,
|
|
427
407
|
false to ignore the error automatically and continue
|
|
408
|
+
flush (bool): Whether to flush the output
|
|
409
|
+
color (str): Color of the message (default: RED)
|
|
410
|
+
text (str): Text in the message (replaces "ERROR ")
|
|
428
411
|
print_kwargs (dict): Keyword arguments to pass to the print function
|
|
429
412
|
"""
|
|
430
413
|
file: TextIO = sys.stderr
|
|
@@ -433,11 +416,7 @@ def error(*values: Any, exit: bool = False, flush: bool = True, **print_kwargs:
|
|
|
433
416
|
file = cast(TextIO, print_kwargs["file"][0])
|
|
434
417
|
else:
|
|
435
418
|
file = print_kwargs["file"]
|
|
436
|
-
|
|
437
|
-
print_kwargs["text"] = "ERROR"
|
|
438
|
-
if "color" not in print_kwargs:
|
|
439
|
-
print_kwargs["color"] = RED
|
|
440
|
-
info(*values, flush=flush, **print_kwargs)
|
|
419
|
+
info(*values, flush=flush, color=color, text=text, **print_kwargs)
|
|
441
420
|
if exit:
|
|
442
421
|
try:
|
|
443
422
|
print("Press enter to ignore error and continue, or 'CTRL+C' to stop the program... ", file=file)
|
|
@@ -452,6 +431,7 @@ def whatisit(
|
|
|
452
431
|
flush: bool = True,
|
|
453
432
|
max_length: int = 250,
|
|
454
433
|
color: str = CYAN,
|
|
434
|
+
text: str = "What is it?",
|
|
455
435
|
**print_kwargs: Any,
|
|
456
436
|
) -> None:
|
|
457
437
|
""" Print the type of each value and the value itself, with its id and length/shape.
|
|
@@ -463,6 +443,7 @@ def whatisit(
|
|
|
463
443
|
print_function (Callable): Function to use to print the values (default: debug())
|
|
464
444
|
max_length (int): Maximum length of the value string to print (default: 250)
|
|
465
445
|
color (str): Color of the message (default: CYAN)
|
|
446
|
+
text (str): Text in the message (replaces "DEBUG")
|
|
466
447
|
print_kwargs (dict): Keyword arguments to pass to the print function
|
|
467
448
|
"""
|
|
468
449
|
def _internal(value: Any) -> str:
|
|
@@ -471,15 +452,22 @@ def whatisit(
|
|
|
471
452
|
# Build metadata parts list
|
|
472
453
|
metadata_parts: list[str] = []
|
|
473
454
|
|
|
474
|
-
# Get
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
455
|
+
# Get attributes if available (with priority order)
|
|
456
|
+
for attributes in [("dtype","dtypes"),("nbytes","memory_usage"),("device",)]:
|
|
457
|
+
# Find the first available attribute of the current tuple
|
|
458
|
+
for attr in attributes:
|
|
459
|
+
try:
|
|
460
|
+
attr_value = getattr(value, attr)
|
|
461
|
+
if attr_value is not None:
|
|
462
|
+
metadata_parts.append(f"{attr}: {attr_value}")
|
|
463
|
+
break
|
|
464
|
+
except (AttributeError, TypeError):
|
|
465
|
+
continue
|
|
479
466
|
|
|
480
467
|
# Get the shape or length of the value
|
|
481
468
|
try:
|
|
482
|
-
|
|
469
|
+
if value.shape:
|
|
470
|
+
metadata_parts.append(f"shape: {value.shape}")
|
|
483
471
|
except (AttributeError, TypeError):
|
|
484
472
|
try:
|
|
485
473
|
metadata_parts.append(f"length: {len(value)}")
|
|
@@ -511,37 +499,28 @@ def whatisit(
|
|
|
511
499
|
# Return the formatted string
|
|
512
500
|
return f"{type(value)}, <id {id(value)}>: {metadata_str}{value_str}"
|
|
513
501
|
|
|
514
|
-
# Add the color to the message
|
|
515
|
-
if "color" not in print_kwargs:
|
|
516
|
-
print_kwargs["color"] = color
|
|
517
|
-
|
|
518
|
-
# Set text to "What is it?" if not already set
|
|
519
|
-
if "text" not in print_kwargs:
|
|
520
|
-
print_kwargs["text"] = "What is it?"
|
|
521
|
-
|
|
522
502
|
# Print the values
|
|
523
503
|
if len(values) > 1:
|
|
524
|
-
print_function("".join(f"\n {_internal(value)}" for value in values), flush=flush, **print_kwargs)
|
|
504
|
+
print_function("".join(f"\n {_internal(value)}" for value in values), flush=flush, color=color, text=text, **print_kwargs)
|
|
525
505
|
elif len(values) == 1:
|
|
526
|
-
print_function(_internal(values[0]), flush=flush, **print_kwargs)
|
|
506
|
+
print_function(_internal(values[0]), flush=flush, color=color, text=text, **print_kwargs)
|
|
527
507
|
|
|
528
|
-
def breakpoint(*values: Any, print_function: Callable[..., None] = warning, flush: bool = True, **print_kwargs: Any) -> None:
|
|
508
|
+
def breakpoint(*values: Any, print_function: Callable[..., None] = warning, flush: bool = True, text: str = "BREAKPOINT (press Enter)", **print_kwargs: Any) -> None:
|
|
529
509
|
""" Breakpoint function, pause the program and print the values.
|
|
530
510
|
|
|
531
511
|
Args:
|
|
532
512
|
values (Any): Values to print
|
|
533
513
|
print_function (Callable): Function to use to print the values (default: warning())
|
|
514
|
+
text (str): Text in the message (replaces "WARNING")
|
|
534
515
|
print_kwargs (dict): Keyword arguments to pass to the print function
|
|
535
516
|
"""
|
|
536
|
-
if "text" not in print_kwargs:
|
|
537
|
-
print_kwargs["text"] = "BREAKPOINT (press Enter)"
|
|
538
517
|
file: TextIO = sys.stderr
|
|
539
518
|
if "file" in print_kwargs:
|
|
540
519
|
if isinstance(print_kwargs["file"], list):
|
|
541
520
|
file = cast(TextIO, print_kwargs["file"][0])
|
|
542
521
|
else:
|
|
543
522
|
file = print_kwargs["file"]
|
|
544
|
-
whatisit(*values, print_function=print_function, flush=flush, **print_kwargs)
|
|
523
|
+
whatisit(*values, print_function=print_function, flush=flush, text=text, **print_kwargs)
|
|
545
524
|
try:
|
|
546
525
|
input()
|
|
547
526
|
except (KeyboardInterrupt, EOFError):
|
|
@@ -700,24 +679,24 @@ def current_time() -> str:
|
|
|
700
679
|
return time.strftime("%H:%M:%S")
|
|
701
680
|
|
|
702
681
|
# Convenience colored functions
|
|
703
|
-
def infoc(*args: Any, **kwargs: Any) -> None:
|
|
704
|
-
return info(*args, use_colored=
|
|
705
|
-
def debugc(*args: Any, **kwargs: Any) -> None:
|
|
706
|
-
return debug(*args, use_colored=
|
|
707
|
-
def alt_debugc(*args: Any, **kwargs: Any) -> None:
|
|
708
|
-
return alt_debug(*args, use_colored=
|
|
709
|
-
def warningc(*args: Any, **kwargs: Any) -> None:
|
|
710
|
-
return warning(*args, use_colored=
|
|
711
|
-
def errorc(*args: Any, **kwargs: Any) -> None:
|
|
712
|
-
return error(*args, use_colored=
|
|
713
|
-
def progressc(*args: Any, **kwargs: Any) -> None:
|
|
714
|
-
return progress(*args, use_colored=
|
|
715
|
-
def suggestionc(*args: Any, **kwargs: Any) -> None:
|
|
716
|
-
return suggestion(*args, use_colored=
|
|
717
|
-
def whatisitc(*args: Any, **kwargs: Any) -> None:
|
|
718
|
-
return whatisit(*args, use_colored=
|
|
719
|
-
def breakpointc(*args: Any, **kwargs: Any) -> None:
|
|
720
|
-
return breakpoint(*args, use_colored=
|
|
682
|
+
def infoc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
683
|
+
return info(*args, use_colored=use_colored, **kwargs)
|
|
684
|
+
def debugc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
685
|
+
return debug(*args, use_colored=use_colored, **kwargs)
|
|
686
|
+
def alt_debugc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
687
|
+
return alt_debug(*args, use_colored=use_colored, **kwargs)
|
|
688
|
+
def warningc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
689
|
+
return warning(*args, use_colored=use_colored, **kwargs)
|
|
690
|
+
def errorc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
691
|
+
return error(*args, use_colored=use_colored, **kwargs)
|
|
692
|
+
def progressc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
693
|
+
return progress(*args, use_colored=use_colored, **kwargs)
|
|
694
|
+
def suggestionc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
695
|
+
return suggestion(*args, use_colored=use_colored, **kwargs)
|
|
696
|
+
def whatisitc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
697
|
+
return whatisit(*args, use_colored=use_colored, **kwargs)
|
|
698
|
+
def breakpointc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None:
|
|
699
|
+
return breakpoint(*args, use_colored=use_colored, **kwargs)
|
|
721
700
|
|
|
722
701
|
|
|
723
702
|
# Test the print functions
|
|
@@ -747,7 +726,7 @@ if __name__ == "__main__":
|
|
|
747
726
|
# Test whatisit with different types
|
|
748
727
|
import numpy as np
|
|
749
728
|
print()
|
|
750
|
-
|
|
729
|
+
whatisitc(
|
|
751
730
|
123,
|
|
752
731
|
"Hello World",
|
|
753
732
|
[1, 2, 3, 4, 5],
|
|
@@ -147,27 +147,30 @@ def info(*values: Any, color: str = ..., text: str = 'INFO ', prefix: str = '',
|
|
|
147
147
|
\t\tuse_colored\t\t(bool):\t\t\t\t\tWhether to use the colored() function to format the message
|
|
148
148
|
\t\tprint_kwargs\t(dict):\t\t\t\t\tKeyword arguments to pass to the print function
|
|
149
149
|
\t'''
|
|
150
|
-
def debug(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
150
|
+
def debug(*values: Any, flush: bool = True, color: str = ..., text: str = 'DEBUG', **print_kwargs: Any) -> None:
|
|
151
151
|
''' Print a debug message looking like "[DEBUG HH:MM:SS] message" in cyan by default. '''
|
|
152
|
-
def alt_debug(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
152
|
+
def alt_debug(*values: Any, flush: bool = True, color: str = ..., text: str = 'DEBUG', **print_kwargs: Any) -> None:
|
|
153
153
|
''' Print a debug message looking like "[DEBUG HH:MM:SS] message" in blue by default. '''
|
|
154
|
-
def suggestion(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
154
|
+
def suggestion(*values: Any, flush: bool = True, color: str = ..., text: str = 'SUGGESTION', **print_kwargs: Any) -> None:
|
|
155
155
|
''' Print a suggestion message looking like "[SUGGESTION HH:MM:SS] message" in cyan by default. '''
|
|
156
|
-
def progress(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
156
|
+
def progress(*values: Any, flush: bool = True, color: str = ..., text: str = 'PROGRESS', **print_kwargs: Any) -> None:
|
|
157
157
|
''' Print a progress message looking like "[PROGRESS HH:MM:SS] message" in magenta by default. '''
|
|
158
|
-
def warning(*values: Any, flush: bool = True, **print_kwargs: Any) -> None:
|
|
158
|
+
def warning(*values: Any, flush: bool = True, color: str = ..., text: str = 'WARNING', **print_kwargs: Any) -> None:
|
|
159
159
|
''' Print a warning message looking like "[WARNING HH:MM:SS] message" in yellow by default and in sys.stderr. '''
|
|
160
|
-
def error(*values: Any, exit: bool = False, flush: bool = True, **print_kwargs: Any) -> None:
|
|
161
|
-
|
|
160
|
+
def error(*values: Any, exit: bool = False, flush: bool = True, color: str = ..., text: str = 'ERROR', **print_kwargs: Any) -> None:
|
|
161
|
+
''' Print an error message (in sys.stderr and in red by default)
|
|
162
162
|
\tand optionally ask the user to continue or stop the program.
|
|
163
163
|
|
|
164
164
|
\tArgs:
|
|
165
165
|
\t\tvalues\t\t\t(Any):\t\tValues to print (like the print function)
|
|
166
166
|
\t\texit\t\t\t(bool):\t\tWhether to ask the user to continue or stop the program,
|
|
167
167
|
\t\t\tfalse to ignore the error automatically and continue
|
|
168
|
+
\t\tflush\t\t\t(bool):\t\tWhether to flush the output
|
|
169
|
+
\t\tcolor\t\t\t(str):\t\tColor of the message (default: RED)
|
|
170
|
+
\t\ttext\t\t\t(str):\t\tText in the message (replaces "ERROR ")
|
|
168
171
|
\t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
|
|
169
|
-
\t
|
|
170
|
-
def whatisit(*values: Any, print_function: Callable[..., None] = ..., flush: bool = True, max_length: int = 250, color: str = ..., **print_kwargs: Any) -> None:
|
|
172
|
+
\t'''
|
|
173
|
+
def whatisit(*values: Any, print_function: Callable[..., None] = ..., flush: bool = True, max_length: int = 250, color: str = ..., text: str = 'What is it?', **print_kwargs: Any) -> None:
|
|
171
174
|
''' Print the type of each value and the value itself, with its id and length/shape.
|
|
172
175
|
|
|
173
176
|
\tThe output format is: "type, <id id_number>:\t(length/shape) value"
|
|
@@ -177,16 +180,18 @@ def whatisit(*values: Any, print_function: Callable[..., None] = ..., flush: boo
|
|
|
177
180
|
\t\tprint_function\t(Callable):\tFunction to use to print the values (default: debug())
|
|
178
181
|
\t\tmax_length\t\t(int):\t\tMaximum length of the value string to print (default: 250)
|
|
179
182
|
\t\tcolor\t\t\t(str):\t\tColor of the message (default: CYAN)
|
|
183
|
+
\t\ttext\t\t\t(str):\t\tText in the message (replaces "DEBUG")
|
|
180
184
|
\t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
|
|
181
185
|
\t'''
|
|
182
|
-
def breakpoint(*values: Any, print_function: Callable[..., None] = ..., flush: bool = True, **print_kwargs: Any) -> None:
|
|
183
|
-
|
|
186
|
+
def breakpoint(*values: Any, print_function: Callable[..., None] = ..., flush: bool = True, text: str = 'BREAKPOINT (press Enter)', **print_kwargs: Any) -> None:
|
|
187
|
+
''' Breakpoint function, pause the program and print the values.
|
|
184
188
|
|
|
185
189
|
\tArgs:
|
|
186
190
|
\t\tvalues\t\t\t(Any):\t\tValues to print
|
|
187
191
|
\t\tprint_function\t(Callable):\tFunction to use to print the values (default: warning())
|
|
192
|
+
\t\ttext\t\t\t(str):\t\tText in the message (replaces "WARNING")
|
|
188
193
|
\t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
|
|
189
|
-
\t
|
|
194
|
+
\t'''
|
|
190
195
|
|
|
191
196
|
class TeeMultiOutput:
|
|
192
197
|
''' File-like object that duplicates output to multiple file-like objects.
|
|
@@ -235,12 +240,12 @@ def is_same_print(*args: Any, **kwargs: Any) -> bool:
|
|
|
235
240
|
""" Checks if the current print call is the same as the previous one. """
|
|
236
241
|
def current_time() -> str:
|
|
237
242
|
''' Get the current time as "HH:MM:SS" if less than 24 hours since import, else "YYYY-MM-DD HH:MM:SS" '''
|
|
238
|
-
def infoc(*args: Any, **kwargs: Any) -> None: ...
|
|
239
|
-
def debugc(*args: Any, **kwargs: Any) -> None: ...
|
|
240
|
-
def alt_debugc(*args: Any, **kwargs: Any) -> None: ...
|
|
241
|
-
def warningc(*args: Any, **kwargs: Any) -> None: ...
|
|
242
|
-
def errorc(*args: Any, **kwargs: Any) -> None: ...
|
|
243
|
-
def progressc(*args: Any, **kwargs: Any) -> None: ...
|
|
244
|
-
def suggestionc(*args: Any, **kwargs: Any) -> None: ...
|
|
245
|
-
def whatisitc(*args: Any, **kwargs: Any) -> None: ...
|
|
246
|
-
def breakpointc(*args: Any, **kwargs: Any) -> None: ...
|
|
243
|
+
def infoc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
244
|
+
def debugc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
245
|
+
def alt_debugc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
246
|
+
def warningc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
247
|
+
def errorc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
248
|
+
def progressc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
249
|
+
def suggestionc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
250
|
+
def whatisitc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
251
|
+
def breakpointc(*args: Any, use_colored: bool = True, **kwargs: Any) -> None: ...
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/axis_flip.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/blur.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/brightness.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/canny.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/clahe.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/common.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/contrast.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/denoise.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/invert.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/laplacian.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/median_blur.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/noise.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/normalize.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/resize.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/rotation.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/salt_pepper.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/sharpening.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/shearing.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/threshold.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/translation.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image/zoom.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/image_preprocess.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/data_processing/technique.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/dataset/grouping_strategy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras/efficientnet.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/models/keras_utils/visualizations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/exhaustive_process.py
RENAMED
|
File without changes
|
{stouputils-1.19.4 → stouputils-1.19.5}/stouputils/data_science/scripts/preprocess_dataset.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|