Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint issues and lint config #219

Merged
merged 1 commit into from Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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:///: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
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