stouputils 1.13.1__tar.gz → 1.13.3__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.
Files changed (170) hide show
  1. {stouputils-1.13.1 → stouputils-1.13.3}/PKG-INFO +1 -1
  2. {stouputils-1.13.1 → stouputils-1.13.3}/pyproject.toml +1 -1
  3. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/pypi.py +5 -4
  4. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/decorators.py +20 -10
  5. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/parallel.py +34 -4
  6. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/print.py +16 -3
  7. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/decorators.pyi +10 -0
  8. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/parallel.pyi +8 -3
  9. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/print.pyi +2 -2
  10. {stouputils-1.13.1 → stouputils-1.13.3}/README.md +0 -0
  11. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/__init__.py +0 -0
  12. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/__init__.pyi +0 -0
  13. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/__main__.py +0 -0
  14. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/_deprecated.py +0 -0
  15. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/_deprecated.pyi +0 -0
  16. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/all_doctests.py +0 -0
  17. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/all_doctests.pyi +0 -0
  18. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/__init__.py +0 -0
  19. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/__init__.pyi +0 -0
  20. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/automatic_docs.py +0 -0
  21. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/automatic_docs.pyi +0 -0
  22. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/__init__.py +0 -0
  23. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/__init__.pyi +0 -0
  24. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/config.py +0 -0
  25. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/config.pyi +0 -0
  26. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/image.py +0 -0
  27. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/image.pyi +0 -0
  28. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/video.py +0 -0
  29. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/applications/upscaler/video.pyi +0 -0
  30. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/archive.py +0 -0
  31. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/archive.pyi +0 -0
  32. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/backup.py +0 -0
  33. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/backup.pyi +0 -0
  34. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/collections.py +0 -0
  35. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/collections.pyi +0 -0
  36. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/__init__.py +0 -0
  37. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/__init__.pyi +0 -0
  38. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/cd_utils.py +0 -0
  39. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/cd_utils.pyi +0 -0
  40. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/github.py +0 -0
  41. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/github.pyi +0 -0
  42. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/pypi.pyi +0 -0
  43. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/pyproject.py +0 -0
  44. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/pyproject.pyi +0 -0
  45. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/stubs.py +0 -0
  46. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/continuous_delivery/stubs.pyi +0 -0
  47. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/ctx.py +0 -0
  48. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/ctx.pyi +0 -0
  49. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/config/get.py +0 -0
  50. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/config/set.py +0 -0
  51. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/__init__.py +0 -0
  52. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/auto_contrast.py +0 -0
  53. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/axis_flip.py +0 -0
  54. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/bias_field_correction.py +0 -0
  55. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/binary_threshold.py +0 -0
  56. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/blur.py +0 -0
  57. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/brightness.py +0 -0
  58. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/canny.py +0 -0
  59. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/clahe.py +0 -0
  60. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/common.py +0 -0
  61. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/contrast.py +0 -0
  62. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/curvature_flow_filter.py +0 -0
  63. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/denoise.py +0 -0
  64. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/histogram_equalization.py +0 -0
  65. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/invert.py +0 -0
  66. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/laplacian.py +0 -0
  67. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/median_blur.py +0 -0
  68. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/noise.py +0 -0
  69. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/normalize.py +0 -0
  70. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/random_erase.py +0 -0
  71. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/resize.py +0 -0
  72. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/rotation.py +0 -0
  73. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/salt_pepper.py +0 -0
  74. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/sharpening.py +0 -0
  75. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/shearing.py +0 -0
  76. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/threshold.py +0 -0
  77. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/translation.py +0 -0
  78. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image/zoom.py +0 -0
  79. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image_augmentation.py +0 -0
  80. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/image_preprocess.py +0 -0
  81. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/prosthesis_detection.py +0 -0
  82. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/data_processing/technique.py +0 -0
  83. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/__init__.py +0 -0
  84. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/dataset.py +0 -0
  85. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/dataset_loader.py +0 -0
  86. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/grouping_strategy.py +0 -0
  87. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/image_loader.py +0 -0
  88. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/dataset/xy_tuple.py +0 -0
  89. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/metric_dictionnary.py +0 -0
  90. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/metric_utils.py +0 -0
  91. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/mlflow_utils.py +0 -0
  92. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/abstract_model.py +0 -0
  93. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/all.py +0 -0
  94. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/base_keras.py +0 -0
  95. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/all.py +0 -0
  96. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/convnext.py +0 -0
  97. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/densenet.py +0 -0
  98. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/efficientnet.py +0 -0
  99. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/mobilenet.py +0 -0
  100. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/resnet.py +0 -0
  101. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/squeezenet.py +0 -0
  102. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/vgg.py +0 -0
  103. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras/xception.py +0 -0
  104. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/__init__.py +0 -0
  105. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +0 -0
  106. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +0 -0
  107. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +0 -0
  108. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +0 -0
  109. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +0 -0
  110. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/losses/__init__.py +0 -0
  111. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +0 -0
  112. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/keras_utils/visualizations.py +0 -0
  113. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/model_interface.py +0 -0
  114. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/models/sandbox.py +0 -0
  115. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/range_tuple.py +0 -0
  116. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/scripts/augment_dataset.py +0 -0
  117. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/scripts/exhaustive_process.py +0 -0
  118. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/scripts/preprocess_dataset.py +0 -0
  119. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/scripts/routine.py +0 -0
  120. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/data_science/utils.py +0 -0
  121. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/decorators.pyi +0 -0
  122. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/image.py +0 -0
  123. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/image.pyi +0 -0
  124. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/__init__.py +0 -0
  125. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/__init__.pyi +0 -0
  126. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/common.py +0 -0
  127. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/common.pyi +0 -0
  128. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/downloader.py +0 -0
  129. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/downloader.pyi +0 -0
  130. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/linux.py +0 -0
  131. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/linux.pyi +0 -0
  132. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/main.py +0 -0
  133. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/main.pyi +0 -0
  134. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/windows.py +0 -0
  135. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/installer/windows.pyi +0 -0
  136. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/io.py +0 -0
  137. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/io.pyi +0 -0
  138. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/parallel.pyi +0 -0
  139. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/print.pyi +0 -0
  140. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/py.typed +0 -0
  141. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/__init__.pyi +0 -0
  142. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/_deprecated.pyi +0 -0
  143. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/all_doctests.pyi +0 -0
  144. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/__init__.pyi +0 -0
  145. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/automatic_docs.pyi +0 -0
  146. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/upscaler/__init__.pyi +0 -0
  147. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/upscaler/config.pyi +0 -0
  148. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/upscaler/image.pyi +0 -0
  149. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/applications/upscaler/video.pyi +0 -0
  150. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/archive.pyi +0 -0
  151. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/backup.pyi +0 -0
  152. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/collections.pyi +0 -0
  153. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/__init__.pyi +0 -0
  154. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/cd_utils.pyi +0 -0
  155. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/github.pyi +0 -0
  156. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/pypi.pyi +0 -0
  157. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/pyproject.pyi +0 -0
  158. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/continuous_delivery/stubs.pyi +0 -0
  159. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/ctx.pyi +0 -0
  160. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/image.pyi +0 -0
  161. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/__init__.pyi +0 -0
  162. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/common.pyi +0 -0
  163. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/downloader.pyi +0 -0
  164. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/linux.pyi +0 -0
  165. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/main.pyi +0 -0
  166. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/installer/windows.pyi +0 -0
  167. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/io.pyi +0 -0
  168. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/stouputils/version_pkg.pyi +0 -0
  169. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/version_pkg.py +0 -0
  170. {stouputils-1.13.1 → stouputils-1.13.3}/stouputils/version_pkg.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: stouputils
