omlish 0.0.0.dev406__py3-none-any.whl → 0.0.0.dev407__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 (63) hide show
  1. omlish/.manifests.json +2 -2
  2. omlish/__about__.py +2 -2
  3. omlish/asyncs/anyio/sync.py +3 -0
  4. omlish/asyncs/bluelet/runner.py +1 -0
  5. omlish/asyncs/bluelet/sockets.py +2 -0
  6. omlish/asyncs/sync.py +1 -0
  7. omlish/bootstrap/base.py +2 -0
  8. omlish/bootstrap/harness.py +1 -0
  9. omlish/codecs/text.py +1 -0
  10. omlish/collections/frozen.py +1 -0
  11. omlish/collections/mappings.py +2 -0
  12. omlish/collections/ordered.py +1 -0
  13. omlish/collections/sorted/sorted.py +1 -0
  14. omlish/collections/trie.py +2 -2
  15. omlish/concurrent/executors.py +1 -0
  16. omlish/dataclasses/tools/modifiers.py +1 -0
  17. omlish/diag/threads.py +1 -0
  18. omlish/formats/dotenv.py +5 -0
  19. omlish/formats/props.py +1 -0
  20. omlish/formats/toml/writer.py +1 -0
  21. omlish/formats/yaml.py +1 -0
  22. omlish/funcs/pipes.py +3 -0
  23. omlish/graphs/trees.py +1 -0
  24. omlish/http/jwt.py +2 -0
  25. omlish/http/multipart.py +1 -0
  26. omlish/inject/impl/injector.py +1 -0
  27. omlish/io/buffers.py +2 -0
  28. omlish/iterators/unique.py +1 -0
  29. omlish/lang/classes/restrict.py +1 -0
  30. omlish/lang/classes/simple.py +1 -0
  31. omlish/lang/contextmanagers.py +1 -0
  32. omlish/lang/descriptors.py +2 -0
  33. omlish/lang/objects.py +2 -0
  34. omlish/lang/resolving.py +1 -0
  35. omlish/lifecycles/contextmanagers.py +1 -0
  36. omlish/lite/cached.py +1 -0
  37. omlish/lite/inject.py +2 -0
  38. omlish/lite/secrets.py +1 -0
  39. omlish/logs/handlers.py +1 -0
  40. omlish/marshal/factories.py +2 -0
  41. omlish/marshal/polymorphism/metadata.py +2 -0
  42. omlish/marshal/registries.py +1 -0
  43. omlish/multiprocessing/spawn.py +3 -0
  44. omlish/secrets/openssl.py +2 -0
  45. omlish/secrets/secrets.py +5 -0
  46. omlish/specs/jmespath/errors.py +4 -0
  47. omlish/specs/jmespath/visitor.py +2 -0
  48. omlish/specs/jsonschema/keywords/base.py +1 -0
  49. omlish/sql/alchemy/apiadapter.py +1 -0
  50. omlish/sql/alchemy/asyncs.py +3 -0
  51. omlish/sql/alchemy/duckdb.py +2 -0
  52. omlish/sql/api/dbapi.py +2 -0
  53. omlish/sql/params.py +3 -0
  54. omlish/sql/queries/names.py +1 -0
  55. omlish/sync.py +3 -0
  56. omlish/testing/pytest/inject/harness.py +4 -2
  57. omlish/text/asdl.py +3 -0
  58. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/METADATA +1 -1
  59. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/RECORD +63 -63
  60. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/WHEEL +0 -0
  61. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/entry_points.txt +0 -0
  62. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/licenses/LICENSE +0 -0
  63. {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev407.dist-info}/top_level.txt +0 -0
omlish/.manifests.json CHANGED
@@ -181,7 +181,7 @@
181
181
  "module": ".formats.yaml",
182
182
  "attr": "_YAML_LAZY_CODEC",
183
183
  "file": "omlish/formats/yaml.py",
