App, cmds, lib: Fix Any returns from typed functions
Add type annotations and casts to functions that were returning Any where a specific type was declared, satisfying the new warn_return_any mypy rule. Fixes: - log.py: get_caller_pos return type via cast - AsyncRunner.py: cast T for fut.result() - util.py: cast for getattr result, str() for args.username - FileContext.py: verbose_default bool annotation - SSHClient.py: cast SSHClient for dynamic import - lib/App.py: cast ArgumentParser, add return types to inner funcs - pm/rpm.py, dpkg.py: cast Iterable[Package] - App.py: cast for self.args.func(), add return types to inner funcs - BaseCmdPkgRelations.py: cast str for args.delimiter Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev 0.81.1 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
b3fee32ee1
commit
1e613a39c6
40 changed files with 228 additions and 179 deletions
|
|
@ -9,14 +9,14 @@ from tarfile import TarFile, TarInfo
|
|||
from .CopyContext import CopyContext
|
||||
from .ExecContext import ExecContext
|
||||
from .log import DEBUG, ERR, log
|
||||
from typing import TYPE_CHECKING, override
|
||||
from typing import TYPE_CHECKING, Any, override
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .base import StatResult
|
||||
|
||||
class TarIo(CopyContext):
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
kwargs['chroot'] = False
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class TarIo(CopyContext):
|
|||
|
||||
async def _read_filtered(
|
||||
self,
|
||||
path,
|
||||
path: str,
|
||||
path_filter: list[str] | None = None,
|
||||
matched: list[str] | None = None,
|
||||
) -> bytes:
|
||||
|
|
@ -81,7 +81,7 @@ class TarIo(CopyContext):
|
|||
return ret
|
||||
|
||||
@classmethod
|
||||
def create(cls, *args, type: str | None = None, **kwargs):
|
||||
def create(cls, *args: Any, type: str | None = None, **kwargs: Any) -> 'TarIo':
|
||||
if type is not None:
|
||||
raise NotImplementedError
|
||||
# return TarIoTarFile(*args, **kwargs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue