stouputils 1.12.2__py3-none-any.whl → 1.13.0__py3-none-any.whl

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 (47) hide show
  1. stouputils/__main__.py +11 -6
  2. stouputils/continuous_delivery/pypi.py +39 -1
  3. stouputils/continuous_delivery/pypi.pyi +9 -0
  4. stouputils/ctx.py +408 -408
  5. stouputils/data_science/config/set.py +125 -125
  6. stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py +31 -31
  7. stouputils/data_science/utils.py +285 -285
  8. stouputils/installer/__init__.py +18 -18
  9. stouputils/installer/linux.py +144 -144
  10. stouputils/installer/main.py +223 -223
  11. stouputils/installer/windows.py +136 -136
  12. stouputils/py.typed +1 -1
  13. stouputils/stouputils/__init__.pyi +15 -0
  14. stouputils/stouputils/_deprecated.pyi +12 -0
  15. stouputils/stouputils/all_doctests.pyi +46 -0
  16. stouputils/stouputils/applications/__init__.pyi +2 -0
  17. stouputils/stouputils/applications/automatic_docs.pyi +106 -0
  18. stouputils/stouputils/applications/upscaler/__init__.pyi +3 -0
  19. stouputils/stouputils/applications/upscaler/config.pyi +18 -0
  20. stouputils/stouputils/applications/upscaler/image.pyi +109 -0
  21. stouputils/stouputils/applications/upscaler/video.pyi +60 -0
  22. stouputils/stouputils/archive.pyi +67 -0
  23. stouputils/stouputils/backup.pyi +109 -0
  24. stouputils/stouputils/collections.pyi +86 -0
  25. stouputils/stouputils/continuous_delivery/__init__.pyi +5 -0
  26. stouputils/stouputils/continuous_delivery/cd_utils.pyi +129 -0
  27. stouputils/stouputils/continuous_delivery/github.pyi +162 -0
  28. stouputils/stouputils/continuous_delivery/pypi.pyi +53 -0
  29. stouputils/stouputils/continuous_delivery/pyproject.pyi +67 -0
  30. stouputils/stouputils/continuous_delivery/stubs.pyi +39 -0
  31. stouputils/stouputils/ctx.pyi +211 -0
  32. stouputils/stouputils/decorators.pyi +242 -0
  33. stouputils/stouputils/image.pyi +172 -0
  34. stouputils/stouputils/installer/__init__.pyi +5 -0
  35. stouputils/stouputils/installer/common.pyi +39 -0
  36. stouputils/stouputils/installer/downloader.pyi +24 -0
  37. stouputils/stouputils/installer/linux.pyi +39 -0
  38. stouputils/stouputils/installer/main.pyi +57 -0
  39. stouputils/stouputils/installer/windows.pyi +31 -0
  40. stouputils/stouputils/io.pyi +213 -0
  41. stouputils/stouputils/parallel.pyi +211 -0
  42. stouputils/stouputils/print.pyi +136 -0
  43. stouputils/stouputils/version_pkg.pyi +15 -0
  44. {stouputils-1.12.2.dist-info → stouputils-1.13.0.dist-info}/METADATA +1 -1
  45. {stouputils-1.12.2.dist-info → stouputils-1.13.0.dist-info}/RECORD +47 -16
  46. {stouputils-1.12.2.dist-info → stouputils-1.13.0.dist-info}/WHEEL +0 -0
  47. {stouputils-1.12.2.dist-info → stouputils-1.13.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,211 @@
1
+ from .ctx import SetMPStartMethod as SetMPStartMethod
2
+ from .print import BAR_FORMAT as BAR_FORMAT, MAGENTA as MAGENTA
3
+ from collections.abc import Callable, Iterable
4
+ from typing import Any, TypeVar
5
+
6
+ def doctest_square(x: int) -> int: ...
7
+ def doctest_slow(x: int) -> int: ...
8
+
9
+ CPU_COUNT: int
10
+ T = TypeVar('T')
11
+ R = TypeVar('R')
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]:
14
+ ''' Method to execute a function in parallel using multiprocessing
15
+
16
+ \t- For CPU-bound operations where the GIL (Global Interpreter Lock) is a bottleneck.
17
+ \t- When the task can be divided into smaller, independent sub-tasks that can be executed concurrently.
18
+ \t- For computationally intensive tasks like scientific simulations, data analysis, or machine learning workloads.
19
+
20
+ \tArgs:
21
+ \t\tfunc\t\t\t\t(Callable | list[Callable]):\tFunction to execute, or list of functions (one per argument)
22
+ \t\targs\t\t\t\t(Iterable):\t\t\tIterable of arguments to pass to the function(s)
23
+ \t\tuse_starmap\t\t\t(bool):\t\t\t\tWhether to use starmap or not (Defaults to False):
24
+ \t\t\tTrue means the function will be called like func(\\*args[i]) instead of func(args[i])
25
+ \t\tchunksize\t\t\t(int):\t\t\t\tNumber of arguments to process at a time
26
+ \t\t\t(Defaults to 1 for proper progress bar display)
27
+ \t\tdesc\t\t\t\t(str):\t\t\t\tDescription displayed in the progress bar
28
+ \t\t\t(if not provided no progress bar will be displayed)
29
+ \t\tmax_workers\t\t\t(int | float):\t\tNumber of workers to use (Defaults to CPU_COUNT), -1 means CPU_COUNT.
30
+ \t\t\tIf float between 0 and 1, it\'s treated as a percentage of CPU_COUNT.
31
+ \t\t\tIf negative float between -1 and 0, it\'s treated as a percentage of len(args).
32
+ \t\tdelay_first_calls\t(float):\t\t\tApply i*delay_first_calls seconds delay to the first "max_workers" calls.
33
+ \t\t\tFor instance, the first process will be delayed by 0 seconds, the second by 1 second, etc.
34
+ \t\t\t(Defaults to 0): This can be useful to avoid functions being called in the same second.
35
+ \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
36
+ \t\tbar_format\t\t\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
37
+ \t\tascii\t\t\t\t(bool):\t\t\t\tWhether to use ASCII or Unicode characters for the progress bar
38
+
39
+ \tReturns:
40
+ \t\tlist[object]:\tResults of the function execution
41
+
42
+ \tExamples:
43
+ \t\t.. code-block:: python
44
+
45
+ \t\t\t> multiprocessing(doctest_square, args=[1, 2, 3])
46
+ \t\t\t[1, 4, 9]
47
+
48
+ \t\t\t> multiprocessing(int.__mul__, [(1,2), (3,4), (5,6)], use_starmap=True)
49
+ \t\t\t[2, 12, 30]
50
+
51
+ \t\t\t> # Using a list of functions (one per argument)
52
+ \t\t\t> multiprocessing([doctest_square, doctest_square, doctest_square], [1, 2, 3])
53
+ \t\t\t[1, 4, 9]
54
+
55
+ \t\t\t> # Will process in parallel with progress bar
56
+ \t\t\t> multiprocessing(doctest_slow, range(10), desc="Processing")
57
+ \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
58
+
59
+ \t\t\t> # Will process in parallel with progress bar and delay the first threads
60
+ \t\t\t> multiprocessing(
61
+ \t\t\t. doctest_slow,
62
+ \t\t\t. range(10),
63
+ \t\t\t. desc="Processing with delay",
64
+ \t\t\t. max_workers=2,
65
+ \t\t\t. delay_first_calls=0.6
66
+ \t\t\t. )
67
+ \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
68
+ \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]:
70
+ ''' Method to execute a function in parallel using multithreading, you should use it:
71
+
72
+ \t- For I/O-bound operations where the GIL is not a bottleneck, such as network requests or disk operations.
73
+ \t- When the task involves waiting for external resources, such as network responses or user input.
74
+ \t- For operations that involve a lot of waiting, such as GUI event handling or handling user input.
75
+
76
+ \tArgs:
77
+ \t\tfunc\t\t\t\t(Callable | list[Callable]):\tFunction to execute, or list of functions (one per argument)
78
+ \t\targs\t\t\t\t(Iterable):\t\t\tIterable of arguments to pass to the function(s)
79
+ \t\tuse_starmap\t\t\t(bool):\t\t\t\tWhether to use starmap or not (Defaults to False):
80
+ \t\t\tTrue means the function will be called like func(\\*args[i]) instead of func(args[i])
81
+ \t\tdesc\t\t\t\t(str):\t\t\t\tDescription displayed in the progress bar
82
+ \t\t\t(if not provided no progress bar will be displayed)
83
+ \t\tmax_workers\t\t\t(int | float):\t\tNumber of workers to use (Defaults to CPU_COUNT), -1 means CPU_COUNT.
84
+ \t\t\tIf float between 0 and 1, it\'s treated as a percentage of CPU_COUNT.
85
+ \t\t\tIf negative float between -1 and 0, it\'s treated as a percentage of len(args).
86
+ \t\tdelay_first_calls\t(float):\t\t\tApply i*delay_first_calls seconds delay to the first "max_workers" calls.
87
+ \t\t\tFor instance with value to 1, the first thread will be delayed by 0 seconds, the second by 1 second, etc.
88
+ \t\t\t(Defaults to 0): This can be useful to avoid functions being called in the same second.
89
+ \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
90
+ \t\tbar_format\t\t\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
91
+ \t\tascii\t\t\t\t(bool):\t\t\t\tWhether to use ASCII or Unicode characters for the progress bar
92
+
93
+ \tReturns:
94
+ \t\tlist[object]:\tResults of the function execution
95
+
96
+ \tExamples:
97
+ \t\t.. code-block:: python
98
+
99
+ \t\t\t> multithreading(doctest_square, args=[1, 2, 3])
100
+ \t\t\t[1, 4, 9]
101
+
102
+ \t\t\t> multithreading(int.__mul__, [(1,2), (3,4), (5,6)], use_starmap=True)
103
+ \t\t\t[2, 12, 30]
104
+
105
+ \t\t\t> # Using a list of functions (one per argument)
106
+ \t\t\t> multithreading([doctest_square, doctest_square, doctest_square], [1, 2, 3])
107
+ \t\t\t[1, 4, 9]
108
+
109
+ \t\t\t> # Will process in parallel with progress bar
110
+ \t\t\t> multithreading(doctest_slow, range(10), desc="Threading")
111
+ \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
112
+
113
+ \t\t\t> # Will process in parallel with progress bar and delay the first threads
114
+ \t\t\t> multithreading(
115
+ \t\t\t. doctest_slow,
116
+ \t\t\t. range(10),
117
+ \t\t\t. desc="Threading with delay",
118
+ \t\t\t. max_workers=2,
119
+ \t\t\t. delay_first_calls=0.6
120
+ \t\t\t. )
121
+ \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
122
+ \t'''
123
+ def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | None = None, **kwargs: Any) -> R:
124
+ ''' Execute a function in a subprocess with positional and keyword arguments.
125
+
126
+ \tThis is useful when you need to run a function in isolation to avoid memory leaks,
127
+ \tresource conflicts, or to ensure a clean execution environment. The subprocess will
128
+ \tbe created, run the function with the provided arguments, and return the result.
129
+
130
+ \tArgs:
131
+ \t\tfunc (Callable): The function to execute in a subprocess.
132
+ \t\t\t(SHOULD BE A TOP-LEVEL FUNCTION TO BE PICKLABLE)
133
+ \t\t*args (Any): Positional arguments to pass to the function.
134
+ \t\ttimeout (float | None): Maximum time in seconds to wait for the subprocess.
135
+ \t\t\tIf None, wait indefinitely. If the subprocess exceeds this time, it will be terminated.
136
+ \t\t**kwargs (Any): Keyword arguments to pass to the function.
137
+
138
+ \tReturns:
139
+ \t\tR: The return value of the function.
140
+
141
+ \tRaises:
142
+ \t\tRuntimeError: If the subprocess exits with a non-zero exit code or times out.
143
+ \t\tTimeoutError: If the subprocess exceeds the specified timeout.
144
+
145
+ \tExamples:
146
+ \t\t.. code-block:: python
147
+
148
+ \t\t\t> # Simple function execution
149
+ \t\t\t> run_in_subprocess(doctest_square, 5)
150
+ \t\t\t25
151
+
152
+ \t\t\t> # Function with multiple arguments
153
+ \t\t\t> def add(a: int, b: int) -> int:
154
+ \t\t\t. return a + b
155
+ \t\t\t> run_in_subprocess(add, 10, 20)
156
+ \t\t\t30
157
+
158
+ \t\t\t> # Function with keyword arguments
159
+ \t\t\t> def greet(name: str, greeting: str = "Hello") -> str:
160
+ \t\t\t. return f"{greeting}, {name}!"
161
+ \t\t\t> run_in_subprocess(greet, "World", greeting="Hi")
162
+ \t\t\t\'Hi, World!\'
163
+
164
+ \t\t\t> # With timeout to prevent hanging
165
+ \t\t\t> run_in_subprocess(some_gpu_func, data, timeout=300.0)
166
+ \t'''
167
+ def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tuple[Any, ...], kwargs: dict[str, Any]) -> None:
168
+ """ Wrapper function to execute the target function and store the result in the queue.
169
+
170
+ \tMust be at module level to be pickable on Windows (spawn context).
171
+
172
+ \tArgs:
173
+ \t\tresult_queue (multiprocessing.Queue): Queue to store the result or exception.
174
+ \t\tfunc (Callable): The target function to execute.
175
+ \t\targs (tuple): Positional arguments for the function.
176
+ \t\tkwargs (dict): Keyword arguments for the function.
177
+ \t"""
178
+ def _starmap[T, R](args: tuple[Callable[[T], R], list[T]]) -> R:
179
+ """ Private function to use starmap using args[0](\\*args[1])
180
+
181
+ \tArgs:
182
+ \t\targs (tuple): Tuple containing the function and the arguments list to pass to the function
183
+ \tReturns:
184
+ \t\tobject: Result of the function execution
185
+ \t"""
186
+ def _delayed_call[T, R](args: tuple[Callable[[T], R], float, T]) -> R:
187
+ """ Private function to apply delay before calling the target function
188
+
189
+ \tArgs:
190
+ \t\targs (tuple): Tuple containing the function, delay in seconds, and the argument to pass to the function
191
+ \tReturns:
192
+ \t\tobject: Result of the function execution
193
+ \t"""
194
+ def _handle_parameters[T, R](func: Callable[[T], R] | list[Callable[[T], R]], args: list[T], use_starmap: bool, delay_first_calls: float, max_workers: int, desc: str, color: str) -> tuple[str, Callable[[T], R], list[T]]:
195
+ ''' Private function to handle the parameters for multiprocessing or multithreading functions
196
+
197
+ \tArgs:
198
+ \t\tfunc\t\t\t\t(Callable | list[Callable]):\tFunction to execute, or list of functions (one per argument)
199
+ \t\targs\t\t\t\t(list):\t\t\t\tList of arguments to pass to the function(s)
200
+ \t\tuse_starmap\t\t\t(bool):\t\t\t\tWhether to use starmap or not (Defaults to False):
201
+ \t\t\tTrue means the function will be called like func(\\*args[i]) instead of func(args[i])
202
+ \t\tdelay_first_calls\t(int):\t\t\t\tApply i*delay_first_calls seconds delay to the first "max_workers" calls.
203
+ \t\t\tFor instance, the first process will be delayed by 0 seconds, the second by 1 second, etc. (Defaults to 0):
204
+ \t\t\tThis can be useful to avoid functions being called in the same second.
205
+ \t\tmax_workers\t\t\t(int):\t\t\t\tNumber of workers to use (Defaults to CPU_COUNT)
206
+ \t\tdesc\t\t\t\t(str):\t\t\t\tDescription of the function execution displayed in the progress bar
207
+ \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar
208
+
209
+ \tReturns:
210
+ \t\ttuple[str, Callable[[T], R], list[T]]:\tTuple containing the description, function, and arguments
211
+ \t'''
@@ -0,0 +1,136 @@
1
+ from collections.abc import Callable as Callable, Iterable, Iterator
2
+ from typing import Any, IO, TextIO, TypeVar
3
+
4
+ RESET: str
5
+ RED: str
6
+ GREEN: str
7
+ YELLOW: str
8
+ BLUE: str
9
+ MAGENTA: str
10
+ CYAN: str
11
+ LINE_UP: str
12
+ BAR_FORMAT: str
13
+ T = TypeVar('T')
14
+ previous_args_kwards: tuple[Any, Any]
15
+ nb_values: int
16
+ import_time: float
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]:
19
+ ''' Function to iterate over a list with a colored TQDM progress bar like the other functions in this module.
20
+
21
+ \tArgs:
22
+ \t\titerable\t(Iterable):\t\t\tList to iterate over
23
+ \t\tdesc\t\t(str):\t\t\t\tDescription of the function execution displayed in the progress bar
24
+ \t\tcolor\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
25
+ \t\tbar_format\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
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)
28
+ \t\t**kwargs:\t\t\t\t\t\tAdditional arguments to pass to the TQDM progress bar
29
+
30
+ \tYields:
31
+ \t\tT: Each item of the iterable
32
+
33
+ \tExamples:
34
+ \t\t>>> for i in colored_for_loop(range(10), desc="Time sleeping loop"):
35
+ \t\t... time.sleep(0.01)
36
+ \t\t>>> # Time sleeping loop: 100%|██████████████████| 10/10 [ 95.72it/s, 00:00<00:00]
37
+ \t'''
38
+ def info(*values: Any, color: str = ..., text: str = 'INFO ', prefix: str = '', file: TextIO | list[TextIO] | None = None, **print_kwargs: Any) -> None:
39
+ ''' Print an information message looking like "[INFO HH:MM:SS] message" in green by default.
40
+
41
+ \tArgs:
42
+ \t\tvalues\t\t\t(Any):\t\t\t\t\tValues to print (like the print function)
43
+ \t\tcolor\t\t\t(str):\t\t\t\t\tColor of the message (default: GREEN)
44
+ \t\ttext\t\t\t(str):\t\t\t\t\tText of the message (default: "INFO ")
45
+ \t\tprefix\t\t\t(str):\t\t\t\t\tPrefix to add to the values
46
+ \t\tfile\t\t\t(TextIO|list[TextIO]):\tFile(s) to write the message to (default: sys.stdout)
47
+ \t\tprint_kwargs\t(dict):\t\t\t\t\tKeyword arguments to pass to the print function
48
+ \t'''
49
+ def debug(*values: Any, **print_kwargs: Any) -> None:
50
+ ''' Print a debug message looking like "[DEBUG HH:MM:SS] message" in cyan by default. '''
51
+ def alt_debug(*values: Any, **print_kwargs: Any) -> None:
52
+ ''' Print a debug message looking like "[DEBUG HH:MM:SS] message" in blue by default. '''
53
+ def suggestion(*values: Any, **print_kwargs: Any) -> None:
54
+ ''' Print a suggestion message looking like "[SUGGESTION HH:MM:SS] message" in cyan by default. '''
55
+ def progress(*values: Any, **print_kwargs: Any) -> None:
56
+ ''' Print a progress message looking like "[PROGRESS HH:MM:SS] message" in magenta by default. '''
57
+ def warning(*values: Any, **print_kwargs: Any) -> None:
58
+ ''' Print a warning message looking like "[WARNING HH:MM:SS] message" in yellow by default and in sys.stderr. '''
59
+ def error(*values: Any, exit: bool = False, **print_kwargs: Any) -> None:
60
+ """ Print an error message (in sys.stderr and in red by default)
61
+ \tand optionally ask the user to continue or stop the program.
62
+
63
+ \tArgs:
64
+ \t\tvalues\t\t\t(Any):\t\tValues to print (like the print function)
65
+ \t\texit\t\t\t(bool):\t\tWhether to ask the user to continue or stop the program,
66
+ \t\t\tfalse to ignore the error automatically and continue
67
+ \t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
68
+ \t"""
69
+ def whatisit(*values: Any, print_function: Callable[..., None] = ..., max_length: int = 250, color: str = ..., **print_kwargs: Any) -> None:
70
+ ''' Print the type of each value and the value itself, with its id and length/shape.
71
+
72
+ \tThe output format is: "type, <id id_number>:\t(length/shape) value"
73
+
74
+ \tArgs:
75
+ \t\tvalues\t\t\t(Any):\t\tValues to print
76
+ \t\tprint_function\t(Callable):\tFunction to use to print the values (default: debug())
77
+ \t\tmax_length\t\t(int):\t\tMaximum length of the value string to print (default: 250)
78
+ \t\tcolor\t\t\t(str):\t\tColor of the message (default: CYAN)
79
+ \t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
80
+ \t'''
81
+ def breakpoint(*values: Any, print_function: Callable[..., None] = ..., **print_kwargs: Any) -> None:
82
+ """ Breakpoint function, pause the program and print the values.
83
+
84
+ \tArgs:
85
+ \t\tvalues\t\t\t(Any):\t\tValues to print
86
+ \t\tprint_function\t(Callable):\tFunction to use to print the values (default: warning())
87
+ \t\tprint_kwargs\t(dict):\t\tKeyword arguments to pass to the print function
88
+ \t"""
89
+
90
+ class TeeMultiOutput:
91
+ ''' File-like object that duplicates output to multiple file-like objects.
92
+
93
+ \tArgs:
94
+ \t\t*files (IO[Any]): One or more file-like objects that have write and flush methods
95
+ \t\tstrip_colors (bool): Strip ANSI color codes from output sent to non-stdout/stderr files
96
+ \t\tascii_only (bool): Replace non-ASCII characters with their ASCII equivalents for non-stdout/stderr files
97
+ \t\tignore_lineup (bool): Ignore lines containing LINE_UP escape sequence in non-terminal outputs
98
+
99
+ \tExamples:
100
+ \t\t>>> f = open("logfile.txt", "w")
101
+ \t\t>>> sys.stdout = TeeMultiOutput(sys.stdout, f)
102
+ \t\t>>> print("Hello World") # Output goes to both console and file
103
+ \t\tHello World
104
+ \t\t>>> f.close()\t# TeeMultiOutput will handle any future writes to closed files gracefully
105
+ \t'''
106
+ files: tuple[IO[Any], ...]
107
+ strip_colors: bool
108
+ ascii_only: bool
109
+ ignore_lineup: bool
110
+ def __init__(self, *files: IO[Any], strip_colors: bool = True, ascii_only: bool = True, ignore_lineup: bool = True) -> None: ...
111
+ @property
112
+ def encoding(self) -> str:
113
+ ''' Get the encoding of the first file, or "utf-8" as fallback.
114
+
115
+ \t\tReturns:
116
+ \t\t\tstr: The encoding, ex: "utf-8", "ascii", "latin1", etc.
117
+ \t\t'''
118
+ def write(self, obj: str) -> int:
119
+ """ Write the object to all files while stripping colors if needed.
120
+
121
+ \t\tArgs:
122
+ \t\t\tobj (str): String to write
123
+ \t\tReturns:
124
+ \t\t\tint: Number of characters written to the first file
125
+ \t\t"""
126
+ def flush(self) -> None:
127
+ """ Flush all files. """
128
+ def fileno(self) -> int:
129
+ """ Return the file descriptor of the first file. """
130
+
131
+ def remove_colors(text: str) -> str:
132
+ """ Remove the colors from a text """
133
+ def is_same_print(*args: Any, **kwargs: Any) -> bool:
134
+ """ Checks if the current print call is the same as the previous one. """
135
+ def current_time() -> str:
136
+ ''' Get the current time as "HH:MM:SS" if less than 24 hours since import, else "YYYY-MM-DD HH:MM:SS" '''
@@ -0,0 +1,15 @@
1
+ from .print import CYAN as CYAN, GREEN as GREEN, RESET as RESET, YELLOW as YELLOW
2
+
3
+ def show_version(main_package: str = 'stouputils', primary_color: str = ..., secondary_color: str = ..., max_depth: int = 2) -> None:
4
+ ''' Print the version of the main package and its dependencies.
5
+
6
+ \tUsed by the "stouputils --version" command.
7
+
8
+ \tArgs:
9
+ \t\tmain_package\t(str):\tName of the main package to show version for
10
+ \t\tprimary_color\t(str):\tColor to use for the primary package name
11
+ \t\tsecondary_color\t(str):\tColor to use for the secondary package names
12
+ \t\tmax_depth\t\t(int):\tMaximum depth for dependency tree (<= 2 for flat, >=3 for tree)
13
+ \t'''
14
+ def show_version_cli() -> None:
15
+ ''' Handle the "stouputils --version" CLI command '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: stouputils
3
- Version: 1.12.2
3
+ Version: 1.13.0
4
4
  Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
5
5
  Keywords: utilities,tools,helpers,development,python
6
6
  Author: Stoupy51
@@ -1,6 +1,6 @@
1
1
  stouputils/__init__.py,sha256=KMJoy8FCiiiXJ53QfgU3rz7AY7AJ_j5kP3j24JuznC0,1136
2
2
  stouputils/__init__.pyi,sha256=J8LeijIkWrTdGlevNR8dlGlgYg-Dh_MvGjp2EsPZ8UM,351
3
- stouputils/__main__.py,sha256=n4_wlF2VrY1HlMuJ8_1LT6G76rh94DRqfuvEPlyWvEk,2430
3
+ stouputils/__main__.py,sha256=sJSncuTWua7jA9pTw4BUoDzNUUExZKeyATbmY4lhl0E,2764
4
4
  stouputils/_deprecated.py,sha256=Bcq6YjdM9Rk9Vq-WMhc_tuEbPORX6U8HAJ9Vh-VIWTA,1478
5
5
  stouputils/_deprecated.pyi,sha256=6-8YsftJd2fRAdBLsysc6jf-uA8V2wiqkiFAbdfWfJQ,664
6
6
  stouputils/all_doctests.py,sha256=1bGGUg80nvLBY3wrPkFrkcuQRjFTWmTpHZtai9X-vnY,5891