184
- "line": 255,
184
+ "line": 256,
185
185
  "value": {
186
186
  "!.codecs.base.LazyLoadedCodec": {
187
187
  "module": "omlish.formats.yaml",
@@ -197,7 +197,7 @@
197
197
  "module": ".formats.yaml",
198
198
  "attr": "_YAML_UNSAFE_LAZY_CODEC",
199
199
  "file": "omlish/formats/yaml.py",
200
- "line": 262,
200
+ "line": 263,
201
201
  "value": {
202
202
  "!.codecs.base.LazyLoadedCodec": {
203
203
  "module": "omlish.formats.yaml",
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev406'
2
- __revision__ = '0862d2e5f3852ab4290573b9bea974cf1e8103a3'
1
+ __version__ = '0.0.0.dev407'
2
+ __revision__ = '069daca807ba62f298b1fef1de82247d29c345c0'
3
3
 
4
4
 
5
5
  #
@@ -14,6 +14,7 @@ T = ta.TypeVar('T')
14
14
  class Once:
15
15
  def __init__(self) -> None:
16
16
  super().__init__()
17
+
17
18
  self._done = False
18
19
  self._lock = anyio.Lock()
19
20
 
@@ -36,6 +37,7 @@ class Once:
36
37
  class Lazy(ta.Generic[T]):
37
38
  def __init__(self) -> None:
38
39
  super().__init__()
40
+
39
41
  self._once = Once()
40
42
  self._v: lang.Maybe[T] = lang.empty()
41
43
 
@@ -55,6 +57,7 @@ class Lazy(ta.Generic[T]):
55
57
  class LazyFn(ta.Generic[T]):
56
58
  def __init__(self, fn: ta.Callable[[], ta.Awaitable[T]]) -> None:
57
59
  super().__init__()
60
+
58
61
  self._fn = fn
59
62
  self._once = Once()
60
63
  self._v: lang.Maybe[T] = lang.empty()
@@ -62,6 +62,7 @@ from .events import WaitableBlueletEvent
62
62
  class BlueletCoroException(Exception): # noqa
63
63
  def __init__(self, coro: BlueletCoro, exc_info: BlueletExcInfo) -> None:
64
64
  super().__init__()
65
+
65
66
  self.coro = coro
66
67
  self.exc_info = exc_info
67
68
 
@@ -33,6 +33,7 @@ class BlueletListener:
33
33
  """Create a listening socket on the given hostname and port."""
34
34
 
35
35
  super().__init__()
36
+
36
37
  self._closed = False
37
38
  self.host = host
38
39
  self.port = port
@@ -64,6 +65,7 @@ class BlueletConnection:
64
65
 
65
66
  def __init__(self, sock: socket.socket, addr: ta.Tuple[str, int]) -> None:
66
67
  super().__init__()
68
+
67
69
  self.sock = sock
68
70
  self.addr = addr
69
71
  self._buf = bytearray()
omlish/asyncs/sync.py CHANGED
@@ -60,6 +60,7 @@ async def async_list(fn: ta.Callable[..., ta.AsyncIterator[T]], *args, **kwargs)
60
60
  class SyncableIterable(ta.Generic[T]):
61
61
  def __init__(self, obj) -> None:
62
62
  super().__init__()
63
+
63
64
  self._obj = obj
64
65
 
65
66
  def __iter__(self) -> ta.Iterator[T]:
omlish/bootstrap/base.py CHANGED
@@ -18,10 +18,12 @@ class Bootstrap(abc.ABC, lang.PackageSealed, ta.Generic[BootstrapConfigT]):
18
18
 
19
19
  def __init__(self, config: BootstrapConfigT) -> None:
20
20
  super().__init__()
21
+
21
22
  self._config = config
22
23
 
23
24
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
24
25
  super().__init_subclass__(**kwargs)
26
+
25
27
  if not cls.__name__.endswith('Bootstrap'):
26
28
  raise NameError(cls)
27
29
  if abc.ABC not in cls.__bases__ and not issubclass(cls.__dict__['Config'], Bootstrap.Config):
@@ -51,6 +51,7 @@ BOOTSTRAP_TYPES_BY_CONFIG_TYPE: ta.Mapping[ta.Type[Bootstrap.Config], ta.Type[Bo
51
51
  class BootstrapHarness:
52
52
  def __init__(self, lst: ta.Sequence[Bootstrap]) -> None:
53
53
  super().__init__()
54
+
54
55
  self._lst = lst
55
56
 
56
57
  @contextlib.contextmanager
omlish/codecs/text.py CHANGED
@@ -69,6 +69,7 @@ class TextEncodingComboCodec(ComboCodec[str, bytes]):
69
69
  options: TextEncodingOptions = TextEncodingOptions(),
70
70
  ) -> None:
71
71
  super().__init__()
72
+
72
73
  self._info = check.isinstance(info, codecs.CodecInfo)
73
74
  self._opts = check.isinstance(options, TextEncodingOptions)
74
75
 
@@ -26,6 +26,7 @@ class FrozenDict(ta.Mapping[K, V], Frozen):
26
26
 
27
27
  def __init__(self, *args, **kwargs):
28
28
  super().__init__()
29
+
29
30
  self._hash = None
30
31
  if len(args) > 1:
31
32
  raise TypeError(args)
@@ -130,7 +130,9 @@ class MissingDict(dict[K, V]):
130
130
  def __init__(self, missing_fn: ta.Callable[[K], V]) -> None:
131
131
  if not callable(missing_fn):
132
132
  raise TypeError(missing_fn)
133
+
133
134
  super().__init__()
135
+
134
136
  self._missing_fn = missing_fn
135
137
 
136
138
  def __missing__(self, key):
@@ -10,6 +10,7 @@ T = ta.TypeVar('T')
10
10
  class OrderedSet(ta.MutableSet[T]):
11
11
  def __init__(self, iterable: ta.Iterable[T] | None = None) -> None:
12
12
  super().__init__()
13
+
13
14
  self._dct: dict[T, ta.Any] = {}
14
15
  if iterable is not None:
15
16
  self |= iterable # type: ignore # noqa
@@ -121,6 +121,7 @@ class SortedListDict(SortedMutableMapping[K, V]):
121
121
 
122
122
  def __init__(self, impl: SortedCollection, *args, **kwargs) -> None:
123
123
  super().__init__()
124
+
124
125
  self._impl = impl
125
126
  for k, v in lang.yield_dict_init(*args, **kwargs):
126
127
  self[k] = v
@@ -144,7 +144,7 @@ class Trie(ta.MutableMapping[ta.Sequence[K], V], ta.Generic[K, V]):
144
144
  stack.append((c, ic(c._children))) # noqa
145
145
  yield (key if share_key else tuple(key), c)
146
146
 
147
- def iter_items(self, **kwargs: ta.Any) -> ta.Iterator[tuple[ta.Sequence[K], V]]:
147
+ def iteritems(self, **kwargs: ta.Any) -> ta.Iterator[tuple[ta.Sequence[K], V]]:
148
148
  for k, node in self.iter_nodes(**kwargs):
149
149
  try:
150
150
  yield (k, node._value) # noqa
@@ -152,5 +152,5 @@ class Trie(ta.MutableMapping[ta.Sequence[K], V], ta.Generic[K, V]):
152
152
  pass
153
153
 
154
154
  def __iter__(self) -> ta.Iterator[ta.Sequence[K]]:
155
- for k, _ in self.iter_items():
155
+ for k, _ in self.iteritems():
156
156
  yield k
@@ -13,6 +13,7 @@ P = ta.ParamSpec('P')
13
13
  class ImmediateExecutor(cf.Executor):
14
14
  def __init__(self, *, immediate_exceptions: bool = False) -> None:
15
15
  super().__init__()
16
+
16
17
  self._immediate_exceptions = immediate_exceptions
17
18
 
18
19
  def submit(
@@ -20,6 +20,7 @@ T = ta.TypeVar('T')
20
20
  class field_modifier: # noqa
21
21
  def __init__(self, fn: ta.Callable[[dc.Field], dc.Field]) -> None:
22
22
  super().__init__()
23
+
23
24
  self.fn = fn
24
25
 
25
26
  def __ror__(self, other: T) -> T:
omlish/diag/threads.py CHANGED
@@ -52,6 +52,7 @@ class StoppableThread:
52
52
  **kwargs: ta.Any,
53
53
  ) -> None:
54
54
  super().__init__()
55
+
55
56
  self._fn = fn
56
57
  self._interval_s = interval_s
57
58
  self._tick_immediately = tick_immediately
omlish/formats/dotenv.py CHANGED
@@ -66,6 +66,7 @@ class DotenvAtom(metaclass=abc.ABCMeta):
66
66
  class DotenvLiteral(DotenvAtom):
67
67
  def __init__(self, value: str) -> None:
68
68
  super().__init__()
69
+
69
70
  self.value = value
70
71
 
71
72
  def __repr__(self) -> str:
@@ -86,6 +87,7 @@ class DotenvLiteral(DotenvAtom):
86
87
  class DotenvVariable(DotenvAtom):
87
88
  def __init__(self, name: str, default: ta.Optional[str]) -> None:
88
89
  super().__init__()
90
+
89
91
  self.name = name
90
92
  self.default = default
91
93
 
@@ -164,6 +166,7 @@ class DotenvBinding(ta.NamedTuple):
164
166
  class _DotenvPosition:
165
167
  def __init__(self, chars: int, line: int) -> None:
166
168
  super().__init__()
169
+
167
170
  self.chars = chars
168
171
  self.line = line
169
172
 
@@ -187,6 +190,7 @@ class DotenvError(Exception):
187
190
  class _DotenvReader:
188
191
  def __init__(self, stream: ta.IO[str]) -> None:
189
192
  super().__init__()
193
+
190
194
  self.string = stream.read()
191
195
  self.position = _DotenvPosition.start()
192
196
  self.mark = _DotenvPosition.start()
@@ -334,6 +338,7 @@ class Dotenv:
334
338
  log: ta.Optional[logging.Logger] = None,
335
339
  ) -> None:
336
340
  super().__init__()
341
+
337
342
  self.path: ta.Union[str, 'os.PathLike[str]', None] = path
338
343
  self.stream: ta.Optional[ta.IO[str]] = stream
339
344
  self._dict: ta.Optional[ta.Dict[str, ta.Optional[str]]] = None
omlish/formats/props.py CHANGED
@@ -129,6 +129,7 @@ class PropertyError(Exception):
129
129
  class ParseError(PropertyError):
130
130
  def __init__(self, message: str, line_number: int, file_obj: ta.Any = None) -> None:
131
131
  super().__init__()
132
+
132
133
  self.message = message
133
134
  self.line_number = line_number
134
135
  self.file_obj = file_obj
@@ -15,6 +15,7 @@ class TomlWriter:
15
15
 
16
16
  def __init__(self, out: ta.TextIO) -> None:
17
17
  super().__init__()
18
+
18
19
  self._out = out
19
20
 
20
21
  self._indent = 0
omlish/formats/yaml.py CHANGED
@@ -134,6 +134,7 @@ class NodeWrappingConstructorMixin:
134
134
  class _cached_class_property: # noqa
135
135
  def __init__(self, fn):
136
136
  super().__init__()
137
+
137
138
  self._fn = fn
138
139
  self._attr = None
139
140
 
omlish/funcs/pipes.py CHANGED
@@ -39,6 +39,7 @@ class Fn(abc.ABC, ta.Generic[T]):
39
39
  class Bind(Fn[T]):
40
40
  def __init__(self, fn: ta.Callable[..., T], *args: ta.Any, **kwargs: ta.Any) -> None:
41
41
  super().__init__()
42
+
42
43
  if Ellipsis not in args and Ellipsis not in kwargs:
43
44
  args += (Ellipsis,)
44
45
  self._fn = fn
@@ -75,6 +76,7 @@ bind = Bind
75
76
  class Pipe(Fn[T]):
76
77
  def __init__(self, lfns: ta.Sequence[ta.Callable], rfn: ta.Callable[..., T]) -> None:
77
78
  super().__init__()
79
+
78
80
  self._lfn, *self._rfns = [*lfns, rfn]
79
81
 
80
82
  def __call__(self, *args: ta.Any, **kwargs: ta.Any) -> T:
@@ -95,6 +97,7 @@ def pipe(*fns: ta.Callable) -> Pipe:
95
97
  class Apply(Fn[T]):
96
98
  def __init__(self, *fns: ta.Callable[[T], ta.Any]) -> None:
97
99
  super().__init__()
100
+
98
101
  self._fns = fns
99
102
 
100
103
  def __call__(self, o: T) -> T: # noqa
omlish/graphs/trees.py CHANGED
@@ -26,6 +26,7 @@ NodeGenerator: ta.TypeAlias = ta.Generator[NodeT]
26
26
  class NodeError(Exception, ta.Generic[NodeT]):
27
27
  def __init__(self, node: NodeT, msg: str, *args, **kwargs) -> None:
28
28
  super().__init__(msg, *args, **kwargs) # noqa
29
+
29
30
  self._node = node
30
31
 
31
32
  @property
omlish/http/jwt.py CHANGED
@@ -52,6 +52,7 @@ class Algorithm(abc.ABC):
52
52
  class HmacAlgorithm(Algorithm):
53
53
  def __init__(self, name: str, digest: ta.Any) -> None:
54
54
  super().__init__()
55
+
55
56
  self._name = name
56
57
  self._digest = digest
57
58
 
@@ -69,6 +70,7 @@ class HmacAlgorithm(Algorithm):
69
70
  class RsaAlgorithm(Algorithm):
70
71
  def __init__(self, name: str, digest: str) -> None:
71
72
  super().__init__()
73
+
72
74
  self._name = name
73
75
  self._digest = digest
74
76
 
omlish/http/multipart.py CHANGED
@@ -31,6 +31,7 @@ class MultipartEncoder:
31
31
  boundary: bytes | None = None,
32
32
  ) -> None:
33
33
  super().__init__()
34
+
34
35
  self._fields = fields
35
36
  self._boundary = boundary or (b'----WebKitFormBoundary-' + uuid.uuid4().hex.encode('ascii'))
36
37
 
@@ -111,6 +111,7 @@ class InjectorImpl(Injector, lang.Final):
111
111
  class _Request:
112
112
  def __init__(self, injector: 'InjectorImpl') -> None:
113
113
  super().__init__()
114
+
114
115
  self._injector = injector
115
116
  self._provisions: dict[Key, lang.Maybe] = {}
116
117
  self._seen_keys: set[Key] = set()
omlish/io/buffers.py CHANGED
@@ -24,6 +24,7 @@ class DelimitingBuffer:
24
24
  class Error(Exception):
25
25
  def __init__(self, buffer: 'DelimitingBuffer') -> None:
26
26
  super().__init__(buffer)
27
+
27
28
  self.buffer = buffer
28
29
 
29
30
  def __repr__(self) -> str:
@@ -179,6 +180,7 @@ class ReadableListBuffer:
179
180
 
180
181
  def __init__(self) -> None:
181
182
  super().__init__()
183
+
182
184
  self._lst: list[bytes] = []
183
185
 
184
186
  def __len__(self) -> int:
@@ -33,6 +33,7 @@ class UniqueIterator(ta.Iterator[UniqueItem[T]]):
33
33
  keyer: ta.Callable[[T], ta.Any] = lang.identity,
34
34
  ) -> None:
35
35
  super().__init__()
36
+
36
37
  self._it = enumerate(it)
37
38
  self._keyer = keyer
38
39
 
@@ -129,6 +129,7 @@ class NoBool:
129
129
  class _NoBoolDescriptor:
130
130
  def __init__(self, fn, instance=None, owner=None) -> None:
131
131
  super().__init__()
132
+
132
133
  self._fn = fn
133
134
  self._instance = instance
134
135
  self._owner = owner
@@ -91,6 +91,7 @@ class Singleton:
91
91
 
92
92
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
93
93
  super().__init_subclass__(**kwargs)
94
+
94
95
  _set_singleton_instance(super().__new__(cls)) # noqa
95
96
 
96
97
 
@@ -266,6 +266,7 @@ class Timer:
266
266
  clock: ta.Callable[[], float] | None = None,
267
267
  ) -> None:
268
268
  super().__init__()
269
+
269
270
  self._clock = clock if clock is not None else time.monotonic
270
271
 
271
272
  _start: float
@@ -200,6 +200,7 @@ decorator = _decorator
200
200
  class AccessForbiddenError(Exception):
201
201
  def __init__(self, name: str | None = None, *args: ta.Any, **kwargs: ta.Any) -> None:
202
202
  super().__init__(*((name,) if name is not None else ()), *args, **kwargs) # noqa
203
+
203
204
  self.name = name
204
205
 
205
206
 
@@ -231,6 +232,7 @@ class _ClassOnly:
231
232
  if not isinstance(mth, classmethod):
232
233
  raise TypeError(f'must be classmethod: {mth}')
233
234
  super().__init__()
235
+
234
236
  self._mth = (mth,)
235
237
  functools.update_wrapper(self, mth) # type: ignore
236
238
 
omlish/lang/objects.py CHANGED
@@ -166,6 +166,7 @@ class SimpleProxy(ta.Generic[T]):
166
166
  class Descriptor:
167
167
  def __init__(self, attr: str) -> None:
168
168
  super().__init__()
169
+
169
170
  self._attr = attr
170
171
 
171
172
  def __get__(self, instance, owner=None):
@@ -189,6 +190,7 @@ class SimpleProxy(ta.Generic[T]):
189
190
 
190
191
  def __init__(self, wrapped: T) -> None:
191
192
  super().__init__()
193
+
192
194
  object.__setattr__(self, '__wrapped__', wrapped)
193
195
 
194
196
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
omlish/lang/resolving.py CHANGED
@@ -59,4 +59,5 @@ def get_fqcn_cls(fqcn: str, *, nocheck: bool = False) -> type:
59
59
  class Resolvable:
60
60
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
61
61
  super().__init_subclass__(**kwargs)
62
+
62
63
  get_cls_fqcn(cls, nocheck=True)
@@ -33,6 +33,7 @@ class ContextManagerLifecycle(Lifecycle, lang.Final, ta.Generic[ContextManagerT]
33
33
  class LifecycleContextManager(ta.Generic[LifecycleT]):
34
34
  def __init__(self, lifecycle: LifecycleT) -> None:
35
35
  super().__init__()
36
+
36
37
  self._lifecycle = lifecycle
37
38
  self._controller = lifecycle if isinstance(lifecycle, LifecycleController) else LifecycleController(lifecycle)
38
39
 
omlish/lite/cached.py CHANGED
@@ -13,6 +13,7 @@ CallableT = ta.TypeVar('CallableT', bound=ta.Callable)
13
13
  class _AbstractCachedNullary:
14
14
  def __init__(self, fn):
15
15
  super().__init__()
16
+
16
17
  self._fn = fn
17
18
  self._value = self._missing = object()
18
19
  functools.update_wrapper(self, fn)
omlish/lite/inject.py CHANGED
@@ -402,6 +402,7 @@ class ContextvarInjectorScope(InjectorScope, abc.ABC):
402
402
 
403
403
  def __init_subclass__(cls, **kwargs: ta.Any) -> None:
404
404
  super().__init_subclass__(**kwargs)
405
+
405
406
  check.not_in(abc.ABC, cls.__bases__)
406
407
  check.state(not hasattr(cls, '_cv'))
407
408
  cls._cv = contextvars.ContextVar(f'{cls.__name__}_cv')
@@ -676,6 +677,7 @@ class _Injector(Injector):
676
677
  class _Request:
677
678
  def __init__(self, injector: '_Injector') -> None:
678
679
  super().__init__()
680
+
679
681
  self._injector = injector
680
682
  self._provisions: ta.Dict[InjectorKey, Maybe] = {}
681
683
  self._seen_keys: ta.Set[InjectorKey] = set()
omlish/lite/secrets.py CHANGED
@@ -12,6 +12,7 @@ class Secret:
12
12
 
13
13
  def __init__(self, *, key: ta.Optional[str] = None, value: str) -> None:
14
14
  super().__init__()
15
+
15
16
  self._key = key
16
17
  setattr(self, self._VALUE_ATTR, lambda: value)
17
18
 
omlish/logs/handlers.py CHANGED
@@ -10,6 +10,7 @@ import typing as ta
10
10
  class ListHandler(logging.Handler):
11
11
  def __init__(self) -> None:
12
12
  super().__init__()
13
+
13
14
  self.records: ta.List[logging.LogRecord] = []
14
15
 
15
16
  def emit(self, record: logging.LogRecord) -> None:
@@ -41,6 +41,7 @@ class TypeMapFactory(mfs.MatchFn[[C, rfl.Type], R]):
41
41
  class TypeCacheFactory(mfs.MatchFn[[C, rfl.Type], R]):
42
42
  def __init__(self, f: mfs.MatchFn[[C, rfl.Type], R]) -> None:
43
43
  super().__init__()
44
+
44
45
  self._f = f
45
46
  self._dct: dict[rfl.Type, R | None] = {}
46
47
  self._mtx = threading.RLock()
@@ -90,6 +91,7 @@ class RecursiveTypeFactory(mfs.MatchFn[[C, rfl.Type], R]):
90
91
  prx: ta.Callable[[], tuple[R, ta.Callable[[R], None]]],
91
92
  ) -> None:
92
93
  super().__init__()
94
+
93
95
  self._f = f
94
96
  self._prx = prx
95
97
  self._dct: dict[rfl.Type, R] = {}
@@ -39,6 +39,7 @@ class Impls(ta.Sequence[Impl]):
39
39
  lst: ta.Iterable[Impl],
40
40
  ) -> None:
