Skip to content

Commit

Permalink
fixed some pylance issues
Browse files Browse the repository at this point in the history
Signed-off-by: hugsy <[email protected]>
  • Loading branch information
hugsy committed Jan 11, 2025
1 parent 963473e commit 3a4543f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def update_gef(argv: list[str]) -> int:
PYTHON_MIN_VERSION: tuple[int, int] = (3, 10)
PYTHON_VERSION: tuple[int, int] = sys.version_info[0:2]
GDB_VERSION: tuple[int, int] = tuple(
map(int, re.search(r"(\d+)[^\d]+(\d+)", gdb.VERSION).groups())
) # type:ignore
map(int, re.search(r"(\d+)[^\d]+(\d+)", gdb.VERSION).groups()) # type:ignore
)

DEFAULT_PAGE_ALIGN_SHIFT = 12
DEFAULT_PAGE_SIZE = 1 << DEFAULT_PAGE_ALIGN_SHIFT
Expand Down Expand Up @@ -4480,7 +4480,7 @@ def new_objfile_handler(evt: "gdb.NewObjFileEvent | None") -> None:
if evt:
path = evt.new_objfile.filename or ""
elif progspace:
path = progspace.filename
path = progspace.filename or ""
else:
raise RuntimeError("Cannot determine file path")
try:
Expand Down Expand Up @@ -4582,8 +4582,9 @@ def get_terminal_size() -> tuple[int, int]:

try:
tty_rows, tty_columns = struct.unpack(
"hh", fcntl.ioctl(1, termios.TIOCGWINSZ, "1234")
) # type: ignore
"hh",
fcntl.ioctl(1, termios.TIOCGWINSZ, "1234"), # type: ignore
)
return tty_rows, tty_columns
except OSError:
return 600, 100
Expand Down Expand Up @@ -5786,7 +5787,7 @@ def do_invoke(self, argv: list[str]) -> None:

try:
git = which("git")
except:
except FileNotFoundError:
git = None

if git:
Expand Down Expand Up @@ -9475,7 +9476,7 @@ def context_trace(self) -> None:
frames = [
current_frame,
]
while current_frame != orig_frame and current_frame:
while current_frame != orig_frame and current_frame is not None:
current_frame = current_frame.older()
if not current_frame:
break
Expand All @@ -9496,8 +9497,8 @@ def context_trace(self) -> None:
items.append(f"{pc:#x}")
if name:
frame_args = (
gdb.FrameDecorator.FrameDecorator(current_frame).frame_args() or []
) # type: ignore
gdb.FrameDecorator.FrameDecorator(current_frame).frame_args() or [] # type: ignore
)
symstr = ", ".join(
[
f"{Color.yellowify(x.sym)}={x.sym.value(current_frame)!s}"
Expand Down Expand Up @@ -13109,7 +13110,7 @@ def file(self) -> pathlib.Path | None:
return self.remote.file
progspace = gdb.current_progspace()
assert progspace
fpath: str = progspace.filename
fpath: str = progspace.filename or ""
if fpath and not self._file:
self._file = pathlib.Path(fpath).expanduser()
return self._file
Expand Down Expand Up @@ -13255,7 +13256,7 @@ def file(self) -> pathlib.Path:
if not filename:
raise RuntimeError("No session started")
start_idx = len("target:") if filename.startswith("target:") else 0
self._file = pathlib.Path(progspace.filename[start_idx:])
self._file = pathlib.Path(filename[start_idx:])
return self._file

@property
Expand Down

0 comments on commit 3a4543f

Please sign in to comment.