@@ -29,16 +29,16 @@ stouputils/continuous_delivery/cd_utils.py,sha256=fkaHk2V3j66uFAUsM2c_UddNhXW2KA
29
29
  stouputils/continuous_delivery/cd_utils.pyi,sha256=nxTLQydVOSVIix88dRtBXjMrUPpI5ftiQYbLI_nMByQ,4848
30
30
  stouputils/continuous_delivery/github.py,sha256=Iva2XNm60Th78P_evnhCJHn0Q9-06udPlOZAxtZB5vw,19464
31
31
  stouputils/continuous_delivery/github.pyi,sha256=RHRsSroEsT0I1qeuq-Wg0JLdEEDttLrzgHZPVRtLZ0Q,6641
32
- stouputils/continuous_delivery/pypi.py,sha256=E4jAu8bYscdUU_0svIxmCDdapxXTDzwbx2TkbMFzeXs,3428
33
- stouputils/continuous_delivery/pypi.pyi,sha256=uZeu3GaDrA9ptMARd3Dj_jyzN65eSmZdKBuG3m8QQAQ,1977
32
+ stouputils/continuous_delivery/pypi.py,sha256=pxXnf6-vQhAFuKDxIw-pCR3ex6zQiSBj5Oc5m1IglMA,5196
33
+ stouputils/continuous_delivery/pypi.pyi,sha256=qmMeHDzezN_ZW-_jGRFbaccG_rkfELbmW9hUPU6vptY,2325
34
34
  stouputils/continuous_delivery/pyproject.py,sha256=olD3QqzLfCLnTBw8IkSKSLBPWyeMv6uS7A0yGdFuIvQ,4802
