Skip to content

Commit 960b1a7

Browse files
committed
More lint
1 parent 5869a63 commit 960b1a7

2 files changed

Lines changed: 51 additions & 34 deletions

File tree

requirements.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,19 @@ uncompyle6 >= 3.7.4
1212
# Get these from github
1313
# pyficache >= 2.1.0, < 2.2.0
1414
# xdis >= 4.7.0
15+
16+
xdis~=6.1.0.dev0
17+
setuptools~=59.6.0
18+
pip~=22.0.2
19+
attrs~=21.2.0
20+
distro~=1.7.0
21+
wheel~=0.37.1
22+
cryptography~=3.4.8
23+
Pillow~=9.0.1
24+
tornado~=6.1
25+
Jinja2~=3.0.3
26+
pyficache~=2.3.0
27+
py~=1.10.0
28+
lxml~=4.8.0
29+
keyring~=23.5.0
30+
typing_extensions~=4.8.0

trepan/debugger.py

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@
3939
# External Egg packages
4040
import tracer
4141

42-
import trepan.interfaces.user as Muser
42+
from trepan.interfaces.user import UserInterface
4343

4444
# Default settings used here
45-
import trepan.lib.default as Mdefault
46-
import trepan.lib.sighandler as Msig
45+
from trepan.lib.default import DEBUGGER_SETTINGS, START_OPTS
46+
from trepan.lib.sighandler import SignalManager
4747
from trepan.exception import DebuggerQuit, DebuggerRestart
4848
from trepan.lib.core import TrepanCore
4949
from trepan.misc import option_set
5050

51-
debugger_obj = None
52-
5351
try:
5452
from readline import get_line_buffer
5553
except ImportError:
@@ -59,8 +57,10 @@ def get_line_buffer():
5957

6058
pass
6159

60+
debugger_obj = None
61+
6262

63-
class Trepan(object):
63+
class Trepan:
6464
# The following functions have to be defined before
6565
# DEFAULT_INIT_OPTS which includes references to these.
6666

@@ -76,8 +76,8 @@ def run(self, cmd, start_opts=None, globals_=None, locals_=None):
7676
7777
Debugger.core.start settings are passed via optional
7878
dictionary `start_opts'. Overall debugger settings are in
79-
Debugger.settings which changed after an instance is created
80-
. Also see `run_eval' if what you want to run is an
79+
``Debugger.settings`` which changed after an instance is created
80+
. Also see `run_eval' if what you want to run is a
8181
run_eval'able expression have that result returned and
8282
`run_call' if you want to debug function run_call.
8383
"""
@@ -112,12 +112,12 @@ def run_exec(self, cmd, start_opts=None, globals_=None, locals_=None):
112112
variables. If `locals_' is not given, it becomes a copy of
113113
`globals_'.
114114
115-
Debugger.core.start settings are passed via optional
115+
``Debugger.core.start`` settings are passed via optional
116116
dictionary `start_opts'. Overall debugger settings are in
117-
Debugger.settings which changed after an instance is created
118-
. Also see `run_eval' if what you want to run is an
119-
run_eval'able expression have that result returned and
120-
`run_call' if you want to debug function run_call.
117+
``Debugger.settings`` which changed after an instance is created.
118+
See `run_eval' if what you want to run is an
119+
expression that should be ``eval``d and have that result returned.
120+
See ``run_call`` if you want to debug function ``run_call()``.
121121
"""
122122
if globals_ is None:
123123
globals_ = globals()
@@ -138,9 +138,9 @@ def run_exec(self, cmd, start_opts=None, globals_=None, locals_=None):
138138
def run_call(self, func: Callable, *args, start_opts=None, **kwds):
139139
"""Run debugger on function call: `func(*args, **kwds)'
140140
141-
See also `run_eval' if what you want to run is an eval'able
142-
expression have that result returned and `run' if you want to
143-
debug a statement via exec.
141+
See also ``run_eval`` if what you want to run is an eval'able
142+
expression have that result returned and ``run``if you want to
143+
debug a statement via ``exec``.
144144
"""
145145
res = None
146146
self.core.start(opts=start_opts)
@@ -276,8 +276,8 @@ def restart_argv(self):
276276
"processor": None,
277277
# Setting contains lots of debugger settings - a whole file
278278
# full of them!
279-
"settings": Mdefault.DEBUGGER_SETTINGS,
280-
"start_opts": Mdefault.START_OPTS,
279+
"settings": DEBUGGER_SETTINGS,
280+
"start_opts": START_OPTS,
281281
"step_ignore": 0,
282282
"from_ipython": False,
283283
}
@@ -287,7 +287,7 @@ def __init__(self, opts=None):
287287
key 'start' inside hash 'opts', we may or may not initially
288288
start debugging.
289289
290-
See also Debugger.start and Debugger.stop.
290+
See also ``Debugger.start`` and ``Debugger.stop``.
291291
"""
292292

293293
self.mainpyfile = None
@@ -316,7 +316,7 @@ def completer(text: str, state):
316316
core_opts[opt] = get_option(opt)
317317
pass
318318

319-
# How is I/O for this debugger handled? This should
319+
# How are I/O for this debugger handled? This should
320320
# be set before calling DebuggerCore.
321321
interface_opts = {
322322
"complete": completer,
@@ -325,7 +325,7 @@ def completer(text: str, state):
325325
# FIXME when I pass in opts=opts things break
326326

327327
inp = opts.get("input", None) if opts else None
328-
interface = get_option("interface") or Muser.UserInterface(
328+
interface = get_option("interface") or UserInterface(
329329
inp=inp, opts=interface_opts
330330
)
331331
self.intf = [interface]
@@ -351,22 +351,24 @@ def completer(text: str, state):
351351
self.program_sys_argv = None
352352
pass
353353

354-
self.sigmgr = Msig.SignalManager(self)
354+
self.sigmgr = SignalManager(self)
355355

356356
# Were we requested to activate immediately?
357357
if get_option("activate"):
358358
self.core.start(get_option("start_opts"))
359359
pass
360360
return
361361

362-
def complete(self, last_token, state):
362+
def complete(self, last_token: str, state: int):
363+
"""
364+
In place expansion of top-level debugger command
365+
for `last_token`` that we are in ``state``.
366+
"""
363367
if hasattr(self.core.processor, "completer"):
364-
str = get_line_buffer() or last_token
365-
results = self.core.processor.completer(str, state)
368+
string_seen = get_line_buffer() or last_token
369+
results = self.core.processor.completer(string_seen, state)
366370
return results[state]
367-
else:
368-
return [None]
369-
371+
return
370372
pass
371373

372374

@@ -375,8 +377,8 @@ def complete(self, last_token, state):
375377

376378
def foo():
377379
y = 2
378-
for i in range(2):
379-
print("%d %d" % (i, y))
380+
for item in range(2):
381+
print(f"{item} {y}")
380382
pass
381383
return 3
382384

@@ -404,15 +406,14 @@ def foo():
404406
print("started")
405407
d.core.step_ignore = 0
406408
d.core.start()
407-
x = 4
408409
x = foo()
409410
for i in range(2):
410-
print("%d" % (i + 1) * 10)
411+
print(f"{(i + 1) * 10}")
411412
pass
412413
d.core.stop()
413414

414-
def square(x):
415-
return x * x
415+
def square(n):
416+
return n * n
416417

417418
print("calling: run_call(square,2)")
418419
d.run_call(square, 2)

0 commit comments

Comments
 (0)