stouputils 1.2.21__tar.gz → 1.2.22__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.
Files changed (25) hide show
  1. {stouputils-1.2.21 → stouputils-1.2.22}/PKG-INFO +1 -1
  2. {stouputils-1.2.21 → stouputils-1.2.22}/pyproject.toml +1 -1
  3. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/print.py +16 -5
  4. {stouputils-1.2.21 → stouputils-1.2.22}/.gitignore +0 -0
  5. {stouputils-1.2.21 → stouputils-1.2.22}/LICENSE +0 -0
  6. {stouputils-1.2.21 → stouputils-1.2.22}/README.md +0 -0
  7. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/__init__.py +0 -0
  8. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/all_doctests.py +0 -0
  9. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/applications/__init__.py +0 -0
  10. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/applications/automatic_docs.py +0 -0
  11. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/archive.py +0 -0
  12. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/backup.py +0 -0
  13. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/collections.py +0 -0
  14. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/continuous_delivery/__init__.py +0 -0
  15. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/continuous_delivery/cd_utils.py +0 -0
  16. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/continuous_delivery/github.py +0 -0
  17. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/continuous_delivery/pypi.py +0 -0
  18. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/continuous_delivery/pyproject.py +0 -0
  19. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/ctx.py +0 -0
  20. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/decorators.py +0 -0
  21. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/dont_look/zip_file_override.py +0 -0
  22. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/image.py +0 -0
  23. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/io.py +0 -0
  24. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/parallel.py +0 -0
  25. {stouputils-1.2.21 → stouputils-1.2.22}/stouputils/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stouputils
3
- Version: 1.2.21
3
+ Version: 1.2.22
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.21"
8
+ version = "1.2.22"
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"
@@ -252,6 +252,18 @@ class TeeMultiOutput(object):
252
252
  self.ignore_lineup: bool = ignore_lineup
253
253
  """ Whether to ignore lines containing LINE_UP escape sequence in non-terminal outputs """
254
254
 
255
+ @property
256
+ def encoding(self) -> str:
257
+ """ Get the encoding of the first file, or "utf-8" as fallback.
258
+
259
+ Returns:
260
+ str: The encoding, ex: "utf-8", "ascii", "latin1", etc.
261
+ """
262
+ try:
263
+ return self.files[0].encoding # type: ignore
264
+ except (IndexError, AttributeError):
265
+ return "utf-8"
266
+
255
267
  def write(self, obj: str) -> None:
256
268
  """ Write the object to all files while stripping colors if needed.
257
269
 
@@ -288,11 +300,10 @@ class TeeMultiOutput(object):
288
300
  def flush(self) -> None:
289
301
  """ Flush all files. """
290
302
  for f in self.files:
291
- if hasattr(f, 'flush'):
292
- try:
293
- f.flush()
294
- except Exception:
295
- pass
303
+ try:
304
+ f.flush()
305
+ except Exception:
306
+ pass
296
307
 
297
308
  def fileno(self) -> int:
298
309
  """ Return the file descriptor of the first file. """
File without changes
File without changes
File without changes