35
35
  stouputils/continuous_delivery/pyproject.pyi,sha256=bMWwqyG0Auo46dt-dWGePQ9yJ8rSrgb7mnJTfbiS3TQ,2053
36
36
  stouputils/continuous_delivery/stubs.py,sha256=xUAcP21Y03PLEr7X6LrIBMvPeLI8Rp-EyaTLxocA0C4,3512
37
37
  stouputils/continuous_delivery/stubs.pyi,sha256=sLZypdz1oGoymQIRPez50rnH8TQhvEIx6A7xUdGtnys,2390
38
- stouputils/ctx.py,sha256=xjFQHgAKpqXZ2zD6P8AJYrnuhMwKV9VbLV1A7B46ZCI,15178
38
+ stouputils/ctx.py,sha256=KVVDmL3pAPX2WM_QzjsmctbG-YfjJ-4aWBSoI7eU_ws,15586
39
39
  stouputils/ctx.pyi,sha256=-7AJwD9bKzKBFsYlgyULPznstq3LvXRXe2r_2at72FI,9799
40
40
  stouputils/data_science/config/get.py,sha256=-9Yo5go7sw7eZNDwMfV3V9qOyk6q3Nrrb0V1eg-F1LE,1722
41
- stouputils/data_science/config/set.py,sha256=vzmDjj_GYCUiM_BzswAGbCUnPa7BAQSI8M5pkZiSJWk,4050
41
+ stouputils/data_science/config/set.py,sha256=PBBnWhgSptWTPkMtq3N1UxmEz_E4ywUcl3daS43wA2M,4175
42
42
  stouputils/data_science/data_processing/image/__init__.py,sha256=dJY410JsVxfwloQiH1TPAwxVsRYAI4vhaZ3w1IAkUCk,1823
