mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
Add type annotations from monkeytype + jw-devops/test
Add type annotations as generated by monkeytype and jw-devops/test, plus some hand editing to satisfy both monkeytype and mypy. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
952bf4a4e1
commit
77d43aebad
7 changed files with 51 additions and 42 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import os, errno
|
||||
import atexit
|
||||
import tempfile
|
||||
import filecmp
|
||||
import inspect
|
||||
from jwutils import log
|
||||
from typing import Set
|
||||
from jwutils import log
|
||||
|
||||
_tmpfiles: Set[str] = set()
|
||||
|
||||
|
|
@ -18,7 +19,7 @@ def silentremove(filename): #export
|
|||
if e.errno != errno.ENOENT:
|
||||
raise # re-raise exception if a different error occurred
|
||||
|
||||
def pad(token, total_size, right_align = False):
|
||||
def pad(token: str, total_size: int, right_align: bool = False) -> str:
|
||||
add = total_size - len(token)
|
||||
if add <= 0:
|
||||
return token
|
||||
|
|
@ -63,7 +64,7 @@ def get_derived_classes(mod, base): # export
|
|||
r.append(c)
|
||||
return r
|
||||
|
||||
def commit_tmpfile(tmp, path): # export
|
||||
def commit_tmpfile(tmp: str, path: str) -> None: # export
|
||||
caller = log.get_caller_pos()
|
||||
if os.path.isfile(path) and filecmp.cmp(tmp, path):
|
||||
log.slog(log.INFO, "{} is up to date".format(path), caller=caller)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue