From d8d514a4d155d729bd1a741e4a3718c3205173f5 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 2 Nov 2025 09:42:21 +0100 Subject: [PATCH] Fix errors reported by mypy Signed-off-by: Jan Lindemann --- tools/python/jwutils/Cmd.py | 3 ++- tools/python/jwutils/Options.py | 2 +- tools/python/jwutils/asyncio/ShellCmd.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/python/jwutils/Cmd.py b/tools/python/jwutils/Cmd.py index c2005d1..394bbae 100644 --- a/tools/python/jwutils/Cmd.py +++ b/tools/python/jwutils/Cmd.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import annotations -from typing import List, Type, Union, TypeVar +from typing import Optional, List, Type, Union, TypeVar import inspect, sys, re, abc, argparse from argparse import ArgumentParser, _SubParsersAction @@ -17,6 +17,7 @@ class Cmd(abc.ABC): # export pass def __init__(self, name: str, help: str) -> None: + from . import Cmds self.name = name self.help = help self.parent = None diff --git a/tools/python/jwutils/Options.py b/tools/python/jwutils/Options.py index 78ce356..b4034f5 100644 --- a/tools/python/jwutils/Options.py +++ b/tools/python/jwutils/Options.py @@ -47,7 +47,7 @@ class Options: # export slog(ERR, 'Failed to split options string >{}<'.format(opts_str)) raise for opt_str in opt_strs: - opt_str = re.sub('\s*=\s*', '=', opt_str) + opt_str = re.sub(r'\s*=\s*', '=', opt_str) sides = opt_str.split('=') lhs = sides[0].strip() if not len(lhs): diff --git a/tools/python/jwutils/asyncio/ShellCmd.py b/tools/python/jwutils/asyncio/ShellCmd.py index a2889ba..a7eaba1 100644 --- a/tools/python/jwutils/asyncio/ShellCmd.py +++ b/tools/python/jwutils/asyncio/ShellCmd.py @@ -99,7 +99,7 @@ class ShellCmd: # export if __name__ == '__main__': import jwutils.log - jwutils.log.set_level(INFO) + jwutils.log.set_level('info') async def run(): sp = ShellCmd([ 'echo', 'hello world!' ]) await sp.run()