From bef93ac56a1a5fec12f234f6d967eba32b7421fe Mon Sep 17 00:00:00 2001 From: Niko Date: Mon, 8 Jan 2024 18:44:42 +0100 Subject: [PATCH] Fix linter types issues (#1996) --- pwndbg/commands/got_tracking.py | 4 +++- pwndbg/exception.py | 2 +- pwndbg/gdblib/dynamic.py | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pwndbg/commands/got_tracking.py b/pwndbg/commands/got_tracking.py index effc84d72..c90d07a6d 100644 --- a/pwndbg/commands/got_tracking.py +++ b/pwndbg/commands/got_tracking.py @@ -2,6 +2,8 @@ from __future__ import annotations import argparse import re +from typing import Any +from typing import Dict import pwndbg.color.message as message import pwndbg.gdblib.dynamic @@ -133,7 +135,7 @@ def got_report(soname=".*", writable=False, fnname=".*"): ) print() - per_object = {} + per_object: Dict[Any, Any] = {} for _, (tracker, patcher) in pwndbg.gdblib.got.all_tracked_entries(): objname = tracker.link_map_entry.name() if objname == b"": diff --git a/pwndbg/exception.py b/pwndbg/exception.py index 3dc20df1a..67a3937e6 100644 --- a/pwndbg/exception.py +++ b/pwndbg/exception.py @@ -30,7 +30,7 @@ def print_exception(exception_msg): except ImportError: _rich_console = ... - if not isinstance(_rich_console, type(Ellipsis)): # type: ignore[arg-type] + if not isinstance(_rich_console, type(Ellipsis)): _rich_console.print_exception() else: print(exception_msg) diff --git a/pwndbg/gdblib/dynamic.py b/pwndbg/gdblib/dynamic.py index 17cbf4adc..b61987061 100644 --- a/pwndbg/gdblib/dynamic.py +++ b/pwndbg/gdblib/dynamic.py @@ -12,6 +12,9 @@ that may have a somewhat obtuse beahvior, due to limitations in GDB. See from __future__ import annotations +from typing import Any +from typing import Dict + import gdb import pwndbg.color.message as message @@ -315,7 +318,7 @@ class DynamicSegment: # Map the tags we want to find to their respective entires. We don't # allow for repeats on most tags as they should only appear once in a # well-formed dynamic segment. - sections = {} + sections: Dict[Any, Any] = {} for i in range(self.entries): tag = self.dyn_array_read(i, "d_tag") if tag in sections: