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
omlish/io/trampoline.py DELETED
@@ -1,289 +0,0 @@
1
- import abc
2
- import contextlib
3
- import io
4
- import typing as ta
5
-
6
- from .. import check
7
- from .. import lang
8
- from ..concurrent import threadlets as tls
9
- from ..sync import ConditionDeque
10
-
11
-
12
- if ta.TYPE_CHECKING:
13
- import threading
14
-
15
- from . import pyio # noqa
16
-
17
- else:
18
- threading = lang.proxy_import('threading')
19
-
20
- pyio = lang.proxy_import('.pyio', __package__)
21
-
22
-
23
- T = ta.TypeVar('T')
24
-
25
- BytesLike: ta.TypeAlias = ta.Any
26
-
27
- BufferedReader: ta.TypeAlias = io.BufferedReader
28
- # BufferedReader: ta.TypeAlias = pyio.BufferedReader
29
-
30
-
31
- ##
32
-
33
-
34
- class ProxyReadFile:
35
- def __init__(self, read: ta.Callable[[int], bytes | BaseException]) -> None:
36
- super().__init__()
37
-
38
- self._read = read
39
- self._eof = False
40
- self._closed = False
41
-
42
- #
43
-
44
- def read(self, n: int, /) -> bytes:
45
- if self._closed:
46
- raise RuntimeError('Closed')
47
- if self._eof:
48
- return b''
49
- d = self._read(n)
50
- if isinstance(d, BaseException):
51
- raise d
52
- if not d:
53
- self._eof = True
54
- return d
55
-
56
- def readall(self, *args, **kwargs):
57
- raise TypeError # FIXME
58
-
59
- def readinto(self, b: BytesLike) -> int | None:
60
- d = self.read(len(b))
61
- if d:
62
- b[:len(d)] = d
63
- return len(d)
64
-
65
- #
66
-
67
- def readable(self) -> bool:
68
- return not (self._eof or self._closed)
69
-
70
- @property
71
- def closed(self) -> bool:
72
- return self._closed
73
-
74
- def close(self) -> None:
75
- self._closed = True
76
-
77
- #
78
-
79
- def flush(self) -> None:
80
- pass
81
-
82
- def seekable(self) -> bool:
83
- return False
84
-
85
- def seek(self, n: int, /) -> ta.Any:
86
- raise TypeError
87
-
88
-
89
- ##
90
-
91
-
92
- class NeedMore(lang.Marker):
93
- pass
94
-
95
-
96
- class Exited(lang.Marker):
97
- pass
98
-
99
-
100
- class Shutdown(BaseException): # noqa
101
- pass
102
-
103
-
104
- IoTrampolineTarget: ta.TypeAlias = ta.Callable[[io.BufferedReader], ta.ContextManager[ta.Callable[[], bytes]]]
105
-
106
-
107
- class IoTrampoline(lang.Abstract):
108
- def __init__(
109
- self,
110
- target: IoTrampolineTarget,
111
- *,
112
- buffer_size: int | None = None,
113
- ) -> None:
114
- super().__init__()
115
-
116
- self._target = target
117
- self._buffer_size = buffer_size
118
-
119
- def _make_buffered_reader(self, raw: ta.Any) -> io.BufferedReader:
120
- return io.BufferedReader(
121
- raw,
122
- **(dict(buffer_size=self._buffer_size) if self._buffer_size is not None else {}),
123
- )
124
-
125
- @abc.abstractmethod
126
- def close(self, timeout: float | None = None) -> None:
127
- raise NotImplementedError
128
-
129
- @abc.abstractmethod
130
- def __enter__(self) -> ta.Self:
131
- raise NotImplementedError
132
-
133
- @abc.abstractmethod
134
- def __exit__(self, exc_type, exc_val, exc_tb):
135
- raise NotImplementedError
136
-
137
- @abc.abstractmethod
138
- def feed(self, *data: bytes) -> ta.Iterable[bytes]:
139
- raise NotImplementedError
140
-
141
-
142
- #
143
-
144
-
145
- class ThreadIoTrampoline(IoTrampoline):
146
- def __init__(self, target: IoTrampolineTarget, **kwargs: ta.Any) -> None:
147
- super().__init__(target, **kwargs)
148
-
149
- self._in: ConditionDeque[bytes | BaseException] = ConditionDeque()
150
- self._out: ConditionDeque[
151
- bytes | # noqa
152
- type[NeedMore] |
153
- type[Exited] |
154
- BaseException
155
- ] = ConditionDeque()
156
-
157
- self._proxy = ProxyReadFile(self._read)
158
-
159
- self._thread = threading.Thread(target=self._thread_proc, daemon=True)
160
-
161
- #
162
-
163
- def close(self, timeout: float | None = None) -> None:
164
- if not self._thread.is_alive():
165
- return
166
- self._out.push(Shutdown())
167
- self._thread.join(timeout)
168
- if self._thread.is_alive():
169
- if timeout is not None:
170
- raise TimeoutError
171
- else:
172
- raise RuntimeError('Failed to join thread')
173
-
174
- #
175
-
176
- def __enter__(self) -> ta.Self:
177
- self._thread.start()
178
- return self
179
-
180
- def __exit__(self, exc_type, exc_val, exc_tb):
181
- self.close()
182
-
183
- #
184
-
185
- def _read(self, n: int, /) -> bytes | BaseException:
186
- return self._in.pop(if_empty=lambda: self._out.push(NeedMore))
187
-
188
- def _thread_proc(self) -> None:
189
- try:
190
- with contextlib.closing(self._make_buffered_reader(self._proxy)) as bf: # noqa
191
- with self._target(bf) as read:
192
- while out := read():
193
- self._out.push(out)
194
- self._out.push(out)
195
- except BaseException as e:
196
- self._out.push(e)
197
- raise
198
- finally:
199
- self._out.push(Exited)
200
-
201
- def feed(self, *data: bytes) -> ta.Iterable[bytes]:
202
- self._in.push(*data)
203
- while True:
204
- e = self._out.pop()
205
- if e is NeedMore:
206
- break
207
- elif isinstance(e, BaseException):
208
- raise e
209
- elif e is Exited:
210
- raise RuntimeError('IO thread exited')
211
- elif isinstance(e, bytes):
212
- yield e
213
- if not e:
214
- return
215
- else:
216
- raise TypeError(e)
217
-
218
-
219
- #
220
-
221
-
222
- class ThreadletIoTrampoline(IoTrampoline):
223
- def __init__(
224
- self,
225
- target: IoTrampolineTarget,
226
- threadlets: tls.Threadlets = tls.GREENLET_THREADLETS,
227
- ** kwargs: ta.Any,
228
- ) -> None:
229
- super().__init__(target, **kwargs)
230
-
231
- self._proxy = ProxyReadFile(self._read)
232
- self._tl: tls.Threadlet = threadlets.spawn(self._g_proc)
233
-
234
- #
235
-
236
- def close(self, timeout: float | None = None) -> None:
237
- if self._tl.dead:
238
- return
239
- out = self._tl.switch(Shutdown())
240
- if out is not Exited or not self._tl.dead:
241
- raise RuntimeError
242
-
243
- #
244
-
245
- def __enter__(self) -> ta.Self:
246
- out = self._tl.switch()
247
- if out is not NeedMore:
248
- raise RuntimeError
249
- return self
250
-
251
- def __exit__(self, exc_type, exc_val, exc_tb):
252
- self.close()
253
-
254
- #
255
-
256
- def _read(self, n: int, /) -> bytes:
257
- out = check.not_none(self._tl.parent).switch(NeedMore)
258
- return out
259
-
260
- def _g_proc(self) -> ta.Any:
261
- try:
262
- with contextlib.closing(self._make_buffered_reader(self._proxy)) as bf: # noqa
263
- with self._target(bf) as read:
264
- while out := read():
265
- e = check.not_none(self._tl.parent).switch(out)
266
- if e is not NeedMore:
267
- raise TypeError(e) # noqa
268
- e = check.not_none(self._tl.parent).switch(out)
269
- if not isinstance(e, Shutdown):
270
- raise TypeError(e) # noqa
271
- return Exited
272
- except BaseException as e:
273
- check.not_none(self._tl.parent).throw(e)
274
- raise
275
-
276
- def feed(self, *data: bytes) -> ta.Iterable[bytes]:
277
- i: bytes | type[NeedMore]
278
- for i in data:
279
- while True:
280
- e = self._tl.switch(i)
281
- i = NeedMore
282
- if e is NeedMore:
283
- break
284
- elif isinstance(e, bytes):
285
- yield e
286
- if not e:
287
- return
288
- else:
289
- raise TypeError(e)
omlish/lite/logs.py DELETED
@@ -1,4 +0,0 @@
1
- import logging
2
-
3
-
4
- log = logging.getLogger(__name__)
omlish/lite/reprs.py DELETED
@@ -1,85 +0,0 @@
1
- # ruff: noqa: UP007 UP045
2
- import dataclasses as dc
3
- import typing as ta
4
-
5
-
6
- ##
7
-
8
-
9
- @dc.dataclass(frozen=True)
10
- class AttrRepr:
11
- attrs: ta.Sequence[str]
12
-
13
- # _: dc.KW_ONLY
14
-
15
- with_module: bool = False
16
- use_qualname: bool = False
17
- with_id: bool = False
18
- value_filter: ta.Optional[ta.Callable[[ta.Any], bool]] = None
19
- recursive: bool = False
20
-
21
- @classmethod
22
- def of(cls, *attrs: str, **kwargs: ta.Any) -> 'AttrRepr':
23
- return cls(attrs, **kwargs)
24
-
25
- #
26
-
27
- def _build_(self, obj: ta.Any) -> str:
28
- vs = ', '.join(
29
- f'{attr}={v!r}'
30
- for attr in self.attrs
31
- for v in [getattr(obj, attr)]
32
- if self.value_filter is None or self.value_filter(v)
33
- )
34
-
35
- return (
36
- f'{obj.__class__.__module__ + "." if self.with_module else ""}'
37
- f'{obj.__class__.__qualname__ if self.use_qualname else obj.__class__.__name__}'
38
- f'{("@" + hex(id(obj))[2:]) if self.with_id else ""}'
39
- f'({vs})'
40
- )
41
-
42
- _build: ta.ClassVar[ta.Callable[[ta.Any], str]]
43
-
44
- def __call__(self, obj: ta.Any) -> str:
45
- try:
46
- build: ta.Any = self._build
47
-
48
- except AttributeError:
49
- build = self._build_
50
- if self.recursive:
51
- build = self._reprlib().recursive_repr()(build)
52
- object.__setattr__(self, '_build', build)
53
-
54
- return build(obj)
55
-
56
- #
57
-
58
- def __get__(self, instance, owner):
59
- if instance is None:
60
- return self
61
-
62
- def __repr__(other): # noqa
63
- return self(other)
64
-
65
- return __repr__.__get__(instance, owner)
66
-
67
- #
68
-
69
- _reprlib_: ta.ClassVar[ta.Any]
70
-
71
- @classmethod
72
- def _reprlib(cls) -> ta.Any:
73
- try:
74
- return cls._reprlib_
75
- except AttributeError:
76
- pass
77
-
78
- import reprlib # noqa
79
-
80
- cls._reprlib_ = reprlib
81
- return reprlib
82
-
83
-
84
- def attr_repr(obj: ta.Any, *attrs: str, **kwargs: ta.Any) -> str:
85
- return AttrRepr(attrs, **kwargs)(obj)
omlish/logs/abc.py DELETED
@@ -1,319 +0,0 @@
1
- # ruff: noqa: A002 N802 N815
2
- import types
3
- import typing as ta
4
-
5
-
6
- ##
7
-
8
-
9
- Level: ta.TypeAlias = int
10
-
11
-
12
- ExceptionInfo: ta.TypeAlias = tuple[type[BaseException], BaseException, types.TracebackType]
13
-
14
-
15
- class LogRecord:
16
- """https://docs.python.org/3/library/logging.html#logrecord-attributes"""
17
-
18
- # Name of the logger used to log the call.
19
- name: str
20
-
21
- # Human-readable time when the LogRecord was created. By default this is of the form '2003-07-08 16:49:45,896' (the
22
- # numbers after the comma are millisecond portion of the time).
23
- asctime: str
24
-
25
- # The logged message, computed as msg % args. This is set when Formatter.format() is invoked.
26
- message: str
27
-
28
- # The format string passed in the original logging call. Merged with args to produce message, or an arbitrary object
29
- # (see Using arbitrary objects as messages).
30
- msg: str
31
-
32
- # The tuple of arguments merged into msg to produce message, or a dict whose values are used for the merge (when
33
- # there is only one argument, and it is a dictionary).
34
- args: tuple
35
-
36
- # Text logging level for the message ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
37
- levelname: str
38
-
39
- # # Numeric logging level for the message (DEBUG, INFO, WARNING, ERROR, CRITICAL).
40
- levelno: Level
41
-
42
- # Full pathname of the source file where the logging call was issued (if available).
43
- pathname: str
44
-
45
- # Filename portion of pathname.
46
- filename: str
47
-
48
- # Module (name portion of filename).
49
- module: str
50
-
51
- # Exception tuple (à la sys.exc_info) or, if no exception has occurred, None.
52
- exc_info: ExceptionInfo | None
53
-
54
- exc_text: str | None
55
-
56
- # Stack frame information (where available) from the bottom of the stack in the current thread, up to and including
57
- # the stack frame of the logging call which resulted in the creation of this record.
58
- stack_info: str | None
59
-
60
- # Source line number where the logging call was issued (if available).
61
- lineno: int
62
-
63
- # Name of function containing the logging call.
64
- funcName: str
65
-
66
- # Time when the LogRecord was created (as returned by time.time_ns() / 1e9).
67
- created: float
68
-
69
- # Millisecond portion of the time when the LogRecord was created.
70
- msecs: float
71
-
72
- # Time in milliseconds when the LogRecord was created, relative to the time the logging module was loaded.
73
- relativeCreated: float
74
-
75
- # Thread ID (if available).
76
- thread: int
77
-
78
- # Thread name (if available).
79
- threadName: str
80
-
81
- # Process name (if available).
82
- processName: str
83
-
84
- # Process ID (if available).
85
- process: int
86
-
87
- # asyncio.Task name (if available).
88
- taskName: str
89
-
90
-
91
- ##
92
-
93
-
94
- class Formatter(ta.Protocol):
95
- """https://docs.python.org/3/library/logging.html#formatter-objects"""
96
-
97
- default_time_format: ta.ClassVar[str]
98
- default_msec_format: ta.ClassVar[str]
99
-
100
- def formatTime(self, record: LogRecord, datefmt: str | None = None) -> str: ...
101
-
102
- def formatException(self, ei: ExceptionInfo) -> str: ...
103
-
104
- def usesTime(self) -> bool: ...
105
-
106
- def formatMessage(self, record: LogRecord) -> str: ...
107
-
108
- def formatStack(self, stack_info: str) -> str: ...
109
-
110
- def format(self, record: LogRecord) -> str: ...
111
-
112
-
113
- class BufferingFormatter(ta.Protocol):
114
- """https://docs.python.org/3/library/logging.html#logging.BufferingFormatter"""
115
-
116
- def formatHeader(self, records: ta.Sequence[LogRecord]) -> str: ...
117
-
118
- def formatFooter(self, records: ta.Sequence[LogRecord]) -> str: ...
119
-
120
- def format(self, records: ta.Sequence[LogRecord]) -> str: ...
121
-
122
-
123
- ##
124
-
125
-
126
- class Filter(ta.Protocol):
127
- """https://docs.python.org/3/library/logging.html#filter-objects"""
128
-
129
- def filter(self, record: LogRecord) -> bool: ...
130
-
131
-
132
- class Filterer(ta.Protocol):
133
- """A base class for loggers and handlers which allows them to share common code."""
134
-
135
- def addFilter(self, filter: Filter) -> None: ...
136
-
137
- def removeFilter(self, filter: Filter) -> None: ...
138
-
139
- def filter(self, record: LogRecord) -> bool: ...
140
-
141
-
142
- ##
143
-
144
-
145
- class Handler(Filterer, ta.Protocol):
146
- """https://docs.python.org/3/library/logging.html#handler-objects"""
147
-
148
- level: Level
149
-
150
- def get_name(self) -> str: ...
151
-
152
- def set_name(self, name: str) -> None: ...
153
-
154
- name: str
155
-
156
- def createLock(self) -> None: ...
157
-
158
- def acquire(self) -> None: ...
159
-
160
- def release(self) -> None: ...
161
-
162
- def setLevel(self, level: Level) -> None: ...
163
-
164
- def format(self, record: LogRecord) -> str: ...
165
-
166
- def emit(self, record: LogRecord) -> None: ...
167
-
168
- def handle(self, record: LogRecord) -> bool: ...
169
-
170
- def setFormatter(self, fmt: Formatter) -> None: ...
171
-
172
- def flush(self) -> None: ...
173
-
174
- def close(self) -> None: ...
175
-
176
- def handleError(self, record: LogRecord) -> None: ...
177
-
178
-
179
- class Stream(ta.Protocol):
180
- def write(self, s: str) -> None: ...
181
-
182
- def flush(self) -> None: ... # OPTIONAL METHOD
183
-
184
- def close(self) -> None: ... # OPTIONAL METHOD
185
-
186
-
187
- class StreamHandler(Handler, ta.Protocol):
188
- """https://docs.python.org/3/library/logging.handlers.html#logging.StreamHandler"""
189
-
190
- terminator: ta.ClassVar[str]
191
-
192
- stream: Stream
193
-
194
- def flush(self) -> None: ...
195
-
196
- def emit(self, record: LogRecord) -> None: ...
197
-
198
- def setStream(self, stream: Stream) -> None: ...
199
-
200
-
201
- ##
202
-
203
-
204
- class Manager(ta.Protocol):
205
- """There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers."""
206
-
207
- root: 'Logger'
208
-
209
- disable: Level
210
-
211
- def getLogger(self, name: str) -> 'Logger': ...
212
-
213
- def setLoggerClass(self, klass: type['Logger']) -> None: ...
214
-
215
- def setLogRecordFactory(self, factory: ta.Callable[..., LogRecord]) -> None: ... # UNREFERENCED?
216
-
217
-
218
- ##
219
-
220
-
221
- Caller: ta.TypeAlias = tuple[
222
- str, # filename
223
- int, # lineno
224
- str, # name
225
- str, # formatted
226
- ]
227
-
228
-
229
- class Logger(Filterer, ta.Protocol):
230
- """https://docs.python.org/3/library/logging.html#logger-objects"""
231
-
232
- name: str
233
- level: Level
234
- parent: ta.Optional['Logger']
235
- propagate: bool
236
- handlers: list[Handler]
237
- disabled: bool
238
-
239
- manager: Manager
240
-
241
- def setLevel(self, level: Level) -> None: ...
242
-
243
- def debug(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
244
- def info(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
245
- def warning(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
246
- def warn(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
247
- def error(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
248
- def exception(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
249
- def critical(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
250
- def fatal(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
251
-
252
- def log(self, level: Level, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
253
-
254
- def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> Caller: ...
255
-
256
- def makeRecord(
257
- self,
258
- name,
259
- level,
260
- fn,
261
- lno,
262
- msg,
263
- args,
264
- exc_info,
265
- func: str | None = None,
266
- extra: ta.Mapping[str, ta.Any] | None = None,
267
- sinfo: str | None = None,
268
- ) -> LogRecord: ...
269
-
270
- def handle(self, record: LogRecord) -> None: ...
271
-
272
- def addHandler(self, hdlr: Handler) -> None: ...
273
-
274
- def removeHandler(self, hdlr: Handler) -> None: ...
275
-
276
- def hasHandlers(self) -> bool: ...
277
-
278
- def callHandlers(self, record: LogRecord) -> None: ...
279
-
280
- def getEffectiveLevel(self) -> Level: ...
281
-
282
- def isEnabledFor(self, level: Level) -> bool: ...
283
-
284
- def getChild(self, suffix: str) -> 'Logger': ...
285
-
286
-
287
- ##
288
-
289
-
290
- class LoggerAdapter(ta.Protocol):
291
- """https://docs.python.org/3/library/logging.html#loggeradapter-objects"""
292
-
293
- logger: Logger
294
- extra: ta.Mapping[str, ta.Any]
295
-
296
- def process(self, msg: str, kwargs: dict[str, ta.Any]) -> tuple[str, dict[str, ta.Any]]: ...
297
-
298
- def debug(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
299
- def info(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
300
- def warning(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
301
- def warn(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
302
- def error(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
303
- def exception(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
304
- def critical(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
305
- def fatal(self, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
306
-
307
- def log(self, level: Level, msg: str, *args: ta.Any, **kwargs: ta.Any) -> None: ...
308
-
309
- def isEnabledFor(self, level: Level) -> bool: ...
310
-
311
- def setLevel(self, level: Level) -> None: ...
312
-
313
- def getEffectiveLevel(self) -> Level: ...
314
-
315
- def hasHandlers(self) -> bool: ...
316
-
317
- manager: Manager
318
-
319
- name: str