41
41
  super().__init__()
42
+
42
43
  self._lst = list(lst)
43
44
 
44
45
  by_ty: dict[type, Impl] = {}
@@ -89,6 +90,7 @@ class Polymorphism:
89
90
  impls: ta.Iterable[Impl],
90
91
  ) -> None:
91
92
  super().__init__()
93
+
92
94
  self._ty = ty
93
95
  self._impls = Impls(impls)
94
96
 
@@ -35,6 +35,7 @@ class _KeyRegistryItems:
35
35
  class Registry:
36
36
  def __init__(self) -> None:
37
37
  super().__init__()
38
+
38
39
  self._mtx = threading.Lock()
39
40
  self._idct: ta.MutableMapping[ta.Any, _KeyRegistryItems] = col.IdentityKeyDict()
40
41
  self._dct: dict[ta.Any, _KeyRegistryItems] = {}
@@ -24,6 +24,7 @@ class ExtrasSpawnPosixPopen(mp.popen_spawn_posix.Popen):
24
24
  def __init__(self, process_obj: 'ExtrasSpawnProcess', *, extras: SpawnExtras) -> None:
25
25
  self.__extras = extras
26
26
  self.__pass_fds = extras.pass_fds
27
+
27
28
  super().__init__(process_obj)
28
29
 
