Skip to content

Commit

Permalink
Lint a tiny bit
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Dec 18, 2024
1 parent ce7d29b commit 7f61503
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
7 changes: 4 additions & 3 deletions trepan/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,10 @@ def process_options(pkg_version: str, sys_argv: str, option_list=None):
dbg_opts["output"] = DebuggerUserOutput(opts.output)
except IOError:
_, xxx_todo_changeme, _ = sys.exc_info()
(errno, strerror) = xxx_todo_changeme.args
print(f"I/O in opening debugger output file {opts.output}")
print(f"error({errno}): {strerror}")
if xxx_todo_changeme is not None:
(errno, strerror) = xxx_todo_changeme.args
print(f"I/O in opening debugger output file {opts.output}")
print(f"error({errno}): {strerror}")
except Exception:
print(f"Unexpected error in opening debugger output file {opts.output}")
print(sys.exc_info()[0])
Expand Down
13 changes: 7 additions & 6 deletions trepan/processor/trace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2013-2014, 2023 Rocky Bernstein
# Copyright (C) 2009, 2013-2014, 2023-2024 Rocky Bernstein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -18,18 +18,19 @@
# 'Helper' function for Processor. Put here so we
# can use this in a couple of processors.

from trepan import vprocessor as Mprocessor
from typing import Optional
from trepan.vprocessor import Processor


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

def __init__(self, debugger, opts=None):
Mprocessor.Processor.__init__(self, debugger)
def __init__(self, debugger, opts: Optional[dict]=None):
Processor.__init__(self, debugger, opts)
return

def event_processor(self, frame, event, arg):
Expand All @@ -43,7 +44,7 @@ def event_processor(self, frame, event, arg):
else:
out.write("%s - %s:%d" % (event, filename, lineno))
if arg is not None:
out.writeline(", %s " % repr(arg))
out.writeline(f", {repr(arg)} ")
else:
out.writeline("")
pass
Expand Down
6 changes: 5 additions & 1 deletion trepan/vprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from typing import Optional
from pygments.console import colorize

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

def __init__(self, core_obj):
def __init__(self, core_obj, opts: Optional[dict]=None):
self.core = core_obj
self.debugger = core_obj.debugger
self.opts = opts
self.intf = []
return

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

0 comments on commit 7f61503

Please sign in to comment.