43
43
  stouputils/data_science/data_processing/image/auto_contrast.py,sha256=grKz4cxMEnLWAP6k4o0CuFyzcw8_v51d6Ep3fufb6Ew,2289
44
44
  stouputils/data_science/data_processing/image/axis_flip.py,sha256=6OsDeA6SK_jIv3NcbCEe4Q5NzH3KgWIPQf-EWkLzTP0,1663
@@ -95,7 +95,7 @@ stouputils/data_science/models/keras/xception.py,sha256=NKv5zTNtPiR3oV7_X-FIFvt5
95
95
  stouputils/data_science/models/keras_utils/callbacks/__init__.py,sha256=Wvlbv7dAZd6stAJKi1kPevNVwpG6ULme_Pl-ZAFV8nE,853
96
96
  stouputils/data_science/models/keras_utils/callbacks/colored_progress_bar.py,sha256=a6zjVzXsheU2l-ecRWhSC0Vkyk55eWbp74C8NQFert4,7641
97
97
  stouputils/data_science/models/keras_utils/callbacks/learning_rate_finder.py,sha256=ftimXot3or5ykJwauv1_-JjUScq7ckX4XjMSDnecBcE,5058
98
- stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py,sha256=_9UXBP-Ryef_WCpRaWT0exhSX8VLezXF-FRDMlYTc58,966
98
+ stouputils/data_science/models/keras_utils/callbacks/model_checkpoint_v2.py,sha256=KTsVin5sozwy6XVDt1Vj7J6obrkGH40NV-AfX4mBmq4,935
99
99
  stouputils/data_science/models/keras_utils/callbacks/progressive_unfreezing.py,sha256=okoiMpJ0a_DKY9ZE6JIdovbxn--Ao-XbE74xC_baKEk,9605
100
100
  stouputils/data_science/models/keras_utils/callbacks/warmup_scheduler.py,sha256=6aErEB8XHfvgqGqG8sFRtmMyZW-VSXbEK2OiIHmCujM,2312
101
101
  stouputils/data_science/models/keras_utils/losses/__init__.py,sha256=6HQkqTZd-W3YPrxg_-2956j_iCmLm4PmbeW2uIPv-4I,174
@@ -108,22 +108,22 @@ stouputils/data_science/scripts/augment_dataset.py,sha256=zGcQ2uSn_DO570NIFEs2DU
108
108
  stouputils/data_science/scripts/exhaustive_process.py,sha256=Ty2lHBZBweWxH6smpjoUEqpGz6JmMUO_oaNZO7d-gtQ,5483
109
109
  stouputils/data_science/scripts/preprocess_dataset.py,sha256=OLC2KjEtSMeyHHPpNOATfNDuq0lZ09utKhsuzBA4MN4,2929
110
110
  stouputils/data_science/scripts/routine.py,sha256=FkTLzmcdm_qUp69D-dPAKJm2RfXZZLtPgje6lEopu2I,7662
111
- stouputils/data_science/utils.py,sha256=HFXI2RQZ53RbBOn_4Act2bi0z4xQlTtsuR5Am80v9JU,11084
111
+ stouputils/data_science/utils.py,sha256=MQ5-S21W2uvtKiwUFsyKJdeN9s9y7MxuvjfjRbwKTD8,10799
112
112
  stouputils/decorators.py,sha256=dBw_TCzd3m3HWL_SrtuGPN444ncMJWBFu1lDpDfvpuk,21189
113
113
  stouputils/decorators.pyi,sha256=k7kAOPM6c2LkhskUatoiv95JmfnMcKIxJRvhZN63axM,10561
114
114
  stouputils/image.py,sha256=NtduEVzgbCuZhDRpDZHGTW7-wTs7MqoxUwSQcipvb08,16633
115
115
  stouputils/image.pyi,sha256=Dkf64KmXJTAEcbtYDHFZ1kqEHqOf2FgJ2Z2BlJgp4fU,8455
116
- stouputils/installer/__init__.py,sha256=DBwI9w3xvw0NR_jDMxmURwPi1F79kPLe7EuNjmrxW_U,502
116
+ stouputils/installer/__init__.py,sha256=Ff_al_z6GSaazLHqfsSxsxmooXcIRmE--ffb1gZt0Q0,484
117
117
  stouputils/installer/__init__.pyi,sha256=ZB-8frAUOW-0pCEJL-e2AdbFodivv46v3EBYwEXCxRo,117
118
118
  stouputils/installer/common.py,sha256=UJr5u02h4LQZQdkmVOkJ3vvW_0-ROGgVMMh0PNoVS1A,2209
119
119
  stouputils/installer/common.pyi,sha256=5aG0-58omFkkNYeVHnQ0uHUBsaI7xoMD-WqWVdOgOms,1403
120
120
  stouputils/installer/downloader.py,sha256=IIV_zI1lnKCD-9OsnroOoo4nDPOLr2Vn6oOYHnXshj8,3659
121
121
  stouputils/installer/downloader.pyi,sha256=8Xp0sXyba4flHAZ0nNqNlFU4VUmfPvllmPUkWalkvRA,1273
122
- stouputils/installer/linux.py,sha256=6BsMFoBDn1-RPMCW8rAciuxHwxbk9QTX0DmA-meQdDE,5512
122
+ stouputils/installer/linux.py,sha256=5hlG7sh4Idk6rBXbfWP9oU-99TNd6njl9D5FjSnux1o,5368
123
123
  stouputils/installer/linux.pyi,sha256=V-EbY7seOFnC6LL844bqWRNvQ7rHmMhDkcFj5r1V7Tk,1943
124
- stouputils/installer/main.py,sha256=8wrx_cnQo1dFGRf6x8vtxh6-96tQ-AzMyvJ0S64j0io,8538
124
+ stouputils/installer/main.py,sha256=pbcEdKOX1P4VLJlVjzxq-hmdk6zrFt_V3aj6pYYQ8cY,8315
125
125
  stouputils/installer/main.pyi,sha256=r3j4GoMBpU06MpOqjSwoDTiSMOmbA3WWUA87970b6KE,3134
126
- stouputils/installer/windows.py,sha256=r2AIuoyAmtMEuoCtQBH9GWQWI-JUT2J9zoH28j9ruOU,4880
126
+ stouputils/installer/windows.py,sha256=WJcsRvEj00uAlJVAWgePhR7Hq0chYE0_n2QUZG9011A,4744
127
127
  stouputils/installer/windows.pyi,sha256=tHogIFhPVDQS0I10liLkAxnpaFFAvmFtEVMpPIae5LU,1616
128
128
  stouputils/io.py,sha256=yQ4jGWoI81cP-ZWxgYwqXmuD6s_IbpkKkZf5jjqqIAE,16841
129
129
  stouputils/io.pyi,sha256=TCBTVEWUkI3dO_jWI9oPMF9SbnT1yLzFChE551JPbSY,9076
@@ -131,10 +131,41 @@ stouputils/parallel.py,sha256=I8STOb-VV9VlSeTm_8ZKCJLdL_ahGL61iFSCptDwHhQ,17512
131
131
  stouputils/parallel.pyi,sha256=cvNMT0FyjOmehaVghurwVKABqvTO3BUbPF8f8ISp8Bw,10855
132
132
  stouputils/print.py,sha256=4IIUWkShAZ77Q7rZBDnUs-gSuAt7V1IGj9DbWwECbc4,16198
133
133
  stouputils/print.pyi,sha256=-uYWZ-hlPhkeu8E0gSoQqY0u-4UhkJAtPUioQb3Xujo,6674