29
30
  def _launch(self, process_obj: 'ExtrasSpawnProcess') -> None:
@@ -38,6 +39,7 @@ class ExtrasSpawnPosixPopen(mp.popen_spawn_posix.Popen):
38
39
  class ExtrasSpawnProcess(mp.context.SpawnProcess):
39
40
  def __init__(self, *args: ta.Any, extras: SpawnExtras, **kwargs: ta.Any) -> None:
40
41
  self.__extras = extras
42
+
41
43
  super().__init__(*args, **kwargs)
42
44
 
43
45
  def _Popen(self, process_obj: 'ExtrasSpawnProcess') -> ExtrasSpawnPosixPopen: # type: ignore # noqa
@@ -56,6 +58,7 @@ class ExtrasSpawnProcess(mp.context.SpawnProcess):
56
58
  class ExtrasSpawnContext(mp.context.SpawnContext):
57
59
  def __init__(self, extras: SpawnExtras = SpawnExtras()) -> None:
58
60
  self.__extras = extras
61
+
59
62
  super().__init__()
60
63
 
61
64
  def Process(self, *args: ta.Any, **kwargs: ta.Any): # type: ignore # noqa
omlish/secrets/openssl.py CHANGED
@@ -56,6 +56,7 @@ class OpensslAescbcCrypto(Crypto):
56
56
  iters: int = 10_000,
