Skip to content

Commit 62ce443

Browse files
authored
Fix lint issues and lint config (#219)
For the two ignored rules: - E731: It's OK to use lambda - W504: W503 and W504 are conflicts with each other, we need to disable one of them.
1 parent 2b8bf9c commit 62ce443

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

src/flask_debugtoolbar/panels/profiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ def process_response(self, request, response):
9494
def title(self):
9595
if not self.is_active:
9696
return "Profiler not active"
97-
return 'View: %.2fms' % (float(self.stats.total_tt)*1000,)
97+
return 'View: %.2fms' % (float(self.stats.total_tt) * 1000,)
9898

9999
def nav_title(self):
100100
return 'Profiler'
101101

102102
def nav_subtitle(self):
103103
if not self.is_active:
104104
return "in-active"
105-
return 'View: %.2fms' % (float(self.stats.total_tt)*1000,)
105+
return 'View: %.2fms' % (float(self.stats.total_tt) * 1000,)
106106

107107
def url(self):
108108
return ''

src/flask_debugtoolbar/panels/sqlalchemy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def extension_used():
6262

6363

6464
def recording_enabled():
65-
return (current_app.debug
66-
or current_app.config.get('SQLALCHEMY_RECORD_QUERIES'))
65+
return (current_app.debug or current_app.config.get('SQLALCHEMY_RECORD_QUERIES'))
6766

6867

6968
def is_available():

src/flask_debugtoolbar/panels/timer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def url(self):
5252
return ''
5353

5454
def _elapsed_ru(self, name):
55-
return (getattr(self._end_rusage, name)
56-
- getattr(self._start_rusage, name))
55+
return (getattr(self._end_rusage, name) - getattr(self._start_rusage, name))
5756

5857
def content(self):
5958

src/flask_debugtoolbar/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def format_sql(query, args):
8888
SqlLexer(),
8989
HtmlFormatter(noclasses=True, style=PYGMENT_STYLE)))
9090

91+
9192
def gzip_compress(data, compresslevel=6):
9293
buff = io.BytesIO()
9394
with gzip.GzipFile(fileobj=buff, mode='wb', compresslevel=compresslevel) as f:

test/basic_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
app.config['SECRET_KEY'] = 'abc123'
88
app.config['SQLALCHEMY_RECORD_QUERIES'] = True
99
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
10-
# This is no longer needed for Flask-SQLAlchemy 3.0+, if you're using 2.X you'll want to define this:
10+
# This is no longer needed for Flask-SQLAlchemy 3.0+,
11+
# if you're using 2.X you'll want to define this:
1112
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
1213

1314
# make sure these are printable in the config panel

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ commands =
1717
deps =
1818
pycodestyle
1919
commands =
20-
pycodestyle flask_debugtoolbar test
20+
# E731: do not assign a lambda expression, use a def
21+
# W504: line break after binary operator
22+
pycodestyle src/flask_debugtoolbar test --ignore=E731,W504
2123

2224
[pycodestyle]
2325
max-line-length = 100

0 commit comments

Comments
 (0)