omlish 0.0.0.dev406__py3-none-any.whl → 0.0.0.dev408__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.
- omlish/.manifests.json +2 -2
- omlish/__about__.py +2 -2
- omlish/asyncs/anyio/sync.py +3 -0
- omlish/asyncs/bluelet/runner.py +1 -0
- omlish/asyncs/bluelet/sockets.py +2 -0
- omlish/asyncs/sync.py +1 -0
- omlish/bootstrap/base.py +2 -0
- omlish/bootstrap/harness.py +1 -0
- omlish/codecs/text.py +1 -0
- omlish/collections/frozen.py +1 -0
- omlish/collections/mappings.py +2 -0
- omlish/collections/ordered.py +1 -0
- omlish/collections/sorted/sorted.py +1 -0
- omlish/collections/trie.py +2 -2
- omlish/concurrent/executors.py +1 -0
- omlish/dataclasses/tools/modifiers.py +1 -0
- omlish/diag/threads.py +1 -0
- omlish/formats/dotenv.py +5 -0
- omlish/formats/props.py +1 -0
- omlish/formats/toml/writer.py +1 -0
- omlish/formats/yaml.py +1 -0
- omlish/funcs/pipes.py +3 -0
- omlish/graphs/trees.py +1 -0
- omlish/http/jwt.py +2 -0
- omlish/http/multipart.py +1 -0
- omlish/inject/impl/injector.py +1 -0
- omlish/inject/lite.py +112 -0
- omlish/io/buffers.py +2 -0
- omlish/iterators/unique.py +1 -0
- omlish/lang/classes/restrict.py +1 -0
- omlish/lang/classes/simple.py +1 -0
- omlish/lang/contextmanagers.py +1 -0
- omlish/lang/descriptors.py +2 -0
- omlish/lang/imports/lazy.py +1 -1
- omlish/lang/imports/proxyinit.py +229 -122
- omlish/lang/objects.py +2 -0
- omlish/lang/resolving.py +1 -0
- omlish/lifecycles/contextmanagers.py +1 -0
- omlish/lite/cached.py +1 -0
- omlish/lite/inject.py +3 -0
- omlish/lite/secrets.py +1 -0
- omlish/logs/handlers.py +1 -0
- omlish/marshal/factories.py +2 -0
- omlish/marshal/polymorphism/metadata.py +2 -0
- omlish/marshal/registries.py +1 -0
- omlish/multiprocessing/spawn.py +3 -0
- omlish/secrets/openssl.py +2 -0
- omlish/secrets/secrets.py +5 -0
- omlish/specs/jmespath/errors.py +4 -0
- omlish/specs/jmespath/visitor.py +2 -0
- omlish/specs/jsonschema/keywords/base.py +1 -0
- omlish/sql/alchemy/apiadapter.py +1 -0
- omlish/sql/alchemy/asyncs.py +3 -0
- omlish/sql/alchemy/duckdb.py +2 -0
- omlish/sql/api/dbapi.py +2 -0
- omlish/sql/params.py +3 -0
- omlish/sql/queries/names.py +1 -0
- omlish/sync.py +3 -0
- omlish/testing/pytest/inject/harness.py +4 -2
- omlish/text/asdl.py +3 -0
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/RECORD +66 -65
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/WHEEL +0 -0
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/licenses/LICENSE +0 -0
- {omlish-0.0.0.dev406.dist-info → omlish-0.0.0.dev408.dist-info}/top_level.txt +0 -0
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
|
omlish/specs/jmespath/errors.py
CHANGED
@@ -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}')
|
omlish/specs/jmespath/visitor.py
CHANGED
@@ -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)
|
omlish/sql/alchemy/apiadapter.py
CHANGED
omlish/sql/alchemy/asyncs.py
CHANGED
@@ -27,6 +27,7 @@ AsyncTransactionLike: ta.TypeAlias = ta.Union[saa.AsyncTransaction, 'AsyncTransa
|
|
27
27
|
class AsyncTransaction:
|
28
28
|
def __init__(self, underlying: saa.AsyncTransaction) -> None:
|
29
29
|
super().__init__()
|
30
|
+
|
30
31
|
self._underlying = underlying
|
31
32
|
|
32
33
|
@property
|
@@ -51,6 +52,7 @@ class AsyncTransaction:
|
|
51
52
|
class AsyncConnection:
|
52
53
|
def __init__(self, underlying: saa.AsyncConnection) -> None:
|
53
54
|
super().__init__()
|
55
|
+
|
54
56
|
self._underlying = underlying
|
55
57
|
|
56
58
|
@property
|
@@ -87,6 +89,7 @@ class AsyncConnection:
|
|
87
89
|
class AsyncEngine:
|
88
90
|
def __init__(self, underlying: saa.AsyncEngine) -> None:
|
89
91
|
super().__init__()
|
92
|
+
|
90
93
|
self._underlying = underlying
|
91
94
|
|
92
95
|
@property
|
omlish/sql/alchemy/duckdb.py
CHANGED
@@ -23,6 +23,7 @@ else:
|
|
23
23
|
class ConnectionWrapper:
|
24
24
|
def __init__(self, c: 'duckdb.DuckDBPyConnection') -> None:
|
25
25
|
super().__init__()
|
26
|
+
|
26
27
|
self.__c = c
|
27
28
|
self.autocommit = None
|
28
29
|
self.closed = False
|
@@ -49,6 +50,7 @@ class CursorWrapper:
|
|
49
50
|
connection_wrapper: 'ConnectionWrapper',
|
50
51
|
) -> None:
|
51
52
|
super().__init__()
|
53
|
+
|
52
54
|
self.__c = c
|
53
55
|
self.__connection_wrapper = connection_wrapper
|
54
56
|
|
omlish/sql/api/dbapi.py
CHANGED
@@ -43,6 +43,7 @@ class DbapiRows(Rows):
|
|
43
43
|
|
44
44
|
def _close(self) -> None:
|
45
45
|
self._cursor.close()
|
46
|
+
|
46
47
|
super()._close()
|
47
48
|
|
48
49
|
@property
|
@@ -65,6 +66,7 @@ class DbapiConn(Conn):
|
|
65
66
|
|
66
67
|
def _close(self) -> None:
|
67
68
|
self._conn.close()
|
69
|
+
|
68
70
|
super()._close()
|
69
71
|
|
70
72
|
@property
|
omlish/sql/params.py
CHANGED
@@ -25,6 +25,7 @@ class ParamsPreparer(lang.Abstract):
|
|
25
25
|
class LinearParamsPreparer(ParamsPreparer):
|
26
26
|
def __init__(self, placeholder: str) -> None:
|
27
27
|
super().__init__()
|
28
|
+
|
28
29
|
self._placeholder = placeholder
|
29
30
|
self._args: list[ParamKey] = []
|
30
31
|
|
@@ -39,6 +40,7 @@ class LinearParamsPreparer(ParamsPreparer):
|
|
39
40
|
class NumericParamsPreparer(ParamsPreparer):
|
40
41
|
def __init__(self) -> None:
|
41
42
|
super().__init__()
|
43
|
+
|
42
44
|
self._args: list[ParamKey] = []
|
43
45
|
self._str_by_key: dict[ParamKey, str] = {}
|
44
46
|
self._pos_by_name: dict[str, int] = {}
|
@@ -76,6 +78,7 @@ class NamedParamsPreparer(ParamsPreparer):
|
|
76
78
|
anon: ta.Callable[[int], str] | None = None,
|
77
79
|
) -> None:
|
78
80
|
super().__init__()
|
81
|
+
|
79
82
|
self._render = render
|
80
83
|
self._anon = anon if anon is not None else self.underscore_anon
|
81
84
|
self._kwargs: dict[str, ParamKey] = {}
|
omlish/sql/queries/names.py
CHANGED
omlish/sync.py
CHANGED
@@ -20,6 +20,7 @@ T = ta.TypeVar('T')
|
|
20
20
|
class Once:
|
21
21
|
def __init__(self) -> None:
|
22
22
|
super().__init__()
|
23
|
+
|
23
24
|
self._done = False
|
24
25
|
self._lock = threading.Lock()
|
25
26
|
|
@@ -42,6 +43,7 @@ class Once:
|
|
42
43
|
class Lazy(ta.Generic[T]):
|
43
44
|
def __init__(self) -> None:
|
44
45
|
super().__init__()
|
46
|
+
|
45
47
|
self._once = Once()
|
46
48
|
self._v: lang.Maybe[T] = lang.empty()
|
47
49
|
|
@@ -61,6 +63,7 @@ class Lazy(ta.Generic[T]):
|
|
61
63
|
class LazyFn(ta.Generic[T]):
|
62
64
|
def __init__(self, fn: ta.Callable[[], T]) -> None:
|
63
65
|
super().__init__()
|
66
|
+
|
64
67
|
self._fn = fn
|
65
68
|
self._once = Once()
|
66
69
|
self._v: lang.Maybe[T] = lang.empty()
|
@@ -48,6 +48,7 @@ _ACTIVE_HARNESSES: set['Harness'] = set()
|
|
48
48
|
class Harness:
|
49
49
|
def __init__(self, es: inj.Elements) -> None:
|
50
50
|
super().__init__()
|
51
|
+
|
51
52
|
self._orig_es = es
|
52
53
|
self._es = inj.as_elements(
|
53
54
|
inj.bind(self),
|
@@ -65,7 +66,7 @@ class Harness:
|
|
65
66
|
##
|
66
67
|
|
67
68
|
@contextlib.contextmanager
|
68
|
-
def
|
69
|
+
def _activate(self) -> ta.Generator[ta.Self]:
|
69
70
|
check.none(self._inj)
|
70
71
|
check.not_in(self, _ACTIVE_HARNESSES)
|
71
72
|
_ACTIVE_HARNESSES.add(self)
|
@@ -122,6 +123,7 @@ class Harness:
|
|
122
123
|
class HarnessPlugin:
|
123
124
|
def __init__(self) -> None:
|
124
125
|
super().__init__()
|
126
|
+
|
125
127
|
self._harnesses_by_session: dict[ta.Any, Harness] = {}
|
126
128
|
|
127
129
|
def get_session_harness(self, session: ta.Any) -> Harness:
|
@@ -129,7 +131,7 @@ class HarnessPlugin:
|
|
129
131
|
|
130
132
|
@pytest.fixture(scope='session', autouse=True)
|
131
133
|
def _harness_scope_listener_session(self, request):
|
132
|
-
with Harness(inj.as_elements(*_HARNESS_ELEMENTS_LIST)).
|
134
|
+
with Harness(inj.as_elements(*_HARNESS_ELEMENTS_LIST))._activate() as harness: # noqa
|
133
135
|
self._harnesses_by_session[request.session] = harness
|
134
136
|
try:
|
135
137
|
with harness._pytest_scope_manager(PytestScope.SESSION, request): # noqa
|
omlish/text/asdl.py
CHANGED
@@ -177,6 +177,7 @@ class VisitorBase:
|
|
177
177
|
|
178
178
|
def __init__(self) -> None:
|
179
179
|
super().__init__()
|
180
|
+
|
180
181
|
self.cache: dict[type, ta.Any] = {}
|
181
182
|
|
182
183
|
def visit(self, obj, *args):
|
@@ -247,6 +248,7 @@ class Token:
|
|
247
248
|
class AsdlSyntaxError(Exception):
|
248
249
|
def __init__(self, msg: str, lineno: int | None = None) -> None:
|
249
250
|
super().__init__()
|
251
|
+
|
250
252
|
self.msg = msg
|
251
253
|
self.lineno = lineno or '<unknown>'
|
252
254
|
|
@@ -291,6 +293,7 @@ class AsdlParser:
|
|
291
293
|
|
292
294
|
def __init__(self) -> None:
|
293
295
|
super().__init__()
|
296
|
+
|
294
297
|
self._tokenizer: ta.Iterator[Token] | None = None
|
295
298
|
self.cur_token: Token | None = None
|
296
299
|
|