summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 17:55:15 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 17:55:22 -0700
commit6fa2d38be243531747241a3ae602069d507368d9 (patch)
tree7cc81446a97a372640f6a189f09b88fa466e77ce /python/fatcat_web
parent367b06f64546e4533662017c9dbe72aca175a294 (diff)
downloadfatcat-6fa2d38be243531747241a3ae602069d507368d9.tar.gz
fatcat-6fa2d38be243531747241a3ae602069d507368d9.zip
lint: simple, safe inline lint fixes
'==' vs 'is'; 'not a in b' vs 'a not in b'; etc
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/editing_routes.py14
-rw-r--r--python/fatcat_web/entity_helpers.py4
-rw-r--r--python/fatcat_web/routes.py4
-rw-r--r--python/fatcat_web/search.py4
4 files changed, 13 insertions, 13 deletions
diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py
index d888735a..5a97dfc4 100644
--- a/python/fatcat_web/editing_routes.py
+++ b/python/fatcat_web/editing_routes.py
@@ -188,7 +188,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template
raise ae
# check that editgroup is edit-able
- if editgroup.changelog_index != None:
+ if editgroup.changelog_index is not None:
abort(400, "Editgroup already merged")
# fetch entity (if set) or 404
@@ -285,7 +285,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template
raise NotImplementedError
editor_editgroups = api.get_editor_editgroups(session['editor']['editor_id'], limit=20)
- potential_editgroups = [e for e in editor_editgroups if e.changelog_index == None and e.submitted == None]
+ potential_editgroups = [e for e in editor_editgroups if e.changelog_index is None and e.submitted is None]
if not form.is_submitted():
# default to most recent not submitted, fallback to "create new"
@@ -313,7 +313,7 @@ def generic_entity_toml_edit(editgroup_id, entity_type, existing_ident, edit_tem
raise ae
# check that editgroup is edit-able
- if editgroup.changelog_index != None:
+ if editgroup.changelog_index is not None:
flash("Editgroup already merged")
abort(400)
@@ -381,7 +381,7 @@ def generic_entity_toml_edit(editgroup_id, entity_type, existing_ident, edit_tem
form = EntityTomlForm.from_entity(existing)
editor_editgroups = api.get_editor_editgroups(session['editor']['editor_id'], limit=20)
- potential_editgroups = [e for e in editor_editgroups if e.changelog_index == None and e.submitted == None]
+ potential_editgroups = [e for e in editor_editgroups if e.changelog_index is None and e.submitted is None]
if not form.is_submitted():
# default to most recent not submitted, fallback to "create new"
@@ -410,7 +410,7 @@ def generic_entity_delete(editgroup_id: Optional[str], entity_type: str, existin
raise ae
# check that editgroup is edit-able
- if editgroup.changelog_index != None:
+ if editgroup.changelog_index is not None:
flash("Editgroup already merged")
abort(400)
@@ -462,7 +462,7 @@ def generic_entity_delete(editgroup_id: Optional[str], entity_type: str, existin
form = EntityTomlForm.from_entity(existing)
editor_editgroups = api.get_editor_editgroups(session['editor']['editor_id'], limit=20)
- potential_editgroups = [e for e in editor_editgroups if e.changelog_index == None and e.submitted == None]
+ potential_editgroups = [e for e in editor_editgroups if e.changelog_index is None and e.submitted is None]
if not form.is_submitted():
# default to most recent not submitted, fallback to "create new"
@@ -484,7 +484,7 @@ def generic_edit_delete(editgroup_id, entity_type, edit_id):
abort(ae.status)
# check that editgroup is edit-able
- if editgroup.changelog_index != None:
+ if editgroup.changelog_index is not None:
flash("Editgroup already merged")
abort(400)
diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py
index 26371341..5522f3b5 100644
--- a/python/fatcat_web/entity_helpers.py
+++ b/python/fatcat_web/entity_helpers.py
@@ -45,7 +45,7 @@ def enrich_fileset_entity(entity):
if entity.state in ('redirect', 'deleted'):
return entity
entity._total_size = None
- if entity.manifest != None:
+ if entity.manifest is not None:
entity._total_size = sum([f.size for f in entity.manifest]) or 0
return entity
@@ -93,7 +93,7 @@ def enrich_release_entity(entity):
c.role in ('author', None) and
(c.surname or c.raw_name or (c.creator and c.creator.surname))
]
- entity._authors = sorted(authors, key=lambda c: (c.index == None and 99999999) or c.index)
+ entity._authors = sorted(authors, key=lambda c: (c.index is None and 99999999) or c.index)
# need authors, title for citeproc to work
entity._can_citeproc = bool(entity._authors) and bool(entity.title)
if entity.abstracts:
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 9795adf7..fc94da66 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -738,7 +738,7 @@ def release_save(ident):
@app.route('/search', methods=['GET', 'POST'])
def generic_search():
- if not 'q' in request.args.keys():
+ if 'q' not in request.args.keys():
return redirect('/release/search')
query = request.args.get('q').strip()
@@ -1080,7 +1080,7 @@ def change_username():
if not app.testing:
app.csrf.protect()
# show the user a list of login options
- if not 'username' in request.form:
+ if 'username' not in request.form:
abort(400)
# on behalf of user...
user_api = auth_api(session['api_token'])
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index 94c7431c..95f1f5c9 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -417,7 +417,7 @@ def get_elastic_search_coverage(query: ReleaseQuery) -> dict:
preservation_bucket = agg_to_dict(resp.aggregations.preservation)
preservation_bucket['total'] = _hits_total_int(resp.hits.total)
for k in ('bright', 'dark', 'shadows_only', 'none'):
- if not k in preservation_bucket:
+ if k not in preservation_bucket:
preservation_bucket[k] = 0
if app.config['FATCAT_MERGE_SHADOW_PRESERVATION']:
preservation_bucket['none'] += preservation_bucket['shadows_only']
@@ -490,7 +490,7 @@ def get_elastic_container_stats(ident, issnl=None, es_client=None, es_index=None
preservation_bucket = agg_to_dict(resp.aggregations.preservation)
preservation_bucket['total'] = _hits_total_int(resp.hits.total)
for k in ('bright', 'dark', 'shadows_only', 'none'):
- if not k in preservation_bucket:
+ if k not in preservation_bucket:
preservation_bucket[k] = 0
if merge_shadows:
preservation_bucket['none'] += preservation_bucket['shadows_only']