diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-01 18:35:17 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-01 18:35:17 -0700 |
commit | a6e515dfe8f07410e7c71fa826995e5172b19731 (patch) | |
tree | 9d11fb7455089634fca68efbbcb599a2e6ee1d27 /python | |
parent | e9568d9d973df345966c71149757868cdf297179 (diff) | |
download | fatcat-a6e515dfe8f07410e7c71fa826995e5172b19731.tar.gz fatcat-a6e515dfe8f07410e7c71fa826995e5172b19731.zip |
lint (flake8) web interface python files
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat_web/auth.py | 3 | ||||
-rw-r--r-- | python/fatcat_web/editing_routes.py | 22 | ||||
-rw-r--r-- | python/fatcat_web/forms.py | 5 | ||||
-rw-r--r-- | python/fatcat_web/graphics.py | 1 | ||||
-rw-r--r-- | python/fatcat_web/routes.py | 7 | ||||
-rw-r--r-- | python/fatcat_web/search.py | 3 | ||||
-rw-r--r-- | python/fatcat_web/web_config.py | 1 |
7 files changed, 16 insertions, 26 deletions
diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index 8e26b7fe..268bc1c4 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -2,8 +2,7 @@ from collections import namedtuple import requests import pymacaroons -from flask import Flask, render_template, send_from_directory, request, \ - url_for, abort, g, redirect, jsonify, session, flash +from flask import render_template, abort, redirect, session, flash from flask_login import logout_user, login_user, UserMixin from fatcat_web import login_manager, app, api, priv_api, Config import fatcat_openapi_client diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py index 87223868..44000b1a 100644 --- a/python/fatcat_web/editing_routes.py +++ b/python/fatcat_web/editing_routes.py @@ -1,16 +1,11 @@ -import os -import json -from flask import Flask, render_template, send_from_directory, request, \ - url_for, abort, g, redirect, jsonify, session, flash, Response +from flask import render_template, abort, redirect, session, flash from flask_login import login_required from fatcat_openapi_client import Editgroup from fatcat_openapi_client.rest import ApiException from fatcat_tools.transforms import * -from fatcat_web import app, api, auth_api, priv_api -from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth -from fatcat_web.cors import crossdomain +from fatcat_web import app, api, auth_api from fatcat_web.search import * from fatcat_web.forms import * from fatcat_web.entity_helpers import * @@ -20,7 +15,7 @@ from fatcat_web.entity_helpers import * def form_editgroup_get_or_create(api, edit_form): """ - This function expects a submitted, validated + This function expects a submitted, validated edit form """ if edit_form.editgroup_id.data: try: @@ -43,8 +38,10 @@ def form_editgroup_get_or_create(api, edit_form): app.log.warning(ae) abort(ae.status) # set this session editgroup_id - flash('Started new editgroup <a href="/editgroup/{}">{}</a>' \ - .format(eg.editgroup_id, eg.editgroup_id)) + flash('Started new editgroup <a href="/editgroup/{}">{}</a>'.format( + eg.editgroup_id, + eg.editgroup_id, + )) return eg def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template): @@ -68,7 +65,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template Helpers: - get_editgroup_revision(editgroup, entity_type, ident) -> None or entity - + TODO: prev_rev interlock """ @@ -214,7 +211,7 @@ def generic_edit_delete(editgroup_id, entity_type, edit_id): # API on behalf of user user_api = auth_api(session['api_token']) - + # do the deletion try: if entity_type == 'container': @@ -358,4 +355,3 @@ def work_editgroup_edit(editgroup_id, ident): @app.route('/editgroup/<editgroup_id>/work/edit/<edit_id>/delete', methods=['POST']) def work_edit_delete(editgroup_id, edit_id): return abort(404) - diff --git a/python/fatcat_web/forms.py b/python/fatcat_web/forms.py index 377e35aa..15585bf6 100644 --- a/python/fatcat_web/forms.py +++ b/python/fatcat_web/forms.py @@ -8,7 +8,7 @@ from flask_wtf import FlaskForm from wtforms import SelectField, DateField, StringField, IntegerField, \ HiddenField, FormField, FieldList, validators -from fatcat_openapi_client import ContainerEntity, CreatorEntity, FileEntity, \ +from fatcat_openapi_client import ContainerEntity, FileEntity, \ ReleaseEntity, ReleaseContrib, FileUrl, ReleaseExtIds release_type_options = [ @@ -293,9 +293,9 @@ class FileUrlForm(FlaskForm): default='web') class FileEntityForm(EntityEditForm): + # TODO: positive definite size = IntegerField('Size (bytes)', [validators.DataRequired()]) - # TODO: positive definite md5 = StringField("MD5", [validators.Optional(True), validators.Length(min=32, max=32)]) @@ -413,4 +413,3 @@ class SavePaperNowForm(FlaskForm): ingest_request['link_source'] = 'arxiv' ingest_request['link_source_id'] = release.ext_ids.arxiv return ingest_request - diff --git a/python/fatcat_web/graphics.py b/python/fatcat_web/graphics.py index fea7eb5a..56852627 100644 --- a/python/fatcat_web/graphics.py +++ b/python/fatcat_web/graphics.py @@ -33,4 +33,3 @@ def ia_coverage_histogram(rows): chart.add('via Fatcat', [y['available'] for y in years]) chart.add('Missing', [y['missing'] for y in years]) return chart - diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 58f4b7e0..4684f799 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -2,12 +2,12 @@ import os import sys import json -from flask import Flask, render_template, make_response, send_from_directory, \ - request, url_for, abort, g, redirect, jsonify, session, flash, Response +from flask import render_template, make_response, send_from_directory, \ + request, url_for, abort, redirect, jsonify, session, flash, Response from flask_login import login_required from flask_wtf.csrf import CSRFError -from fatcat_openapi_client import Editgroup, EditgroupAnnotation +from fatcat_openapi_client import EditgroupAnnotation from fatcat_openapi_client.rest import ApiException from fatcat_tools.transforms import * from fatcat_tools.normal import * @@ -1042,4 +1042,3 @@ def robots(): return send_from_directory(os.path.join(app.root_path, 'static'), 'robots.txt', mimetype='text/plain') - diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py index c1246d22..4a87c735 100644 --- a/python/fatcat_web/search.py +++ b/python/fatcat_web/search.py @@ -66,7 +66,6 @@ def do_release_search(q, limit=30, fulltext_only=True, offset=0): if len(q.split()) == 1 and q.startswith("10.") and q.count("/") >= 1: q = 'doi:"{}"'.format(q) - if fulltext_only: q += " in_web:true" @@ -297,7 +296,7 @@ def get_elastic_container_random_releases(ident, limit=5): def get_elastic_container_histogram(ident): """ - Fetches a stacked histogram of + Fetches a stacked histogram Filters to the past 500 years (at most), or about 1000 values. diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py index 0cb153d6..344f1c2a 100644 --- a/python/fatcat_web/web_config.py +++ b/python/fatcat_web/web_config.py @@ -83,4 +83,3 @@ class Config(object): 'fatcat_domain': FATCAT_DOMAIN, }, } - |