57
57
  ) -> None:
58
58
  super().__init__()
59
+
59
60
  self._iters = iters
60
61
 
61
62
  def generate_key(self, sz: int = DEFAULT_KEY_SIZE) -> bytes:
@@ -131,6 +132,7 @@ class OpensslSubprocessAescbcCrypto(Crypto):
131
132
  file_input: SubprocessFileInputMethod = temp_subprocess_file_input,
132
133
  ) -> None:
133
134
  super().__init__()
135
+
134
136
  self._cmd = cmd
135
137
  self._timeout = timeout
136
138
  self._file_input = file_input
omlish/secrets/secrets.py CHANGED
@@ -33,6 +33,7 @@ class Secret(lang.NotPicklable, lang.Sensitive, lang.Final):
33
33
 
34
34
  def __init__(self, *, key: str | None, value: str) -> None:
35
35
  super().__init__()
36
+
36
37
  self._key = key
37
38
  setattr(self, self._VALUE_ATTR, lambda: value)
38
39
 
@@ -203,6 +204,7 @@ class CachingSecrets(Secrets):
203
204
  clock: ta.Callable[..., float] = time.time,
204
205
  ) -> None:
205
206
  super().__init__()
207
+
206
208
  self._child = child
207
209
  self._dct: dict[str, Secret] = {}
