Skip to content

Commit 4baa566

Browse files
committed
More lint
1 parent 4e13e6e commit 4baa566

8 files changed

Lines changed: 58 additions & 66 deletions

File tree

__pkginfo__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
ftp_url = None
8383
install_requires = [
8484
"columnize >= 0.3.10",
85-
"nose>=1.0.0, <= 1.3.7",
8685
"pyficache >= 2.3.0",
8786
"xdis >= 6.0.3,<6.2.0",
8887
"pygments %s" % pygments_version,

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# The "pygments" version is not quite right
44
# And the xdis version is missing
55
columnize >= 0.3.10
6-
nose>=1.0.0, <= 1.3.7
6+
pyficache >= 2.3.0,
77
pygments >= 2.2.0
88
spark_parser
99
tracer >= 0.3.2

test/unit/test_options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ def test_options():
3232
}
3333
dbg_opts_set = {"proc_opts", "from_ipython"}
3434

35-
opts, dbg_opts, sys_argv = process_options("testing", "1.0", [__file__])
35+
opts, dbg_opts, sys_argv = process_options("1.0", [__file__])
3636
diff_set = option_key_set - set(vars(opts).keys())
3737
assert diff_set == set(), "expecting at least these options keys set"
3838
assert (
3939
dbg_opts_set - set(dbg_opts.keys())
4040
) == set(), "expecting at least these processor keys set"
4141

4242
arg_str = f"{__file__} --fntrace --cd=/tmp"
43-
opts, dbg_opts, sys_argv = process_options("testing", "1.1", arg_str.split())
43+
opts, dbg_opts, sys_argv = process_options("1.1", arg_str.split())
4444
assert opts.cd == "/tmp"
4545

4646
arg_str = f"{__file__} --style=emacs"
47-
opts, dbg_opts, sys_argv = process_options("testing", "1.2", arg_str.split())
47+
opts, dbg_opts, sys_argv = process_options("1.2", arg_str.split())
4848
assert opts.style == "emacs"

trepan/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@
4242

4343
def main(dbg=None, sys_argv=list(sys.argv)):
4444
"""Routine which gets run if we were invoked directly"""
45-
global __title__
4645

4746
# Save the original just for use in the restart that works via exec.
4847
orig_sys_argv = list(sys_argv)
49-
opts, dbg_opts, sys_argv = process_options(__title__, __version__, sys_argv)
48+
opts, dbg_opts, sys_argv = process_options(__version__, sys_argv)
5049

5150
if opts.server is not None:
5251
if opts.server == "tcp":

trepan/bwcli.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: iso-8859-1 -*-
3-
# Copyright (C) 2013, 2015, 2020, 2023 Rocky Bernstein <rocky@gnu.org>
3+
# Copyright (C) 2013, 2015, 2020, 2023-2024
4+
# Rocky Bernstein <rocky@gnu.org>
45
#
56
# This program is free software: you can redistribute it and/or modify
67
# it under the terms of the GNU General Public License as published by
@@ -23,14 +24,13 @@
2324
import pyficache
2425

2526
# Our local modules
26-
from trepan import (
27-
clifns as Mclifns,
28-
debugger as Mdebugger,
29-
exception as Mexcept,
30-
misc as Mmisc,
31-
)
27+
import trepan.debugger
28+
29+
from trepan.clifns import whence_file
30+
from trepan.exception import DebuggerQuit, DebuggerRestart
3231
from trepan.interfaces.bullwinkle import BWInterface
3332
from trepan.lib.file import readable
33+
from trepan.misc import wrapped_lines
3434

3535
# The name of the debugger we are currently going by.
3636
__title__ = "trepan"
@@ -39,8 +39,8 @@
3939
from trepan.version import __version__
4040

4141

42-
def process_options(debugger_name, pkg_version, sys_argv, option_list=None):
43-
"""Handle debugger options. Set `option_list' if you are writing
42+
def process_options(pkg_version, sys_argv, option_list=None):
43+
"""Handle debugger options. Set ``option_list`` if you are writing
4444
another main program and want to extend the existing set of debugger
4545
options.
4646
@@ -90,7 +90,7 @@ def process_options(debugger_name, pkg_version, sys_argv, option_list=None):
9090

9191

9292
def postprocess_options(dbg, opts):
93-
"""Handle options (`opts') that feed into the debugger (`dbg')"""
93+
"""Handle options (`opts') that feed into the debugger (``dbg``)"""
9494
# Set dbg.settings['printset']
9595
print_events = []
9696
if opts.fntrace:
@@ -109,28 +109,27 @@ def postprocess_options(dbg, opts):
109109

110110
dbg.settings["highlight"] = "plain"
111111

112-
Mdebugger.debugger_obj = dbg
112+
trepan.debugger_obj = dbg
113113
return
114114

115115

