stouputils 1.6.4__tar.gz → 1.6.6__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.6.4 → stouputils-1.6.6}/PKG-INFO +1 -1
- {stouputils-1.6.4 → stouputils-1.6.6}/pyproject.toml +1 -1
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/io.py +48 -23
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/io.pyi +16 -15
- {stouputils-1.6.4 → stouputils-1.6.6}/.gitignore +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/LICENSE +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/README.md +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/__init__.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/__main__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/all_doctests.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/all_doctests.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/__init__.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/automatic_docs.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/automatic_docs.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/__init__.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/config.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/config.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/image.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/image.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/video.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/applications/upscaler/video.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/archive.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/archive.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/backup.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/backup.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/collections.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/collections.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/__init__.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/cd_utils.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/cd_utils.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/github.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/github.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/pypi.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/pypi.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/pyproject.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/pyproject.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/stubs.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/continuous_delivery/stubs.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/ctx.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/ctx.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/config/get.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/config/set.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/auto_contrast.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/axis_flip.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/bias_field_correction.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/binary_threshold.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/blur.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/brightness.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/canny.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/clahe.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/common.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/contrast.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/curvature_flow_filter.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/denoise.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/histogram_equalization.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/invert.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/laplacian.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/median_blur.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/noise.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/normalize.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/random_erase.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/resize.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/rotation.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/salt_pepper.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/sharpening.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/shearing.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/threshold.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/translation.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/zoom.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image_augmentation.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image_preprocess.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/prosthesis_detection.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/technique.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/dataset.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/dataset_loader.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/grouping_strategy.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/image_loader.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/dataset/xy_tuple.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/metric_dictionnary.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/metric_utils.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/mlflow_utils.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/abstract_model.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/all.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/base_keras.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/all.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/convnext.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/densenet.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/efficientnet.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/mobilenet.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/resnet.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/squeezenet.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/vgg.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras/xception.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/losses/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/losses/next_generation_loss.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/visualizations.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/model_interface.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/sandbox.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/range_tuple.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/scripts/augment_dataset.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/scripts/exhaustive_process.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/scripts/preprocess_dataset.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/scripts/routine.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/utils.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/decorators.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/decorators.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/image.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/image.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/__init__.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/__init__.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/common.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/common.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/downloader.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/downloader.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/linux.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/linux.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/main.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/main.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/windows.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/installer/windows.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/parallel.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/parallel.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/print.py +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/print.pyi +0 -0
- {stouputils-1.6.4 → stouputils-1.6.6}/stouputils/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stouputils
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.6
|
|
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
|
Project-URL: Homepage, https://github.com/Stoupy51/stouputils
|
|
6
6
|
Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "stouputils"
|
|
8
|
-
version = "1.6.
|
|
8
|
+
version = "1.6.6"
|
|
9
9
|
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."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -80,16 +80,22 @@ def relative_path(file_path: str, relative_to: str = "") -> str:
|
|
|
80
80
|
return file_path or "."
|
|
81
81
|
|
|
82
82
|
# JSON dump with indentation for levels
|
|
83
|
-
def super_json_dump(
|
|
83
|
+
def super_json_dump(
|
|
84
|
+
data: Any,
|
|
85
|
+
file: IO[Any] | str | None = None,
|
|
86
|
+
max_level: int | None = 2,
|
|
87
|
+
indent: str | int = '\t',
|
|
88
|
+
suffix: str = "\n"
|
|
89
|
+
) -> str:
|
|
84
90
|
r""" Writes the provided data to a JSON file with a specified indentation depth.
|
|
85
91
|
For instance, setting max_level to 2 will limit the indentation to 2 levels.
|
|
86
92
|
|
|
87
93
|
Args:
|
|
88
|
-
data
|
|
89
|
-
file
|
|
90
|
-
max_level
|
|
91
|
-
indent
|
|
92
|
-
suffix
|
|
94
|
+
data (Any): The data to dump (usually a dict or a list)
|
|
95
|
+
file (IO[Any] | str): The file object or path to dump the data to
|
|
96
|
+
max_level (int | None): The depth of indentation to stop at (-1 for infinite), None will default to 2
|
|
97
|
+
indent (str | int): The indentation character (default: '\t')
|
|
98
|
+
suffix (str): The suffix to add at the end of the string (default: '\n')
|
|
93
99
|
Returns:
|
|
94
100
|
str: The content of the file in every case
|
|
95
101
|
|
|
@@ -102,9 +108,11 @@ def super_json_dump(data: Any, file: IO[Any]|None = None, max_level: int = 2, in
|
|
|
102
108
|
>>> super_json_dump({"a": [[1,2,3]], "b": 2}, max_level = 3)
|
|
103
109
|
'{\n\t"a": [\n\t\t[\n\t\t\t1,\n\t\t\t2,\n\t\t\t3\n\t\t]\n\t],\n\t"b": 2\n}\n'
|
|
104
110
|
"""
|
|
105
|
-
# Normalize indentation to string
|
|
111
|
+
# Normalize indentation to string, and handle None values for max_level
|
|
106
112
|
if isinstance(indent, int):
|
|
107
113
|
indent = ' ' * indent
|
|
114
|
+
if max_level is None:
|
|
115
|
+
max_level = 2
|
|
108
116
|
|
|
109
117
|
# Dump content with 2-space indent and replace it with the desired indent
|
|
110
118
|
content: str = orjson.dumps(data, option=orjson.OPT_INDENT_2).decode("utf-8")
|
|
@@ -128,7 +136,11 @@ def super_json_dump(data: Any, file: IO[Any]|None = None, max_level: int = 2, in
|
|
|
128
136
|
# Final newline and write
|
|
129
137
|
content += suffix
|
|
130
138
|
if file:
|
|
131
|
-
file
|
|
139
|
+
if isinstance(file, str):
|
|
140
|
+
with super_open(file, "w") as f:
|
|
141
|
+
f.write(content)
|
|
142
|
+
else:
|
|
143
|
+
file.write(content)
|
|
132
144
|
return content
|
|
133
145
|
|
|
134
146
|
# JSON load from file path
|
|
@@ -144,17 +156,26 @@ def super_json_load(file_path: str) -> Any:
|
|
|
144
156
|
return orjson.loads(f.read())
|
|
145
157
|
|
|
146
158
|
# CSV dump to file
|
|
147
|
-
def super_csv_dump(
|
|
148
|
-
|
|
159
|
+
def super_csv_dump(
|
|
160
|
+
data: Any,
|
|
161
|
+
file: IO[Any] | str | None = None,
|
|
162
|
+
delimiter: str = ',',
|
|
163
|
+
has_header: bool = True,
|
|
164
|
+
index: bool = False,
|
|
165
|
+
*args: Any,
|
|
166
|
+
**kwargs: Any
|
|
167
|
+
) -> str:
|
|
168
|
+
""" Writes data to a CSV file with customizable options and returns the CSV content as a string.
|
|
149
169
|
|
|
150
170
|
Args:
|
|
151
|
-
data
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
data (list[list[Any]] | list[dict[str, Any]] | pd.DataFrame | pl.DataFrame):
|
|
172
|
+
The data to write, either a list of lists, list of dicts, pandas DataFrame, or Polars DataFrame
|
|
173
|
+
file (IO[Any] | str): The file object or path to dump the data to
|
|
174
|
+
delimiter (str): The delimiter to use (default: ',')
|
|
175
|
+
has_header (bool): Whether to include headers (default: True, applies to dict and DataFrame data)
|
|
176
|
+
index (bool): Whether to include the index (default: False, only applies to pandas DataFrame)
|
|
177
|
+
*args (Any): Additional positional arguments to pass to the underlying CSV writer or DataFrame method
|
|
178
|
+
**kwargs (Any): Additional keyword arguments to pass to the underlying CSV writer or DataFrame method
|
|
158
179
|
Returns:
|
|
159
180
|
str: The CSV content as a string
|
|
160
181
|
|
|
@@ -178,7 +199,7 @@ def super_csv_dump(data: Any, file: IO[Any] | None = None, delimiter: str = ',',
|
|
|
178
199
|
copy_kwargs.setdefault("include_header", has_header)
|
|
179
200
|
copy_kwargs.setdefault("line_terminator", "\r\n")
|
|
180
201
|
data.write_csv(output, *args, **copy_kwargs)
|
|
181
|
-
except
|
|
202
|
+
except Exception:
|
|
182
203
|
pass
|
|
183
204
|
|
|
184
205
|
# Handle pandas DataFrame
|
|
@@ -190,7 +211,7 @@ def super_csv_dump(data: Any, file: IO[Any] | None = None, delimiter: str = ',',
|
|
|
190
211
|
copy_kwargs.setdefault("header", has_header)
|
|
191
212
|
copy_kwargs.setdefault("lineterminator", "\r\n")
|
|
192
213
|
data.to_csv(output, *args, **copy_kwargs)
|
|
193
|
-
except
|
|
214
|
+
except Exception:
|
|
194
215
|
pass
|
|
195
216
|
|
|
196
217
|
# Handle list of dicts
|
|
@@ -213,7 +234,11 @@ def super_csv_dump(data: Any, file: IO[Any] | None = None, delimiter: str = ',',
|
|
|
213
234
|
|
|
214
235
|
content: str = output.getvalue()
|
|
215
236
|
if file:
|
|
216
|
-
file
|
|
237
|
+
if isinstance(file, str):
|
|
238
|
+
with super_open(file, "w") as f:
|
|
239
|
+
f.write(content)
|
|
240
|
+
else:
|
|
241
|
+
file.write(content)
|
|
217
242
|
output.close()
|
|
218
243
|
return content
|
|
219
244
|
|
|
@@ -265,14 +290,14 @@ def super_csv_load(file_path: str, delimiter: str = ',', has_header: bool = True
|
|
|
265
290
|
if use_polars:
|
|
266
291
|
import polars as pl # type: ignore
|
|
267
292
|
if not os.path.exists(file_path):
|
|
268
|
-
return pl.DataFrame()
|
|
293
|
+
return pl.DataFrame() # type: ignore
|
|
269
294
|
kwargs.setdefault("separator", delimiter)
|
|
270
295
|
kwargs.setdefault("has_header", has_header)
|
|
271
|
-
return pl.read_csv(file_path, *args, **kwargs)
|
|
296
|
+
return pl.read_csv(file_path, *args, **kwargs) # type: ignore
|
|
272
297
|
else:
|
|
273
298
|
import pandas as pd # type: ignore
|
|
274
299
|
if not os.path.exists(file_path):
|
|
275
|
-
return pd.DataFrame()
|
|
300
|
+
return pd.DataFrame() # type: ignore
|
|
276
301
|
kwargs.setdefault("sep", delimiter)
|
|
277
302
|
kwargs.setdefault("header", 0 if has_header else None)
|
|
278
303
|
return pd.read_csv(file_path, *args, **kwargs) # type: ignore
|
|
@@ -35,16 +35,16 @@ def relative_path(file_path: str, relative_to: str = '') -> str:
|
|
|
35
35
|
\t\t>>> relative_path("D:/some/random/path/stouputils/io.py", "D:\\\\some\\\\")
|
|
36
36
|
\t\t\'random/path/stouputils/io.py\'
|
|
37
37
|
\t'''
|
|
38
|
-
def super_json_dump(data: Any, file: IO[Any] | None = None, max_level: int = 2, indent: str | int = '\t', suffix: str = '\n') -> str:
|
|
38
|
+
def super_json_dump(data: Any, file: IO[Any] | str | None = None, max_level: int | None = 2, indent: str | int = '\t', suffix: str = '\n') -> str:
|
|
39
39
|
''' Writes the provided data to a JSON file with a specified indentation depth.
|
|
40
40
|
\tFor instance, setting max_level to 2 will limit the indentation to 2 levels.
|
|
41
41
|
|
|
42
42
|
\tArgs:
|
|
43
|
-
\t\tdata
|
|
44
|
-
\t\tfile
|
|
45
|
-
\t\tmax_level
|
|
46
|
-
\t\tindent
|
|
47
|
-
\t\tsuffix
|
|
43
|
+
\t\tdata\t\t(Any): \t\t\t\tThe data to dump (usually a dict or a list)
|
|
44
|
+
\t\tfile\t\t(IO[Any] | str): \tThe file object or path to dump the data to
|
|
45
|
+
\t\tmax_level\t(int | None):\t\tThe depth of indentation to stop at (-1 for infinite), None will default to 2
|
|
46
|
+
\t\tindent\t\t(str | int):\t\tThe indentation character (default: \'\\t\')
|
|
47
|
+
\t\tsuffix\t\t(str):\t\t\t\tThe suffix to add at the end of the string (default: \'\\n\')
|
|
48
48
|
\tReturns:
|
|
49
49
|
\t\tstr: The content of the file in every case
|
|
50
50
|
|
|
@@ -65,17 +65,18 @@ def super_json_load(file_path: str) -> Any:
|
|
|
65
65
|
\tReturns:
|
|
66
66
|
\t\tAny: The content of the JSON file
|
|
67
67
|
\t"""
|
|
68
|
-
def super_csv_dump(data: Any, file: IO[Any] | None = None, delimiter: str = ',', has_header: bool = True, index: bool = False, *args: Any, **kwargs: Any) -> str:
|
|
69
|
-
''' Writes data to a CSV file with customizable options
|
|
68
|
+
def super_csv_dump(data: Any, file: IO[Any] | str | None = None, delimiter: str = ',', has_header: bool = True, index: bool = False, *args: Any, **kwargs: Any) -> str:
|
|
69
|
+
''' Writes data to a CSV file with customizable options and returns the CSV content as a string.
|
|
70
70
|
|
|
71
71
|
\tArgs:
|
|
72
|
-
\t\tdata
|
|
73
|
-
\t\
|
|
74
|
-
\t\
|
|
75
|
-
\t\
|
|
76
|
-
\t\
|
|
77
|
-
\t\t
|
|
78
|
-
\t\t
|
|
72
|
+
\t\tdata\t\t(list[list[Any]] | list[dict[str, Any]] | pd.DataFrame | pl.DataFrame):
|
|
73
|
+
\t\t\t\t\t\tThe data to write, either a list of lists, list of dicts, pandas DataFrame, or Polars DataFrame
|
|
74
|
+
\t\tfile\t\t(IO[Any] | str): The file object or path to dump the data to
|
|
75
|
+
\t\tdelimiter\t(str): The delimiter to use (default: \',\')
|
|
76
|
+
\t\thas_header\t(bool): Whether to include headers (default: True, applies to dict and DataFrame data)
|
|
77
|
+
\t\tindex\t\t(bool): Whether to include the index (default: False, only applies to pandas DataFrame)
|
|
78
|
+
\t\t*args\t\t(Any): Additional positional arguments to pass to the underlying CSV writer or DataFrame method
|
|
79
|
+
\t\t**kwargs\t(Any): Additional keyword arguments to pass to the underlying CSV writer or DataFrame method
|
|
79
80
|
\tReturns:
|
|
80
81
|
\t\tstr: The CSV content as a string
|
|
81
82
|
|
|
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.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/__init__.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/auto_contrast.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/axis_flip.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/brightness.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/canny.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/clahe.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/common.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/contrast.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/denoise.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/invert.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/laplacian.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/median_blur.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/noise.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/normalize.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/random_erase.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/resize.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/rotation.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/salt_pepper.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/sharpening.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/shearing.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/threshold.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image/translation.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image_augmentation.py
RENAMED
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/data_processing/image_preprocess.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
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/losses/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{stouputils-1.6.4 → stouputils-1.6.6}/stouputils/data_science/models/keras_utils/visualizations.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
|