208
210
  self._ttl_s = ttl_s
@@ -243,6 +245,7 @@ class CachingSecrets(Secrets):
243
245
  class CompositeSecrets(Secrets):
244
246
  def __init__(self, *children: Secrets) -> None:
245
247
  super().__init__()
248
+
246
249
  self._children = children
247
250
 
248
251
  def _get_raw(self, key: str) -> str:
@@ -265,6 +268,7 @@ class LoggingSecrets(Secrets):
265
268
  log: logging.Logger | None = None, # noqa
266
269
  ) -> None:
267
270
  super().__init__()
271
+
268
272
  self._child = child
269
273
  self._log = log if log is not None else globals()['log']
270
274
 
@@ -317,6 +321,7 @@ class EnvVarSecrets(Secrets):
317
321
  pop: bool = False,
318
322
  ) -> None:
319
323
  super().__init__()
324
+
320
325
  self._env = env
321
326
  self._upcase = upcase
322
327
  self._prefix = prefix
@@ -19,6 +19,7 @@ class ParseError(JmespathError):
19
19
  msg: str = _ERROR_MESSAGE,
20
20
  ) -> None:
21
21
  super().__init__(lex_position, token_value, token_type)
22
+
22
23
  self.lex_position = lex_position
23
24
  self.token_value = token_value
