omlish 0.0.0.dev424__py3-none-any.whl → 0.0.0.dev425__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 (96) hide show
  1. omlish/__about__.py +3 -3
  2. omlish/dataclasses/impl/configs.py +2 -1
  3. omlish/formats/json/stream/lexing.py +8 -0
  4. omlish/formats/json/stream/utils.py +3 -0
  5. omlish/formats/json5/streams.py +22 -0
  6. omlish/lang/__init__.py +3 -1
  7. omlish/lang/asyncs.py +12 -0
  8. omlish/lang/functions.py +0 -11
  9. omlish/lang/lazyglobals.py +27 -5
  10. omlish/lang/maysync.py +2 -2
  11. omlish/lifecycles/contextmanagers.py +1 -2
  12. omlish/lifecycles/controller.py +1 -2
  13. omlish/lite/asyncs.py +15 -0
  14. omlish/lite/timing.py +2 -2
  15. omlish/logs/all.py +23 -34
  16. omlish/logs/base.py +248 -0
  17. omlish/logs/callers.py +21 -15
  18. omlish/logs/infos.py +105 -0
  19. omlish/logs/levels.py +64 -0
  20. omlish/logs/protocols.py +31 -0
  21. omlish/logs/standard.py +12 -11
  22. omlish/logs/std/adapters.py +41 -0
  23. omlish/logs/std/configs.py +29 -0
  24. omlish/logs/{filters.py → std/filters.py} +1 -1
  25. omlish/logs/{handlers.py → std/handlers.py} +1 -1
  26. omlish/logs/{json.py → std/json.py} +2 -2
  27. omlish/logs/{proxy.py → std/proxy.py} +3 -3
  28. omlish/logs/std/records.py +286 -0
  29. omlish/logs/times.py +89 -0
  30. omlish/logs/typed/bindings.py +24 -0
  31. omlish/logs/utils.py +60 -4
  32. omlish/logs/warnings.py +8 -0
  33. omlish/manifests/loading.py +1 -1
  34. omlish/os/journald.py +3 -3
  35. omlish/testing/pytest/plugins/skips.py +0 -4
  36. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.dist-info}/METADATA +1 -1
  37. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.dist-info}/RECORD +44 -86
  38. omlish/defs.py +0 -216
  39. omlish/dispatch/_dispatch2.py +0 -69
  40. omlish/dispatch/_dispatch3.py +0 -108
  41. omlish/dynamic.py +0 -219
  42. omlish/formats/json/Json.g4 +0 -77
  43. omlish/formats/json/_antlr/JsonLexer.py +0 -109
  44. omlish/formats/json/_antlr/JsonListener.py +0 -61
  45. omlish/formats/json/_antlr/JsonParser.py +0 -457
  46. omlish/formats/json/_antlr/JsonVisitor.py +0 -42
  47. omlish/io/trampoline.py +0 -289
  48. omlish/logs/abc.py +0 -319
  49. omlish/logs/color.py +0 -27
  50. omlish/logs/configs.py +0 -29
  51. omlish/logs/protocol.py +0 -218
  52. omlish/logs/timing.py +0 -58
  53. omlish/specs/irc/__init__.py +0 -0
  54. omlish/specs/irc/messages/__init__.py +0 -0
  55. omlish/specs/irc/messages/base.py +0 -49
  56. omlish/specs/irc/messages/formats.py +0 -92
  57. omlish/specs/irc/messages/messages.py +0 -774
  58. omlish/specs/irc/messages/parsing.py +0 -98
  59. omlish/specs/irc/numerics/__init__.py +0 -0
  60. omlish/specs/irc/numerics/formats.py +0 -97
  61. omlish/specs/irc/numerics/numerics.py +0 -865
  62. omlish/specs/irc/numerics/types.py +0 -59
  63. omlish/specs/irc/protocol/LICENSE +0 -11
  64. omlish/specs/irc/protocol/__init__.py +0 -61
  65. omlish/specs/irc/protocol/consts.py +0 -6
  66. omlish/specs/irc/protocol/errors.py +0 -30
  67. omlish/specs/irc/protocol/message.py +0 -21
  68. omlish/specs/irc/protocol/nuh.py +0 -55
  69. omlish/specs/irc/protocol/parsing.py +0 -158
  70. omlish/specs/irc/protocol/rendering.py +0 -153
  71. omlish/specs/irc/protocol/tags.py +0 -102
  72. omlish/specs/irc/protocol/utils.py +0 -30
  73. omlish/specs/proto/Protobuf3.g4 +0 -396
  74. omlish/specs/proto/__init__.py +0 -0
  75. omlish/specs/proto/_antlr/Protobuf3Lexer.py +0 -340
  76. omlish/specs/proto/_antlr/Protobuf3Listener.py +0 -448
  77. omlish/specs/proto/_antlr/Protobuf3Parser.py +0 -3909
  78. omlish/specs/proto/_antlr/Protobuf3Visitor.py +0 -257
  79. omlish/specs/proto/_antlr/__init__.py +0 -0
  80. omlish/specs/proto/nodes.py +0 -54
  81. omlish/specs/proto/parsing.py +0 -97
  82. omlish/sql/parsing/Minisql.g4 +0 -292
  83. omlish/sql/parsing/__init__.py +0 -0
  84. omlish/sql/parsing/_antlr/MinisqlLexer.py +0 -322
  85. omlish/sql/parsing/_antlr/MinisqlListener.py +0 -511
  86. omlish/sql/parsing/_antlr/MinisqlParser.py +0 -3763
  87. omlish/sql/parsing/_antlr/MinisqlVisitor.py +0 -292
  88. omlish/sql/parsing/_antlr/__init__.py +0 -0
  89. omlish/sql/parsing/parsing.py +0 -119
  90. /omlish/{.manifests.json → .omlish-manifests.json} +0 -0
  91. /omlish/{formats/json/_antlr → logs/std}/__init__.py +0 -0
  92. /omlish/logs/{noisy.py → std/noisy.py} +0 -0
  93. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.dist-info}/WHEEL +0 -0
  94. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.dist-info}/entry_points.txt +0 -0
  95. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.dist-info}/licenses/LICENSE +0 -0
  96. {omlish-0.0.0.dev424.dist-info → omlish-0.0.0.dev425.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)