Skip to content

Commit

Permalink
Fix lint issues and lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
greyli committed Nov 17, 2023
1 parent f959951 commit 5bfe686
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/flask_debugtoolbar/panels/profiler.py
Expand Up @@ -94,15 +94,15 @@ 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'

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 ''
Expand Down
3 changes: 1 addition & 2 deletions src/flask_debugtoolbar/panels/sqlalchemy.py
Expand Up @@ -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():
Expand Down
3 changes: 1 addition & 2 deletions src/flask_debugtoolbar/panels/timer.py
Expand Up @@ -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):

Expand Down
1 change: 1 addition & 0 deletions src/flask_debugtoolbar/utils.py
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion test/basic_app.py
Expand Up @@ -7,7 +7,8 @@
app.config['SECRET_KEY'] = 'abc123'
app.config['SQLALCHEMY_RECORD_QUERIES'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
# 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
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Expand Up @@ -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

0 comments on commit 5bfe686

Please sign in to comment.