3
- Version: 1.13.1
3
+ Version: 1.13.3
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.13.1"
11
+ version = "1.13.3"
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"]
@@ -108,14 +108,15 @@ def pypi_full_routine_using_uv() -> None:
108
108
  package_dir = "src/" + package_name
109
109
 
110
110
  # Generate stubs unless '--no-stubs' is passed
111
- if "--no-stubs" not in sys.argv:
111
+ if "--no-stubs" not in sys.argv and "--no_stubs" not in sys.argv:
112
112
  from .stubs import stubs_full_routine
113
113
  stubs_full_routine(package_name, output_directory=package_dir, clean_before=True)
114
114
 
115
115
  # Increment version in pyproject.toml
116
- increment: str = "patch" if sys.argv[-1] not in ("minor", "major") else sys.argv[-1]
117
- if os.system(f"uv version --bump {increment} --frozen") != 0:
118
- raise Exception("Error while incrementing version using 'uv version'")
116
+ if "--no-bump" not in sys.argv and "--no_bump" not in sys.argv:
117
+ increment: str = "patch" if sys.argv[-1] not in ("minor", "major") else sys.argv[-1]
118
+ if os.system(f"uv version --bump {increment} --frozen") != 0:
119
+ raise Exception("Error while incrementing version using 'uv version'")
119
120
 
120
121
  # Build the package using 'uv build'
121
122
  import shutil
@@ -64,7 +64,7 @@ def measure_time(
64
64
  """
65
65
  def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
66
66
  # Set the message if not specified, else use the provided one
67
- new_msg: str = message if message else f"Execution time of {_get_func_name(func)}"
67
+ new_msg: str = message if message else f"Execution time of {_get_func_name(func)}()"
68
68
 
69
69
  if is_generator:
70
70
  @wraps(func)
@@ -149,11 +149,11 @@ def handle_error(
149
149
  return func(*args, **kwargs)
150
150
  except exceptions as e:
151
151
  if error_log == LogLevels.WARNING:
152
- warning(f"{msg}Error during {_get_func_name(func)}: ({type(e).__name__}) {e}")
152
+ warning(f"{msg}Error during {_get_func_name(func)}(): ({type(e).__name__}) {e}")
153
153
  elif error_log == LogLevels.WARNING_TRACEBACK:
154
- warning(f"{msg}Error during {_get_func_name(func)}:\n{format_exc()}")
154
+ warning(f"{msg}Error during {_get_func_name(func)}():\n{format_exc()}")
155
155
  elif error_log == LogLevels.ERROR_TRACEBACK:
156
- error(f"{msg}Error during {_get_func_name(func)}:\n{format_exc()}", exit=True)
156
+ error(f"{msg}Error during {_get_func_name(func)}():\n{format_exc()}", exit=True)
157
157
  elif error_log == LogLevels.RAISE_EXCEPTION:
158
158
  raise e
159
159
 
@@ -212,7 +212,7 @@ def timeout(
212
212
  @wraps(func)
213
213
  def wrapper(*args: tuple[Any, ...], **kwargs: dict[str, Any]) -> Any:
214
214
  # Build timeout message
215
- msg: str = message if message else f"Function '{_get_func_name(func)}' timed out after {seconds} seconds"
215
+ msg: str = message if message else f"Function '{_get_func_name(func)}()' timed out after {seconds} seconds"
216
216
 
217
217
  # Try to use signal-based timeout (Unix only, main thread only)
218
218
  try:
@@ -332,7 +332,7 @@ def retry(
332
332
  if message:
333
333
  warning(f"{message}, retrying ({attempt + 1}/{max_attempts}): {e}")
334
334
  else:
335
- warning(f"{type(e).__name__} encountered while running {_get_func_name(func)}, retrying ({attempt + 1}/{max_attempts}): {e}")
335
+ warning(f"{type(e).__name__} encountered while running {_get_func_name(func)}(), retrying ({attempt + 1}/{max_attempts}): {e}")
336
336
 
337
337
  # Wait before next attempt
338
338
  time.sleep(current_delay)
@@ -375,10 +375,20 @@ def simple_cache(
375
375
  3
376
376
  >>> test2(3, 4)
377
377
  7
378
+
379
+ >>> @simple_cache
380
+ ... def factorial(n: int) -> int:
381
+ ... return n * factorial(n - 1) if n else 1
382
+ >>> factorial(10) # no previously cached result, makes 11 recursive calls
383
+ 3628800
384
+ >>> factorial(5) # no new calls, just returns the cached result
385
+ 120
386
+ >>> factorial(12) # two new recursive calls, factorial(10) is cached
387
+ 479001600
378
388
  """
379
389
  def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
380
390
  # Create the cache dict
381
- cache_dict: dict[bytes, Any] = {}
391
+ cache_dict: dict[Any, Any] = {}
382
392
 
383
393
  # Create the wrapper
384
394
  @wraps(func)
@@ -386,9 +396,9 @@ def simple_cache(
386
396
 
387
397
  # Get the hashed key
388
398
  if method == "str":
389
- hashed: bytes = str(args).encode() + str(kwargs).encode()
399
+ hashed = str(args) + str(kwargs)
390
400
  elif method == "pickle":
391
- hashed: bytes = pickle_dumps((args, kwargs))
401
+ hashed = pickle_dumps((args, kwargs))
392
402
  else:
393
403
  raise ValueError("Invalid caching method. Supported methods are 'str' and 'pickle'.")
394
404
 
@@ -447,7 +457,7 @@ def abstract(
447
457
  NotImplementedError: Function 'method' is abstract and must be implemented by a subclass
448
458
  """
449
459
  def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
450
- message: str = f"Function '{_get_func_name(func)}' is abstract and must be implemented by a subclass"
460
+ message: str = f"Function '{_get_func_name(func)}()' is abstract and must be implemented by a subclass"
451
461
  if not func.__doc__:
452
462
  func.__doc__ = message
453
463
 
@@ -45,6 +45,8 @@ def multiprocessing[T, R](
45
45
  color: str = MAGENTA,
46
46
  bar_format: str = BAR_FORMAT,
47
47
  ascii: bool = False,
48
+ smooth_tqdm: bool = True,
49
+ **tqdm_kwargs: Any
48
50
  ) -> list[R]:
49
51
  r""" Method to execute a function in parallel using multiprocessing
50
52
 
@@ -70,6 +72,8 @@ def multiprocessing[T, R](
70
72
  color (str): Color of the progress bar (Defaults to MAGENTA)
71
73
  bar_format (str): Format of the progress bar (Defaults to BAR_FORMAT)
72
74
  ascii (bool): Whether to use ASCII or Unicode characters for the progress bar
75
+ smooth_tqdm (bool): Whether to enable smooth progress bar updates by setting miniters and mininterval (Defaults to True)
76
+ **tqdm_kwargs (Any): Additional keyword arguments to pass to tqdm
73
77
 
74
78
  Returns:
75
79
  list[object]: Results of the function execution
@@ -123,13 +127,22 @@ def multiprocessing[T, R](
123
127
  desc, func, args = _handle_parameters(func, args, use_starmap, delay_first_calls, max_workers, desc, color)
124
128
  if bar_format == BAR_FORMAT:
125
129
  bar_format = bar_format.replace(MAGENTA, color)
130
+ if smooth_tqdm:
131
+ tqdm_kwargs.setdefault("mininterval", 0.0)
132
+ try:
133
+ total = len(args) # type: ignore
134
+ import shutil
135
+ width = shutil.get_terminal_size().columns
136
+ tqdm_kwargs.setdefault("miniters", max(1, total // width))
137
+ except (TypeError, OSError):
138
+ tqdm_kwargs.setdefault("miniters", 1)
126
139
 
127
140
  # Do multiprocessing only if there is more than 1 argument and more than 1 CPU
128
141
  if max_workers > 1 and len(args) > 1:
129
142
  def process() -> list[Any]:
130
143
  if verbose:
131
144
  return list(process_map(
132
- func, args, max_workers=max_workers, chunksize=chunksize, desc=desc, bar_format=bar_format, ascii=ascii
145
+ func, args, max_workers=max_workers, chunksize=chunksize, desc=desc, bar_format=bar_format, ascii=ascii, **tqdm_kwargs
133
146
  )) # type: ignore
134
147
  else:
135
148
  with Pool(max_workers) as pool:
@@ -148,7 +161,7 @@ def multiprocessing[T, R](
148
161
  # Single process execution
149
162
  else:
150
163
  if verbose:
151
- return [func(arg) for arg in tqdm(args, total=len(args), desc=desc, bar_format=bar_format, ascii=ascii)]
164
+ return [func(arg) for arg in tqdm(args, total=len(args), desc=desc, bar_format=bar_format, ascii=ascii, **tqdm_kwargs)]
152
165
  else:
153
166
  return [func(arg) for arg in args]
154
167
 
@@ -163,6 +176,8 @@ def multithreading[T, R](
163
176
  color: str = MAGENTA,
164
177
  bar_format: str = BAR_FORMAT,
165
178
  ascii: bool = False,
179
+ smooth_tqdm: bool = True,
180
+ **tqdm_kwargs: Any
166
181
  ) -> list[R]:
167
182
  r""" Method to execute a function in parallel using multithreading, you should use it:
168
183
 
@@ -186,6 +201,8 @@ def multithreading[T, R](
186
201
  color (str): Color of the progress bar (Defaults to MAGENTA)
187
202
  bar_format (str): Format of the progress bar (Defaults to BAR_FORMAT)
188
203
  ascii (bool): Whether to use ASCII or Unicode characters for the progress bar
204
+ smooth_tqdm (bool): Whether to enable smooth progress bar updates by setting miniters and mininterval (Defaults to True)
205
+ **tqdm_kwargs (Any): Additional keyword arguments to pass to tqdm
189
206
 
190
207
  Returns:
191
208
  list[object]: Results of the function execution
@@ -237,12 +254,21 @@ def multithreading[T, R](
237
254
  desc, func, args = _handle_parameters(func, args, use_starmap, delay_first_calls, max_workers, desc, color)
238
255
  if bar_format == BAR_FORMAT:
239
256
  bar_format = bar_format.replace(MAGENTA, color)
257
+ if smooth_tqdm:
258
+ tqdm_kwargs.setdefault("mininterval", 0.0)
259
+ try:
260
+ total = len(args) # type: ignore
261
+ import shutil
262
+ width = shutil.get_terminal_size().columns
263
+ tqdm_kwargs.setdefault("miniters", max(1, total // width))
264
+ except (TypeError, OSError):
265
+ tqdm_kwargs.setdefault("miniters", 1)
240
266
 
241
267
  # Do multithreading only if there is more than 1 argument and more than 1 CPU
242
268
  if max_workers > 1 and len(args) > 1:
243
269
  if verbose:
244
270
  with ThreadPoolExecutor(max_workers) as executor:
245
- return list(tqdm(executor.map(func, args), total=len(args), desc=desc, bar_format=bar_format, ascii=ascii))
271
+ return list(tqdm(executor.map(func, args), total=len(args), desc=desc, bar_format=bar_format, ascii=ascii, **tqdm_kwargs))
246
272
  else:
247
273
  with ThreadPoolExecutor(max_workers) as executor:
248
274
  return list(executor.map(func, args))
@@ -250,7 +276,7 @@ def multithreading[T, R](
250
276
  # Single process execution
251
277
  else:
252
278
  if verbose:
253
- return [func(arg) for arg in tqdm(args, total=len(args), desc=desc, bar_format=bar_format, ascii=ascii)]
279
+ return [func(arg) for arg in tqdm(args, total=len(args), desc=desc, bar_format=bar_format, ascii=ascii, **tqdm_kwargs)]
254
280
  else:
255
281
  return [func(arg) for arg in args]
256
282
 
@@ -259,6 +285,7 @@ def run_in_subprocess[R](
259
285
  func: Callable[..., R],
260
286
  *args: Any,
261
287
  timeout: float | None = None,
288
+ no_join: bool = False,
262
289
  **kwargs: Any
263
290
  ) -> R:
264
291
  """ Execute a function in a subprocess with positional and keyword arguments.
@@ -273,6 +300,7 @@ def run_in_subprocess[R](
273
300
  *args (Any): Positional arguments to pass to the function.
274
301
  timeout (float | None): Maximum time in seconds to wait for the subprocess.
275
302
  If None, wait indefinitely. If the subprocess exceeds this time, it will be terminated.
303
+ no_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget).
276
304
  **kwargs (Any): Keyword arguments to pass to the function.
277
305
 
278
306
  Returns:
@@ -318,6 +346,8 @@ def run_in_subprocess[R](
318
346
  process.start()
319
347
 
320
348
  # Join with timeout to prevent indefinite hanging
349
+ if no_join:
350
+ return None # type: ignore
321
351
  process.join(timeout=timeout)
322
352
 
323
353
  # Check if process is still alive (timed out)
@@ -45,6 +45,7 @@ def colored_for_loop[T](
45
45
  color: str = MAGENTA,
46
46
  bar_format: str = BAR_FORMAT,
47
47
  ascii: bool = False,
48
+ smooth_tqdm: bool = True,
48
49
  **kwargs: Any
49
50
  ) -> Iterator[T]:
50
51
  """ Function to iterate over a list with a colored TQDM progress bar like the other functions in this module.
@@ -55,7 +56,7 @@ def colored_for_loop[T](
55
56
  color (str): Color of the progress bar (Defaults to MAGENTA)
56
57
  bar_format (str): Format of the progress bar (Defaults to BAR_FORMAT)
57
58
  ascii (bool): Whether to use ASCII or Unicode characters for the progress bar (Defaults to False)
58
- verbose (int): Level of verbosity, decrease by 1 for each depth (Defaults to 1)
59
+ smooth_tqdm (bool): Whether to enable smooth progress bar updates by setting miniters=1 and mininterval=0.0 (Defaults to True)
59
60
  **kwargs: Additional arguments to pass to the TQDM progress bar
60
61
 
61
62
  Yields:
@@ -70,6 +71,16 @@ def colored_for_loop[T](
70
71
  bar_format = bar_format.replace(MAGENTA, color)
71
72
  desc = color + desc
72
73
 
74
+ if smooth_tqdm:
75
+ kwargs.setdefault("mininterval", 0.0)
76
+ try:
77
+ total = len(iterable) # type: ignore
78
+ import shutil
79
+ width = shutil.get_terminal_size().columns
80
+ kwargs.setdefault("miniters", max(1, total // width))
81
+ except (TypeError, OSError):
82
+ kwargs.setdefault("miniters", 1)
83
+
73
84
  from tqdm.auto import tqdm
74
85
  yield from tqdm(iterable, desc=desc, bar_format=bar_format, ascii=ascii, **kwargs)
75
86
 
@@ -224,8 +235,10 @@ def whatisit(
224
235
  try:
225
236
  if not isinstance(value, str | bytes | bytearray | dict | int | float):
226
237
  import numpy as np
227
- metadata_parts.append(f"min: {np.min(value)}")
228
- metadata_parts.append(f"max: {np.max(value)}")
238
+ mini, maxi = np.min(value), np.max(value)
239
+ if mini != maxi:
240
+ metadata_parts.append(f"min: {mini}")
241
+ metadata_parts.append(f"max: {maxi}")
229
242
  except (Exception):
230
243
  pass
231
244
 
@@ -151,6 +151,16 @@ def simple_cache(func: Callable[..., Any] | None = None, *, method: Literal['str
151
151
  \t\t3
152
152
  \t\t>>> test2(3, 4)
153
153
  \t\t7
154
+
155
+ \t\t>>> @simple_cache
156
+ \t\t... def factorial(n: int) -> int:
157
+ \t\t... return n * factorial(n - 1) if n else 1
158
+ \t\t>>> factorial(10) # no previously cached result, makes 11 recursive calls
159
+ \t\t3628800
160
+ \t\t>>> factorial(5) # no new calls, just returns the cached result
161
+ \t\t120
162
+ \t\t>>> factorial(12) # two new recursive calls, factorial(10) is cached
163
+ \t\t479001600
154
164
  \t'''
155
165
  def abstract(func: Callable[..., Any] | None = None, *, error_log: LogLevels = ...) -> Callable[..., Any]:
156
166
  """ Decorator that marks a function as abstract.
@@ -10,7 +10,7 @@ CPU_COUNT: int
10
10
  T = TypeVar('T')
11
11
  R = TypeVar('R')
12
12
 
13
- def multiprocessing[T, R](func: Callable[..., R] | list[Callable[..., R]], args: Iterable[T], use_starmap: bool = False, chunksize: int = 1, desc: str = '', max_workers: int | float = ..., delay_first_calls: float = 0, color: str = ..., bar_format: str = ..., ascii: bool = False) -> list[R]:
13
+ def multiprocessing[T, R](func: Callable[..., R] | list[Callable[..., R]], args: Iterable[T], use_starmap: bool = False, chunksize: int = 1, desc: str = '', max_workers: int | float = ..., delay_first_calls: float = 0, color: str = ..., bar_format: str = ..., ascii: bool = False, smooth_tqdm: bool = True, **tqdm_kwargs: Any) -> list[R]:
14
14
  ''' Method to execute a function in parallel using multiprocessing
15
15
 
16
16
  \t- For CPU-bound operations where the GIL (Global Interpreter Lock) is a bottleneck.
@@ -35,6 +35,8 @@ def multiprocessing[T, R](func: Callable[..., R] | list[Callable[..., R]], args:
35
35
  \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
36
36
  \t\tbar_format\t\t\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
37
37
  \t\tascii\t\t\t\t(bool):\t\t\t\tWhether to use ASCII or Unicode characters for the progress bar
38
+ \t\tsmooth_tqdm\t\t\t(bool):\t\t\t\tWhether to enable smooth progress bar updates by setting miniters and mininterval (Defaults to True)
39
+ \t\t**tqdm_kwargs\t\t(Any):\t\t\t\tAdditional keyword arguments to pass to tqdm
38
40
 
39
41
  \tReturns:
40
42
  \t\tlist[object]:\tResults of the function execution
@@ -66,7 +68,7 @@ def multiprocessing[T, R](func: Callable[..., R] | list[Callable[..., R]], args:
66
68
  \t\t\t. )
67
69
  \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
68
70
  \t'''
69
- def multithreading[T, R](func: Callable[..., R] | list[Callable[..., R]], args: Iterable[T], use_starmap: bool = False, desc: str = '', max_workers: int | float = ..., delay_first_calls: float = 0, color: str = ..., bar_format: str = ..., ascii: bool = False) -> list[R]:
71
+ def multithreading[T, R](func: Callable[..., R] | list[Callable[..., R]], args: Iterable[T], use_starmap: bool = False, desc: str = '', max_workers: int | float = ..., delay_first_calls: float = 0, color: str = ..., bar_format: str = ..., ascii: bool = False, smooth_tqdm: bool = True, **tqdm_kwargs: Any) -> list[R]:
70
72
  ''' Method to execute a function in parallel using multithreading, you should use it:
71
73
 
72
74
  \t- For I/O-bound operations where the GIL is not a bottleneck, such as network requests or disk operations.
@@ -89,6 +91,8 @@ def multithreading[T, R](func: Callable[..., R] | list[Callable[..., R]], args:
89
91
  \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
90
92
  \t\tbar_format\t\t\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
91
93
  \t\tascii\t\t\t\t(bool):\t\t\t\tWhether to use ASCII or Unicode characters for the progress bar
94
+ \t\tsmooth_tqdm\t\t\t(bool):\t\t\t\tWhether to enable smooth progress bar updates by setting miniters and mininterval (Defaults to True)
95
+ \t\t**tqdm_kwargs\t\t(Any):\t\t\t\tAdditional keyword arguments to pass to tqdm
92
96
 
93
97
  \tReturns:
94
98
  \t\tlist[object]:\tResults of the function execution
@@ -120,7 +124,7 @@ def multithreading[T, R](func: Callable[..., R] | list[Callable[..., R]], args:
120
124
  \t\t\t. )
121
125
  \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
122
126
  \t'''
123
- def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | None = None, **kwargs: Any) -> R:
127
+ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | None = None, no_join: bool = False, **kwargs: Any) -> R:
124
128
  ''' Execute a function in a subprocess with positional and keyword arguments.
125
129
 
126
130
  \tThis is useful when you need to run a function in isolation to avoid memory leaks,
@@ -133,6 +137,7 @@ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | No
133
137
  \t\t*args (Any): Positional arguments to pass to the function.
134
138
  \t\ttimeout (float | None): Maximum time in seconds to wait for the subprocess.
135
139
  \t\t\tIf None, wait indefinitely. If the subprocess exceeds this time, it will be terminated.
140
+ \t\tno_join (bool): If True, do not wait for the subprocess to finish (fire-and-forget).
136
141
  \t\t**kwargs (Any): Keyword arguments to pass to the function.
137
142
 
138
143
  \tReturns:
@@ -15,7 +15,7 @@ previous_args_kwards: tuple[Any, Any]
15
15
  nb_values: int
16
16
  import_time: float
17
17
 
18
- def colored_for_loop[T](iterable: Iterable[T], desc: str = 'Processing', color: str = ..., bar_format: str = ..., ascii: bool = False, **kwargs: Any) -> Iterator[T]:
18
+ def colored_for_loop[T](iterable: Iterable[T], desc: str = 'Processing', color: str = ..., bar_format: str = ..., ascii: bool = False, smooth_tqdm: bool = True, **kwargs: Any) -> Iterator[T]:
19
19
  ''' Function to iterate over a list with a colored TQDM progress bar like the other functions in this module.
20
20
 
21
21
  \tArgs:
@@ -24,7 +24,7 @@ def colored_for_loop[T](iterable: Iterable[T], desc: str = 'Processing', color:
24
24
  \t\tcolor\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
25
25
  \t\tbar_format\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
26
26
  \t\tascii\t\t(bool):\t\t\t\tWhether to use ASCII or Unicode characters for the progress bar (Defaults to False)
27
- \t\tverbose\t\t(int):\t\t\t\tLevel of verbosity, decrease by 1 for each depth (Defaults to 1)
27
+ \t\tsmooth_tqdm\t(bool):\t\t\t\tWhether to enable smooth progress bar updates by setting miniters=1 and mininterval=0.0 (Defaults to True)
28
28
  \t\t**kwargs:\t\t\t\t\t\tAdditional arguments to pass to the TQDM progress bar
29
29
 
30
30
  \tYields:
File without changes