24
25
  self.token_type = token_type.upper()
@@ -56,7 +57,9 @@ class LexerError(ParseError):
56
57
  self.lexer_position = lexer_position
57
58
  self.lexer_value = lexer_value
58
59
  self.message = message
60
+
59
61
  super().__init__(lexer_position, lexer_value, message)
62
+
60
63
  # Whatever catches LexerError can set this.
61
64
  self.expression = expression
62
65
 
@@ -143,4 +146,5 @@ class UnknownFunctionError(JmespathError):
143
146
  class UndefinedVariableError(JmespathError):
144
147
  def __init__(self, varname):
145
148
  self.varname = varname
149
+
146
150
  super().__init__(f'Reference to undefined variable: {self.varname}')
@@ -164,6 +164,7 @@ class Options:
164
164
  class _Expression:
165
165
  def __init__(self, expression: Node, interpreter: 'TreeInterpreter') -> None:
166
166
  super().__init__()
167
+
167
168
  self.expression = expression
168
169
  self.interpreter = interpreter
169
170
 
@@ -487,6 +488,7 @@ class TreeInterpreter(Visitor):
487
488
  class GraphvizVisitor:
488
489
  def __init__(self) -> None:
489
490
  super().__init__()
491
+
490
492
  self._lines: list[str] = []
491
493
  self._count = 1
492
494
 
@@ -34,6 +34,7 @@ class KnownKeyword(Keyword, lang.Abstract):
34
34
  **kwargs: ta.Any,
35
35
  ) -> None:
36
36
  super().__init_subclass__(**kwargs)
37
+
37
38
  check.empty(set(dir(cls)) & {'tag', 'aliases', 'tag_and_aliases'})
38
39
  if not lang.is_abstract_class(cls):
39
40
  check.issubclass(cls, lang.Final)