Skip to content

Commit 7f61503

Browse files
committed
Lint a tiny bit
1 parent ce7d29b commit 7f61503

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

trepan/options.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,10 @@ def process_options(pkg_version: str, sys_argv: str, option_list=None):
400400
dbg_opts["output"] = DebuggerUserOutput(opts.output)
401401
except IOError:
402402
_, xxx_todo_changeme, _ = sys.exc_info()
403-
(errno, strerror) = xxx_todo_changeme.args
404-
print(f"I/O in opening debugger output file {opts.output}")
405-
print(f"error({errno}): {strerror}")
403+
if xxx_todo_changeme is not None:
404+
(errno, strerror) = xxx_todo_changeme.args
405+
print(f"I/O in opening debugger output file {opts.output}")
406+
print(f"error({errno}): {strerror}")
406407
except Exception:
407408
print(f"Unexpected error in opening debugger output file {opts.output}")
408409
print(sys.exc_info()[0])

trepan/processor/trace.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2009, 2013-2014, 2023 Rocky Bernstein
2+
# Copyright (C) 2009, 2013-2014, 2023-2024 Rocky Bernstein
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -18,18 +18,19 @@
1818
# 'Helper' function for Processor. Put here so we
1919
# can use this in a couple of processors.
2020

21-
from trepan import vprocessor as Mprocessor
21+
from typing import Optional
22+
from trepan.vprocessor import Processor
2223

2324

24-
class PrintProcessor(Mprocessor.Processor):
25+
class PrintProcessor(Processor):
2526
"""A processor that just prints out events as we see them. This
2627
is suitable for example for line/call tracing. We assume that the
2728
caller is going to filter out which events it wants printed or
2829
whether it wants any printed at all.
2930
"""
3031

31-
def __init__(self, debugger, opts=None):
32-
Mprocessor.Processor.__init__(self, debugger)
32+
def __init__(self, debugger, opts: Optional[dict]=None):
33+
Processor.__init__(self, debugger, opts)
3334
return
3435

3536
def event_processor(self, frame, event, arg):
@@ -43,7 +44,7 @@ def event_processor(self, frame, event, arg):
4344
else:
4445
out.write("%s - %s:%d" % (event, filename, lineno))
4546
if arg is not None:
46-
out.writeline(", %s " % repr(arg))
47+
out.writeline(f", {repr(arg)} ")
4748
else:
4849
out.writeline("")
4950
pass

trepan/vprocessor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#
1616
# You should have received a copy of the GNU General Public License
1717
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from typing import Optional
1820
from pygments.console import colorize
1921

2022
NotImplementedMessage = "This method must be overridden in a subclass"
@@ -28,9 +30,11 @@ class Processor:
2830
the events.
2931
"""
3032

31-
def __init__(self, core_obj):
33+
def __init__(self, core_obj, opts: Optional[dict]=None):
3234
self.core = core_obj
3335
self.debugger = core_obj.debugger
36+
self.opts = opts
37+
self.intf = []
3438
return
3539

3640
# Note for errmsg, msg, and msg_nocr we don't want to simply make

0 commit comments

Comments
 (0)