errortools 2.3.0__tar.gz → 2.5.0__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 (77) hide show
  1. {errortools-2.3.0 → errortools-2.5.0}/PKG-INFO +38 -8
  2. errortools-2.3.0/errortools.egg-info/PKG-INFO → errortools-2.5.0/README.md +329 -335
  3. {errortools-2.3.0 → errortools-2.5.0}/_errortools/classes/abc.py +6 -1
  4. {errortools-2.3.0 → errortools-2.5.0}/_errortools/const.py +6 -4
  5. {errortools-2.3.0 → errortools-2.5.0}/_errortools/decorator/deprecated.py +1 -1
  6. errortools-2.5.0/_errortools/errno.py +86 -0
  7. errortools-2.5.0/_errortools/future.py +165 -0
  8. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/level.py +4 -4
  9. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/sink.py +2 -2
  10. errortools-2.5.0/_errortools/partial.py +199 -0
  11. {errortools-2.3.0 → errortools-2.5.0}/_errortools/version.py +2 -2
  12. errortools-2.5.0/errortools/future.py +5 -0
  13. errortools-2.5.0/errortools/logging.py +46 -0
  14. errortools-2.5.0/errortools/partial.py +5 -0
  15. errortools-2.3.0/README.md → errortools-2.5.0/errortools.egg-info/PKG-INFO +365 -300
  16. {errortools-2.3.0 → errortools-2.5.0}/errortools.egg-info/SOURCES.txt +4 -0
  17. errortools-2.5.0/setup.py +79 -0
  18. {errortools-2.3.0 → errortools-2.5.0}/tests/__init__.py +1 -1
  19. {errortools-2.3.0 → errortools-2.5.0}/tests/test_decorator.py +3 -3
  20. {errortools-2.3.0 → errortools-2.5.0}/tests/test_errno.py +5 -2
  21. errortools-2.5.0/tests/test_future.py +302 -0
  22. {errortools-2.3.0 → errortools-2.5.0}/tests/test_logging.py +7 -5
  23. errortools-2.3.0/_errortools/errno.py +0 -78
  24. errortools-2.3.0/_errortools/future.py +0 -23
  25. errortools-2.3.0/_errortools/partial.py +0 -110
  26. errortools-2.3.0/setup.py +0 -35
  27. {errortools-2.3.0 → errortools-2.5.0}/AUTHORS.txt +0 -0
  28. {errortools-2.3.0 → errortools-2.5.0}/LICENSE.txt +0 -0
  29. {errortools-2.3.0 → errortools-2.5.0}/_errortools/__init__.py +0 -0
  30. {errortools-2.3.0 → errortools-2.5.0}/_errortools/_cli.py +0 -0
  31. {errortools-2.3.0 → errortools-2.5.0}/_errortools/classes/__init__.py +0 -0
  32. {errortools-2.3.0 → errortools-2.5.0}/_errortools/classes/errorcodes.py +0 -0
  33. {errortools-2.3.0 → errortools-2.5.0}/_errortools/classes/group.py +0 -0
  34. {errortools-2.3.0 → errortools-2.5.0}/_errortools/classes/warn.py +0 -0
  35. {errortools-2.3.0 → errortools-2.5.0}/_errortools/cli.py +0 -0
  36. {errortools-2.3.0 → errortools-2.5.0}/_errortools/decorator/__init__.py +0 -0
  37. {errortools-2.3.0 → errortools-2.5.0}/_errortools/decorator/cache.py +0 -0
  38. {errortools-2.3.0 → errortools-2.5.0}/_errortools/descriptor/__init__.py +0 -0
  39. {errortools-2.3.0 → errortools-2.5.0}/_errortools/descriptor/errormsg.py +0 -0
  40. {errortools-2.3.0 → errortools-2.5.0}/_errortools/descriptor/nonblankmsg.py +0 -0
  41. {errortools-2.3.0 → errortools-2.5.0}/_errortools/ignore.py +0 -0
  42. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/__init__.py +0 -0
  43. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/base.py +0 -0
  44. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/logger.py +0 -0
  45. {errortools-2.3.0 → errortools-2.5.0}/_errortools/logging/record.py +0 -0
  46. {errortools-2.3.0 → errortools-2.5.0}/_errortools/metadata.py +0 -0
  47. {errortools-2.3.0 → errortools-2.5.0}/_errortools/methods/__init__.py +0 -0
  48. {errortools-2.3.0 → errortools-2.5.0}/_errortools/methods/errorattr.py +0 -0
  49. {errortools-2.3.0 → errortools-2.5.0}/_errortools/methods/errordelattr.py +0 -0
  50. {errortools-2.3.0 → errortools-2.5.0}/_errortools/methods/errorhasattr.py +0 -0
  51. {errortools-2.3.0 → errortools-2.5.0}/_errortools/methods/errorsetattr.py +0 -0
  52. {errortools-2.3.0 → errortools-2.5.0}/_errortools/py.typed +0 -0
  53. {errortools-2.3.0 → errortools-2.5.0}/_errortools/raises.py +0 -0
  54. {errortools-2.3.0 → errortools-2.5.0}/_errortools/typing.py +0 -0
  55. {errortools-2.3.0 → errortools-2.5.0}/_errortools/wrappers/__init__.py +0 -0
  56. {errortools-2.3.0 → errortools-2.5.0}/_errortools/wrappers/cache.py +0 -0
  57. {errortools-2.3.0 → errortools-2.5.0}/_errortools/wrappers/ignore.py +0 -0
  58. {errortools-2.3.0 → errortools-2.5.0}/errortools/__init__.py +0 -0
  59. {errortools-2.3.0 → errortools-2.5.0}/errortools/__main__.py +0 -0
  60. {errortools-2.3.0 → errortools-2.5.0}/errortools.egg-info/dependency_links.txt +0 -0
  61. {errortools-2.3.0 → errortools-2.5.0}/errortools.egg-info/entry_points.txt +0 -0
  62. {errortools-2.3.0 → errortools-2.5.0}/errortools.egg-info/requires.txt +0 -0
  63. {errortools-2.3.0 → errortools-2.5.0}/errortools.egg-info/top_level.txt +0 -0
  64. {errortools-2.3.0 → errortools-2.5.0}/setup.cfg +0 -0
  65. {errortools-2.3.0 → errortools-2.5.0}/tests/conftest.py +0 -0
  66. {errortools-2.3.0 → errortools-2.5.0}/tests/run_tests.py +0 -0
  67. {errortools-2.3.0 → errortools-2.5.0}/tests/test_abc.py +0 -0
  68. {errortools-2.3.0 → errortools-2.5.0}/tests/test_const.py +0 -0
  69. {errortools-2.3.0 → errortools-2.5.0}/tests/test_descriptor.py +0 -0
  70. {errortools-2.3.0 → errortools-2.5.0}/tests/test_errorcodes.py +0 -0
  71. {errortools-2.3.0 → errortools-2.5.0}/tests/test_groups.py +0 -0
  72. {errortools-2.3.0 → errortools-2.5.0}/tests/test_ignore.py +0 -0
  73. {errortools-2.3.0 → errortools-2.5.0}/tests/test_mixins.py +0 -0
  74. {errortools-2.3.0 → errortools-2.5.0}/tests/test_partials.py +0 -0
  75. {errortools-2.3.0 → errortools-2.5.0}/tests/test_raises.py +0 -0
  76. {errortools-2.3.0 → errortools-2.5.0}/tests/test_typing.py +0 -0
  77. {errortools-2.3.0 → errortools-2.5.0}/tests/test_warnings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: errortools
