omlish 0.0.0.dev424__py3-none-any.whl → 0.0.0.dev426__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 (126) hide show
  1. omlish/__about__.py +3 -3
  2. omlish/c3.py +4 -1
  3. omlish/configs/processing/flattening.py +1 -1
  4. omlish/configs/processing/merging.py +8 -6
  5. omlish/dataclasses/impl/concerns/doc.py +1 -1
  6. omlish/dataclasses/impl/configs.py +2 -1
  7. omlish/diag/_pycharm/runhack.py +1 -1
  8. omlish/diag/procfs.py +2 -2
  9. omlish/formats/json/stream/lexing.py +69 -14
  10. omlish/formats/json/stream/parsing.py +1 -1
  11. omlish/formats/json/stream/utils.py +3 -0
  12. omlish/formats/json5/streams.py +22 -0
  13. omlish/formats/logfmt.py +8 -2
  14. omlish/funcs/genmachine.py +1 -1
  15. omlish/http/sse.py +1 -1
  16. omlish/inject/impl/injector.py +1 -1
  17. omlish/inject/impl/multis.py +2 -2
  18. omlish/inject/impl/providers.py +0 -4
  19. omlish/inject/impl/proxy.py +0 -2
  20. omlish/inject/scopes.py +0 -4
  21. omlish/io/buffers.py +1 -1
  22. omlish/lang/__init__.py +26 -14
  23. omlish/lang/asyncs.py +12 -0
  24. omlish/lang/{attrs.py → attrstorage.py} +15 -15
  25. omlish/lang/cached/property.py +2 -2
  26. omlish/lang/classes/simple.py +26 -4
  27. omlish/lang/collections.py +1 -1
  28. omlish/lang/functions.py +0 -11
  29. omlish/lang/iterables.py +2 -2
  30. omlish/lang/lazyglobals.py +27 -5
  31. omlish/lang/maysync.py +2 -2
  32. omlish/lifecycles/contextmanagers.py +1 -2
  33. omlish/lifecycles/controller.py +1 -2
  34. omlish/lite/asyncs.py +20 -0
  35. omlish/lite/attrops.py +332 -0
  36. omlish/lite/cached.py +1 -1
  37. omlish/lite/maybes.py +2 -0
  38. omlish/lite/strings.py +0 -7
  39. omlish/lite/timing.py +6 -3
  40. omlish/logs/all.py +25 -32
  41. omlish/logs/base.py +248 -0
  42. omlish/logs/callers.py +21 -15
  43. omlish/logs/infos.py +105 -0
  44. omlish/logs/levels.py +64 -0
  45. omlish/logs/modules.py +10 -0
  46. omlish/logs/protocols.py +31 -0
  47. omlish/logs/standard.py +12 -11
  48. omlish/logs/std/adapters.py +41 -0
  49. omlish/logs/std/configs.py +29 -0
  50. omlish/logs/{filters.py → std/filters.py} +1 -1
  51. omlish/logs/{handlers.py → std/handlers.py} +1 -1
  52. omlish/logs/{json.py → std/json.py} +2 -2
  53. omlish/logs/{proxy.py → std/proxy.py} +3 -3
  54. omlish/logs/std/records.py +286 -0
  55. omlish/logs/times.py +86 -0
  56. omlish/logs/typed/bindings.py +24 -0
  57. omlish/logs/utils.py +60 -4
  58. omlish/logs/warnings.py +8 -0
  59. omlish/manifests/loading.py +1 -1
  60. omlish/os/atomics.py +1 -1
  61. omlish/os/journald.py +3 -3
  62. omlish/reflect/types.py +22 -0
  63. omlish/testing/pytest/plugins/skips.py +0 -4
  64. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/METADATA +2 -2
  65. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/RECORD +72 -114
  66. omlish/defs.py +0 -216
  67. omlish/dispatch/_dispatch2.py +0 -69
  68. omlish/dispatch/_dispatch3.py +0 -108
  69. omlish/dynamic.py +0 -219
  70. omlish/formats/json/Json.g4 +0 -77
  71. omlish/formats/json/_antlr/JsonLexer.py +0 -109
  72. omlish/formats/json/_antlr/JsonListener.py +0 -61
  73. omlish/formats/json/_antlr/JsonParser.py +0 -457
  74. omlish/formats/json/_antlr/JsonVisitor.py +0 -42
  75. omlish/io/trampoline.py +0 -289
  76. omlish/lite/logs.py +0 -4
  77. omlish/lite/reprs.py +0 -85
  78. omlish/logs/abc.py +0 -319
  79. omlish/logs/color.py +0 -27
  80. omlish/logs/configs.py +0 -29
  81. omlish/logs/protocol.py +0 -218
  82. omlish/logs/timing.py +0 -58
  83. omlish/specs/irc/__init__.py +0 -0
  84. omlish/specs/irc/messages/__init__.py +0 -0
  85. omlish/specs/irc/messages/base.py +0 -49
  86. omlish/specs/irc/messages/formats.py +0 -92
  87. omlish/specs/irc/messages/messages.py +0 -774
  88. omlish/specs/irc/messages/parsing.py +0 -98
  89. omlish/specs/irc/numerics/__init__.py +0 -0
  90. omlish/specs/irc/numerics/formats.py +0 -97
  91. omlish/specs/irc/numerics/numerics.py +0 -865
  92. omlish/specs/irc/numerics/types.py +0 -59
  93. omlish/specs/irc/protocol/LICENSE +0 -11
  94. omlish/specs/irc/protocol/__init__.py +0 -61
  95. omlish/specs/irc/protocol/consts.py +0 -6
  96. omlish/specs/irc/protocol/errors.py +0 -30
  97. omlish/specs/irc/protocol/message.py +0 -21
  98. omlish/specs/irc/protocol/nuh.py +0 -55
  99. omlish/specs/irc/protocol/parsing.py +0 -158
  100. omlish/specs/irc/protocol/rendering.py +0 -153
  101. omlish/specs/irc/protocol/tags.py +0 -102
  102. omlish/specs/irc/protocol/utils.py +0 -30
  103. omlish/specs/proto/Protobuf3.g4 +0 -396
  104. omlish/specs/proto/__init__.py +0 -0
  105. omlish/specs/proto/_antlr/Protobuf3Lexer.py +0 -340
  106. omlish/specs/proto/_antlr/Protobuf3Listener.py +0 -448
  107. omlish/specs/proto/_antlr/Protobuf3Parser.py +0 -3909
  108. omlish/specs/proto/_antlr/Protobuf3Visitor.py +0 -257
  109. omlish/specs/proto/_antlr/__init__.py +0 -0
  110. omlish/specs/proto/nodes.py +0 -54
  111. omlish/specs/proto/parsing.py +0 -97
  112. omlish/sql/parsing/Minisql.g4 +0 -292
  113. omlish/sql/parsing/__init__.py +0 -0
  114. omlish/sql/parsing/_antlr/MinisqlLexer.py +0 -322
  115. omlish/sql/parsing/_antlr/MinisqlListener.py +0 -511
  116. omlish/sql/parsing/_antlr/MinisqlParser.py +0 -3763
  117. omlish/sql/parsing/_antlr/MinisqlVisitor.py +0 -292
  118. omlish/sql/parsing/_antlr/__init__.py +0 -0
  119. omlish/sql/parsing/parsing.py +0 -119
  120. /omlish/{.manifests.json → .omlish-manifests.json} +0 -0
  121. /omlish/{formats/json/_antlr → logs/std}/__init__.py +0 -0
  122. /omlish/logs/{noisy.py → std/noisy.py} +0 -0
  123. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/WHEEL +0 -0
  124. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/entry_points.txt +0 -0
  125. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/licenses/LICENSE +0 -0
  126. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev426.dist-info}/top_level.txt +0 -0
