Skip to content

Commit

Permalink
Force functions typing, fix missing typing (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
myakove authored Apr 17, 2024
1 parent 4c8494b commit 285db7d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ repos:
- id: mypy
exclude: ^(tests/)
additional_dependencies: [types-all]
args: [--ignore-missing-imports, --disallow-untyped-defs]
6 changes: 3 additions & 3 deletions pyhelper_utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from time import sleep
from functools import wraps
from logging import Logger
from typing import Any
from typing import Any, Callable


def tts(ts: Any) -> int:
Expand Down Expand Up @@ -60,9 +60,9 @@ def ignore_exceptions(
any: the underline function return value.
"""

def wrapper(func):
def wrapper(func: Callable) -> Callable:
@wraps(func)
def inner(*args, **kwargs):
def inner(*args: Any, **kwargs: Any) -> Any:
try:
return func(*args, **kwargs)
except Exception as ex:
Expand Down
2 changes: 1 addition & 1 deletion pyhelper_utils/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
LOGGER = get_logger(name="runners")


def function_runner_with_pdb(func: Callable, dry_run: bool = False, *args, **kwargs) -> Any:
def function_runner_with_pdb(func: Callable, dry_run: bool = False, *args: Any, **kwargs: Any) -> Any:
"""
Run function with support to drop into pdb.
Expand Down
8 changes: 4 additions & 4 deletions pyhelper_utils/shell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import subprocess
from typing import Optional
from typing import Any, List, Optional

from simple_logger.logger import get_logger

Expand All @@ -9,15 +9,15 @@


def run_command(
command: list,
command: List[str],
verify_stderr: bool = True,
shell: bool = False,
timeout: Optional[int] = None,
capture_output: bool = True,
check: bool = True,
hide_log_command: bool = False,
**kwargs,
) -> tuple:
**kwargs: Any,
) -> tuple[bool, str, str]:
"""
Run command locally.
Expand Down

0 comments on commit 285db7d

Please sign in to comment.