diff --git a/src/flask_debugtoolbar/panels/profiler.py b/src/flask_debugtoolbar/panels/profiler.py index 3294e4a..66f22aa 100644 --- a/src/flask_debugtoolbar/panels/profiler.py +++ b/src/flask_debugtoolbar/panels/profiler.py @@ -94,7 +94,7 @@ def process_response(self, request, response): def title(self): if not self.is_active: return "Profiler not active" - return 'View: %.2fms' % (float(self.stats.total_tt)*1000,) + return 'View: %.2fms' % (float(self.stats.total_tt) * 1000,) def nav_title(self): return 'Profiler' @@ -102,7 +102,7 @@ def nav_title(self): def nav_subtitle(self): if not self.is_active: return "in-active" - return 'View: %.2fms' % (float(self.stats.total_tt)*1000,) + return 'View: %.2fms' % (float(self.stats.total_tt) * 1000,) def url(self): return '' diff --git a/src/flask_debugtoolbar/panels/sqlalchemy.py b/src/flask_debugtoolbar/panels/sqlalchemy.py index 87f4bdd..13211eb 100644 --- a/src/flask_debugtoolbar/panels/sqlalchemy.py +++ b/src/flask_debugtoolbar/panels/sqlalchemy.py @@ -62,8 +62,7 @@ def extension_used(): def recording_enabled(): - return (current_app.debug - or current_app.config.get('SQLALCHEMY_RECORD_QUERIES')) + return (current_app.debug or current_app.config.get('SQLALCHEMY_RECORD_QUERIES')) def is_available(): diff --git a/src/flask_debugtoolbar/panels/timer.py b/src/flask_debugtoolbar/panels/timer.py index 2e04aa6..df3317e 100644 --- a/src/flask_debugtoolbar/panels/timer.py +++ b/src/flask_debugtoolbar/panels/timer.py @@ -52,8 +52,7 @@ def url(self): return '' def _elapsed_ru(self, name): - return (getattr(self._end_rusage, name) - - getattr(self._start_rusage, name)) + return (getattr(self._end_rusage, name) - getattr(self._start_rusage, name)) def content(self): diff --git a/src/flask_debugtoolbar/utils.py b/src/flask_debugtoolbar/utils.py index 267a2e3..76957e1 100644 --- a/src/flask_debugtoolbar/utils.py +++ b/src/flask_debugtoolbar/utils.py @@ -88,6 +88,7 @@ def format_sql(query, args): SqlLexer(), HtmlFormatter(noclasses=True, style=PYGMENT_STYLE))) + def gzip_compress(data, compresslevel=6): buff = io.BytesIO() with gzip.GzipFile(fileobj=buff, mode='wb', compresslevel=compresslevel) as f: diff --git a/test/basic_app.py b/test/basic_app.py index 689d14a..e10671d 100644 --- a/test/basic_app.py +++ b/test/basic_app.py @@ -7,7 +7,8 @@ app.config['SECRET_KEY'] = 'abc123' app.config['SQLALCHEMY_RECORD_QUERIES'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' -# This is no longer needed for Flask-SQLAlchemy 3.0+, if you're using 2.X you'll want to define this: +# This is no longer needed for Flask-SQLAlchemy 3.0+, +# if you're using 2.X you'll want to define this: # app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # make sure these are printable in the config panel diff --git a/tox.ini b/tox.ini index a2d3df4..48be4c1 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,9 @@ commands = deps = pycodestyle commands = - pycodestyle flask_debugtoolbar test + # E731: do not assign a lambda expression, use a def + # W504: line break after binary operator + pycodestyle src/flask_debugtoolbar test --ignore=E731,W504 [pycodestyle] max-line-length = 100