From 56f4fb2ce20489fc3c978d29109a6348bdb616f2 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Thu, 1 Aug 2019 22:25:58 +0200 Subject: [PATCH] Formatting --- app.py | 17 +++++++---------- blueprints/admin.py | 2 +- blueprints/api.py | 6 +++--- blueprints/tasks.py | 2 +- blueprints/well_known.py | 2 +- core/activitypub.py | 2 +- core/db.py | 2 +- core/gc.py | 2 +- core/shared.py | 4 ++-- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app.py b/app.py index 3514839..ee357ca 100644 --- a/app.py +++ b/app.py @@ -34,9 +34,8 @@ import blueprints.indieauth import blueprints.tasks import blueprints.well_known import config -from core.meta import Box -from core.activitypub import embed_collection from blueprints.api import _api_required +from blueprints.tasks import TaskError from config import DB from config import HEADERS from config import ID @@ -44,12 +43,14 @@ from config import ME from config import MEDIA_CACHE from config import VERSION from core import activitypub +from core.activitypub import embed_collection from core.db import find_one_activity +from core.meta import Box from core.meta import MetaKey from core.meta import _meta -from core.meta import is_public from core.meta import by_remote_id from core.meta import in_outbox +from core.meta import is_public from core.shared import MY_PERSON from core.shared import _add_answers_to_question from core.shared import _build_thread @@ -61,12 +62,10 @@ from core.shared import noindex from core.shared import paginated_query from core.shared import post_to_outbox from core.tasks import Tasks -from blueprints.tasks import TaskError from utils import now from utils.key import get_secret_key from utils.template_filters import filters - app = Flask(__name__) app.secret_key = get_secret_key("flask") app.register_blueprint(filters) @@ -566,11 +565,9 @@ def outbox_detail(item_id): @app.route("/outbox//activity") def outbox_activity(item_id): - data = find_one_activity({ - **in_outbox(), - **by_remote_id(back.activity_url(item_id)), - **is_public(), - }) + data = find_one_activity( + {**in_outbox(), **by_remote_id(back.activity_url(item_id)), **is_public()} + ) if not data: abort(404) diff --git a/blueprints/admin.py b/blueprints/admin.py index 9326aae..e390aaa 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -19,10 +19,10 @@ from passlib.hash import bcrypt from u2flib_server import u2f import config -from core.activitypub import Box from config import DB from config import ID from config import PASS +from core.activitypub import Box from core.shared import MY_PERSON from core.shared import _build_thread from core.shared import _Response diff --git a/blueprints/api.py b/blueprints/api.py index 8a0645a..a1cd1c4 100644 --- a/blueprints/api.py +++ b/blueprints/api.py @@ -24,24 +24,24 @@ from little_boxes.errors import NotFromOutboxError from werkzeug.utils import secure_filename import config -from core.meta import Box +from config import ADMIN_API_KEY from config import BASE_URL from config import DB from config import DEBUG_MODE from config import ID from config import JWT from config import MEDIA_CACHE -from config import ADMIN_API_KEY from config import _drop_db from core import activitypub +from core.meta import Box from core.meta import MetaKey from core.meta import _meta from core.shared import MY_PERSON from core.shared import _Response from core.shared import back from core.shared import csrf -from core.shared import post_to_outbox from core.shared import login_required +from core.shared import post_to_outbox from core.tasks import Tasks from utils import now diff --git a/blueprints/tasks.py b/blueprints/tasks.py index 6fdf976..f10892b 100644 --- a/blueprints/tasks.py +++ b/blueprints/tasks.py @@ -14,10 +14,10 @@ from little_boxes.httpsig import HTTPSigAuth from requests.exceptions import HTTPError import config -from core.activitypub import Box from config import DB from core import activitypub from core import gc +from core.activitypub import Box from core.meta import MetaKey from core.meta import _meta from core.notifications import set_inbox_flags diff --git a/blueprints/well_known.py b/blueprints/well_known.py index d4ec755..1f936c0 100644 --- a/blueprints/well_known.py +++ b/blueprints/well_known.py @@ -9,8 +9,8 @@ from flask import request from little_boxes import activitypub as ap import config -from core.meta import Box from config import DB +from core.meta import Box blueprint = flask.Blueprint("well_known", __name__) diff --git a/core/activitypub.py b/core/activitypub.py index 4768ffd..77b55f6 100644 --- a/core/activitypub.py +++ b/core/activitypub.py @@ -29,7 +29,7 @@ from config import ME from config import USER_AGENT from config import USERNAME from core.meta import Box -from tasks import Tasks +from core.tasks import Tasks logger = logging.getLogger(__name__) diff --git a/core/db.py b/core/db.py index dea2f57..607170c 100644 --- a/core/db.py +++ b/core/db.py @@ -1,7 +1,7 @@ from enum import Enum from enum import unique -from typing import Dict from typing import Any +from typing import Dict from typing import Optional from config import DB diff --git a/core/gc.py b/core/gc.py index 38b7fa9..3763527 100644 --- a/core/gc.py +++ b/core/gc.py @@ -8,12 +8,12 @@ from typing import List from little_boxes import activitypub as ap -from core.meta import Box from config import DAYS_TO_KEEP from config import ID from config import ME from config import MEDIA_CACHE from core import activitypub +from core.meta import Box from utils.migrations import DB back = activitypub.MicroblogPubBackend() diff --git a/core/shared.py b/core/shared.py index 7133cc6..367b179 100644 --- a/core/shared.py +++ b/core/shared.py @@ -19,11 +19,11 @@ from little_boxes import activitypub as ap from little_boxes.activitypub import format_datetime from poussetaches import PousseTaches -from core.meta import Box -from core.activitypub import _answer_key from config import DB from config import ME from core import activitypub +from core.activitypub import _answer_key +from core.meta import Box from core.tasks import Tasks _Response = Union[flask.Response, werkzeug.wrappers.Response, str]