mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
Apply monkeytype traces
Run
monkeytype run jw-acc.py --log-level debug db import --format mdb-json-dir dbs
monkeytype list-modules | grep ^jw | while read m; do
monkeytype apply $m
done
and fix the fallout.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
440b40e267
commit
3a7fb50979
2 changed files with 7 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ import inspect
|
||||||
import re
|
import re
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple, Optional, Any
|
||||||
from . import misc
|
from . import misc
|
||||||
|
|
||||||
# --- python 2 / 3 compatibility stuff
|
# --- python 2 / 3 compatibility stuff
|
||||||
|
|
@ -88,7 +88,7 @@ _prio_colors = {
|
||||||
EMERG : [ CONSOLE_FONT_BOLD + CONSOLE_FONT_MAGENTA, CONSOLE_FONT_OFF ],
|
EMERG : [ CONSOLE_FONT_BOLD + CONSOLE_FONT_MAGENTA, CONSOLE_FONT_OFF ],
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_caller_pos(up: int = 1, kwargs=None) -> Tuple[str, int]:
|
def get_caller_pos(up: int = 1, kwargs: Optional[dict[str, Any]] = None) -> Tuple[str, int]:
|
||||||
if kwargs and 'caller' in kwargs:
|
if kwargs and 'caller' in kwargs:
|
||||||
r = kwargs['caller']
|
r = kwargs['caller']
|
||||||
del kwargs['caller']
|
del kwargs['caller']
|
||||||
|
|
@ -114,7 +114,7 @@ def slog_m(prio: int, *args, **kwargs) -> None: # export
|
||||||
for line in margs[1:].split('\n'):
|
for line in margs[1:].split('\n'):
|
||||||
slog(prio, line, **kwargs, caller=caller)
|
slog(prio, line, **kwargs, caller=caller)
|
||||||
|
|
||||||
def slog(prio: int, *args, only_printable=False, **kwargs) -> None: # export
|
def slog(prio: int, *args, only_printable: bool=False, **kwargs) -> None: # export
|
||||||
|
|
||||||
if prio > _level:
|
if prio > _level:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from typing import Optional, Union
|
from typing import Any, List, Optional, Union
|
||||||
|
|
||||||
from jwutils.log import *
|
from jwutils.log import *
|
||||||
|
|
||||||
def quote(s):
|
def quote(s):
|
||||||
|
|
@ -36,7 +37,7 @@ class StringTree: # export
|
||||||
def __init__(self, path: str, content: str) -> None:
|
def __init__(self, path: str, content: str) -> None:
|
||||||
slog(DEBUG, "ctor, path =", path, "content =", content)
|
slog(DEBUG, "ctor, path =", path, "content =", content)
|
||||||
self.children: OrderedDict[str, StringTree] = OrderedDict()
|
self.children: OrderedDict[str, StringTree] = OrderedDict()
|
||||||
self.content = None
|
self.content: Optional[str] = None
|
||||||
self.__set(path, content)
|
self.__set(path, content)
|
||||||
assert(hasattr(self, "content"))
|
assert(hasattr(self, "content"))
|
||||||
#assert self.content is not None
|
#assert self.content is not None
|
||||||
|
|
@ -180,7 +181,7 @@ class StringTree: # export
|
||||||
raise Exception('tried to get value from leave "{}"'.format(self.content))
|
raise Exception('tried to get value from leave "{}"'.format(self.content))
|
||||||
return self.children[next(reversed(self.children))].content # type: ignore
|
return self.children[next(reversed(self.children))].content # type: ignore
|
||||||
|
|
||||||
def child_list(self, depth_first=True):
|
def child_list(self, depth_first: bool=True) -> List[StringTree]:
|
||||||
if depth_first == False:
|
if depth_first == False:
|
||||||
raise Exception("tried to retrieve child list with breadth-first search, not yet implemented")
|
raise Exception("tried to retrieve child list with breadth-first search, not yet implemented")
|
||||||
r = []
|
r = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue