stouputils 1.2.37__tar.gz → 1.2.38__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stouputils-1.2.37 → stouputils-1.2.38}/PKG-INFO +1 -1
- {stouputils-1.2.37 → stouputils-1.2.38}/pyproject.toml +1 -1
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/ctx.py +11 -4
- {stouputils-1.2.37 → stouputils-1.2.38}/.gitignore +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/LICENSE +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/README.md +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/__init__.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/all_doctests.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/__init__.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/automatic_docs.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/upscaler/__init__.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/upscaler/config.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/upscaler/image.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/applications/upscaler/video.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/archive.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/backup.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/collections.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/continuous_delivery/__init__.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/continuous_delivery/cd_utils.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/continuous_delivery/github.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/continuous_delivery/pypi.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/continuous_delivery/pyproject.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/decorators.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/dont_look/zip_file_override.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/image.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/__init__.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/common.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/downloader.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/linux.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/main.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/installer/windows.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/io.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/parallel.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/print.py +0 -0
- {stouputils-1.2.37 → stouputils-1.2.38}/stouputils/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stouputils
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.38
|
|
4
4
|
Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Stoupy51/stouputils
|
|
6
6
|
Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "stouputils"
|
|
8
|
-
version = "1.2.
|
|
8
|
+
version = "1.2.38"
|
|
9
9
|
description = "Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -9,6 +9,7 @@ This module provides context managers for temporarily silencing output.
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
# Imports
|
|
12
|
+
from __future__ import annotations
|
|
12
13
|
import os
|
|
13
14
|
import sys
|
|
14
15
|
import time
|
|
@@ -37,7 +38,7 @@ class Muffle:
|
|
|
37
38
|
self.original_stderr: TextIO = sys.stderr
|
|
38
39
|
""" Attribute remembering original stderr """
|
|
39
40
|
|
|
40
|
-
def __enter__(self) ->
|
|
41
|
+
def __enter__(self) -> Muffle:
|
|
41
42
|
""" Enter context manager which redirects stdout and stderr to devnull """
|
|
42
43
|
# Redirect stdout to devnull
|
|
43
44
|
sys.stdout = open(os.devnull, "w", encoding="utf-8")
|
|
@@ -46,6 +47,9 @@ class Muffle:
|
|
|
46
47
|
if self.mute_stderr:
|
|
47
48
|
sys.stderr = open(os.devnull, "w", encoding="utf-8")
|
|
48
49
|
|
|
50
|
+
# Return self
|
|
51
|
+
return self
|
|
52
|
+
|
|
49
53
|
def __exit__(self, exc_type: type[BaseException]|None, exc_val: BaseException|None, exc_tb: Any|None) -> None:
|
|
50
54
|
""" Exit context manager which restores original stdout and stderr """
|
|
51
55
|
# Restore original stdout
|
|
@@ -110,15 +114,17 @@ class LogToFile:
|
|
|
110
114
|
self.original_stderr: TextIO = sys.stderr
|
|
111
115
|
""" Original stderr before redirection """
|
|
112
116
|
|
|
113
|
-
def __enter__(self) ->
|
|
117
|
+
def __enter__(self) -> LogToFile:
|
|
114
118
|
""" Enter context manager which opens the log file and redirects stdout/stderr """
|
|
115
119
|
# Redirect stdout and stderr if requested
|
|
116
120
|
if self.tee_stdout:
|
|
117
121
|
sys.stdout = TeeMultiOutput(self.original_stdout, self.file, ignore_lineup=self.ignore_lineup)
|
|
118
|
-
|
|
119
122
|
if self.tee_stderr:
|
|
120
123
|
sys.stderr = TeeMultiOutput(self.original_stderr, self.file, ignore_lineup=self.ignore_lineup)
|
|
121
124
|
|
|
125
|
+
# Return self
|
|
126
|
+
return self
|
|
127
|
+
|
|
122
128
|
def __exit__(self, exc_type: type[BaseException]|None, exc_val: BaseException|None, exc_tb: Any|None) -> None:
|
|
123
129
|
""" Exit context manager which closes the log file and restores stdout/stderr """
|
|
124
130
|
# Restore original stdout and stderr
|
|
@@ -204,9 +210,10 @@ class MeasureTime:
|
|
|
204
210
|
self.start_ns: int = 0
|
|
205
211
|
""" Start time in nanoseconds """
|
|
206
212
|
|
|
207
|
-
def __enter__(self) ->
|
|
213
|
+
def __enter__(self) -> MeasureTime:
|
|
208
214
|
""" Enter context manager, record start time """
|
|
209
215
|
self.start_ns = self.ns()
|
|
216
|
+
return self
|
|
210
217
|
|
|
211
218
|
def __exit__(self, exc_type: type[BaseException]|None, exc_val: BaseException|None, exc_tb: Any|None) -> None:
|
|
212
219
|
""" Exit context manager, calculate duration and print """
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|