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/.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":
|
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":
|
200
|
+
"line": 263,
|
201
201
|
"value": {
|
202
202
|
"!.codecs.base.LazyLoadedCodec": {
|
203
203
|
"module": "omlish.formats.yaml",
|
omlish/__about__.py
CHANGED
omlish/asyncs/anyio/sync.py
CHANGED
@@ -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()
|
omlish/asyncs/bluelet/runner.py
CHANGED
omlish/asyncs/bluelet/sockets.py
CHANGED
@@ -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
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):
|
omlish/bootstrap/harness.py
CHANGED
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
|
|
omlish/collections/frozen.py
CHANGED
omlish/collections/mappings.py
CHANGED
@@ -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):
|
omlish/collections/ordered.py
CHANGED
omlish/collections/trie.py
CHANGED
@@ -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
|
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.
|
155
|
+
for k, _ in self.iteritems():
|
156
156
|
yield k
|
omlish/concurrent/executors.py
CHANGED
omlish/diag/threads.py
CHANGED
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
|
omlish/formats/toml/writer.py
CHANGED
omlish/formats/yaml.py
CHANGED
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
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
omlish/inject/impl/injector.py
CHANGED
@@ -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/inject/lite.py
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
"""
|
2
|
+
TODO:
|
3
|
+
- explicit blacklisted key element - blacklist lite Injector
|
4
|
+
"""
|
5
|
+
import dataclasses as dc
|
6
|
+
import typing as ta
|
7
|
+
|
8
|
+
from .. import check
|
9
|
+
from .. import reflect as rfl
|
10
|
+
from ..lite import inject as lij
|
11
|
+
from .bindings import Binding
|
12
|
+
from .elements import Elements
|
13
|
+
from .keys import Key
|
14
|
+
from .providers import ConstProvider
|
15
|
+
from .providers import CtorProvider
|
16
|
+
from .providers import FnProvider
|
17
|
+
from .providers import LinkProvider
|
18
|
+
from .providers import Provider
|
19
|
+
from .scopes import Singleton
|
20
|
+
from .types import Scope
|
21
|
+
from .types import Unscoped
|
22
|
+
|
23
|
+
|
24
|
+
##
|
25
|
+
|
26
|
+
|
27
|
+
@dc.dataclass(frozen=True)
|
28
|
+
class BoxedLiteProvider:
|
29
|
+
p: Provider
|
30
|
+
sc: Scope | None = None
|
31
|
+
|
32
|
+
|
33
|
+
##
|
34
|
+
|
35
|
+
|
36
|
+
@ta.overload
|
37
|
+
def convert_from_lite(o: lij.InjectorBindings) -> Elements:
|
38
|
+
...
|
39
|
+
|
40
|
+
|
41
|
+
@ta.overload
|
42
|
+
def convert_from_lite(o: lij.InjectorKey) -> Key:
|
43
|
+
...
|
44
|
+
|
45
|
+
|
46
|
+
@ta.overload
|
47
|
+
def convert_from_lite(o: lij.InjectorBinding) -> Binding:
|
48
|
+
...
|
49
|
+
|
50
|
+
|
51
|
+
@ta.overload
|
52
|
+
def convert_from_lite(o: lij.InjectorProvider) -> BoxedLiteProvider:
|
53
|
+
...
|
54
|
+
|
55
|
+
|
56
|
+
def convert_from_lite(o):
|
57
|
+
if isinstance(o, lij.InjectorBindings):
|
58
|
+
return Elements([
|
59
|
+
convert_from_lite(c)
|
60
|
+
for c in o.bindings()
|
61
|
+
])
|
62
|
+
|
63
|
+
elif isinstance(o, lij.InjectorKey):
|
64
|
+
check.not_equal(o.cls_, lij.InjectorKeyCls)
|
65
|
+
check.arg(not o.array)
|
66
|
+
return Key(rfl.type_(o.cls_), tag=o.tag)
|
67
|
+
|
68
|
+
elif isinstance(o, lij.InjectorBinding):
|
69
|
+
blp = convert_from_lite(o.provider)
|
70
|
+
return Binding(
|
71
|
+
convert_from_lite(o.key),
|
72
|
+
blp.p,
|
73
|
+
blp.sc if blp.sc is not None else Unscoped(),
|
74
|
+
)
|
75
|
+
|
76
|
+
elif isinstance(o, lij.InjectorProvider):
|
77
|
+
if isinstance(o, lij.FnInjectorProvider):
|
78
|
+
return BoxedLiteProvider(FnProvider(
|
79
|
+
o.fn,
|
80
|
+
))
|
81
|
+
|
82
|
+
elif isinstance(o, lij.CtorInjectorProvider):
|
83
|
+
return BoxedLiteProvider(CtorProvider(
|
84
|
+
o.cls_,
|
85
|
+
))
|
86
|
+
|
87
|
+
elif isinstance(o, lij.ConstInjectorProvider):
|
88
|
+
return BoxedLiteProvider(ConstProvider(
|
89
|
+
o.v,
|
90
|
+
))
|
91
|
+
|
92
|
+
elif isinstance(o, lij.SingletonInjectorProvider):
|
93
|
+
blp = convert_from_lite(o.p)
|
94
|
+
check.none(blp.sc)
|
95
|
+
return dc.replace(
|
96
|
+
blp,
|
97
|
+
sc=Singleton(),
|
98
|
+
)
|
99
|
+
|
100
|
+
elif isinstance(o, lij.LinkInjectorProvider):
|
101
|
+
return BoxedLiteProvider(LinkProvider(
|
102
|
+
convert_from_lite(o.k),
|
103
|
+
))
|
104
|
+
|
105
|
+
elif isinstance(o, lij.ScopedInjectorProvider):
|
106
|
+
raise NotImplementedError
|
107
|
+
|
108
|
+
else:
|
109
|
+
raise TypeError(o)
|
110
|
+
|
111
|
+
else:
|
112
|
+
raise TypeError(o)
|
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:
|
omlish/iterators/unique.py
CHANGED
omlish/lang/classes/restrict.py
CHANGED
omlish/lang/classes/simple.py
CHANGED
omlish/lang/contextmanagers.py
CHANGED
omlish/lang/descriptors.py
CHANGED
@@ -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/imports/lazy.py
CHANGED