omdev 0.0.0.dev459__py3-none-any.whl → 0.0.0.dev461__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.

Potentially problematic release.


This version of omdev might be problematic. Click here for more details.

Files changed (37) hide show
  1. omdev/__about__.py +1 -1
  2. omdev/irc/__init__.py +0 -0
  3. omdev/irc/messages/__init__.py +0 -0
  4. omdev/irc/messages/base.py +50 -0
  5. omdev/irc/messages/formats.py +92 -0
  6. omdev/irc/messages/messages.py +775 -0
  7. omdev/irc/messages/parsing.py +99 -0
  8. omdev/irc/numerics/__init__.py +0 -0
  9. omdev/irc/numerics/formats.py +97 -0
  10. omdev/irc/numerics/numerics.py +865 -0
  11. omdev/irc/numerics/types.py +59 -0
  12. omdev/irc/protocol/LICENSE +11 -0
  13. omdev/irc/protocol/__init__.py +61 -0
  14. omdev/irc/protocol/consts.py +6 -0
  15. omdev/irc/protocol/errors.py +30 -0
  16. omdev/irc/protocol/message.py +21 -0
  17. omdev/irc/protocol/nuh.py +55 -0
  18. omdev/irc/protocol/parsing.py +158 -0
  19. omdev/irc/protocol/rendering.py +153 -0
  20. omdev/irc/protocol/tags.py +102 -0
  21. omdev/irc/protocol/utils.py +30 -0
  22. omdev/markdown/__init__.py +0 -0
  23. omdev/markdown/incparse.py +116 -0
  24. omdev/markdown/tokens.py +51 -0
  25. omdev/precheck/imports.py +14 -1
  26. omdev/precheck/main.py +1 -1
  27. omdev/tui/apps/markdown/cli.py +3 -4
  28. omdev/tui/rich/__init__.py +33 -0
  29. omdev/tui/rich/console2.py +20 -0
  30. omdev/tui/rich/markdown2.py +186 -0
  31. omdev/tui/textual/__init__.py +9 -0
  32. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/METADATA +4 -4
  33. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/RECORD +37 -10
  34. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/WHEEL +0 -0
  35. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/entry_points.txt +0 -0
  36. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/licenses/LICENSE +0 -0
  37. {omdev-0.0.0.dev459.dist-info → omdev-0.0.0.dev461.dist-info}/top_level.txt +0 -0
omdev/__about__.py CHANGED
@@ -44,7 +44,7 @@ class Project(ProjectBase):
44
44
 
45
45
  'tui': [
46
46
  'rich ~= 14.2',
47
- 'textual ~= 6.2',
47
+ 'textual ~= 6.3',
48
48
  ],
49
49
  }
50
50
 
