mypy: fix typing issues + CI + lint.sh (#3141)

* fix mypy errors
pull/3143/head
patryk4815 5 months ago committed by GitHub
parent 9200ae4b87
commit 567ac6048c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -50,8 +50,8 @@ jobs:
level: error
# Change the current directory to run mypy command.
# mypy command reads setup.cfg or other settings file in this path.
execute_command: uv run --group lint --group dev mypy
execute_command: uv run --group dev --group lint --group tests --extra gdb --extra lldb mypy
install_types: false
target: pwndbg
target: pwndbg pwndbginit tests/host
filter_mode: nofilter
fail_on_error: true

@ -71,5 +71,5 @@ $UV_RUN_LINT vermin -vvv --no-tips -t=3.10- --eval-annotations --violations ${LI
# mypy is run in a separate step on GitHub Actions
if [[ -z "$GITHUB_ACTIONS" ]]; then
$UV_RUN_LINT mypy pwndbg pwndbginit tests/host
$UV_RUN_MYPY mypy pwndbg pwndbginit tests/host
fi

@ -34,7 +34,7 @@ def run_uv_install(
else:
# We don't want to quietly uninstall dependencies by just specifying
# `--extra gdb` so we will be conservative and pull all extras in.
command: List[str] = [str(binary_path), "sync", "--all-extras"]
command = [str(binary_path), "sync", "--all-extras"]
if dev:
command.append("--all-groups")
logging.debug(f"Updating deps with command: {' '.join(command)}")

@ -21,10 +21,14 @@ def get_gdb_version(path: str) -> Tuple[str, str]:
capture_output=True,
text=True,
)
return tuple(result.stdout.strip().split(" ", 2))
arr = result.stdout.strip().split(" ", 1)
if len(arr) != 2:
return "", ""
return arr[0], arr[1]
def get_venv_bin_path():
def get_venv_bin_path() -> str:
bin_dir = "Scripts" if os.name == "nt" else "bin"
return os.path.join(sys.prefix, bin_dir)
@ -54,7 +58,7 @@ def main():
sys.argv = gdb_argv
try:
from gdb_for_pwndbg.gdb import main
from gdb_for_pwndbg.gdb import main # type: ignore[import-untyped]
main()
return

@ -18,11 +18,13 @@ if [[ "$PWNDBG_NO_UV" == "1" ]]; then
UV_RUN_TEST=""
UV_RUN_LINT=""
UV_RUN_DOCS=""
UV_RUN_MYPY=""
else
# We are going to use uv.
UV="${PWNDBG_VENV_PATH}/bin/uv"
UV_RUN="${UV} run"
UV_RUN_TEST="${UV_RUN} --group dev --group tests --all-extras"
UV_RUN_LINT="${UV_RUN} --group dev --group lint"
UV_RUN_LINT="${UV_RUN} --group lint"
UV_RUN_DOCS="${UV_RUN} --group docs --extra gdb --extra lldb"
UV_RUN_MYPY="${UV_RUN} --group dev --group lint --group tests --extra gdb --extra lldb"
fi

Loading…
Cancel
Save