mypy: Fix warn_return_any type errors
Add proper type annotations to fix mypy warn_return_any errors. The following files were modified to add cast() calls or return type annotations where functions returned Any values: - algo/ShuntingYard.py: Add cast for operator() return value - auth/Auth.py: Add cast for load() return value, fix imports - cast.py: Fix cast_str_to_int return type, fix _strip type - db/TableIoHandler.py: Remove redundant cast, fix store() return - db/query/Queries.py: Add cast for _run() and __getitem__ returns - db/query/Query.py: Add cast for db property return - db/query/QueryResult.py: Add cast for db and query property returns - db/schema/Schema.py: Add return type to __tables property, cast columns - db/schema/Table.py: Add cast for model_module_search_paths return - ev/app/EventRouter.py: Add cast for peer_conf.get() return - ev/base/Object.py: Add cast for get_conf_section and str_or_none returns - ev/base/SimpleObject.py: Add cast for create() return, fix imports - load_yaml.py: Add cast for _expand_links_recursive return - misc.py: Fix object_builtin_name return type, add param annotations - stree/StringTree.py: Fix get() return type with default_value variable Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
f171443d49
commit
ec342ba172
1 changed files with 37 additions and 38 deletions
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import abc
|
||||
|
||||
from enum import Enum, Flag, auto
|
||||
from typing import TYPE_CHECKING, TypeAlias
|
||||
from typing import TYPE_CHECKING, Any, cast, Self, TypeAlias, Sequence
|
||||
|
||||
from ..Config import Config
|
||||
from ..enum_helper import kebab_to_pascal
|
||||
|
|
@ -12,8 +12,7 @@ from ..misc import load_object
|
|||
from ..stree.StringTree import StringTree
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
from typing import Any, Mapping, Self, Sequence
|
||||
from typing import Mapping
|
||||
|
||||
class Access(Enum): # export
|
||||
Read = auto()
|
||||
|
|
@ -127,13 +126,9 @@ class Auth(abc.ABC): # export
|
|||
class_name_filter = class_name_filter.format(**macros)
|
||||
|
||||
# == Do it
|
||||
return load_object(
|
||||
path,
|
||||
base_type,
|
||||
class_name_filter,
|
||||
conf,
|
||||
*args,
|
||||
**kwargs,
|
||||
return cast(
|
||||
'Self',
|
||||
load_object(path, base_type, class_name_filter, conf, *args, **kwargs)
|
||||
)
|
||||
|
||||
def __init__(self, conf: Config, *args, **kwargs) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue