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
@@ -110,7 +110,7 @@ def pypi_full_routine_using_uv() -> None:
110
110
  # Generate stubs unless '--no-stubs' is passed
111
111
  if "--no-stubs" not in sys.argv and "--no_stubs" not in sys.argv:
112
112
  from .stubs import stubs_full_routine
113
- stubs_full_routine(package_name, output_directory=package_dir, clean_before=True)
113
+ stubs_full_routine(package_name, output_directory=os.path.dirname(package_dir) or ".", clean_before=True)
114
114
 
115
115
  # Increment version in pyproject.toml
116
116
  if "--no-bump" not in sys.argv and "--no_bump" not in sys.argv:
@@ -47,6 +47,7 @@ def pypi_full_routine_using_uv() -> None:
47
47
 
48
48
  \tSteps:
49
49
  \t\t1. Generate stubs unless '--no-stubs' is passed
50
- \t\t2. Build the package using 'uv build'
51
- \t\t3. Upload the most recent file to PyPI using 'uv publish'
50
+ \t\t2. Increment version in pyproject.toml (patch by default, minor if 'minor' is passed as last argument, 'major' if 'major' is passed)
51
+ \t\t3. Build the package using 'uv build'
52
+ \t\t4. Upload the most recent file to PyPI using 'uv publish'
52
53
  \t"""
stouputils/decorators.pyi CHANGED
@@ -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.
stouputils/parallel.pyi CHANGED
@@ -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:
@@ -170,10 +175,10 @@ def _subprocess_wrapper[R](result_queue: Any, func: Callable[..., R], args: tupl
170
175
  \tMust be at module level to be pickable on Windows (spawn context).
171
176
 
172
177
  \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.
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.
177
182
  \t"""
178
183
  def _starmap[T, R](args: tuple[Callable[[T], R], list[T]]) -> R:
179
184
  """ Private function to use starmap using args[0](\\*args[1])
stouputils/print.pyi CHANGED
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: stouputils
3
- Version: 1.14.2
3
+ Version: 1.14.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
@@ -29,8 +29,8 @@ 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=H62NlWKG_9OQcNpisEJ3DqtNnneVmcnVnv3NItdNvv0,5298
33
- stouputils/continuous_delivery/pypi.pyi,sha256=qmMeHDzezN_ZW-_jGRFbaccG_rkfELbmW9hUPU6vptY,2325
32
+ stouputils/continuous_delivery/pypi.py,sha256=v7EVkF36mi1VtGiSRd-H4k9DQsdMmOnRYDgjdnCezOU,5322
33
+ stouputils/continuous_delivery/pypi.pyi,sha256=fRAu8ocLNpEN6dhUTMuFxlmRgt3-LRjKPOJjFlUPrJ4,2463
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
@@ -110,7 +110,7 @@ stouputils/data_science/scripts/preprocess_dataset.py,sha256=OLC2KjEtSMeyHHPpNOA
110
110
  stouputils/data_science/scripts/routine.py,sha256=FkTLzmcdm_qUp69D-dPAKJm2RfXZZLtPgje6lEopu2I,7662
111
111
  stouputils/data_science/utils.py,sha256=MQ5-S21W2uvtKiwUFsyKJdeN9s9y7MxuvjfjRbwKTD8,10799
112
112
  stouputils/decorators.py,sha256=bheT64aWNE22yQePB_5-JMQ4Ezm-1VcTg2WRZaJB2r4,21534
113
- stouputils/decorators.pyi,sha256=k7kAOPM6c2LkhskUatoiv95JmfnMcKIxJRvhZN63axM,10561
113
+ stouputils/decorators.pyi,sha256=_ZPqr84G316gkj_cq_LZGuCMhSyGBWunvlxM5Cq9Hvo,10944
114
114
  stouputils/image.py,sha256=NtduEVzgbCuZhDRpDZHGTW7-wTs7MqoxUwSQcipvb08,16633
115
115
  stouputils/image.pyi,sha256=Dkf64KmXJTAEcbtYDHFZ1kqEHqOf2FgJ2Z2BlJgp4fU,8455
116
116
  stouputils/installer/__init__.py,sha256=Ff_al_z6GSaazLHqfsSxsxmooXcIRmE--ffb1gZt0Q0,484
@@ -128,44 +128,13 @@ stouputils/installer/windows.pyi,sha256=tHogIFhPVDQS0I10liLkAxnpaFFAvmFtEVMpPIae
128
128
  stouputils/io.py,sha256=yQ4jGWoI81cP-ZWxgYwqXmuD6s_IbpkKkZf5jjqqIAE,16841
129
129
  stouputils/io.pyi,sha256=TCBTVEWUkI3dO_jWI9oPMF9SbnT1yLzFChE551JPbSY,9076
130
130
  stouputils/parallel.py,sha256=_o96klxFYgDPyxCeqFp5qNOtJhhXHQYmFIfqbJYnxko,19061
131
- stouputils/parallel.pyi,sha256=cvNMT0FyjOmehaVghurwVKABqvTO3BUbPF8f8ISp8Bw,10855
131
+ stouputils/parallel.pyi,sha256=ug9I-Ni2q9cwwByXERQuxW-UM3rqw3dCiurnJjOWUpI,11576
132
132
  stouputils/print.py,sha256=BGPGu8SfIWhIjFRoUI2VaSCVGFhbBumYq9U2g1K-5uQ,16627
133
- stouputils/print.pyi,sha256=-uYWZ-hlPhkeu8E0gSoQqY0u-4UhkJAtPUioQb3Xujo,6674
133
+ stouputils/print.pyi,sha256=TtP-OuK22uwsP0Wcruy0FxG_zD3fFwHUpxNp34HgCUU,6745
134
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=_ZPqr84G316gkj_cq_LZGuCMhSyGBWunvlxM5Cq9Hvo,10944
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=ug9I-Ni2q9cwwByXERQuxW-UM3rqw3dCiurnJjOWUpI,11576
164
- stouputils/stouputils/print.pyi,sha256=TtP-OuK22uwsP0Wcruy0FxG_zD3fFwHUpxNp34HgCUU,6745
165
- stouputils/stouputils/version_pkg.pyi,sha256=QPvqp1U3QA-9C_CC1dT9Vahv1hXEhstbM7x5uzMZSsQ,755
166
135
  stouputils/version_pkg.py,sha256=Jsp-s03L14DkiZ94vQgrlQmaxApfn9DC8M_nzT1SJLk,7014
167
136
  stouputils/version_pkg.pyi,sha256=QPvqp1U3QA-9C_CC1dT9Vahv1hXEhstbM7x5uzMZSsQ,755
168
- stouputils-1.14.2.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
169
- stouputils-1.14.2.dist-info/entry_points.txt,sha256=tx0z9VOnE-sfkmbFbA93zaBMzV3XSsKEJa_BWIqUzxw,57
170
- stouputils-1.14.2.dist-info/METADATA,sha256=-FSEGFl-6SdbXmpDRu6g9EwzqysGeWmG-FaOxSSUWoQ,13615
171
- stouputils-1.14.2.dist-info/RECORD,,
137
+ stouputils-1.14.3.dist-info/WHEEL,sha256=eycQt0QpYmJMLKpE3X9iDk8R04v2ZF0x82ogq-zP6bQ,79
138
+ stouputils-1.14.3.dist-info/entry_points.txt,sha256=tx0z9VOnE-sfkmbFbA93zaBMzV3XSsKEJa_BWIqUzxw,57
139
+ stouputils-1.14.3.dist-info/METADATA,sha256=ZVcCoefkLLJlZz6C20QotomXv78x7Bdt3D1CVqqkB4Y,13615
140
+ stouputils-1.14.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.21
2
+ Generator: uv 0.9.24
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,15 +0,0 @@
1
- from ._deprecated import *
2
- from .all_doctests import *
3
- from .archive import *
4
- from .backup import *
5
- from .collections import *
6
- from .continuous_delivery import *
7
- from .ctx import *
8
- from .decorators import *
9
- from .image import *
10
- from .io import *
11
- from .parallel import *
12
- from .print import *
13
- from .version_pkg import *
14
-
15
- __version__: str
@@ -1,12 +0,0 @@
1
- from .decorators import LogLevels as LogLevels, deprecated as deprecated
2
- from .io import csv_dump as csv_dump, csv_load as csv_load, json_dump as json_dump, json_load as json_load
3
- from typing import Any
4
-
5
- def super_csv_dump(*args: Any, **kwargs: Any) -> Any:
6
- ''' Deprecated function, use "csv_dump" instead. '''
7
- def super_csv_load(*args: Any, **kwargs: Any) -> Any:
8
- ''' Deprecated function, use "csv_load" instead. '''
9
- def super_json_dump(*args: Any, **kwargs: Any) -> Any:
10
- ''' Deprecated function, use "json_dump" instead. '''
11
- def super_json_load(*args: Any, **kwargs: Any) -> Any:
12
- ''' Deprecated function, use "json_load" instead. '''
@@ -1,46 +0,0 @@
1
- from . import decorators as decorators
2
- from .decorators import measure_time as measure_time
3
- from .io import clean_path as clean_path, relative_path as relative_path
4
- from .print import error as error, info as info, progress as progress, warning as warning
5
- from doctest import TestResults as TestResults
6
- from types import ModuleType
7
-
8
- def launch_tests(root_dir: str, strict: bool = True) -> int:
9
- ''' Main function to launch tests for all modules in the given directory.
10
-
11
- \tArgs:
12
- \t\troot_dir\t\t\t\t(str):\t\t\tRoot directory to search for modules
13
- \t\tstrict\t\t\t\t\t(bool):\t\t\tModify the force_raise_exception variable to True in the decorators module
14
-
15
- \tReturns:
16
- \t\tint: The number of failed tests
17
-
18
- \tExamples:
19
- \t\t>>> launch_tests("unknown_dir")
20
- \t\tTraceback (most recent call last):
21
- \t\t\t...
22
- \t\tValueError: No modules found in \'unknown_dir\'
23
-
24
- \t.. code-block:: python
25
-
26
- \t\t> if launch_tests("/path/to/source") > 0:
27
- \t\t\tsys.exit(1)
28
- \t\t[PROGRESS HH:MM:SS] Importing module \'module1\'\ttook 0.001s
29
- \t\t[PROGRESS HH:MM:SS] Importing module \'module2\'\ttook 0.002s
30
- \t\t[PROGRESS HH:MM:SS] Importing module \'module3\'\ttook 0.003s
31
- \t\t[PROGRESS HH:MM:SS] Importing module \'module4\'\ttook 0.004s
32
- \t\t[INFO HH:MM:SS] Testing 4 modules...
33
- \t\t[PROGRESS HH:MM:SS] Testing module \'module1\'\ttook 0.005s
34
- \t\t[PROGRESS HH:MM:SS] Testing module \'module2\'\ttook 0.006s
35
- \t\t[PROGRESS HH:MM:SS] Testing module \'module3\'\ttook 0.007s
36
- \t\t[PROGRESS HH:MM:SS] Testing module \'module4\'\ttook 0.008s
37
- \t'''
38
- def test_module_with_progress(module: ModuleType, separator: str) -> TestResults:
39
- """ Test a module with testmod and measure the time taken with progress printing.
40
-
41
- \tArgs:
42
- \t\tmodule\t\t(ModuleType):\tModule to test
43
- \t\tseparator\t(str):\t\t\tSeparator string for alignment in output
44
- \tReturns:
45
- \t\tTestResults: The results of the tests
46
- \t"""
@@ -1,2 +0,0 @@
1
- from .automatic_docs import *
2
- from .upscaler import *
@@ -1,106 +0,0 @@
1
- from ..continuous_delivery import version_to_float as version_to_float
2
- from ..decorators import LogLevels as LogLevels, handle_error as handle_error, simple_cache as simple_cache
3
- from ..io import clean_path as clean_path, json_dump as json_dump, super_open as super_open
4
- from ..print import info as info
5
- from collections.abc import Callable as Callable
6
-
7
- REQUIREMENTS: list[str]
8
-
9
- def check_dependencies(html_theme: str) -> None:
10
- ''' Check for each requirement if it is installed.
11
-
12
- \tArgs:
13
- \t\thtml_theme (str): HTML theme to use for the documentation, to check if it is installed (e.g. "breeze", "pydata_sphinx_theme", "furo", etc.)
14
- \t'''
15
- def get_sphinx_conf_content(project: str, project_dir: str, author: str, current_version: str, copyright: str, html_logo: str, html_favicon: str, html_theme: str = 'breeze', github_user: str = '', github_repo: str = '', version_list: list[str] | None = None, skip_undocumented: bool = True) -> str:
16
- """ Get the content of the Sphinx configuration file.
17
-
18
- \tArgs:
19
- \t\tproject (str): Name of the project
20
- \t\tproject_dir (str): Path to the project directory
21
- \t\tauthor (str): Author of the project
22
- \t\tcurrent_version (str): Current version
23
- \t\tcopyright (str): Copyright information
24
- \t\thtml_logo (str): URL to the logo
25
- \t\thtml_favicon (str): URL to the favicon
26
- \t\tgithub_user (str): GitHub username
27
- \t\tgithub_repo (str): GitHub repository name
28
- \t\tversion_list (list[str] | None): List of versions. Defaults to None
29
- \t\tskip_undocumented (bool): Whether to skip undocumented members. Defaults to True
30
-
31
- \tReturns:
32
- \t\tstr: Content of the Sphinx configuration file
33
- \t"""
34
- def get_versions_from_github(github_user: str, github_repo: str, recent_minor_versions: int = 2) -> list[str]:
35
- """ Get list of versions from GitHub gh-pages branch.
36
- \tOnly shows detailed versions for the last N minor versions, and keeps only
37
- \tthe latest patch version for older minor versions.
38
-
39
- \tArgs:
40
- \t\tgithub_user (str): GitHub username
41
- \t\tgithub_repo (str): GitHub repository name
42
- \t\trecent_minor_versions (int): Number of recent minor versions to show all patches for (-1 for all).
43
-
44
- \tReturns:
45
- \t\tlist[str]: List of versions, with 'latest' as first element
46
- \t"""
47
- def markdown_to_rst(markdown_content: str) -> str:
48
- """ Convert markdown content to RST format.
49
-
50
- \tArgs:
51
- \t\tmarkdown_content (str): Markdown content
52
-
53
- \tReturns:
54
- \t\tstr: RST content
55
- \t"""
56
- def generate_index_rst(readme_path: str, index_path: str, project: str, github_user: str, github_repo: str, get_versions_function: Callable[[str, str, int], list[str]] = ..., recent_minor_versions: int = 2) -> None:
57
- """ Generate index.rst from README.md content.
58
-
59
- \tArgs:
60
- \t\treadme_path (str): Path to the README.md file
61
- \t\tindex_path (str): Path where index.rst should be created
62
- \t\tproject (str): Name of the project
63
- \t\tgithub_user (str): GitHub username
64
- \t\tgithub_repo (str): GitHub repository name
65
- \t\tget_versions_function (Callable[[str, str, int], list[str]]): Function to get versions from GitHub
66
- \t\trecent_minor_versions (int): Number of recent minor versions to show all patches for. Defaults to 2
67
- \t"""
68
- def generate_documentation(source_dir: str, modules_dir: str, project_dir: str, build_dir: str) -> None:
69
- """ Generate documentation using Sphinx.
70
-
71
- \tArgs:
72
- \t\tsource_dir (str): Source directory
73
- \t\tmodules_dir (str): Modules directory
74
- \t\tproject_dir (str): Project directory
75
- \t\tbuild_dir (str): Build directory
76
- \t"""
77
- def generate_redirect_html(filepath: str) -> None:
78
- """ Generate HTML content for redirect page.
79
-
80
- \tArgs:
81
- \t\tfilepath (str): Path to the file where the HTML content should be written
82
- \t"""
83
- def update_documentation(root_path: str, project: str, project_dir: str = '', author: str = 'Author', copyright: str = '2025, Author', html_logo: str = '', html_favicon: str = '', html_theme: str = 'breeze', github_user: str = '', github_repo: str = '', version: str | None = None, skip_undocumented: bool = True, recent_minor_versions: int = 2, get_versions_function: Callable[[str, str, int], list[str]] = ..., generate_index_function: Callable[..., None] = ..., generate_docs_function: Callable[..., None] = ..., generate_redirect_function: Callable[[str], None] = ..., get_conf_content_function: Callable[..., str] = ...) -> None:
84
- ''' Update the Sphinx documentation.
85
-
86
- \tArgs:
87
- \t\troot_path (str): Root path of the project
88
- \t\tproject (str): Name of the project
89
- \t\tproject_dir (str): Path to the project directory (to be used with generate_docs_function)
90
- \t\tauthor (str): Author of the project
91
- \t\tcopyright (str): Copyright information
92
- \t\thtml_logo (str): URL to the logo
93
- \t\thtml_favicon (str): URL to the favicon
94
- \t\thtml_theme (str): Theme to use for the documentation. Defaults to "breeze"
95
- \t\tgithub_user (str): GitHub username
96
- \t\tgithub_repo (str): GitHub repository name
97
- \t\tversion (str | None): Version to build documentation for (e.g. "1.0.0", defaults to "latest")
98
- \t\tskip_undocumented (bool): Whether to skip undocumented members. Defaults to True
99
- \t\trecent_minor_versions (int): Number of recent minor versions to show all patches for. Defaults to 2
100
-
101
- \t\tget_versions_function (Callable[[str, str, int], list[str]]): Function to get versions from GitHub
102
- \t\tgenerate_index_function (Callable[..., None]): Function to generate index.rst
103
- \t\tgenerate_docs_function (Callable[..., None]): Function to generate documentation
104
- \t\tgenerate_redirect_function (Callable[[str], None]): Function to create redirect file
105
- \t\tget_conf_content_function (Callable[..., str]): Function to get Sphinx conf.py content
106
- \t'''
@@ -1,3 +0,0 @@
1
- from .config import *
2
- from .image import *
3
- from .video import *
@@ -1,18 +0,0 @@
1
- WAIFU2X_NCNN_VULKAN_RELEASES: dict[str, str]
2
- FFMPEG_RELEASES: dict[str, str]
3
- YOUTUBE_BITRATE_RECOMMENDATIONS: dict[str, dict[str, dict[int, int]]]
4
-
5
- class Config:
6
- """ Configuration class for the upscaler. """
7
- JPG_QUALITY: int
8
- VIDEO_FINAL_BITRATE: int
9
- FFMPEG_EXECUTABLE: str
10
- FFMPEG_ARGS: tuple[str, ...]
11
- FFPROBE_EXECUTABLE: str
12
- FFMPEG_CHECK_HELP_TEXT: str
13
- UPSCALER_EXECUTABLE: str
14
- UPSCALER_ARGS: tuple[str, ...]
15
- UPSCALER_EXECUTABLE_HELP_TEXT: str
16
- SLIGHTLY_FASTER_MODE: bool
17
- upscaler_executable_checked: bool
18
- ffmpeg_executable_checked: bool
@@ -1,109 +0,0 @@
1
- from ...installer import check_executable as check_executable
2
- from ...io import clean_path as clean_path
3
- from ...parallel import multithreading as multithreading
4
- from ...print import colored_for_loop as colored_for_loop, debug as debug, info as info
5
- from .config import Config as Config, WAIFU2X_NCNN_VULKAN_RELEASES as WAIFU2X_NCNN_VULKAN_RELEASES
6
- from tempfile import TemporaryDirectory
7
-
8
- def convert_frame(frame_path: str, delete_png: bool = True) -> None:
9
- ''' Convert a PNG frame to JPG format to take less space.
10
-
11
- \tArgs:
12
- \t\tframe_path (str): Path to the PNG frame to convert.
13
- \t\tdelete_png (bool): Whether to delete the original PNG file after conversion.
14
-
15
- \tReturns:
16
- \t\tNone: This function doesn\'t return anything.
17
-
18
- \tExample:
19
- \t\t.. code-block:: python
20
-
21
- \t\t\t> convert_frame("input.png", delete_png=True)
22
- \t\t\t> # input.png will be converted to input.jpg and the original file will be deleted
23
-
24
- \t\t\t> convert_frame("input.png", delete_png=False)
25
- \t\t\t> # input.png will be converted to input.jpg and the original file will be kept
26
- \t'''
27
- def get_all_files(folder: str, suffix: str | tuple[str, ...] = '') -> list[str]:
28
- ''' Get all files paths in a folder, with a specific suffix if provided.
29
-
30
- \tArgs:
31
- \t\tfolder (str): Path to the folder containing the files.
32
- \t\tsuffix (str | tuple[str, ...]): Suffix of the files to get (e.g. ".png", ".jpg", etc.).
33
-
34
- \tReturns:
35
- \t\tlist[str]: List of all files paths in the folder.
36
-
37
- \tExample:
38
- \t\t>>> files: list[str] = get_all_files("some_folder", ".png")
39
- \t\t>>> len(files)
40
- \t\t0
41
- \t'''
42
- def create_temp_dir_for_not_upscaled(input_path: str, output_path: str) -> TemporaryDirectory[str] | None:
43
- """ Creates a temporary directory containing only images that haven't been upscaled yet.
44
-
45
- Args:
46
- input_path (str): Path to the folder containing input images.
47
- output_path (str): Path to the folder where upscaled images are saved.
48
-
49
- Returns:
50
- TemporaryDirectory[str] | None: A temporary directory object if there are images to process,
51
- None if all images are already upscaled.
52
- """
53
- def check_upscaler_executable() -> None: ...
54
- def upscale(input_path: str, output_path: str, upscale_ratio: int) -> None:
55
- ''' Upscale an input image (or a directory of images) with the upscaler executable.
56
-
57
- \tArgs:
58
- \t\tinput_path (str): Path to the image to upscale (or a directory).
59
- \t\toutput_path (str): Path to the output image (or a directory).
60
- \t\tupscale_ratio (int): Upscaling ratio.
61
-
62
- \tExample:
63
- \t\t.. code-block:: python
64
-
65
- \t\t\t> upscale("folder", "folder", 2)
66
- \t\t\tTraceback (most recent call last):
67
- \t\t\t\t...
68
- \t\t\tAssertionError: Input and output paths cannot be the same, got \'folder\'
69
-
70
- \t\t\t> upscale("stouputils", "stouputils/output.jpg", 2)
71
- \t\t\tTraceback (most recent call last):
72
- \t\t\t\t...
73
- \t\t\tAssertionError: If input is a directory, output must be a directory too, got \'stouputils/output.jpg\'
74
-
75
-
76
- \t\t\t> upscale("input.jpg", "output.jpg", 2)
77
- \t\t\t> # The input.jpg will be upscaled to output.jpg with a ratio of 2
78
-
79
- \t\t\t> upscale("input_folder", "output_folder", 2)
80
- \t\t\t> # The input_folder will be upscaled to output_folder with a ratio of 2
81
- \t'''
82
- def upscale_images(images: list[str], output_folder: str, upscale_ratio: int, desc: str = 'Upscaling images') -> None:
83
- """ Upscale multiple images from a list.
84
-
85
- \tArgs:
86
- \t\timages (list[str]): List of paths to the images to upscale.
87
- \t\toutput_folder (str): Path to the output folder where the upscaled images will be saved.
88
- \t\tupscale_ratio (int): Upscaling ratio.
89
- \t\tdesc (str): Description of the function execution displayed in the progress bar.
90
- \t\t\tNo progress bar will be displayed if desc is empty.
91
-
92
- \tReturns:
93
- \t\tNone: This function doesn't return anything.
94
- \t"""
95
- def upscale_folder(input_folder: str, output_folder: str, upscale_ratio: int, slightly_faster_mode: bool = True, desc: str = 'Upscaling folder') -> None:
96
- """ Upscale all images in a folder.
97
-
98
- \tArgs:
99
- \t\tinput_folder (str): Path to the input folder containing the images to upscale.
100
- \t\toutput_folder (str): Path to the output folder where the upscaled images will be saved.
101
- \t\tupscale_ratio (int): Upscaling ratio.
102
- \t\tslightly_faster_mode (bool): Whether to use the slightly faster mode (no progress bar),
103
- \t\t\tone call to the upscaler executable.
104
- \t\tdesc (str): Description of the function execution displayed in the progress bar.
105
- \t\t\tNo progress bar will be displayed if desc is empty.
106
-
107
- \tReturns:
108
- \t\tNone: This function doesn't return anything.
109
- \t"""
@@ -1,60 +0,0 @@
1
- from ...installer import check_executable as check_executable
2
- from ...io import clean_path as clean_path
3
- from ...parallel import multithreading as multithreading
4
- from ...print import colored_for_loop as colored_for_loop, debug as debug, error as error, info as info, warning as warning
5
- from .config import Config as Config, FFMPEG_RELEASES as FFMPEG_RELEASES, YOUTUBE_BITRATE_RECOMMENDATIONS as YOUTUBE_BITRATE_RECOMMENDATIONS
6
- from .image import convert_frame as convert_frame, get_all_files as get_all_files, upscale_folder as upscale_folder
7
- from typing import Literal
8
-
9
- def get_recommended_bitrate(resolution: tuple[int, int], frame_rate: int = 60, upload_type: Literal['SDR', 'HDR'] = 'SDR') -> int:
10
- ''' Get the recommended bitrate (in kbps) for the output video based on the video resolution.
11
-
12
- \tArgs:
13
- \t\tresolution (tuple[int, int]): Video resolution (width, height).
14
- \t\tframe_rate (int): Frame rate of the video, default is 60.
15
- \t\tupload_type (Literal["SDR","HDR"]): Upload type from which the recommendation is made, default is "SDR".
16
-
17
- \tReturns:
18
- \t\tint: The recommended bitrate for the output video (in kbps)
19
-
20
- \tSource: https://support.google.com/youtube/answer/1722171?hl=en#zippy=%2Cbitrate
21
-
22
- \tExamples:
23
- \t\t>>> # Valid examples
24
- \t\t>>> get_recommended_bitrate((3840, 2160), 60, "SDR")
25
- \t\t68000
26
- \t\t>>> get_recommended_bitrate((1920, 1080), 60, "HDR")
27
- \t\t15000
28
- \t\t>>> get_recommended_bitrate((1920, 1080), 60, "SDR")
29
- \t\t12000
30
- \t\t>>> get_recommended_bitrate((1920, 1080), 30, "SDR")
31
- \t\t8000
32
-
33
- \t\t>>> # Invalid examples
34
- \t\t>>> get_recommended_bitrate((1920, 1080), 60, "Ratio")
35
- \t\tTraceback (most recent call last):
36
- \t\t\t...
37
- \t\tAssertionError: Invalid upload type: \'Ratio\'
38
- \t\t>>> get_recommended_bitrate("1920x1080", 60, "SDR")
39
- \t\tTraceback (most recent call last):
40
- \t\t\t...
41
- \t\tAssertionError: Invalid resolution: 1920x1080, must be a tuple of two integers
42
- \t\t>>> get_recommended_bitrate((1920, 1080), -10, "SDR")
43
- \t\tTraceback (most recent call last):
44
- \t\t\t...
45
- \t\tAssertionError: Invalid frame rate: -10, must be a positive integer
46
- \t'''
47
- def check_ffmpeg_executable() -> None: ...
48
- def upscale_video(video_file: str, input_folder: str, progress_folder: str, output_folder: str) -> None:
49
- """ Handles a video file. """
50
- def video_upscaler_cli(input_folder: str, progress_folder: str, output_folder: str) -> None:
51
- """ Upscales videos from an input folder and saves them to an output folder.
52
-
53
- \tUses intermediate folders for extracted and upscaled frames within the progress folder.
54
- \t**Handles resuming partially processed videos.**
55
-
56
- \tArgs:
57
- \t\tinput_folder (str): Path to the folder containing input videos.
58
- \t\tprogress_folder (str): Path to the folder for storing intermediate files (frames).
59
- \t\toutput_folder (str): Path to the folder where upscaled videos will be saved.
60
- \t"""