omdev/irc/__init__.py ADDED
File without changes
File without changes
@@ -0,0 +1,50 @@
1
+ import typing as ta
2
+
3
+ from omlish import check
4
+ from omlish import dataclasses as dc
5
+ from omlish.funcs import pairs as fps
6
+
7
+ from ..numerics import numerics as nr
8
+ from .formats import MessageFormat
9
+ from .formats import MessageParamsUnpacker
10
+
11
+
12
+ ##
13
+
14
+
15
+ class Message(dc.Case):
16
+ FORMAT: ta.ClassVar[MessageFormat]
17
+ REPLIES: ta.ClassVar[ta.Collection[nr.NumericReply]] = ()
18
+
19
+
20
+ ##
21
+
22
+
23
+ def list_pair_params_unpacker(
24
+ kwarg: str,
25
+ key_param: str,
26
+ value_param: str,
27
+ ) -> MessageParamsUnpacker:
28
+ def forward(params: ta.Mapping[str, str]) -> ta.Mapping[str, ta.Any]:
29
+ out: dict = dict(params)
30
+ ks = out.pop(key_param)
31
+ vs = out.pop(value_param, None)
32
+ if vs is not None:
33
+ out[kwarg] = list(zip(ks, vs, strict=True))
34
+ else:
35
+ out[kwarg] = ks
36
+ return out
37
+
38
+ def backward(kwargs: ta.Mapping[str, ta.Any]) -> ta.Mapping[str, str]:
39
+ out: dict = dict(kwargs)
40
+ ts = out.pop(kwarg)
41
+ is_ts = check.single({isinstance(e, tuple) for e in ts})
42
+ if is_ts:
43
+ ks, vs = zip(*ts)
44
+ out[key_param] = ks
45
+ out[value_param] = vs
46
+ else:
47
+ out[key_param] = ts
48
+ return out
49
+
50
+ return fps.of(forward, backward)
@@ -0,0 +1,92 @@
1
+ import enum
2
+ import typing as ta
3
+
4
+ from omlish import check
5
+ from omlish import dataclasses as dc
6
+ from omlish import lang
7
+ from omlish.funcs import pairs as fps
8
+
9
+
10
+ MessageParamsUnpacker: ta.TypeAlias = fps.FnPair[
11
+ ta.Mapping[str, str], # params
12
+ ta.Mapping[str, ta.Any], # kwargs
13
+ ]
14
+
15
+
16
+ ##
17
+
18
+
19
+ class MessageFormat(dc.Frozen, final=True):
20
+ name: str
21
+
22
+ class Param(dc.Case):
23
+ @classmethod
24
+ def of(cls, obj: ta.Any) -> 'MessageFormat.Param':
25
+ if isinstance(obj, MessageFormat.Param):
26
+ return obj
27
+
28
+ elif isinstance(obj, str):
29
+ s = check.non_empty_str(obj)
30
+
31
+ optional = False
32
+ if s.startswith('?'):
33
+ optional = True
34
+ s = s[1:]
35
+
36
+ arity = MessageFormat.KwargParam.Arity.SINGLE
37
+ if s.startswith('*'):
38
+ arity = MessageFormat.KwargParam.Arity.VARIADIC
39
+ s = s[1:]
40
+
41
+ elif s.startswith(','):
42
+ arity = MessageFormat.KwargParam.Arity.COMMA_LIST
43
+ s = s[1:]
44
+
45
+ return MessageFormat.KwargParam(
46
+ s,
47
+ optional=optional,
48
+ arity=arity,
49
+ )
50
+
51
+ else:
52
+ raise TypeError(obj)
53
+
54
+ class KwargParam(Param):
55
+ name: str = dc.xfield(validate=lang.is_ident)
56
+
57
+ optional: bool = False
58
+
59
+ class Arity(enum.Enum):
60
+ SINGLE = enum.auto() # <foo>
61
+ VARIADIC = enum.auto() # <foo>{ <foo>}
62
+ COMMA_LIST = enum.auto() # <foo>{,<foo>}
63
+
64
+ arity: Arity = Arity.SINGLE
65
+
66
+ class LiteralParam(Param):
67
+ text: str
68
+
69
+ params: ta.Sequence[Param]
70
+
71
+ _: dc.KW_ONLY
72
+
73
+ unpack_params: MessageParamsUnpacker | None = None
74
+
75
+ @dc.init
76
+ def _validate_params(self) -> None:
77
+ kws = [p for p in self.params if isinstance(p, MessageFormat.KwargParam)]
78
+ check.unique(p.name for p in kws)
79
+ check.state(all(p.arity is not MessageFormat.KwargParam.Arity.VARIADIC for p in kws[:-1]))
80
+
81
+ @classmethod
82
+ def of(
83
+ cls,
84
+ name: str,
85
+ *params: ta.Any,
86
+ **kwargs: ta.Any,
87
+ ) -> 'MessageFormat':
88
+ return cls(
89
+ name,
90
+ [MessageFormat.Param.of(p) for p in params],
91
+ **kwargs,
92
+ )