omlish 0.0.0.dev126__py3-none-any.whl → 0.0.0.dev127__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev126'
2
- __revision__ = '631da43a3ae4f71529271e291fc643834c85c462'
1
+ __version__ = '0.0.0.dev127'
2
+ __revision__ = '270ecbafef8e08ba95e97d41fdbf2b0f40df097f'
3
3
 
4
4
 
5
5
  #
@@ -13,7 +13,7 @@ from .coerce import ( # noqa
13
13
  frozenset_of,
14
14
  frozenset_of_or_none,
15
15
  frozenset_or_none,
16
- map,
16
+ map, # noqa
17
17
  map_of,
18
18
  map_of_or_none,
19
19
  map_or_none,
omlish/formats/props.py CHANGED
@@ -548,7 +548,7 @@ class Properties(collections.abc.MutableMapping):
548
548
  month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
549
549
  now = time.gmtime()
550
550
  print(
551
- '#%s %s %02d %02d:%02d:%02d UTC %04d' % (
551
+ '#%s %s %02d %02d:%02d:%02d UTC %04d' % ( # noqa
552
552
  day_of_week[now.tm_wday],
553
553
  month[now.tm_mon - 1],
554
554
  now.tm_mday,
omlish/http/consts.py CHANGED
@@ -11,7 +11,7 @@ import http
11
11
 
12
12
 
13
13
  def format_status(status: http.HTTPStatus) -> str:
14
- return '%d %s' % (int(status), status.phrase)
14
+ return f'{int(status)} {status.phrase}'
15
15
 
16
16
 
17
17
  STATUS_OK = format_status(http.HTTPStatus.OK)
@@ -10,12 +10,12 @@ import inspect
10
10
  import typing as ta
11
11
  import weakref
12
12
 
13
+ from ... import check
13
14
  from ... import reflect as rfl
14
15
  from ..exceptions import ConflictingKeyError
15
16
  from ..inspect import Kwarg
16
17
  from ..inspect import KwargsTarget
17
18
  from ..keys import Key
18
- from ..keys import as_key
19
19
  from ..types import Tag
20
20
 
21
21
 
@@ -72,15 +72,22 @@ def build_kwargs_target(
72
72
  obj: ta.Any,
73
73
  *,
74
74
  skip_args: int = 0,
75
- skip_kwargs: ta.Iterable[ta.Any] | None = None,
75
+ skip_kwargs: ta.Iterable[str] | None = None,
76
76
  raw_optional: bool = False,
77
77
  ) -> KwargsTarget:
78
78
  sig = signature(obj)
79
79
  tags = _TAGS.get(obj)
80
80
 
81
- seen: set[Key] = set(map(as_key, skip_kwargs)) if skip_kwargs is not None else set()
81
+ skip_names: set[str] = set()
82
+ if skip_kwargs is not None:
83
+ skip_names.update(check.not_isinstance(skip_kwargs, str))
84
+
85
+ seen: set[Key] = set()
82
86
  kws: list[Kwarg] = []
83
87
  for p in list(sig.parameters.values())[skip_args:]:
88
+ if p.name in skip_names:
89
+ continue
90
+
84
91
  if p.annotation is inspect.Signature.empty:
85
92
  if p.default is not inspect.Parameter.empty:
86
93
  raise KeyError(f'{obj}, {p.name}')
omlish/lang/__init__.py CHANGED
@@ -1,5 +1,3 @@
1
- # This module should import nothing but stdlib modules, and as few as possible. That *includes* lite - no using lite.
2
-
3
1
  from .cached import ( # noqa
4
2
  cached_function,
5
3
  cached_property,
@@ -219,14 +217,19 @@ from .timeouts import ( # noqa
219
217
  )
220
218
 
221
219
  from .typing import ( # noqa
222
- AnyFunc,
223
220
  BytesLike,
224
- Func0,
225
- Func1,
226
- Func2,
227
- Func3,
228
221
  SequenceNotStr,
229
222
  protocol_check,
230
223
  typed_lambda,
231
224
  typed_partial,
232
225
  )
226
+
227
+ ##
228
+
229
+ from ..lite.typing import ( # noqa
230
+ AnyFunc,
231
+ Func0,
232
+ Func1,
233
+ Func2,
234
+ Func3,
235
+ )
omlish/lang/typing.py CHANGED
@@ -5,7 +5,6 @@ TODO:
5
5
  - probably need to gen types per inst
6
6
  - typed_factory
7
7
  """
8
- import dataclasses as dc
9
8
  import functools
10
9
  import inspect
11
10
  import typing as ta
@@ -17,11 +16,6 @@ T = ta.TypeVar('T')
17
16
  T_co = ta.TypeVar('T_co', covariant=True)
18
17
  T_contra = ta.TypeVar('T_contra', contravariant=True)
19
18
 
20
- A0 = ta.TypeVar('A0')
21
- A1 = ta.TypeVar('A1')
22
- A2 = ta.TypeVar('A2')
23
-
24
-
25
19
  BytesLike: ta.TypeAlias = bytes | bytearray
26
20
 
27
21
 
@@ -102,50 +96,6 @@ def typed_partial(obj, **kw): # noqa
102
96
  return _update_wrapper_no_anns(lam, obj)
103
97
 
104
98
 
105
- ##
106
- # A workaround for typing deficiencies (like `Argument 2 to NewType(...) must be subclassable`).
107
-
108
-
109
- @dc.dataclass(frozen=True)
110
- class AnyFunc(ta.Generic[T]):
111
- fn: ta.Callable[..., T]
112
-
113
- def __call__(self, *args: ta.Any, **kwargs: ta.Any) -> T:
114
- return self.fn(*args, **kwargs)
115
-
116
-
117
- @dc.dataclass(frozen=True)
118
- class Func0(ta.Generic[T]):
119
- fn: ta.Callable[[], T]
120
-
121
- def __call__(self) -> T:
122
- return self.fn()
123
-
124
-
125
- @dc.dataclass(frozen=True)
126
- class Func1(ta.Generic[A0, T]):
127
- fn: ta.Callable[[A0], T]
128
-
129
- def __call__(self, a0: A0) -> T:
130
- return self.fn(a0)
131
-
132
-
133
- @dc.dataclass(frozen=True)
134
- class Func2(ta.Generic[A0, A1, T]):
135
- fn: ta.Callable[[A0, A1], T]
136
-
137
- def __call__(self, a0: A0, a1: A1) -> T:
138
- return self.fn(a0, a1)
139
-
140
-
141
- @dc.dataclass(frozen=True)
142
- class Func3(ta.Generic[A0, A1, A2, T]):
143
- fn: ta.Callable[[A0, A1, A2], T]
144
-
145
- def __call__(self, a0: A0, a1: A1, a2: A2) -> T:
146
- return self.fn(a0, a1, a2)
147
-
148
-
149
99
  ##
150
100
 
151
101
 
@@ -1,4 +1,39 @@
1
1
  # ruff: noqa: UP006 UP007
2
+ # PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
3
+ # --------------------------------------------
4
+ #
5
+ # 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization
6
+ # ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated
7
+ # documentation.
8
+ #
9
+ # 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive,
10
+ # royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative
11
+ # works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License
12
+ # Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
13
+ # 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation; All Rights Reserved" are retained in Python
14
+ # alone or in any derivative version prepared by Licensee.
15
+ #
16
+ # 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and
17
+ # wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in
18
+ # any such work a brief summary of the changes made to Python.
19
+ #
20
+ # 4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES,
21
+ # EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY
22
+ # OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY
23
+ # RIGHTS.
24
+ #
25
+ # 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL
26
+ # DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF
27
+ # ADVISED OF THE POSSIBILITY THEREOF.
28
+ #
29
+ # 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
30
+ #
31
+ # 7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint
32
+ # venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade
33
+ # name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
34
+ #
35
+ # 8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this
36
+ # License Agreement.
2
37
  import abc
3
38
  import http.client
4
39
  import http.server
omlish/lite/inject.py CHANGED
@@ -14,10 +14,10 @@ from .maybes import Maybe
14
14
  from .reflect import get_optional_alias_arg
15
15
  from .reflect import is_new_type
16
16
  from .reflect import is_optional_alias
17
- from .typing import Func
18
17
 
19
18
 
20
19
  T = ta.TypeVar('T')
20
+ U = ta.TypeVar('U')
21
21
 
22
22
  InjectorKeyCls = ta.Union[type, ta.NewType]
23
23
 
@@ -90,11 +90,23 @@ class Injector(abc.ABC):
90
90
  raise NotImplementedError
91
91
 
92
92
  @abc.abstractmethod
93
- def provide_kwargs(self, obj: ta.Any) -> ta.Mapping[str, ta.Any]:
93
+ def provide_kwargs(
94
+ self,
95
+ obj: ta.Any,
96
+ *,
97
+ skip_args: int = 0,
98
+ skip_kwargs: ta.Optional[ta.Iterable[ta.Any]] = None,
99
+ ) -> ta.Mapping[str, ta.Any]:
94
100
  raise NotImplementedError
95
101
 
96
102
  @abc.abstractmethod
97
- def inject(self, obj: ta.Any) -> ta.Any:
103
+ def inject(
104
+ self,
105
+ obj: ta.Any,
106
+ *,
107
+ args: ta.Optional[ta.Sequence[ta.Any]] = None,
108
+ kwargs: ta.Optional[ta.Mapping[str, ta.Any]] = None,
109
+ ) -> ta.Any:
98
110
  raise NotImplementedError
99
111
 
100
112
  def __getitem__(
@@ -108,8 +120,12 @@ class Injector(abc.ABC):
108
120
  # exceptions
109
121
 
110
122
 
123
+ class InjectorError(Exception):
124
+ pass
125
+
126
+
111
127
  @dc.dataclass(frozen=True)
112
- class InjectorKeyError(Exception):
128
+ class InjectorKeyError(InjectorError):
113
129
  key: InjectorKey
114
130
 
115
131
  source: ta.Any = None
@@ -316,29 +332,49 @@ def build_injector_provider_map(bs: InjectorBindings) -> ta.Mapping[InjectorKey,
316
332
  # inspection
317
333
 
318
334
 
319
- # inspect.signature(eval_str=True) was added in 3.10 and we have to support 3.8, so we have to get_type_hints to eval
320
- # str annotations *in addition to* getting the signature for parameter information.
321
335
  class _InjectionInspection(ta.NamedTuple):
322
336
  signature: inspect.Signature
323
337
  type_hints: ta.Mapping[str, ta.Any]
338
+ args_offset: int
324
339
 
325
340
 
326
341
  _INJECTION_INSPECTION_CACHE: ta.MutableMapping[ta.Any, _InjectionInspection] = weakref.WeakKeyDictionary()
327
342
 
328
343
 
329
344
  def _do_injection_inspect(obj: ta.Any) -> _InjectionInspection:
330
- uw = obj
345
+ tgt = obj
346
+ if isinstance(tgt, type) and tgt.__init__ is not object.__init__: # type: ignore[misc]
347
+ # Python 3.8's inspect.signature can't handle subclasses overriding __new__, always generating *args/**kwargs.
348
+ # - https://bugs.python.org/issue40897
349
+ # - https://github.com/python/cpython/commit/df7c62980d15acd3125dfbd81546dad359f7add7
350
+ tgt = tgt.__init__ # type: ignore[misc]
351
+ has_generic_base = True
352
+ else:
353
+ has_generic_base = False
354
+
355
+ # inspect.signature(eval_str=True) was added in 3.10 and we have to support 3.8, so we have to get_type_hints to
356
+ # eval str annotations *in addition to* getting the signature for parameter information.
357
+ uw = tgt
358
+ has_partial = False
331
359
  while True:
332
360
  if isinstance(uw, functools.partial):
361
+ has_partial = True
333
362
  uw = uw.func
334
363
  else:
335
364
  if (uw2 := inspect.unwrap(uw)) is uw:
336
365
  break
337
366
  uw = uw2
338
367
 
368
+ if has_generic_base and has_partial:
369
+ raise InjectorError(
370
+ 'Injector inspection does not currently support both a typing.Generic base and a functools.partial: '
371
+ f'{obj}',
372
+ )
373
+
339
374
  return _InjectionInspection(
340
- inspect.signature(obj),
375
+ inspect.signature(tgt),
341
376
  ta.get_type_hints(uw),
377
+ 1 if has_generic_base else 0,
342
378
  )
343
379
 
344
380
 
@@ -369,14 +405,23 @@ def build_injection_kwargs_target(
369
405
  obj: ta.Any,
370
406
  *,
371
407
  skip_args: int = 0,
372
- skip_kwargs: ta.Optional[ta.Iterable[ta.Any]] = None,
408
+ skip_kwargs: ta.Optional[ta.Iterable[str]] = None,
373
409
  raw_optional: bool = False,
374
410
  ) -> InjectionKwargsTarget:
375
411
  insp = _injection_inspect(obj)
376
412
 
377
- seen: ta.Set[InjectorKey] = set(map(as_injector_key, skip_kwargs)) if skip_kwargs is not None else set()
413
+ params = list(insp.signature.parameters.values())
414
+
415
+ skip_names: ta.Set[str] = set()
416
+ if skip_kwargs is not None:
417
+ skip_names.update(check_not_isinstance(skip_kwargs, str))
418
+
419
+ seen: ta.Set[InjectorKey] = set()
378
420
  kws: ta.List[InjectionKwarg] = []
379
- for p in list(insp.signature.parameters.values())[skip_args:]:
421
+ for p in params[insp.args_offset + skip_args:]:
422
+ if p.name in skip_names:
423
+ continue
424
+
380
425
  if p.annotation is inspect.Signature.empty:
381
426
  if p.default is not inspect.Parameter.empty:
382
427
  raise KeyError(f'{obj}, {p.name}')
@@ -385,6 +430,7 @@ def build_injection_kwargs_target(
385
430
  if p.kind not in (inspect.Parameter.POSITIONAL_OR_KEYWORD, inspect.Parameter.KEYWORD_ONLY):
386
431
  raise TypeError(insp)
387
432
 
433
+ # 3.8 inspect.signature doesn't eval_str but typing.get_type_hints does, so prefer that.
388
434
  ann = insp.type_hints.get(p.name, p.annotation)
389
435
  if (
390
436
  not raw_optional and
@@ -452,8 +498,19 @@ class _Injector(Injector):
452
498
  return v.must()
453
499
  raise UnboundInjectorKeyError(key)
454
500
 
455
- def provide_kwargs(self, obj: ta.Any) -> ta.Mapping[str, ta.Any]:
456
- kt = build_injection_kwargs_target(obj)
501
+ def provide_kwargs(
502
+ self,
503
+ obj: ta.Any,
504
+ *,
505
+ skip_args: int = 0,
506
+ skip_kwargs: ta.Optional[ta.Iterable[ta.Any]] = None,
507
+ ) -> ta.Mapping[str, ta.Any]:
508
+ kt = build_injection_kwargs_target(
509
+ obj,
510
+ skip_args=skip_args,
511
+ skip_kwargs=skip_kwargs,
512
+ )
513
+
457
514
  ret: ta.Dict[str, ta.Any] = {}
458
515
  for kw in kt.kwargs:
459
516
  if kw.has_default:
@@ -465,9 +522,24 @@ class _Injector(Injector):
465
522
  ret[kw.name] = v
466
523
  return ret
467
524
 
468
- def inject(self, obj: ta.Any) -> ta.Any:
469
- kws = self.provide_kwargs(obj)
470
- return obj(**kws)
525
+ def inject(
526
+ self,
527
+ obj: ta.Any,
528
+ *,
529
+ args: ta.Optional[ta.Sequence[ta.Any]] = None,
530
+ kwargs: ta.Optional[ta.Mapping[str, ta.Any]] = None,
531
+ ) -> ta.Any:
532
+ provided = self.provide_kwargs(
533
+ obj,
534
+ skip_args=len(args) if args is not None else 0,
535
+ skip_kwargs=kwargs if kwargs is not None else None,
536
+ )
537
+
538
+ return obj(
539
+ *(args if args is not None else ()),
540
+ **(kwargs if kwargs is not None else {}),
541
+ **provided,
542
+ )
471
543
 
472
544
 
473
545
  ###
@@ -606,16 +678,42 @@ class InjectorBinder:
606
678
 
607
679
 
608
680
  def make_injector_factory(
609
- factory_cls: ta.Any,
610
- factory_fn: ta.Callable[..., T],
611
- ) -> ta.Callable[..., Func[T]]:
612
- def outer(injector: Injector) -> factory_cls:
681
+ fn: ta.Callable[..., T],
682
+ cls: U,
683
+ ann: ta.Any = None,
684
+ ) -> ta.Callable[..., U]:
685
+ if ann is None:
686
+ ann = cls
687
+
688
+ def outer(injector: Injector) -> ann:
613
689
  def inner(*args, **kwargs):
614
- return injector.inject(functools.partial(factory_fn, *args, **kwargs))
615
- return Func(inner)
690
+ return injector.inject(fn, args=args, kwargs=kwargs)
691
+ return cls(inner) # type: ignore
692
+
616
693
  return outer
617
694
 
618
695
 
696
+ def make_injector_array_type(
697
+ ele: ta.Union[InjectorKey, InjectorKeyCls],
698
+ cls: U,
699
+ ann: ta.Any = None,
700
+ ) -> ta.Callable[..., U]:
701
+ if isinstance(ele, InjectorKey):
702
+ if not ele.array:
703
+ raise InjectorError('Provided key must be array', ele)
704
+ key = ele
705
+ else:
706
+ key = dc.replace(as_injector_key(ele), array=True)
707
+
708
+ if ann is None:
709
+ ann = cls
710
+
711
+ def inner(injector: Injector) -> ann:
712
+ return cls(injector.provide(key)) # type: ignore[operator]
713
+
714
+ return inner
715
+
716
+
619
717
  ##
620
718
 
621
719
 
@@ -650,8 +748,8 @@ class Injection:
650
748
  # injector
651
749
 
652
750
  @classmethod
653
- def create_injector(cls, *args: InjectorBindingOrBindings, p: ta.Optional[Injector] = None) -> Injector:
654
- return _Injector(as_injector_bindings(*args), p)
751
+ def create_injector(cls, *args: InjectorBindingOrBindings, parent: ta.Optional[Injector] = None) -> Injector:
752
+ return _Injector(as_injector_bindings(*args), parent)
655
753
 
656
754
  # binder
657
755
 
@@ -691,10 +789,20 @@ class Injection:
691
789
  @classmethod
692
790
  def bind_factory(
693
791
  cls,
694
- factory_cls: ta.Any,
695
- factory_fn: ta.Callable[..., T],
792
+ fn: ta.Callable[..., T],
793
+ cls_: U,
794
+ ann: ta.Any = None,
795
+ ) -> InjectorBindingOrBindings:
796
+ return cls.bind(make_injector_factory(fn, cls_, ann))
797
+
798
+ @classmethod
799
+ def bind_array_type(
800
+ cls,
801
+ ele: ta.Union[InjectorKey, InjectorKeyCls],
802
+ cls_: U,
803
+ ann: ta.Any = None,
696
804
  ) -> InjectorBindingOrBindings:
697
- return cls.bind(make_injector_factory(factory_cls, factory_fn))
805
+ return cls.bind(make_injector_array_type(ele, cls_, ann))
698
806
 
699
807
 
700
808
  inj = Injection
omlish/lite/logs.py CHANGED
@@ -92,7 +92,7 @@ class StandardLogFormatter(logging.Formatter):
92
92
  return ct.strftime(datefmt) # noqa
93
93
  else:
94
94
  t = ct.strftime('%Y-%m-%d %H:%M:%S')
95
- return '%s.%03d' % (t, record.msecs)
95
+ return '%s.%03d' % (t, record.msecs) # noqa
96
96
 
97
97
 
98
98
  ##
omlish/lite/typing.py CHANGED
@@ -4,10 +4,50 @@ import typing as ta
4
4
 
5
5
  T = ta.TypeVar('T')
6
6
 
7
+ A0 = ta.TypeVar('A0')
8
+ A1 = ta.TypeVar('A1')
9
+ A2 = ta.TypeVar('A2')
10
+
11
+
12
+ ##
13
+ # A workaround for typing deficiencies (like `Argument 2 to NewType(...) must be subclassable`).
14
+
7
15
 
8
16
  @dc.dataclass(frozen=True)
9
- class Func(ta.Generic[T]):
17
+ class AnyFunc(ta.Generic[T]):
10
18
  fn: ta.Callable[..., T]
11
19
 
12
20
  def __call__(self, *args: ta.Any, **kwargs: ta.Any) -> T:
13
21
  return self.fn(*args, **kwargs)
22
+
23
+
24
+ @dc.dataclass(frozen=True)
25
+ class Func0(ta.Generic[T]):
26
+ fn: ta.Callable[[], T]
27
+
28
+ def __call__(self) -> T:
29
+ return self.fn()
30
+
31
+
32
+ @dc.dataclass(frozen=True)
33
+ class Func1(ta.Generic[A0, T]):
34
+ fn: ta.Callable[[A0], T]
35
+
36
+ def __call__(self, a0: A0) -> T:
37
+ return self.fn(a0)
38
+
39
+
40
+ @dc.dataclass(frozen=True)
41
+ class Func2(ta.Generic[A0, A1, T]):
42
+ fn: ta.Callable[[A0, A1], T]
43
+
44
+ def __call__(self, a0: A0, a1: A1) -> T:
45
+ return self.fn(a0, a1)
46
+
47
+
48
+ @dc.dataclass(frozen=True)
49
+ class Func3(ta.Generic[A0, A1, A2, T]):
50
+ fn: ta.Callable[[A0, A1, A2], T]
51
+
52
+ def __call__(self, a0: A0, a1: A1, a2: A2) -> T:
53
+ return self.fn(a0, a1, a2)
@@ -33,7 +33,7 @@ from . import lexer # noqa
33
33
  from . import parser # noqa
34
34
 
35
35
  from .parser import ( # noqa
36
- compile,
36
+ compile, # noqa
37
37
  search,
38
38
  )
39
39
 
@@ -11,7 +11,7 @@ from .exceptions import JmespathTypeError
11
11
  from .exceptions import JmespathValueError
12
12
  from .exceptions import ParseError
13
13
  from .exceptions import UnknownFunctionError
14
- from .parser import compile
14
+ from .parser import compile # noqa
15
15
  from .parser import search
16
16
  from .visitor import node_type
17
17
 
omlish/text/asdl.py CHANGED
@@ -403,7 +403,7 @@ class AsdlParser:
403
403
  * Reads in the next token
404
404
  """
405
405
 
406
- if isinstance(kind, tuple) and self.cur().kind in kind or self.cur().kind == kind:
406
+ if (isinstance(kind, tuple) and self.cur().kind in kind) or self.cur().kind == kind:
407
407
  value = self.cur().value
408
408
  self._advance()
409
409
  return value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omlish
3
- Version: 0.0.0.dev126
3
+ Version: 0.0.0.dev127
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=CxGnj-UiRPlZgmgWoovDWrOnqpSEmBy_kqA7cdfSA3w,1431
2
- omlish/__about__.py,sha256=zO48N_--bB6Un4-OfQz5_MvQF-ggb0OnlqmEkL-klKM,3379
2
+ omlish/__about__.py,sha256=frpDk6-FPhjy0H_urrYbYkCvemnqGrhQd5huAIICeVY,3379
3
3
  omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
4
4
  omlish/argparse.py,sha256=cqKGAqcxuxv_s62z0gq29L9KAvg_3-_rFvXKjVpRJjo,8126
5
5
  omlish/c3.py,sha256=ubu7lHwss5V4UznbejAI0qXhXahrU01MysuHOZI9C4U,8116
@@ -95,7 +95,7 @@ omlish/bootstrap/harness.py,sha256=VW8YP-yENGyXIuJ8GL_xintArF13nafwpz-iAghPt34,1
95
95
  omlish/bootstrap/main.py,sha256=yZhOHDDlj4xB5a89dRdT8z58FsqqnpoBg1-tvY2CJe4,5903
96
96
  omlish/bootstrap/marshal.py,sha256=ZxdAeMNd2qXRZ1HUK89HmEhz8tqlS9OduW34QBscKw0,516
97
97
  omlish/bootstrap/sys.py,sha256=iLHUNIuIPv-k-Mc6aHj5sSET78olCVt7t0HquFDO4iQ,8762
98
- omlish/collections/__init__.py,sha256=qIznS1cnXBxQsZk871DDWOnQfxk_u1PZ_VuIWxqPuxw,2134
98
+ omlish/collections/__init__.py,sha256=zeUvcAz073ekko37QKya6sElTMfKTuF1bKrdbMtaRpI,2142
99
99
  omlish/collections/_abc.py,sha256=sP7BpTVhx6s6C59mTFeosBi4rHOWC6tbFBYbxdZmvh0,2365
100
100
  omlish/collections/coerce.py,sha256=o11AMrUiyoadd8WkdqeKPIpXf2xd0LyylzNCyJivCLU,7036
101
101
  omlish/collections/exceptions.py,sha256=shcS-NCnEUudF8qC_SmO2TQyjivKlS4TDjaz_faqQ0c,44
@@ -179,7 +179,7 @@ omlish/docker/hub.py,sha256=7LIuJGdA-N1Y1dmo50ynKM1KUTcnQM_5XbtPbdT_QLU,3940
179
179
  omlish/docker/manifests.py,sha256=LR4FpOGNUT3bZQ-gTjB6r_-1C3YiG30QvevZjrsVUQM,7068
180
180
  omlish/formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
181
181
  omlish/formats/dotenv.py,sha256=orf37G11RM6Z6MxjBWbFAntwT8fi-ptkjN4EWoTeAsA,17689
182
- omlish/formats/props.py,sha256=JwFJbKblqzqnzXf7YKFzQSDfcAXzkKsfoYvad6FPy98,18945
182
+ omlish/formats/props.py,sha256=cek3JLFLIrpE76gvs8rs_B8yF4SpY8ooDH8apWsquwE,18953
183
183
  omlish/formats/xml.py,sha256=ggiOwSERt4d9XmZwLZiDIh5qnFJS4jdmow9m9_9USps,1491
184
184
  omlish/formats/yaml.py,sha256=wTW8ECG9jyA7qIFUqKZUro4KAKpN4IvcW_qhlrKveXM,6836
185
185
  omlish/formats/json/__init__.py,sha256=y7T-Jm-7FuQFzb-6uedky0ZhBaKtCKzcu291juXfiWI,669
@@ -221,7 +221,7 @@ omlish/graphs/dot/utils.py,sha256=_FMwn77WfiiAfLsRTOKWm4IYbNv5kQN22YJ5psw6CWg,80
221
221
  omlish/http/__init__.py,sha256=OqCovZi_jv1Mnk975idaXA8FCGy4laoQIvNZ3hdKpRQ,722
222
222
  omlish/http/asgi.py,sha256=wXhBZ21bEl32Kv9yBrRwUR_7pHEgVtHP8ZZwbasQ6-4,3307
223
223
  omlish/http/clients.py,sha256=WRtCNIt9Y790xpem69HiXJY9W-vPlpGPKZwpHusa2EE,6280
224
- omlish/http/consts.py,sha256=5GngtFFmmdPpIbioE5kt38sAZqIdHHeiqE7u5KKMOxU,2295
224
+ omlish/http/consts.py,sha256=7BJ4D1MdIvqBcepkgCfBFHolgTwbOlqsOEiee_IjxOA,2289
225
225
  omlish/http/cookies.py,sha256=uuOYlHR6e2SC3GM41V0aozK10nef9tYg83Scqpn5-HM,6351
226
226
  omlish/http/dates.py,sha256=Otgp8wRxPgNGyzx8LFowu1vC4EKJYARCiAwLFncpfHM,2875
227
227
  omlish/http/encodings.py,sha256=w2WoKajpaZnQH8j-IBvk5ZFL2O2pAU_iBvZnkocaTlw,164
@@ -255,7 +255,7 @@ omlish/inject/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
255
255
  omlish/inject/impl/bindings.py,sha256=8H586RCgmvwq53XBL9WMbb-1-Tdw_hh9zxIDCwcHA1c,414
256
256
  omlish/inject/impl/elements.py,sha256=bJBbHce_eZyIua2wbcejMwd9Uv-QeYcQ-c5N1qOXSmU,5950
257
257
  omlish/inject/impl/injector.py,sha256=WxIVOF6zvipb44302_j-xQZt8vnNCY0gdLX6UWzslXI,7550
258
- omlish/inject/impl/inspect.py,sha256=yZzqx2R9Ddn1EDJuwsu2r8APvJ42jGQP11ewtbIKD_s,3002
258
+ omlish/inject/impl/inspect.py,sha256=J0d2HJ-Z2-cHD4mJ0Kf5oJCOa2bMVG68Oh0Mhe3Cay4,3120
259
259
  omlish/inject/impl/multis.py,sha256=rRIWNCiTGaSWQUz_jxEy8LUmzdJDAlG94sLHYDS-ncg,2048
260
260
  omlish/inject/impl/origins.py,sha256=-cdcwz3BWb5LuC9Yn5ynYOwyPsKH06-kCc-3U0PxZ5w,1640
261
261
  omlish/inject/impl/privates.py,sha256=alpCYyk5VJ9lJknbRH2nLVNFYVvFhkj-VC1Vco3zCFQ,2613
@@ -266,7 +266,7 @@ omlish/io/__init__.py,sha256=aaIEsXTSfytW-oEkUWczdUJ_ifFY7ihIpyidIbfjkwY,56
266
266
  omlish/io/_abc.py,sha256=Cxs8KB1B_69rxpUYxI-MTsilAmNooJJn3w07DKqYKkE,1255
267
267
  omlish/io/pyio.py,sha256=YB3g6yg64MzcFwbzKBo4adnbsbZ3FZMlOZfjNtWmYoc,95316
268
268
  omlish/io/trampoline.py,sha256=oUKTQg1F5xQS1431Kt7MbK-NZpX509ubcXU-s86xJr8,7171
269
- omlish/lang/__init__.py,sha256=91OtPj-DbKKX1VI-gMlPMlNYWgkj227cgNBxL7Rp8R0,3836
269
+ omlish/lang/__init__.py,sha256=f7FZLBp3n_edtP5EBK2NoEOi01MIgVs51Z-MbmLsLR8,3760
270
270
  omlish/lang/cached.py,sha256=92TvRZQ6sWlm7dNn4hgl7aWKbX0J1XUEo3DRjBpgVQk,7834
271
271
  omlish/lang/clsdct.py,sha256=AjtIWLlx2E6D5rC97zQ3Lwq2SOMkbg08pdO_AxpzEHI,1744
272
272
  omlish/lang/cmp.py,sha256=5vbzWWbqdzDmNKAGL19z6ZfUKe5Ci49e-Oegf9f4BsE,1346
@@ -284,7 +284,7 @@ omlish/lang/resources.py,sha256=yywDWhh0tsgw24l7mHYv49ll4oZS8Kc8MSCa8f4UbbI,2280
284
284
  omlish/lang/strings.py,sha256=BsciSYnckD4vGtC6kmtnugR9IN6CIHdcjO4nZu-pSAw,3898
285
285
  omlish/lang/sys.py,sha256=UoZz_PJYVKLQAKqYxxn-LHz1okK_38I__maZgnXMcxU,406
286
286
  omlish/lang/timeouts.py,sha256=vECdWYhc_IZgcal1Ng1Y42wf2FV3KAx-i8As-MgGHIQ,1186
287
- omlish/lang/typing.py,sha256=W4PpjAbCDmNefVIc3kOAXPGvUTUHlSxuzGicqGUeKJY,4345
287
+ omlish/lang/typing.py,sha256=Zdad9Zv0sa-hIaUXPrzPidT7sDVpRcussAI7D-j-I1c,3296
288
288
  omlish/lang/classes/__init__.py,sha256=D3dn4FOQu5f50kW4_jLCI_zI0fTtADdYumirRdIqSuU,605
289
289
  omlish/lang/classes/abstract.py,sha256=19jsUEJUSTkQkXnMvjGbokfq-Z4jXFOd_tT76jSu5I0,3362
290
290
  omlish/lang/classes/restrict.py,sha256=pSK7ZT_kpwqS6lWRrxwuEe-tt07F0-uZVazgGh-HDco,3921
@@ -303,11 +303,11 @@ omlish/lite/cached.py,sha256=Fs-ljXVJmHBjAaHc-JuJXMEV4MNSX5c_KHZIM3AEaIw,694
303
303
  omlish/lite/check.py,sha256=1mo1GK78Ro5-IC_jUrmNabmt--hz_9v1y5h28K2cqUY,1102
304
304
  omlish/lite/contextmanagers.py,sha256=_jfNdpYvxkbKwyjQLbK-o69W89GoEuUfl_NrCosE9lU,1308
305
305
  omlish/lite/docker.py,sha256=3IVZZtIm7-UdB2SwArmN_MosTva1_KifyYp3YWjODbE,337
306
- omlish/lite/inject.py,sha256=A1rAqiHXF7hhol_ggHnvINnDxKc1zZkh62Ufb1o9x9Y,17422
306
+ omlish/lite/inject.py,sha256=NTZl6VXhYDILPMm1zBx-CbqF7Vkpxv9w1JVKqmmUp5w,20407
307
307
  omlish/lite/io.py,sha256=lcpI1cS_Kn90tvYMg8ZWkSlYloS4RFqXCk-rKyclhdg,3148
308
308
  omlish/lite/journald.py,sha256=f5Y2Q6-6O3iK_7MoGiwZwoQEOcP7LfkxxQNUR9tMjJM,3882
309
309
  omlish/lite/json.py,sha256=7-02Ny4fq-6YAu5ynvqoijhuYXWpLmfCI19GUeZnb1c,740
310
- omlish/lite/logs.py,sha256=tw7mbQslkyo9LopfgQnj0tYiqJ9TDNiw7D07aF7Dm2g,6176
310
+ omlish/lite/logs.py,sha256=1pcGu0ekhVCcLUckLSP16VccnAoprjtl5Vkdfm7y1Wg,6184
311
311
  omlish/lite/marshal.py,sha256=SyYMsJ-TaGO9FX7LykBB0WtqsqetX9eLBotPiz3M_xg,9478
312
312
  omlish/lite/maybes.py,sha256=7OlHJ8Q2r4wQ-aRbZSlJY7x0e8gDvufFdlohGEIJ3P4,833
313
313
  omlish/lite/pidfile.py,sha256=PRSDOAXmNkNwxh-Vwif0Nrs8RAmWroiNhLKIbdjwzBc,1723
@@ -318,11 +318,11 @@ omlish/lite/socket.py,sha256=7OYgkXTcQv0wq7TQuLnl9y6dJA1ZT6Vbc1JH59QlxgY,1792
318
318
  omlish/lite/socketserver.py,sha256=Esy9dAo9dPnNavNx5hW52YZi5hv504a8XQUudMrPs2A,1595
319
319
  omlish/lite/strings.py,sha256=QURcE4-1pKVW8eT_5VCJpXaHDWR2dW2pYOChTJnZDiQ,1504
320
320
  omlish/lite/subprocesses.py,sha256=_YwUpvfaC2pV5TMC9-Ivuw1Ao-YxteD3a1NQwGERft4,3380
321
- omlish/lite/typing.py,sha256=WNayHqzE2yrpxBTt1roQDKm45Prk5d1Bb2JDZZraKuQ,254
321
+ omlish/lite/typing.py,sha256=U3-JaEnkDSYxK4tsu_MzUn3RP6qALBe5FXQXpD-licE,1090
322
322
  omlish/lite/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
323
323
  omlish/lite/http/coroserver.py,sha256=aBaYjP80yQHQxPxwi7PTYHub-fdRDKsMnB-tM8lBc2o,18095
324
324
  omlish/lite/http/handlers.py,sha256=Yu0P3nqz-frklwCM2PbiWvoJNE-NqeTFLBvpNpqcdtA,753
325
- omlish/lite/http/parsing.py,sha256=QWD0CbAABAeltjIy1ohWn7Ro1q8FJzgPUdE1tHnpQHY,11455
325
+ omlish/lite/http/parsing.py,sha256=jLdbBTQQhKU701j3_Ixl77nQE3rZld2qbJNAFhuW_cc,13977
326
326
  omlish/lite/http/versions.py,sha256=M6WhZeeyun-3jL_NCViNONOfLCiApuFOfe5XNJwzSvw,394
327
327
  omlish/logs/__init__.py,sha256=FbOyAW-lGH8gyBlSVArwljdYAU6RnwZLI5LwAfuNnrk,438
328
328
  omlish/logs/_abc.py,sha256=rWySJcr1vatu-AR1EYtODRhi-TjFaixqUzXeWg1c0GA,8006
@@ -381,10 +381,10 @@ omlish/secrets/secrets.py,sha256=cnDGBoPknVxsCN04_gqcJT_7Ebk3iO3VPkRZ2oMjkMw,786
381
381
  omlish/secrets/subprocesses.py,sha256=EcnKlHHtnUMHGrBWXDfu8tv28wlgZx4P4GOiuPW9Vo8,1105
382
382
  omlish/specs/__init__.py,sha256=zZwF8yXTEkSstYtORkDhVLK-_hWU8WOJCuBpognb_NY,118
383
383
  omlish/specs/jmespath/LICENSE,sha256=IH-ZZlZkS8XMkf_ubNVD1aYHQ2l_wd0tmHtXrCcYpRU,1113
384
- omlish/specs/jmespath/__init__.py,sha256=MfBlUXNSPq5pRyboMgBk8JoIj0lQo-2TQ6Re7IwGQK0,2079
384
+ omlish/specs/jmespath/__init__.py,sha256=9tsrquw1kXe1KAhTP3WeL0GlGBiTguQVxsC-lUYTWP4,2087
385
385
  omlish/specs/jmespath/__main__.py,sha256=wIXm6bs08etNG_GZlN2rBkADPb0rKfL2HSkm8spnpxw,200
386
386
  omlish/specs/jmespath/ast.py,sha256=XhcUGodHIdsY3-hVZEfpeW6LBehRjLbxVFXkMfZhRdk,5386
387
- omlish/specs/jmespath/cli.py,sha256=Lw57Eq5rmpwTwsvOzNmce_-XyoM84OIx5cuPgjUXNb0,2197
387
+ omlish/specs/jmespath/cli.py,sha256=RYVTFVEwIFFZ8jYOsvaadzyFmweZxpENQfCe79iMa5U,2205
388
388
  omlish/specs/jmespath/exceptions.py,sha256=Co1HiUBPFNwFgZY3FV_ayuZoSgZIAmDcImImxauYNxc,4435
389
389
  omlish/specs/jmespath/functions.py,sha256=lE_MlW5rDQirDCE9HtcAG-17kuHhH36RaPaQfk97xDY,22595
390
390
  omlish/specs/jmespath/lexer.py,sha256=hlPGCXPzGhd9ySj-z2cGTbyC9z3e0Io78IMYJZSEwNk,12647
@@ -476,15 +476,15 @@ omlish/testing/pytest/plugins/spacing.py,sha256=JQQhi9q3c523Ro1a_K_9RGAb7HotiO74
476
476
  omlish/testing/pytest/plugins/switches.py,sha256=hqFYM6tCcr-6fAPg8DBI-TJn762Kq4EUFt6gjXgiAQQ,3802
477
477
  omlish/testing/pytest/plugins/utils.py,sha256=L5C622UXcA_AUKDcvyh5IMiRfqSGGz0McdhwZWvfMlU,261
478
478
  omlish/text/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
479
- omlish/text/asdl.py,sha256=3v5UocAfxan_d9drkGNdH3AMfx_FFBpQu3ULGL4M6VM,16865
479
+ omlish/text/asdl.py,sha256=AS3irh-sag5pqyH3beJif78PjCbOaFso1NeKq-HXuTs,16867
480
480
  omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
481
481
  omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
482
482
  omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
483
483
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
484
484
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
485
- omlish-0.0.0.dev126.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
486
- omlish-0.0.0.dev126.dist-info/METADATA,sha256=FKuQ1AMbnI2zzwtuJgbcVRYa8BZSt8SpEcCW6SYdT1o,4173
487
- omlish-0.0.0.dev126.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
488
- omlish-0.0.0.dev126.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
489
- omlish-0.0.0.dev126.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
490
- omlish-0.0.0.dev126.dist-info/RECORD,,
485
+ omlish-0.0.0.dev127.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
486
+ omlish-0.0.0.dev127.dist-info/METADATA,sha256=nPexn3qC06UA2g2k3-RnVI-T3TCJWMELnpT0xtYgY60,4173
487
+ omlish-0.0.0.dev127.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
488
+ omlish-0.0.0.dev127.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
489
+ omlish-0.0.0.dev127.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
490
+ omlish-0.0.0.dev127.dist-info/RECORD,,