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:
Jan Lindemann 2024-12-15 15:35:29 +01:00
commit 3a7fb50979
2 changed files with 7 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import inspect
import re
from os.path import basename
from datetime import datetime
from typing import List, Tuple
from typing import List, Tuple, Optional, Any
from . import misc
# --- python 2 / 3 compatibility stuff
@ -88,7 +88,7 @@ _prio_colors = {
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:
r = 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'):
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:
return

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from collections import OrderedDict
from typing import Optional, Union
from typing import Any, List, Optional, Union
from jwutils.log import *
def quote(s):
@ -36,7 +37,7 @@ class StringTree: # export
def __init__(self, path: str, content: str) -> None:
slog(DEBUG, "ctor, path =", path, "content =", content)
self.children: OrderedDict[str, StringTree] = OrderedDict()
self.content = None
self.content: Optional[str] = None
self.__set(path, content)
assert(hasattr(self, "content"))
#assert self.content is not None
@ -180,7 +181,7 @@ class StringTree: # export
raise Exception('tried to get value from leave "{}"'.format(self.content))
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:
raise Exception("tried to retrieve child list with breadth-first search, not yet implemented")
r = []