116116
def main(dbg=None, sys_argv=list(sys.argv)):
117117
"""Routine which gets run if we were invoked directly"""
118-
global __title__
119118

120119
# Save the original just for use in the restart that works via exec.
121120
orig_sys_argv = list(sys_argv)
122-
opts, dbg_opts, sys_argv = process_options(__title__, __version__, sys_argv)
121+
opts, dbg_opts, sys_argv = process_options(__version__, sys_argv)
123122
dbg_opts["orig_sys_argv"] = sys_argv
124123
dbg_opts["interface"] = BWInterface()
125124
dbg_opts["processor"] = "bullwinkle"
126125

127126
if dbg is None:
128-
dbg = Mdebugger.Trepan(dbg_opts)
127+
dbg = trepan.debugger.Trepan(dbg_opts)
129128
dbg.core.add_ignore(main)
130129
pass
131130
postprocess_options(dbg, opts)
132131

133-
# process_options has munged sys.argv to remove any options that
132+
# process_options has munged sys.argv to remove any
134133
# options that belong to this debugger. The original options to
135134
# invoke the debugger and script are in global sys_argv
136135
if len(sys_argv) == 0:
@@ -140,7 +139,7 @@ def main(dbg=None, sys_argv=list(sys.argv)):
140139
else:
141140
mainpyfile = sys_argv[0] # Get script filename.
142141
if not osp.isfile(mainpyfile):
143-
mainpyfile = Mclifns.whence_file(mainpyfile)
142+
mainpyfile = whence_file(mainpyfile)
144143
is_readable = readable(mainpyfile)
145144
if is_readable is None:
146145
print(
@@ -207,16 +206,16 @@ def main(dbg=None, sys_argv=list(sys.argv)):
207206
dbg.core.execution_status = "Terminated"
208207
dbg.intf[-1].msg("The program finished - quit or restart")
209208
dbg.core.processor.process_commands()
210-
except Mexcept.DebuggerQuit:
209+
except DebuggerQuit:
211210
break
212-
except Mexcept.DebuggerRestart:
211+
except DebuggerRestart:
213212
dbg.core.execution_status = "Restart requested"
214213
if dbg.program_sys_argv:
215214
sys.argv = list(dbg.program_sys_argv)
216215
part1 = "Restarting %s with arguments:" % dbg.core.filename(mainpyfile)
217216
args = " ".join(dbg.program_sys_argv[1:])
218217
dbg.intf[-1].msg(
219-
Mmisc.wrapped_lines(part1, args, dbg.settings["width"])
218+
wrapped_lines(part1, args, dbg.settings["width"])
220219
)
221220
else:
222221
break

trepan/debugger.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@
4141
# External Egg packages
4242
import tracer
4343

44+
import trepan
4445
import trepan.interfaces.user as Muser
4546

4647
# Default settings used here
4748
import trepan.lib.default as Mdefault
4849
import trepan.lib.sighandler as Msig
50+
4951
from trepan.exception import DebuggerQuit, DebuggerRestart
5052
from trepan.misc import option_set
5153

@@ -99,9 +101,6 @@ def run(self, cmd, start_opts=None, globals_=None, locals_=None):
99101
exec(cmd, globals_, locals_)
100102
except DebuggerQuit:
101103
pass
102-
except DebuggerQuit:
103-
pass
104-
pass
105104
except DebuggerQuit:
106105
pass
107106
finally:
@@ -338,7 +337,7 @@ def __init__(self, opts=None):
338337
self.intf[-1].output = out
339338
pass
340339

341-
self.core = Mcore.TrepanCore(self, core_opts)
340+
self.core = trepan.lib.core.TrepanCore(self, core_opts)
342341
self.core.add_ignore(self.core.stop)
343342

344343
# When set True, we'll also suspend our debug-hook tracing.

trepan/lib/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import pyficache
3636
import tracer
3737

38+
import trepan
3839
import trepan.clifns as Mclifns
3940

4041
# Our local modules
@@ -61,8 +62,6 @@ def __init__(self, debugger, opts=None):
6162
See also `start' and `stop'.
6263
"""
6364

64-
import trepan.bwprocessor as Mbwproc
65-
6665
def get_option(key: str) -> Any:
6766
return option_set(opts, key, self.DEFAULT_INIT_OPTS)
6867

@@ -94,7 +93,7 @@ def get_option(key: str) -> Any:
9493
if not self.processor:
9594
self.processor = Mcmdproc.CommandProcessor(self, opts=proc_opts)
9695
elif self.processor == "bullwinkle":
97-
self.processor = Mbwproc.BWProcessor(self, opts=proc_opts)
96+
self.processor = trepan.bwprocessor.BWProcessor(self, opts=proc_opts)
9897
pass
9998
# What events are considered in stepping. Note: 'None' means *all*.
10099
self.step_events = None

0 commit comments

Comments
 (0)