From 116d2e3e6e17e4cbd5e9dcfea6a1f7bce9075027 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 22 Apr 2019 09:58:11 +0200 Subject: [PATCH] Run isort --- activitypub.py | 2 +- app.py | 20 +++++++++----------- config.py | 2 +- poussetaches.py | 8 +++++--- setup_wizard/wizard.py | 8 +++++--- utils/opengraph.py | 1 + 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/activitypub.py b/activitypub.py index 60a0e81..42478d6 100644 --- a/activitypub.py +++ b/activitypub.py @@ -1,7 +1,7 @@ import hashlib +import json import logging import os -import json from datetime import datetime from enum import Enum from typing import Any diff --git a/app.py b/app.py index b8863c2..1a1f12f 100644 --- a/app.py +++ b/app.py @@ -17,19 +17,18 @@ from typing import Tuple from urllib.parse import urlencode from urllib.parse import urlparse -from requests.exceptions import HTTPError -import requests import bleach import mf2py import pymongo +import requests import timeago from bson.objectid import ObjectId from dateutil import parser from flask import Flask -from flask import make_response from flask import Response from flask import abort from flask import jsonify as flask_jsonify +from flask import make_response from flask import redirect from flask import render_template from flask import request @@ -46,27 +45,25 @@ from little_boxes.activitypub import format_datetime from little_boxes.activitypub import get_backend from little_boxes.content_helper import parse_markdown from little_boxes.errors import ActivityGoneError -from little_boxes.errors import NotAnActivityError -from little_boxes.errors import BadActivityError from little_boxes.errors import ActivityNotFoundError +from little_boxes.errors import BadActivityError from little_boxes.errors import Error +from little_boxes.errors import NotAnActivityError from little_boxes.errors import NotFromOutboxError from little_boxes.httpsig import HTTPSigAuth from little_boxes.httpsig import verify_request from little_boxes.webfinger import get_actor_url from little_boxes.webfinger import get_remote_follow_template -from utils import opengraph from passlib.hash import bcrypt +from requests.exceptions import HTTPError from u2flib_server import u2f from werkzeug.utils import secure_filename import activitypub import config - from activitypub import Box -from activitypub import embed_collection from activitypub import _answer_key -from config import USER_AGENT +from activitypub import embed_collection from config import ADMIN_API_KEY from config import BASE_URL from config import DB @@ -81,15 +78,16 @@ from config import KEY from config import ME from config import MEDIA_CACHE from config import PASS +from config import USER_AGENT from config import USERNAME from config import VERSION from config import _drop_db +from poussetaches import PousseTaches +from utils import opengraph from utils.key import get_secret_key from utils.lookup import lookup from utils.media import Kind -from poussetaches import PousseTaches - p = PousseTaches( os.getenv("MICROBLOGPUB_POUSSETACHES_HOST", "http://localhost:7991"), os.getenv("MICROBLOGPUB_INTERNAL_HOST", "http://localhost:5000"), diff --git a/config.py b/config.py index ba3928f..d63814c 100644 --- a/config.py +++ b/config.py @@ -4,6 +4,7 @@ import subprocess from datetime import datetime from enum import Enum +import pymongo import requests import sass import yaml @@ -11,7 +12,6 @@ from itsdangerous import JSONWebSignatureSerializer from little_boxes import strtobool from little_boxes.activitypub import DEFAULT_CTX from pymongo import MongoClient -import pymongo from utils.key import KEY_DIR from utils.key import get_key diff --git a/poussetaches.py b/poussetaches.py index d839919..ee581fc 100644 --- a/poussetaches.py +++ b/poussetaches.py @@ -1,13 +1,15 @@ import base64 import json import os -from typing import Dict +from datetime import datetime from typing import Any +from typing import Dict from typing import List -from dataclasses import dataclass + import flask import requests -from datetime import datetime + +from dataclasses import dataclass POUSSETACHES_AUTH_KEY = os.getenv("POUSSETACHES_AUTH_KEY") diff --git a/setup_wizard/wizard.py b/setup_wizard/wizard.py index 10808e7..16be68a 100644 --- a/setup_wizard/wizard.py +++ b/setup_wizard/wizard.py @@ -1,11 +1,12 @@ """Basic wizard for setting up microblog.pub configuration files.""" -import os import binascii +import os +import sys from pathlib import Path import bcrypt -from prompt_toolkit import prompt from markdown import markdown +from prompt_toolkit import prompt def main(): @@ -63,4 +64,5 @@ if __name__ == "__main__": try: main() except KeyboardInterrupt: - pass + print("Aborted") + sys.exit(1) diff --git a/utils/opengraph.py b/utils/opengraph.py index d6a9c51..5163b85 100644 --- a/utils/opengraph.py +++ b/utils/opengraph.py @@ -1,4 +1,5 @@ import logging + import opengraph import requests from bs4 import BeautifulSoup