Skip to content

Commit 901d515

Browse files
committed
Misc lint
1 parent 5cf30f3 commit 901d515

8 files changed

Lines changed: 28 additions & 21 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ flake8:
3030
flake8 trepan
3131

3232
#: Run all tests: unit, functional and integration verbosely
33-
check: test-unit test-functional test-integration # flake8
33+
# check: test-unit test-functional test-integration # flake8
34+
check: test-unit test-integration # flake8
3435

3536
#: Run unit (white-box) tests
3637
test-unit:

trepan/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def main(dbg=None, sys_argv=list(sys.argv)):
111111
load_module,
112112
PYTHON_VERSION_TRIPLE,
113113
IS_PYPY,
114-
version_tuple_to_str,
115114
)
115+
from xdis.version_info import version_tuple_to_str
116116

117117
(
118118
python_version,
@@ -197,7 +197,7 @@ def write_wrapper(*args, **kwargs):
197197
# linemap_io = StringIO()
198198
try:
199199
decompile_file(mainpyfile, fd.file, mapstream=fd)
200-
except:
200+
except Exception:
201201
print(
202202
"%s: error decompiling '%s'" % (__title__, mainpyfile),
203203
file=sys.stderr,

trepan/api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2008-2009, 2013-2017, 2019-2021 Rocky Bernstein <rocky@gnu.org>
2+
#
3+
# Copyright (C) 2008-2009, 2013-2017, 2019-2021, 2023 Rocky
4+
# Bernstein <rocky@gnu.org>
35
#
46
# This program is free software: you can redistribute it and/or modify
57
# it under the terms of the GNU General Public License as published by
@@ -69,7 +71,7 @@ def run_eval(
6971
return dbg.run_eval(
7072
expression, start_opts=start_opts, globals_=globals_, locals_=locals_
7173
)
72-
except:
74+
except Exception:
7375
dbg.core.trace_hook_suspend = True
7476
if start_opts and "tb_fn" in start_opts:
7577
tb_fn = start_opts["tb_fn"]
@@ -92,7 +94,7 @@ def run_call(func, *args, **kwds):
9294
dbg = Trepan()
9395
try:
9496
return dbg.run_call(func, *args, **kwds)
95-
except:
97+
except Exception:
9698
uncaught_exception(dbg)
9799
pass
98100
return
@@ -119,7 +121,7 @@ def run_exec(statement, debug_opts=None, start_opts=None, globals_=None, locals_
119121
return dbg.run_exec(
120122
statement, start_opts=start_opts, globals_=globals_, locals_=locals_
121123
)
122-
except:
124+
except Exception:
123125
uncaught_exception(dbg)
124126
pass
125127
return

trepan/bwprocessor/command/mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
""" Not a command. A stub class used by a command in its 'main' for
1919
demonstrating how the command works."""
2020

21-
import os, sys
21+
import sys
2222

2323
from trepan.lib import breakpoint, default
2424

trepan/lib/format.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2013, 2015, 2017, 2019, 2020 Rocky Bernstein <rocky@gnu.org>
2+
3+
# Copyright (C) 2013, 2015, 2017, 2019, 2020,2023
4+
# Rocky Bernstein <rocky@gnu.org>
35
#
46
# This program is free software: you can redistribute it and/or modify
57
# it under the terms of the GNU General Public License as published by
@@ -47,13 +49,13 @@
4749
color_scheme[Generic.Emph] = color_scheme[Comment.Preproc]
4850

4951
# Assume pygments has fixed up the horrible atom colors
50-
## FIXME: change some horrible colors under atom dark
51-
## this is a hack until I get general way to do colorstyle setting
52-
## color_scheme[Token.Comment] = ('darkgray', 'white')
53-
## color_scheme[Token.Keyword] = ('darkblue', 'green')
54-
## color_scheme[Token.Number] = ('darkblue', 'blue')
55-
## color_scheme[Keyword] = ('darkblue', 'turquoise')
56-
## color_scheme[Number] = ('darkblue', 'green')
52+
# FIXME: change some horrible colors under atom dark
53+
# this is a hack until I get general way to do colorstyle setting
54+
# color_scheme[Token.Comment] = ('darkgray', 'white')
55+
# color_scheme[Token.Keyword] = ('darkblue', 'green')
56+
# color_scheme[Token.Number] = ('darkblue', 'blue')
57+
# color_scheme[Keyword] = ('darkblue', 'turquoise')
58+
# color_scheme[Number] = ('darkblue', 'green')
5759

5860
pyficache.dark_terminal_formatter.colorscheme = color_scheme
5961
pyficache.light_terminal_formatter.colorscheme = color_scheme

trepan/lib/printing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2007-2010, 2015, 2020 Rocky Bernstein
2+
#
3+
# Copyright (C) 2007-2010, 2015, 2020, 2023 Rocky Bernstein
34

45
# This program is free software: you can redistribute it and/or modify
56
# it under the terms of the GNU General Public License as published by
@@ -36,7 +37,7 @@ def print_argspec(obj, obj_name):
3637
"""A slightly decorated version of inspect.format_argspec"""
3738
try:
3839
return obj_name + inspect.formatargspec(*inspect.getargspec(obj))
39-
except:
40+
except Exception:
4041
return None
4142
return # Not reached
4243

trepan/processor/cmdlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def parse_location(proc, args):
158158
def five():
159159
return 5
160160

161-
import os
161+
import os # noqa
162162

163163
for cmd in (
164164
# "list",

trepan/processor/command/tbreak.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
import sys
1717

18+
from trepan.processor.cmdbreak import parse_break_cmd, set_break
19+
1820
# Our local modules
1921
from trepan.processor.command.base_cmd import DebuggerCommand
20-
from trepan.processor.cmdbreak import parse_break_cmd, set_break
2122
from trepan.processor.complete import complete_break_linenumber
2223

2324

@@ -66,7 +67,7 @@ class TempBreakCommand(DebuggerCommand):
6667

6768
def run(self, args):
6869
func, filename, lineno, condition, offset = parse_break_cmd(self.proc, args)
69-
if not (func == None and filename == None):
70+
if not (func is None and filename is None):
7071
set_break(self, func, filename, lineno, condition, True, args)
7172
return
7273

0 commit comments

Comments
 (0)