From fbbd7f2dc2d4a82d3da9327a7297f47103196544 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 22 Feb 2019 11:48:41 -0800 Subject: bunch of lint/whitespace cleanups --- python/fatcat_web/auth.py | 3 +-- python/fatcat_web/cors.py | 7 ++++--- python/fatcat_web/routes.py | 7 ++++--- python/fatcat_web/search.py | 24 ++++++++++++------------ 4 files changed, 21 insertions(+), 20 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index 03964c92..1953151b 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -4,8 +4,8 @@ import requests import pymacaroons from flask import Flask, render_template, send_from_directory, request, \ url_for, abort, g, redirect, jsonify, session, flash -from fatcat_web import login_manager, api, priv_api, Config from flask_login import logout_user, login_user, UserMixin +from fatcat_web import login_manager, api, priv_api, Config import fatcat_client def handle_logout(): @@ -141,4 +141,3 @@ def load_user(editor_id): user.username = editor['username'] user.token = token return user - diff --git a/python/fatcat_web/cors.py b/python/fatcat_web/cors.py index 2285cf80..d84babd8 100644 --- a/python/fatcat_web/cors.py +++ b/python/fatcat_web/cors.py @@ -1,12 +1,13 @@ -from datetime import timedelta -from flask import make_response, request, current_app -from functools import update_wrapper """ This snippet from: http://flask.pocoo.org/snippets/56/ "Posted by Armin Ronacher on 2011-07-14" """ +from datetime import timedelta +from functools import update_wrapper +from flask import make_response, request, current_app + def crossdomain(origin=None, methods=None, headers=None, max_age=21600, attach_to_all=True, diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 11f73e4f..693adf25 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -4,12 +4,13 @@ import json from flask import Flask, render_template, send_from_directory, request, \ url_for, abort, g, redirect, jsonify, session, flash from flask_login import login_required + +from fatcat_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_client.rest import ApiException -from fatcat_web.search import * from fatcat_web.cors import crossdomain -from fatcat_tools.transforms import * +from fatcat_web.search import * ### Views ################################################################### diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py index f10ce406..3b48f49e 100644 --- a/python/fatcat_web/search.py +++ b/python/fatcat_web/search.py @@ -1,8 +1,4 @@ -import requests -from flask import abort, flash -from fatcat_web import app - """ Helpers for doing elasticsearch queries (used in the web interface; not part of the formal API) @@ -10,6 +6,10 @@ the formal API) TODO: ELASTICSEARCH_*_INDEX should probably be factored out and just hard-coded """ +import requests +from flask import abort, flash +from fatcat_web import app + def do_search(index, request, limit=30): @@ -119,14 +119,14 @@ def get_elastic_entity_stats(): stats = {} # 2. releases - # x=> total count - # x=> total citation records - # x=> total (paper, chapter, proceeding) - # x=> with fulltext on web - # x=> open access - # x=> not in KBART, in IA - # - # Can probably do the above with two queries: + # - total count + # - total citation records + # - total (paper, chapter, proceeding) + # - " with fulltext on web + # - " open access + # - " not in KBART, in IA + # + # Can do the above with two queries: # - all releases, aggregate count and sum(ref_count) # - in-scope works, aggregate count by (fulltext, OA, kbart/ia) -- cgit v1.2.3