@@ -1,98 +0,0 @@
1
- import typing as ta
2
-
3
- from .... import dataclasses as dc
4
- from .base import Message
5
- from .formats import MessageFormat
6
-
7
-
8
- ##
9
-
10
-
11
- class ParseError(Exception):
12
- pass
13
-
14
-
15
- def parse_message(cls: type[Message], params: ta.Sequence[str]) -> Message:
16
- mf = cls.FORMAT
17
-
18
- kws: dict = {}
19
- i = 0
20
- for fp in mf.params:
21
- if isinstance(fp, MessageFormat.KwargParam):
22
- if i >= len(params):
23
- if not fp.optional:
24
- raise ParseError(f'Missing param: {fp.name}')
25
- continue
26
-
27
- kv: ta.Any
28
- if (ar := fp.arity) is MessageFormat.KwargParam.Arity.SINGLE:
29
- kv = params[i]
30
- i += 1
31
-
32
- elif ar is MessageFormat.KwargParam.Arity.VARIADIC:
33
- kv = params[i:]
34
- i = len(params)
35
-
36
- elif ar is MessageFormat.KwargParam.Arity.COMMA_LIST:
37
- kv = params[i].split(',')
38
- i += 1
39
-
40
- else:
41
- raise TypeError(ar)
42
-
43
- kws[fp.name] = kv
44
-
45
- elif isinstance(fp, MessageFormat.LiteralParam):
46
- if i >= len(params):
47
- raise ParseError('Missing literal param')
48
-
49
- pv = params[i]
50
- if fp.text != pv:
51
- raise ParseError(f'Unexpected literal: {pv}')
52
- i += 1
53
-
54
- else:
55
- raise TypeError(fp)
56
-
57
- if i != len(params):
58
- raise ParseError('Unconsumed params')
59
-
60
- if (up := mf.unpack_params) is not None:
61
- kws = dict(up(kws))
62
-
63
- return cls(**kws)
64
-
65
-
66
- ##
67
-
68
-
69
- class UnparsedMessage(ta.NamedTuple):
70
- name: str
71
- params: ta.Sequence[str]
72
-
73
-
74
- def unparse_message(msg: Message) -> UnparsedMessage:
75
- mf = msg.FORMAT
76
-
77
- kws = {k: v for k, v in dc.asdict(msg).items() if v is not None}
78
-
79
- if (up := mf.unpack_params) is not None:
80
- kws = dict(up.backward(kws))
81
-
82
- params = []
83
-
84
- for fp in mf.params:
85
- if isinstance(fp, MessageFormat.KwargParam):
86
- # FIXME
87
- raise NotImplementedError
88
-
89
- elif isinstance(fp, MessageFormat.LiteralParam):
90
- params.append(fp.text)
91
-
92
- else:
93
- raise TypeError(fp)
94
-
95
- return UnparsedMessage(
96
- name=mf.name,
97
- params=params,
98
- )
File without changes
@@ -1,97 +0,0 @@
1
- import dataclasses as dc
2
- import typing as ta
3
-
4
- from .... import check
5
- from .... import lang
6
-
7
-
8
- FormatPart: ta.TypeAlias = ta.Union[str, 'Formats.Optional', 'Formats.Variadic']
9
- FormatParts: ta.TypeAlias = ta.Sequence[FormatPart]
10
-
11
-
12
- ##
13
-
14
-
15
- class Formats(lang.Namespace):
16
- @dc.dataclass(frozen=True)
17
- class Name:
18
- name: str
19
-
20
- @dc.dataclass(frozen=True)
21
- class Optional:
22
- body: FormatParts
23
-
24
- @dc.dataclass(frozen=True)
25
- class Variadic:
26
- body: FormatParts
27
-
28
- #
29
-
30
- _PARTS_BY_DELIMITERS: ta.Mapping[tuple[str, str], type] = {
31
- ('[', ']'): Optional,
32
- ('{', '}'): Variadic,
33
- }
34
-
35
- _DELIMITERS_BY_PARTS: ta.Mapping[type, tuple[str, str]] = {v: k for k, v in _PARTS_BY_DELIMITERS.items()}
36
-
37
- #
38
-
39
- @staticmethod
40
- def split_parts(s: str) -> FormatParts:
41
- stk: list[tuple[str, list]] = [('', [])]
42
-
43
- p = 0
44
- while p < len(s):
45
- n = lang.find_any(s, '{}[]<', p)
46
-
47
- if n < 0:
48
- check.state(not stk[-1][0])
49
- stk[-1][1].append(s[p:])
50
- break
51
-
52
- if n != p:
53
- stk[-1][1].append(s[p:n])
54
-
55
- d = s[n]
56
- if d == '<':
57
- e = s.index('>', n)
58
- stk[-1][1].append(Formats.Name(s[n + 1:e]))
59
- p = e + 1
60
-
61
- elif d in '{[':
62
- stk.append((d, []))
63
- p = n + 1
64
-
65
- elif d in '}]':
66
- x, l = stk.pop()
67
- pc = Formats._PARTS_BY_DELIMITERS[(x, d)]
68
- stk[-1][1].append(pc(l))
69
- p = n + 1
70
-
71
- else:
72
- raise RuntimeError
73
-
74
- _, ret = check.single(stk)
75
- return ret
76
-
77
- #
78
-
79
- @staticmethod
80
- def render_parts(p: FormatPart | FormatParts) -> ta.Iterator[str]:
81
- if isinstance(p, str):
82
- yield p
83
-
84
- elif isinstance(p, Formats.Name):
85
- yield '<'
86
- yield p.name
87
- yield '>'
88
-
89
- elif isinstance(p, (Formats.Optional, Formats.Variadic)):
90
- l, r = Formats._DELIMITERS_BY_PARTS[type(p)]
91
- yield l
92
- yield from Formats.render_parts(p.body)
93
- yield r
94
-
95
- else:
96
- for c in p:
97
- yield from Formats.render_parts(c)