miu-logger 0.1.4__tar.gz → 0.1.6__tar.gz
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.
- {miu_logger-0.1.4/src/miu_logger.egg-info → miu_logger-0.1.6}/PKG-INFO +1 -1
- {miu_logger-0.1.4 → miu_logger-0.1.6}/pyproject.toml +1 -1
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/listener.py +1 -1
- miu_logger-0.1.6/src/miu_logger/stubgen.py +62 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6/src/miu_logger.egg-info}/PKG-INFO +1 -1
- miu_logger-0.1.4/src/miu_logger/stubgen.py +0 -25
- {miu_logger-0.1.4 → miu_logger-0.1.6}/LICENSE +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/README.md +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/setup.cfg +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/__init__.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/conditional.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/config.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/filters.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/formatters.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/logger_factory.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger/repository.py +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger.egg-info/SOURCES.txt +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger.egg-info/dependency_links.txt +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger.egg-info/requires.txt +0 -0
- {miu_logger-0.1.4 → miu_logger-0.1.6}/src/miu_logger.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Iterable
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
REPOSITORY_TEMPLATE = """from typing import Optional
|
|
6
|
+
from queue import Queue
|
|
7
|
+
from miu_logger.conditional import ConditionalLogger
|
|
8
|
+
from miu_logger.config import LogConfig
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LoggingRepository:
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
config: LogConfig,
|
|
15
|
+
*,
|
|
16
|
+
use_listener: bool = True,
|
|
17
|
+
queue: Optional[Queue] = None
|
|
18
|
+
) -> None: ...
|
|
19
|
+
|
|
20
|
+
{domains}
|
|
21
|
+
|
|
22
|
+
def get(self, domain: str) -> ConditionalLogger: ...
|
|
23
|
+
def get_queue(self) -> Queue: ...
|
|
24
|
+
def shutdown(self) -> None: ...
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
CONDITIONAL_LOGGER_STUB = """from typing import Any
|
|
28
|
+
import logging
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ConditionalLogger:
|
|
32
|
+
def __init__(self, logger: logging.Logger, should_log_debug: Any) -> None: ...
|
|
33
|
+
|
|
34
|
+
def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
35
|
+
def info(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
36
|
+
def warning(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
37
|
+
def error(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
38
|
+
def critical(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
39
|
+
def exception(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def generate_repository_stub(domains: Iterable[str], out_dir: str = "typings") -> None:
|
|
44
|
+
out_path = Path(out_dir) / "miu_logger"
|
|
45
|
+
out_path.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
|
|
47
|
+
# Generate repository.pyi
|
|
48
|
+
lines = []
|
|
49
|
+
for d in domains:
|
|
50
|
+
lines.append(f" @property")
|
|
51
|
+
lines.append(f" def {d}(self) -> ConditionalLogger: ...")
|
|
52
|
+
|
|
53
|
+
content = REPOSITORY_TEMPLATE.format(domains="\n".join(lines))
|
|
54
|
+
|
|
55
|
+
with open(out_path / "repository.pyi", "w") as f:
|
|
56
|
+
f.write(content)
|
|
57
|
+
|
|
58
|
+
# Generate conditional.pyi
|
|
59
|
+
with open(out_path / "conditional.pyi", "w") as f:
|
|
60
|
+
f.write(CONDITIONAL_LOGGER_STUB)
|
|
61
|
+
|
|
62
|
+
print(f"✓ Generated stubs in {out_path}")
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from typing import Iterable
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TEMPLATE = """from typing import Any
|
|
6
|
-
from miu_logger.conditional import ConditionalLogger
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class LoggingRepository:
|
|
10
|
-
{domains}
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def generate_repository_stub(domains: Iterable[str], out_dir: str = "typings") -> None:
|
|
15
|
-
out_path = Path(out_dir) / "miu_logger"
|
|
16
|
-
out_path.mkdir(parents=True, exist_ok=True)
|
|
17
|
-
|
|
18
|
-
lines = []
|
|
19
|
-
for d in domains:
|
|
20
|
-
lines.append(f" {d}: ConditionalLogger")
|
|
21
|
-
|
|
22
|
-
content = TEMPLATE.format(domains="\n".join(lines))
|
|
23
|
-
|
|
24
|
-
with open(out_path / "repository.pyi", "w") as f:
|
|
25
|
-
f.write(content)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|