stouputils 1.14.2__py3-none-any.whl → 1.14.3__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 (40) hide show
  1. stouputils/continuous_delivery/pypi.py +1 -1
  2. stouputils/continuous_delivery/pypi.pyi +3 -2
  3. stouputils/decorators.pyi +10 -0
  4. stouputils/parallel.pyi +12 -7
  5. stouputils/print.pyi +2 -2
  6. {stouputils-1.14.2.dist-info → stouputils-1.14.3.dist-info}/METADATA +1 -1
  7. {stouputils-1.14.2.dist-info → stouputils-1.14.3.dist-info}/RECORD +9 -40
  8. {stouputils-1.14.2.dist-info → stouputils-1.14.3.dist-info}/WHEEL +1 -1
  9. stouputils/stouputils/__init__.pyi +0 -15
  10. stouputils/stouputils/_deprecated.pyi +0 -12
  11. stouputils/stouputils/all_doctests.pyi +0 -46
  12. stouputils/stouputils/applications/__init__.pyi +0 -2
  13. stouputils/stouputils/applications/automatic_docs.pyi +0 -106
  14. stouputils/stouputils/applications/upscaler/__init__.pyi +0 -3
  15. stouputils/stouputils/applications/upscaler/config.pyi +0 -18
  16. stouputils/stouputils/applications/upscaler/image.pyi +0 -109
  17. stouputils/stouputils/applications/upscaler/video.pyi +0 -60
  18. stouputils/stouputils/archive.pyi +0 -67
  19. stouputils/stouputils/backup.pyi +0 -109
  20. stouputils/stouputils/collections.pyi +0 -86
  21. stouputils/stouputils/continuous_delivery/__init__.pyi +0 -5
  22. stouputils/stouputils/continuous_delivery/cd_utils.pyi +0 -129
  23. stouputils/stouputils/continuous_delivery/github.pyi +0 -162
  24. stouputils/stouputils/continuous_delivery/pypi.pyi +0 -53
  25. stouputils/stouputils/continuous_delivery/pyproject.pyi +0 -67
  26. stouputils/stouputils/continuous_delivery/stubs.pyi +0 -39
  27. stouputils/stouputils/ctx.pyi +0 -211
  28. stouputils/stouputils/decorators.pyi +0 -252
  29. stouputils/stouputils/image.pyi +0 -172
  30. stouputils/stouputils/installer/__init__.pyi +0 -5
  31. stouputils/stouputils/installer/common.pyi +0 -39
  32. stouputils/stouputils/installer/downloader.pyi +0 -24
  33. stouputils/stouputils/installer/linux.pyi +0 -39
  34. stouputils/stouputils/installer/main.pyi +0 -57
  35. stouputils/stouputils/installer/windows.pyi +0 -31
  36. stouputils/stouputils/io.pyi +0 -213
  37. stouputils/stouputils/parallel.pyi +0 -216
  38. stouputils/stouputils/print.pyi +0 -136
  39. stouputils/stouputils/version_pkg.pyi +0 -15
  40. {stouputils-1.14.2.dist-info → stouputils-1.14.3.dist-info}/entry_points.txt +0 -0
@@ -1,216 +0,0 @@
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, smooth_tqdm: bool = True, **tqdm_kwargs: Any) -> 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
- \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
40
-
41
- \tReturns:
42
- \t\tlist[object]:\tResults of the function execution
43
-
44
- \tExamples:
45
- \t\t.. code-block:: python
46
-
47
- \t\t\t> multiprocessing(doctest_square, args=[1, 2, 3])
48
- \t\t\t[1, 4, 9]
49
-
50
- \t\t\t> multiprocessing(int.__mul__, [(1,2), (3,4), (5,6)], use_starmap=True)
51
- \t\t\t[2, 12, 30]
52
-
53
- \t\t\t> # Using a list of functions (one per argument)
54
- \t\t\t> multiprocessing([doctest_square, doctest_square, doctest_square], [1, 2, 3])
55
- \t\t\t[1, 4, 9]
56
-
57
- \t\t\t> # Will process in parallel with progress bar
58
- \t\t\t> multiprocessing(doctest_slow, range(10), desc="Processing")
59
- \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
60
-
61
- \t\t\t> # Will process in parallel with progress bar and delay the first threads
62
- \t\t\t> multiprocessing(
63
- \t\t\t. doctest_slow,
64
- \t\t\t. range(10),
65
- \t\t\t. desc="Processing with delay",
66
- \t\t\t. max_workers=2,
67
- \t\t\t. delay_first_calls=0.6
68
- \t\t\t. )
69
- \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
70
- \t'''
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]:
72
- ''' Method to execute a function in parallel using multithreading, you should use it:
73
-
74
- \t- For I/O-bound operations where the GIL is not a bottleneck, such as network requests or disk operations.
75
- \t- When the task involves waiting for external resources, such as network responses or user input.
76
- \t- For operations that involve a lot of waiting, such as GUI event handling or handling user input.
77
-
78
- \tArgs:
79
- \t\tfunc\t\t\t\t(Callable | list[Callable]):\tFunction to execute, or list of functions (one per argument)
80
- \t\targs\t\t\t\t(Iterable):\t\t\tIterable of arguments to pass to the function(s)
81
- \t\tuse_starmap\t\t\t(bool):\t\t\t\tWhether to use starmap or not (Defaults to False):
82
- \t\t\tTrue means the function will be called like func(\\*args[i]) instead of func(args[i])
83
- \t\tdesc\t\t\t\t(str):\t\t\t\tDescription displayed in the progress bar
84
- \t\t\t(if not provided no progress bar will be displayed)
85
- \t\tmax_workers\t\t\t(int | float):\t\tNumber of workers to use (Defaults to CPU_COUNT), -1 means CPU_COUNT.
86
- \t\t\tIf float between 0 and 1, it\'s treated as a percentage of CPU_COUNT.
87
- \t\t\tIf negative float between -1 and 0, it\'s treated as a percentage of len(args).
88
- \t\tdelay_first_calls\t(float):\t\t\tApply i*delay_first_calls seconds delay to the first "max_workers" calls.
89
- \t\t\tFor instance with value to 1, the first thread will be delayed by 0 seconds, the second by 1 second, etc.
90
- \t\t\t(Defaults to 0): This can be useful to avoid functions being called in the same second.
91
- \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar (Defaults to MAGENTA)
92
- \t\tbar_format\t\t\t(str):\t\t\t\tFormat of the progress bar (Defaults to BAR_FORMAT)
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
96
-
97
- \tReturns:
98
- \t\tlist[object]:\tResults of the function execution
99
-
100
- \tExamples:
101
- \t\t.. code-block:: python
102
-
103
- \t\t\t> multithreading(doctest_square, args=[1, 2, 3])
104
- \t\t\t[1, 4, 9]
105
-
106
- \t\t\t> multithreading(int.__mul__, [(1,2), (3,4), (5,6)], use_starmap=True)
107
- \t\t\t[2, 12, 30]
108
-
109
- \t\t\t> # Using a list of functions (one per argument)
110
- \t\t\t> multithreading([doctest_square, doctest_square, doctest_square], [1, 2, 3])
111
- \t\t\t[1, 4, 9]
112
-
113
- \t\t\t> # Will process in parallel with progress bar
114
- \t\t\t> multithreading(doctest_slow, range(10), desc="Threading")
115
- \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
116
-
117
- \t\t\t> # Will process in parallel with progress bar and delay the first threads
118
- \t\t\t> multithreading(
119
- \t\t\t. doctest_slow,
120
- \t\t\t. range(10),
121
- \t\t\t. desc="Threading with delay",
122
- \t\t\t. max_workers=2,
123
- \t\t\t. delay_first_calls=0.6
124
- \t\t\t. )
125
- \t\t\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
126
- \t'''
127
- def run_in_subprocess[R](func: Callable[..., R], *args: Any, timeout: float | None = None, no_join: bool = False, **kwargs: Any) -> R:
128
- ''' Execute a function in a subprocess with positional and keyword arguments.
129
-
130
- \tThis is useful when you need to run a function in isolation to avoid memory leaks,
131
- \tresource conflicts, or to ensure a clean execution environment. The subprocess will
132
- \tbe created, run the function with the provided arguments, and return the result.
133
-
134
- \tArgs:
135
- \t\tfunc (Callable): The function to execute in a subprocess.
136
- \t\t\t(SHOULD BE A TOP-LEVEL FUNCTION TO BE PICKLABLE)
137
- \t\t*args (Any): Positional arguments to pass to the function.
138
- \t\ttimeout (float | None): Maximum time in seconds to wait for the subprocess.
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).
141
- \t\t**kwargs (Any): Keyword arguments to pass to the function.
142
-
143
- \tReturns:
144
- \t\tR: The return value of the function.
145
-
146
- \tRaises:
147
- \t\tRuntimeError: If the subprocess exits with a non-zero exit code or times out.
148
- \t\tTimeoutError: If the subprocess exceeds the specified timeout.
149
-
150
- \tExamples:
151
- \t\t.. code-block:: python
152
-
153
- \t\t\t> # Simple function execution
154
- \t\t\t> run_in_subprocess(doctest_square, 5)
155
- \t\t\t25
156
-
157
- \t\t\t> # Function with multiple arguments
158
- \t\t\t> def add(a: int, b: int) -> int:
159
- \t\t\t. return a + b
160
- \t\t\t> run_in_subprocess(add, 10, 20)
161
- \t\t\t30
162
-
163
- \t\t\t> # Function with keyword arguments
164
- \t\t\t> def greet(name: str, greeting: str = "Hello") -> str:
165
- \t\t\t. return f"{greeting}, {name}!"
166
- \t\t\t> run_in_subprocess(greet, "World", greeting="Hi")
167
- \t\t\t\'Hi, World!\'
168
-
169
- \t\t\t> # With timeout to prevent hanging
170
- \t\t\t> run_in_subprocess(some_gpu_func, data, timeout=300.0)
171
- \t'''
172
- def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tuple[Any, ...], kwargs: dict[str, Any]) -> None:
173
- """ Wrapper function to execute the target function and store the result in the queue.
174
-
175
- \tMust be at module level to be pickable on Windows (spawn context).
176
-
177
- \tArgs:
178
- \t\tresult_queue (multiprocessing.Queue | None): Queue to store the result or exception (None if detached).
179
- \t\tfunc (Callable): The target function to execute.
180
- \t\targs (tuple): Positional arguments for the function.
181
- \t\tkwargs (dict): Keyword arguments for the function.
182
- \t"""
183
- def _starmap[T, R](args: tuple[Callable[[T], R], list[T]]) -> R:
184
- """ Private function to use starmap using args[0](\\*args[1])
185
-
186
- \tArgs:
187
- \t\targs (tuple): Tuple containing the function and the arguments list to pass to the function
188
- \tReturns:
189
- \t\tobject: Result of the function execution
190
- \t"""
191
- def _delayed_call[T, R](args: tuple[Callable[[T], R], float, T]) -> R:
192
- """ Private function to apply delay before calling the target function
193
-
194
- \tArgs:
195
- \t\targs (tuple): Tuple containing the function, delay in seconds, and the argument to pass to the function
196
- \tReturns:
197
- \t\tobject: Result of the function execution
198
- \t"""
199
- 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]]:
200
- ''' Private function to handle the parameters for multiprocessing or multithreading functions
201
-
202
- \tArgs:
203
- \t\tfunc\t\t\t\t(Callable | list[Callable]):\tFunction to execute, or list of functions (one per argument)
204
- \t\targs\t\t\t\t(list):\t\t\t\tList of arguments to pass to the function(s)
205
- \t\tuse_starmap\t\t\t(bool):\t\t\t\tWhether to use starmap or not (Defaults to False):
206
- \t\t\tTrue means the function will be called like func(\\*args[i]) instead of func(args[i])
207
- \t\tdelay_first_calls\t(int):\t\t\t\tApply i*delay_first_calls seconds delay to the first "max_workers" calls.
208
- \t\t\tFor instance, the first process will be delayed by 0 seconds, the second by 1 second, etc. (Defaults to 0):
209
- \t\t\tThis can be useful to avoid functions being called in the same second.
210
- \t\tmax_workers\t\t\t(int):\t\t\t\tNumber of workers to use (Defaults to CPU_COUNT)
211
- \t\tdesc\t\t\t\t(str):\t\t\t\tDescription of the function execution displayed in the progress bar
212
- \t\tcolor\t\t\t\t(str):\t\t\t\tColor of the progress bar
213
-
214
- \tReturns:
215
- \t\ttuple[str, Callable[[T], R], list[T]]:\tTuple containing the description, function, and arguments
216
- \t'''
@@ -1,136 +0,0 @@
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, smooth_tqdm: bool = True, **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\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
- \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" '''
@@ -1,15 +0,0 @@
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 '''