3
- Version: 2.3.0
3
+ Version: 2.5.0
4
4
  Summary: errortools - a toolset for working with Python exceptions and warnings and logging.
5
5
  Home-page: https://github.com/more-abc/errortools
6
6
  Author: Evan Yang
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
16
17
  Classifier: Operating System :: OS Independent
17
18
  Classifier: Typing :: Typed
18
19
  Requires-Python: >=3.10
@@ -36,9 +37,18 @@ Dynamic: summary
36
37
  # errortools
37
38
  A lightweight Python exception handling utility library.
38
39
 
40
+ [![Code Style: Google](https://img.shields.io/badge/style-google-3666d6.svg)](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings)
41
+ [![PyPI Version](https://img.shields.io/pypi/v/errortools)](https://pypi.org/project/errortools/)
42
+ [![Python Versions](https://img.shields.io/pypi/pyversions/errortools)](https://pypi.org/project/errortools/)
43
+ ![This week commits](https://img.shields.io/github/commit-activity/w/more-abc/errortools)
44
+ ![This month commits](https://img.shields.io/github/commit-activity/m/more-abc/errortools)
45
+ ![Past year commits](https://img.shields.io/github/commit-activity/y/more-abc/errortools)
46
+ ![Total commits badge](https://img.shields.io/github/commit-activity/t/more-abc/errortools)
47
+
39
48
  ## Features
40
49
  - **Raise Exceptions**: `raises()`, `raises_all()`, `reraise()` — batch raising and exception conversion
41
50
  - **Catch & Suppress**: `ignore()`, `ignore_subclass()`, `ignore_warns()`, `fast_ignore()`, `super_fast_ignore()`, `timeout()`, `retry()` — graceful suppression of exceptions and warnings, with automatic retry
51
+ - **Future Utilities**: `super_fast_catch()`, `super_fast_reraise()`, `ExceptionCollector` — lightweight exception handling for high-performance scenarios
42
52
  - **Exception Caching**: `error_cache` — cache exceptions raised by functions (similar to `lru_cache`)
43
53
  - **Custom Exceptions**: `PureBaseException`, `ContextException`, `BaseErrorCodes`, `BaseWarning` — structured exception classes with error codes, trace IDs, and context
44
54
  - **Attribute Error Mixin**: Customize error behavior for attribute access, assignment, and deletion
@@ -62,7 +72,7 @@ from errortools import (
62
72
  error_cache,
63
73
  PureBaseException, ContextException, BaseErrorCodes, BaseWarning,
64
74
  )
65
- from errortools.future import super_fast_ignore
75
+ from errortools.future import super_fast_ignore, super_fast_catch, super_fast_reraise, ExceptionCollector
66
76
 
67
77
  # ── 1. ignore ── context manager with full metadata ──────────────────────────
68
78
  with ignore(KeyError) as err:
@@ -154,7 +164,27 @@ raises_all(
154
164
  exc = assert_raises(int, [ValueError], "not-a-number")
155
165
  print(exc) # invalid literal for int() with base 10: 'not-a-number'
156
166
 
157
- # ── 10. error_cache ── cache exceptions by call arguments ─────────────────────
167
+ # ── 10. super_fast_catch ── lightweight exception capture ──────────────────────
168
+ with super_fast_catch(ValueError) as ctx:
169
+ raise ValueError("oops")
170
+
171
+ assert ctx.exception is not None
172
+ print(ctx.exception) # ValueError('oops')
173
+
174
+ # ── 11. super_fast_reraise ── lightweight exception type conversion ────────────
175
+ with super_fast_reraise(KeyError, ValueError):
176
+ raise KeyError("missing") # → ValueError: 'missing'
177
+
178
+ # ── 12. ExceptionCollector ── batch collect exceptions ───────────────────────────
179
+ collector = ExceptionCollector()
180
+ collector.catch(int, "bad1")
181
+ collector.catch(int, "bad2")
182
+
183
+ if collector.has_errors:
184
+ print(f"Collected {collector.count} errors")
185
+ collector.raise_all("batch operation failed") # → ExceptionGroup (2 sub-exceptions)
186
+
187
+ # ── 13. error_cache ── cache exceptions by call arguments ─────────────────────
158
188
  @error_cache(maxsize=64)
159
189
  def load(user_id: int) -> dict:
160
190
  if user_id < 0:
@@ -167,7 +197,7 @@ with ignore(ValueError):
167
197
  print(load.cache_info()) # CacheInfo(hits=0, misses=1, maxsize=64, currsize=1)
168
198
  load.clear_cache()
169
199
 
170
- # ── 11. Custom exceptions — three layers ──────────────────────────────────────
200
+ # ── 14. Custom exceptions — three layers ──────────────────────────────────────
171
201
 
172
202
  # Layer 1: PureBaseException — code + detail only
173
203
  class AppError(PureBaseException):
@@ -203,7 +233,7 @@ raise BaseErrorCodes.runtime_failure("crash") # RuntimeFailure [
203
233
  raise BaseErrorCodes.timeout_failure() # TimeoutFailure [4002]
204
234
  raise BaseErrorCodes.configuration_error("missing key") # ConfigurationError [5001]
205
235
 
206
- # ── 12. BaseWarning ── structured warnings with factory methods ───────────────
236
+ # ── 15. BaseWarning ── structured warnings with factory methods ───────────────
207
237
  class ExperimentalWarning(BaseWarning):
208
238
  default_detail = "This feature is experimental."
209
239
 
@@ -234,9 +264,9 @@ logger.success("All systems operational")
234
264
  Output (colourised in a terminal):
235
265
 
236
266
  ```
237
- 2026-01-01 12:00:00.123 | INFO | app:main:42 - Server started on port 8080
238
- 2026-01-01 12:00:00.124 | WARNING | app:main:43 - Disk at 92.5%
239
- 2026-01-01 12:00:00.125 | SUCCESS | app:main:44 - All systems operational
267
+ 2026-04-30 08:34:21.850 | INFO | <string>:<module>:3 - Server started on port 8080
268
+ 2026-04-30 08:34:21.851 | WARNING | <string>:<module>:4 - Disk at 92.5%
269
+ 2026-04-30 08:34:21.851 | SUCCESS | <string>:<module>:5 - All systems operational
240
270
  ```
241
271
 
242
272
  ### Log levels