aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/editing_routes.py32
-rw-r--r--python/fatcat_web/entity_helpers.py21
-rw-r--r--python/fatcat_web/ref_routes.py24
-rw-r--r--python/fatcat_web/routes.py77
4 files changed, 121 insertions, 33 deletions
diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py
index 61aade72..d888735a 100644
--- a/python/fatcat_web/editing_routes.py
+++ b/python/fatcat_web/editing_routes.py
@@ -1,17 +1,31 @@
from typing import Optional
-from flask import render_template, abort, redirect, session, flash
-from flask_login import login_required
-
-from fatcat_openapi_client import *
+from fatcat_openapi_client import (
+ ContainerEntity,
+ CreatorEntity,
+ Editgroup,
+ EntityEdit,
+ FileEntity,
+ FilesetEntity,
+ ReleaseEntity,
+ WebcaptureEntity,
+ WorkEntity,
+)
from fatcat_openapi_client.rest import ApiException
-from fatcat_tools.transforms import *
-from fatcat_web import app, api, auth_api
-from fatcat_web.search import *
-from fatcat_web.forms import *
-from fatcat_web.entity_helpers import *
+from flask import abort, flash, redirect, render_template, session
+from flask_login import login_required
+from fatcat_tools.transforms import entity_from_toml
+from fatcat_web import api, app, auth_api
+from fatcat_web.entity_helpers import generic_get_editgroup_entity, generic_get_entity
+from fatcat_web.forms import (
+ ContainerEntityForm,
+ EntityEditForm,
+ EntityTomlForm,
+ FileEntityForm,
+ ReleaseEntityForm,
+)
### Helper Methods ##########################################################
diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py
index ab4c16b5..26371341 100644
--- a/python/fatcat_web/entity_helpers.py
+++ b/python/fatcat_web/entity_helpers.py
@@ -1,11 +1,26 @@
-from flask import abort
-from fatcat_openapi_client import *
+from fatcat_openapi_client import (
+ ContainerEntity,
+ CreatorEntity,
+ FileEntity,
+ FilesetEntity,
+ ReleaseEntity,
+ ReleaseExtIds,
+ WebcaptureEntity,
+ WorkEntity,
+)
from fatcat_openapi_client.rest import ApiException, ApiValueError
-from fatcat_tools.transforms import *
+from flask import abort
+
+from fatcat_tools.transforms import (
+ container_to_elasticsearch,
+ file_to_elasticsearch,
+ release_to_elasticsearch,
+)
from fatcat_web import api
from fatcat_web.hacks import strip_extlink_xml, wayback_suffix
+
def enrich_container_entity(entity):
if entity.state in ('redirect', 'deleted'):
return entity
diff --git a/python/fatcat_web/ref_routes.py b/python/fatcat_web/ref_routes.py
index 2d8ed413..eed3f1df 100644
--- a/python/fatcat_web/ref_routes.py
+++ b/python/fatcat_web/ref_routes.py
@@ -5,18 +5,28 @@ Flask endpoints for reference (citation) endpoints. Eg, listing references
import json
-from flask import render_template, request, Response, jsonify
-from fatcat_openapi_client import *
-from fuzzycat.grobid_unstructured import grobid_api_process_citation, transform_grobid_ref_xml, grobid_ref_to_release
+from flask import Response, jsonify, render_template, request
+from fuzzycat.grobid_unstructured import (
+ grobid_api_process_citation,
+ grobid_ref_to_release,
+ transform_grobid_ref_xml,
+)
from fuzzycat.simple import close_fuzzy_biblio_matches, close_fuzzy_release_matches
-from fatcat_tools.references import enrich_inbound_refs, enrich_outbound_refs, get_inbound_refs, get_outbound_refs, RefHits
+from fatcat_tools.references import (
+ RefHits,
+ enrich_inbound_refs,
+ enrich_outbound_refs,
+ get_inbound_refs,
+ get_outbound_refs,
+)
from fatcat_tools.transforms.access import release_access_options
from fatcat_tools.transforms.entities import entity_to_dict
-from fatcat_web import app, api
+from fatcat_web import api, app
from fatcat_web.cors import crossdomain
-from fatcat_web.forms import *
-from fatcat_web.entity_helpers import *
+from fatcat_web.entity_helpers import generic_get_entity
+from fatcat_web.forms import ReferenceMatchForm
+
def _refs_web(direction, release_ident=None, work_ident=None, openlibrary_id=None, wikipedia_article=None) -> RefHits:
offset = request.args.get('offset', '0')
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index e9741b6d..9795adf7 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -1,25 +1,74 @@
-import os
import json
+import os
+
import citeproc_styles
-from flask import render_template, make_response, send_from_directory, \
- request, url_for, abort, redirect, jsonify, session, Response
+from fatcat_openapi_client import EditgroupAnnotation
+from fatcat_openapi_client.rest import ApiException, ApiValueError
+from flask import (
+ Response,
+ abort,
+ jsonify,
+ make_response,
+ redirect,
+ render_template,
+ request,
+ send_from_directory,
+ session,
+ url_for,
+)
from flask_login import login_required
from flask_wtf.csrf import CSRFError
-from fatcat_openapi_client import EditgroupAnnotation
-from fatcat_openapi_client.rest import ApiException
-from fatcat_tools.transforms import *
-from fatcat_tools.normal import *
-from fatcat_web import app, api, auth_api, priv_api, mwoauth, Config
-from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth, handle_wmoauth
+from fatcat_tools.normal import (
+ clean_arxiv_id,
+ clean_doi,
+ clean_isbn13,
+ clean_issn,
+ clean_orcid,
+ clean_pmcid,
+ clean_sha1,
+ clean_sha256,
+)
+from fatcat_tools.transforms import citeproc_csl, release_to_csl
+from fatcat_web import Config, api, app, auth_api, mwoauth, priv_api
+from fatcat_web.auth import (
+ handle_ia_xauth,
+ handle_logout,
+ handle_token_login,
+ handle_wmoauth,
+ load_user,
+)
from fatcat_web.cors import crossdomain
-from fatcat_web.search import *
-from fatcat_web.entity_helpers import *
-from fatcat_web.graphics import *
-from fatcat_web.kafka import *
+from fatcat_web.entity_helpers import (
+ generic_get_editgroup_entity,
+ generic_get_entity,
+ generic_get_entity_revision,
+)
from fatcat_web.forms import SavePaperNowForm
-
+from fatcat_web.graphics import (
+ ia_coverage_histogram,
+ preservation_by_date_histogram,
+ preservation_by_volume_histogram,
+ preservation_by_year_histogram,
+)
+from fatcat_web.kafka import kafka_pixy_produce
+from fatcat_web.search import (
+ FatcatSearchError,
+ GenericQuery,
+ ReleaseQuery,
+ do_container_search,
+ do_release_search,
+ get_elastic_container_histogram_legacy,
+ get_elastic_container_preservation_by_volume,
+ get_elastic_container_random_releases,
+ get_elastic_container_stats,
+ get_elastic_entity_stats,
+ get_elastic_preservation_by_date,
+ get_elastic_preservation_by_type,
+ get_elastic_preservation_by_year,
+ get_elastic_search_coverage,
+)
### Generic Entity Views ####################################################