Skip to content

Commit

Permalink
Merge pull request #7912 from ckan/flake8-ignore-node_modules
Browse files Browse the repository at this point in the history
Flake8: ignore node modules
  • Loading branch information
kowh-ai committed Nov 17, 2023
2 parents e2e5de2 + 482b76a commit 8e5d925
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 23 deletions.
11 changes: 2 additions & 9 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,23 @@ exclude =
.*
./contrib
./bin
./node_modules

per-file-ignores =
test_*.py:E501
extend-exclude =
ckan/__init__.py,ckan/config/middleware.py
ckan/lib/app_globals.py
ckan/lib/cli.py
ckan/lib/create_test_data.py
ckan/lib/dictization/__init__.py
ckan/lib/dictization/model_dictize.py
ckan/lib/dictization/model_save.py
ckan/lib/email_notifications.py
ckan/lib/hash.py
ckan/lib/jinja_extensions.py
ckan/lib/maintain.py
ckan/lib/navl/validators.py
ckan/lib/plugins.py
ckan/lib/search/__init__.py
ckan/lib/search/index.py
ckan/lib/search/query.py
ckan/logic/action/__init__.py
ckan/logic/action/delete.py
ckan/logic/action/get.py
ckan/logic/action/update.py
Expand All @@ -49,16 +46,12 @@ extend-exclude =
ckan/model/system_info.py
ckan/model/tag.py
ckan/model/task_status.py
ckan/model/term_translation.py
ckan/model/user.py
ckan/model/vocabulary.py
ckan/authz.py
ckanext/datastore/logic/action.py
ckanext/datastore/tests/test_create.py
ckanext/example_idatasetform/plugin.py
ckanext/example_itemplatehelpers/plugin.py
ckanext/multilingual/plugin.py
ckanext/stats/stats.py
ckanext/test_tag_vocab_plugin.py
doc/conf.py
setup.py
3 changes: 2 additions & 1 deletion ckan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

# The packaging system relies on this import, please do not remove it
# type_ignore_reason: pyright thinks it's iterable
import sys; sys.path.insert(0, __path__[0]) # type: ignore
import sys
sys.path.insert(0, __path__[0]) # type: ignore
2 changes: 1 addition & 1 deletion ckan/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from flask_babel import (gettext as flask_ugettext,
ngettext as flask_ungettext)

import simplejson as json # type: ignore # noqa: re-export
import simplejson as json # type: ignore # noqa
import ckan.lib.maintain as maintain
from ckan.config.declaration import Declaration
from ckan.types import Model, Request
Expand Down
4 changes: 3 additions & 1 deletion ckan/lib/dictization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def table_dict_save(table_dict: dict[str, Any],
extra_attrs: Iterable[str] = ()) -> Any:
'''Given a dict and a model class, update or create a sqlalchemy object.
This will use an existing object if "id" is supplied OR if any unique
constraints are met. e.g supplying just a tag name will get out that tag obj.
constraints are met. e.g supplying just a tag name will get out that tag
obj.
'''
session = context["session"]

Expand Down
6 changes: 3 additions & 3 deletions ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import ckan


from ckan.lib.pagination import Page # type: ignore # noqa: re-export
from ckan.lib.pagination import Page # type: ignore # noqa
from ckan.common import _, g, request, json

from ckan.lib.webassets_tools import include_asset, render_assets
Expand Down Expand Up @@ -1104,7 +1104,7 @@ def get_facet_items_dict(
if not len(facet_item['name'].strip()):
continue
params_items = request.args.items(multi=True)
if not (facet, facet_item['name']) in params_items:
if (facet, facet_item['name']) not in params_items:
facets.append(dict(active=False, **facet_item))
elif not exclude_active:
facets.append(dict(active=True, **facet_item))
Expand Down Expand Up @@ -1146,7 +1146,7 @@ def has_more_facets(facet: str,
if not len(facet_item['name'].strip()):
continue
params_items = request.args.items(multi=True)
if not (facet, facet_item['name']) in params_items:
if (facet, facet_item['name']) not in params_items:
facets.append(dict(active=False, **facet_item))
elif not exclude_active:
facets.append(dict(active=True, **facet_item))
Expand Down
3 changes: 2 additions & 1 deletion ckan/model/term_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

__all__ = ['term_translation_table']

term_translation_table = Table('term_translation', meta.metadata,
term_translation_table = Table(
'term_translation', meta.metadata,
Column('term', UnicodeText, nullable=False),
Column('term_translation', UnicodeText, nullable=False),
Column('lang_code', UnicodeText, nullable=False),
Expand Down
4 changes: 2 additions & 2 deletions ckan/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8

from ckan.plugins.core import * # noqa: re-export
from ckan.plugins.interfaces import * # noqa: re-export
from ckan.plugins.core import * # noqa
from ckan.plugins.interfaces import * # noqa


def __getattr__(name: str):
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/controllers/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_other_datasets_dont_show_up_on_user_dashboard(self, app, user):

response = app.get(url=url_for("dashboard.datasets"), headers=headers)

assert not (dataset_title in response)
assert dataset_title not in response

def test_user_edit_no_user(self, app):

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/pytest_ckan/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def factory(data, filename, context={}, **kwargs):
action = kwargs.pop("action", "resource_create")
field = kwargs.pop("upload_field_name", "upload")
test_file = BytesIO()
if type(data) is not bytes:
if not isinstance(data, bytes):
data = bytes(data, encoding="utf-8")
test_file.write(data)
test_file.seek(0)
Expand Down
2 changes: 0 additions & 2 deletions ckan/views/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ def get(self,
u'form_snippet': form_snippet,
u'dataset_type': package_type,
u'resources_json': resources_json,
u'form_snippet': form_snippet,
u'errors_json': errors_json
}
)
Expand Down Expand Up @@ -844,7 +843,6 @@ def get(self,
u'pkg_dict': pkg_dict,
u'pkg': pkg,
u'resources_json': resources_json,
u'form_snippet': form_snippet,
u'errors_json': errors_json
}
)
Expand Down
2 changes: 1 addition & 1 deletion ckanext/example_blanket_implementation/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

# must be ignored by blanket
from random import randrange # type: ignore # noqa: test
from random import randrange # type: ignore # noqa


def blanket_helper():
Expand Down
1 change: 1 addition & 0 deletions ckanext/example_itemplatehelpers/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any, Callable
import ckan.plugins as plugins


# Our custom template helper function.
def example_helper():
'''An example template helper function.'''
Expand Down

0 comments on commit 8e5d925

Please sign in to comment.