Skip to content

Commit 27a7e3b

Browse files
committed
fix(syntax): flake8;
- Fixed syntax from flake8.
1 parent 8ea18f5 commit 27a7e3b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ckanext/xloader/plugin.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
from ckan import plugins
66
from ckan.plugins import toolkit
7-
from ckan.model.domain_object import DomainObjectOperation
8-
from ckan.model.resource import Resource
97

108
from ckan.model.domain_object import DomainObjectOperation
119
from ckan.model.resource import Resource
10+
from ckan.model.package import Package
1211

1312
from . import action, auth, helpers as xloader_helpers, utils
1413

@@ -101,15 +100,15 @@ def configure(self, config_):
101100
# IDomainObjectModification
102101

103102
def notify(self, entity, operation):
104-
# type: (ckan.model.Package|ckan.model.Resource, DomainObjectOperation) -> None
103+
# type: (Package|Resource, DomainObjectOperation) -> None
105104
"""
106105
Runs before_commit to database for Packages and Resources.
107106
We only want to check for changed Resources for this.
108107
We want to check if values have changed, namely the url and the format.
109108
See: ckan/model/modification.py.DomainObjectModificationExtension
110109
"""
111110
if operation != DomainObjectOperation.changed \
112-
or not isinstance(entity, Resource):
111+
or not isinstance(entity, Resource):
113112
return
114113

115114
context = {
@@ -124,7 +123,7 @@ def notify(self, entity, operation):
124123

125124
if _should_remove_unsupported_resource_from_datastore(resource_dict):
126125
toolkit.enqueue_job(fn=_remove_unsupported_resource_from_datastore, args=[entity.id])
127-
126+
128127
if not getattr(entity, 'url_changed', False):
129128
# do not submit to xloader if the url has not changed.
130129
return
@@ -242,9 +241,9 @@ def _should_remove_unsupported_resource_from_datastore(res_dict):
242241
return False
243242
return (not XLoaderFormats.is_it_an_xloader_format(res_dict.get('format', u''))
244243
and (res_dict.get('url_type') == 'upload'
245-
or not res_dict.get('url_type'))
244+
or not res_dict.get('url_type'))
246245
and (toolkit.asbool(res_dict.get('datastore_active', False))
247-
or toolkit.asbool(res_dict.get('extras', {}).get('datastore_active', False))))
246+
or toolkit.asbool(res_dict.get('extras', {}).get('datastore_active', False))))
248247

249248

250249
def _remove_unsupported_resource_from_datastore(resource_id):
@@ -263,7 +262,7 @@ def _remove_unsupported_resource_from_datastore(resource_id):
263262

264263
if _should_remove_unsupported_resource_from_datastore(res):
265264
log.info('Unsupported resource format "%s". Deleting datastore tables for resource %s',
266-
res.get(u'format', u''), res['id'])
265+
res.get(u'format', u''), res['id'])
267266
try:
268267
toolkit.get_action('datastore_delete')(context, {
269268
"resource_id": res['id'],

0 commit comments

Comments
 (0)