134
- stouputils/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
134
+ stouputils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
135
+ stouputils/stouputils/__init__.pyi,sha256=J8LeijIkWrTdGlevNR8dlGlgYg-Dh_MvGjp2EsPZ8UM,351
136
+ stouputils/stouputils/_deprecated.pyi,sha256=6-8YsftJd2fRAdBLsysc6jf-uA8V2wiqkiFAbdfWfJQ,664
137
+ stouputils/stouputils/all_doctests.pyi,sha256=8JD8qn7neYuR0PolabWxX6id1dNEvQDrvOhMS2aYhTM,1907
138
+ stouputils/stouputils/applications/__init__.pyi,sha256=DTYq2Uqq1uLzCMkFByjRqdtREA-9SaQnp4QpgmCEPFg,56
139
+ stouputils/stouputils/applications/automatic_docs.pyi,sha256=sfFXpVE5y5Z907HEjKzpZ_9zM34d-jKNDQCdMx7E-9s,6189
140
+ stouputils/stouputils/applications/upscaler/__init__.pyi,sha256=VSp6Tq09ATCTdfnjhbDnu7lblaLLGbCNi-E22jYxa88,67
141
+ stouputils/stouputils/applications/upscaler/config.pyi,sha256=lsRHAW3mvvM2inKSJ66VXb511ovmIScLABrUzckmUfk,608
142
+ stouputils/stouputils/applications/upscaler/image.pyi,sha256=AB92XoKt8Q2c_J72ZdDdyVDuCGOEiM7E6v8L-uFmAxI,4786
143
+ stouputils/stouputils/applications/upscaler/video.pyi,sha256=AyRlb7iHqCwdW7lHiW8Dy_czin8CbN-GiK2_xoVJvNU,2918
144
+ stouputils/stouputils/archive.pyi,sha256=Z2BbQAiErRYntv53QC9uf_XPw3tx3Oy73wB0Bbil11c,3246
145
+ stouputils/stouputils/backup.pyi,sha256=-SLVykkR5U8479T84zjNPVBNnV193s0zyWjathY2DDA,4923
146
+ stouputils/stouputils/collections.pyi,sha256=mKIBV4K7mm-PTvtoYi_cVOAGjW7bo3iIASqosSXFUzE,3519
147
+ stouputils/stouputils/continuous_delivery/__init__.pyi,sha256=_Sz2D10n1CDEyY8qDFwXNKdr01HVxanY4qdq9aN19cc,117
148
+ stouputils/stouputils/continuous_delivery/cd_utils.pyi,sha256=nxTLQydVOSVIix88dRtBXjMrUPpI5ftiQYbLI_nMByQ,4848
149
+ stouputils/stouputils/continuous_delivery/github.pyi,sha256=RHRsSroEsT0I1qeuq-Wg0JLdEEDttLrzgHZPVRtLZ0Q,6641
150
+ stouputils/stouputils/continuous_delivery/pypi.pyi,sha256=fRAu8ocLNpEN6dhUTMuFxlmRgt3-LRjKPOJjFlUPrJ4,2463
151
+ stouputils/stouputils/continuous_delivery/pyproject.pyi,sha256=bMWwqyG0Auo46dt-dWGePQ9yJ8rSrgb7mnJTfbiS3TQ,2053
152
+ stouputils/stouputils/continuous_delivery/stubs.pyi,sha256=sLZypdz1oGoymQIRPez50rnH8TQhvEIx6A7xUdGtnys,2390
153
+ stouputils/stouputils/ctx.pyi,sha256=-7AJwD9bKzKBFsYlgyULPznstq3LvXRXe2r_2at72FI,9799
154
+ stouputils/stouputils/decorators.pyi,sha256=k7kAOPM6c2LkhskUatoiv95JmfnMcKIxJRvhZN63axM,10561
155
+ stouputils/stouputils/image.pyi,sha256=Dkf64KmXJTAEcbtYDHFZ1kqEHqOf2FgJ2Z2BlJgp4fU,8455
156
+ stouputils/stouputils/installer/__init__.pyi,sha256=ZB-8frAUOW-0pCEJL-e2AdbFodivv46v3EBYwEXCxRo,117
157
+ stouputils/stouputils/installer/common.pyi,sha256=5aG0-58omFkkNYeVHnQ0uHUBsaI7xoMD-WqWVdOgOms,1403
158
+ stouputils/stouputils/installer/downloader.pyi,sha256=8Xp0sXyba4flHAZ0nNqNlFU4VUmfPvllmPUkWalkvRA,1273
159
+ stouputils/stouputils/installer/linux.pyi,sha256=V-EbY7seOFnC6LL844bqWRNvQ7rHmMhDkcFj5r1V7Tk,1943
160
+ stouputils/stouputils/installer/main.pyi,sha256=r3j4GoMBpU06MpOqjSwoDTiSMOmbA3WWUA87970b6KE,3134
161
+ stouputils/stouputils/installer/windows.pyi,sha256=tHogIFhPVDQS0I10liLkAxnpaFFAvmFtEVMpPIae5LU,1616
162
+ stouputils/stouputils/io.pyi,sha256=TCBTVEWUkI3dO_jWI9oPMF9SbnT1yLzFChE551JPbSY,9076
163
+ stouputils/stouputils/parallel.pyi,sha256=cvNMT0FyjOmehaVghurwVKABqvTO3BUbPF8f8ISp8Bw,10855
164
+ stouputils/stouputils/print.pyi,sha256=-uYWZ-hlPhkeu8E0gSoQqY0u-4UhkJAtPUioQb3Xujo,6674
165
+ stouputils/stouputils/version_pkg.pyi,sha256=QPvqp1U3QA-9C_CC1dT9Vahv1hXEhstbM7x5uzMZSsQ,755
135
166
  stouputils/version_pkg.py,sha256=Jsp-s03L14DkiZ94vQgrlQmaxApfn9DC8M_nzT1SJLk,7014
136
167
  stouputils/version_pkg.pyi,sha256=QPvqp1U3QA-9C_CC1dT9Vahv1hXEhstbM7x5uzMZSsQ,755
137
- stouputils-1.12.2.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
138
- stouputils-1.12.2.dist-info/entry_points.txt,sha256=tx0z9VOnE-sfkmbFbA93zaBMzV3XSsKEJa_BWIqUzxw,57
139
- stouputils-1.12.2.dist-info/METADATA,sha256=7GyfVHC5zHyTuBx7WsW7R3p_uzDZ1MppXjkFefmCOTg,13615
140
- stouputils-1.12.2.dist-info/RECORD,,
168
+ stouputils-1.13.0.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
169
+ stouputils-1.13.0.dist-info/entry_points.txt,sha256=tx0z9VOnE-sfkmbFbA93zaBMzV3XSsKEJa_BWIqUzxw,57
170
+ stouputils-1.13.0.dist-info/METADATA,sha256=Tc6LE1z8Gbch2G-mLmzwx-hzrD06GLBSx5_ECwngFWU,13615
171
+ stouputils-1.13.0.dist-info/RECORD,,