zstdlib 0.10.2__tar.gz → 0.10.4__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.
- {zstdlib-0.10.2 → zstdlib-0.10.4}/PKG-INFO +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/log/test_trace.py +4 -4
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_exc_capture.py +2 -3
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/__init__.py +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/enum.py +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/exc_capture.py +7 -9
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/frozen.py +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/io.py +0 -2
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/log/cute.py +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/macos.py +5 -3
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib.egg-info/PKG-INFO +1 -1
- {zstdlib-0.10.2 → zstdlib-0.10.4}/LICENSE +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/README.md +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/pyproject.toml +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/setup.cfg +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/log/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/log/base.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/log/test_cute.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_ansi.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_enum.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_frozen.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_io.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_lazy.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_not_set.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/tests/test_singleton.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/ansi.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/lazy.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/log/__init__.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/log/trace.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/not_set.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/py.typed +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/signal_cm.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib/singleton.py +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib.egg-info/SOURCES.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib.egg-info/dependency_links.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib.egg-info/requires.txt +0 -0
- {zstdlib-0.10.2 → zstdlib-0.10.4}/zstdlib.egg-info/top_level.txt +0 -0
|
@@ -46,20 +46,20 @@ class TestTrace(LeftBase, unittest.TestCase):
|
|
|
46
46
|
# Root check
|
|
47
47
|
with self.hijack("") as log:
|
|
48
48
|
old = log.getEffectiveLevel()
|
|
49
|
-
# pylint: disable=not-callable
|
|
49
|
+
# pylint: disable-next=not-callable
|
|
50
50
|
logging.trace("test1") # type: ignore[misc]
|
|
51
51
|
log.setLevel(logging.DEBUG)
|
|
52
|
-
# pylint: disable=not-callable
|
|
52
|
+
# pylint: disable-next=not-callable
|
|
53
53
|
logging.trace("test2") # type: ignore[misc]
|
|
54
54
|
log.setLevel(old)
|
|
55
55
|
self.assertEqual(self.messages[log], ["test1"])
|
|
56
56
|
# Logger check
|
|
57
57
|
with self.hijack("TestTrace.t1") as log:
|
|
58
58
|
old = log.getEffectiveLevel()
|
|
59
|
-
# pylint: disable=not-callable
|
|
59
|
+
# pylint: disable-next=not-callable
|
|
60
60
|
log.trace("test3")
|
|
61
61
|
log.setLevel(logging.DEBUG)
|
|
62
|
-
# pylint: disable=not-callable
|
|
62
|
+
# pylint: disable-next=not-callable
|
|
63
63
|
log.trace("test4")
|
|
64
64
|
log.setLevel(old)
|
|
65
65
|
self.assertEqual(self.messages[log], ["test3"])
|
|
@@ -79,9 +79,8 @@ class TestLazy(unittest.TestCase):
|
|
|
79
79
|
# armed
|
|
80
80
|
with ExcDelay("", RuntimeError, armed=False) as capture, capture():
|
|
81
81
|
raise RuntimeError()
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
ed.armed = False
|
|
82
|
+
with ExcDelay("", RuntimeError, armed=True) as capture, capture():
|
|
83
|
+
capture.armed = False
|
|
85
84
|
raise RuntimeError()
|
|
86
85
|
with self.assertRaises(ExceptionGroup), ExcDelay("", RuntimeError, armed=True) as capture, capture():
|
|
87
86
|
raise RuntimeError()
|
|
@@ -76,7 +76,7 @@ class EnumType(type):
|
|
|
76
76
|
raise ValueError("Non-auto enum entries must be type annotated") from None
|
|
77
77
|
return ret
|
|
78
78
|
|
|
79
|
-
# pylint: disable=too-many-arguments, dangerous-default-value, too-many-locals
|
|
79
|
+
# pylint: disable-next=too-many-arguments, dangerous-default-value, too-many-locals
|
|
80
80
|
def __new__(
|
|
81
81
|
mcs: type[EnumType],
|
|
82
82
|
name: str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from contextlib import AbstractContextManager, contextmanager
|
|
2
2
|
from collections.abc import Iterator
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Self
|
|
4
4
|
|
|
5
5
|
__all__ = ("ExcCapture", "ExcDelay")
|
|
6
6
|
|
|
@@ -8,12 +8,6 @@ __all__ = ("ExcCapture", "ExcDelay")
|
|
|
8
8
|
type EXC_T = type[BaseException] | tuple[type[BaseException]]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class CaptureFType(Protocol):
|
|
12
|
-
"""The type of the capture function (used for type checking)"""
|
|
13
|
-
|
|
14
|
-
def __call__(self, exc_t: EXC_T | None = None) -> AbstractContextManager[None]: ...
|
|
15
|
-
|
|
16
|
-
|
|
17
11
|
class ExcCapture:
|
|
18
12
|
"""A class that exposes a context manager which captures and suppresses any raised exception of a given type / tuple of types"""
|
|
19
13
|
|
|
@@ -45,6 +39,10 @@ class ExcCapture:
|
|
|
45
39
|
self.previous = e
|
|
46
40
|
self.errors.append(e)
|
|
47
41
|
|
|
42
|
+
def __call__(self, exc_t: EXC_T | None = None) -> AbstractContextManager[None]:
|
|
43
|
+
"""An alias for .capture"""
|
|
44
|
+
return self.capture(exc_t)
|
|
45
|
+
|
|
48
46
|
|
|
49
47
|
class ExcDelay(ExcCapture):
|
|
50
48
|
"""A context manager subclass of ExcCapture that raises on exit if errors are captured"""
|
|
@@ -70,9 +68,9 @@ class ExcDelay(ExcCapture):
|
|
|
70
68
|
self._msg: str = msg
|
|
71
69
|
super().__init__(exc_t)
|
|
72
70
|
|
|
73
|
-
def __enter__(self) ->
|
|
71
|
+
def __enter__(self) -> Self:
|
|
74
72
|
"""Return the capture function to use"""
|
|
75
|
-
return self
|
|
73
|
+
return self
|
|
76
74
|
|
|
77
75
|
def __exit__(self, type_: type[BaseException] | None, *_: object) -> None:
|
|
78
76
|
"""Raise an ExceptionGroup (or BaseExceptionGroup depending on exc_t) if self.errors"""
|
|
@@ -88,7 +88,7 @@ def frozen[T](arg: str | type[T]) -> Callable[[type[T]], type[T]] | type[T]:
|
|
|
88
88
|
|
|
89
89
|
def new_method(self: Any, *args: Any, **kwargs: Any) -> Any:
|
|
90
90
|
ret = original_method(self, *args, **kwargs)
|
|
91
|
-
# pylint: disable=protected-access
|
|
91
|
+
# pylint: disable-next=protected-access
|
|
92
92
|
self._freezable_frozen_ = True # type: ignore[attr-defined]
|
|
93
93
|
return ret
|
|
94
94
|
|
|
@@ -32,8 +32,6 @@ class ProtectedFile:
|
|
|
32
32
|
return hash(self.raw)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
# See bug: https://github.com/pylint-dev/pylint/issues/9335
|
|
36
|
-
# pylint: disable=undefined-variable
|
|
37
35
|
class _IOWrapperBase[T: (str, bytes)]:
|
|
38
36
|
"""A base class for IO objects that adds additional functionality such as readuntil, unread, and peek
|
|
39
37
|
These classes are singletons with respect to their input object
|
|
@@ -22,7 +22,7 @@ class CuteFormatter(Formatter):
|
|
|
22
22
|
CRITICAL: Color.bright_red_bg_yellow,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
# pylint: disable=
|
|
25
|
+
# pylint: disable-next=keyword-arg-before-vararg,too-many-arguments
|
|
26
26
|
def __init__(
|
|
27
27
|
self,
|
|
28
28
|
fmt: str = "%(cute_levelname)s | %(cute_asctime)s | %(cute_name)s | %(cute_message)s",
|
|
@@ -17,6 +17,7 @@ __all__ = ("Caffeinate", "osascript")
|
|
|
17
17
|
|
|
18
18
|
CAFFEINATE = Path("/usr/bin/caffeinate") # This is a hard-coded location on macOS
|
|
19
19
|
KILL_WAIT_SECONDS: int = 60 # How long to .wait after .send_signal
|
|
20
|
+
_CAFFEINATE_ENABLED = CAFFEINATE.exists()
|
|
20
21
|
|
|
21
22
|
P = ParamSpec("P")
|
|
22
23
|
R = TypeVar("R")
|
|
@@ -43,7 +44,7 @@ class Caffeinate:
|
|
|
43
44
|
msg = "The context manager is meant for managing the subprocess' lifetime, which is disable by .signal == 0, consider using .start() / .stop() instead."
|
|
44
45
|
super().__init__(msg)
|
|
45
46
|
|
|
46
|
-
# pylint: disable=too-many-arguments
|
|
47
|
+
# pylint: disable-next=too-many-arguments
|
|
47
48
|
def __init__(
|
|
48
49
|
self,
|
|
49
50
|
# Passed through to CLI tool
|
|
@@ -81,7 +82,7 @@ class Caffeinate:
|
|
|
81
82
|
signal: The signal used to kill the child process (if cmd likely the process Caffeinate execs into). If 0, do not kill it
|
|
82
83
|
block: If True: Block until cmd has finished executing before returning from __enter__
|
|
83
84
|
"""
|
|
84
|
-
if not
|
|
85
|
+
if not _CAFFEINATE_ENABLED:
|
|
85
86
|
raise NotImplementedError(f"This class is only available on macOS via: {CAFFEINATE}")
|
|
86
87
|
if (
|
|
87
88
|
isinstance(timeout, float)
|
|
@@ -249,4 +250,5 @@ class Caffeinate:
|
|
|
249
250
|
|
|
250
251
|
|
|
251
252
|
assert 0 not in Signals, "0 not expected in signal.Signals as it's a nop"
|
|
252
|
-
|
|
253
|
+
if _CAFFEINATE_ENABLED:
|
|
254
|
+
atexit.register(Caffeinate._atexit) # pylint: disable=protected-access
|
|
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
|