Skip to content

Commit

Permalink
fix flake8 (#6321)
Browse files Browse the repository at this point in the history
  • Loading branch information
konnectr authored Jul 30, 2023
1 parent ae29eb3 commit f6ba950
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: sudo pip install flake8 black isort
- run: sudo pip install flake8==6.1.0 black==23.1.0 isort==5.12.0
- run: flake8 .
- run: black --check .
- run: isort --check-only --diff .
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ repos:
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8

2 changes: 1 addition & 1 deletion redash/query_runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _get_tables(self, schema_dict):

def _get_tables_stats(self, tables_dict):
for t in tables_dict.keys():
if type(tables_dict[t]) == dict:
if isinstance(tables_dict[t], dict):
res = self._run_query_internal("select count(*) as cnt from %s" % t)
tables_dict[t]["size"] = res[0]["cnt"]

Expand Down
4 changes: 2 additions & 2 deletions redash/query_runner/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def execute_query(data_source_name_or_id, query, result_type=None):
:query string: Query to run
"""
try:
if type(data_source_name_or_id) == int:
if isinstance(data_source_name_or_id, int):
data_source = models.DataSource.get_by_id(data_source_name_or_id)
else:
data_source = models.DataSource.get_by_name(data_source_name_or_id)
Expand Down Expand Up @@ -241,7 +241,7 @@ def get_source_schema(data_source_name_or_id):
:return:
"""
try:
if type(data_source_name_or_id) == int:
if isinstance(data_source_name_or_id, int):
data_source = models.DataSource.get_by_id(data_source_name_or_id)
else:
data_source = models.DataSource.get_by_name(data_source_name_or_id)
Expand Down

0 comments on commit f6ba950

Please sign in to comment.