kopia lustrzana https://github.com/tsileo/little-boxes
Cleanup/sorted imports
rodzic
69ac8e18a7
commit
1607d5e74a
|
@ -1,27 +1,22 @@
|
|||
"""Core ActivityPub classes."""
|
||||
import logging
|
||||
import json
|
||||
import logging
|
||||
import weakref
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
|
||||
from .errors import BadActivityError
|
||||
from .errors import UnexpectedActivityTypeError
|
||||
from .errors import Error
|
||||
from .errors import NotFromOutboxError
|
||||
|
||||
# from .errors import ActivityNotFoundError
|
||||
# from .urlutils import check_url
|
||||
from .collection import parse_collection
|
||||
from .backend import Backend
|
||||
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Dict
|
||||
from typing import Any
|
||||
from typing import Union
|
||||
from typing import Type
|
||||
from typing import Union
|
||||
|
||||
from .backend import Backend
|
||||
from .collection import parse_collection
|
||||
from .errors import BadActivityError
|
||||
from .errors import Error
|
||||
from .errors import NotFromOutboxError
|
||||
from .errors import UnexpectedActivityTypeError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""Contains some ActivityPub related utils."""
|
||||
from typing import Optional
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Any
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .errors import RecursionLimitExceededError
|
||||
from .errors import UnexpectedActivityTypeError
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import re
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
from typing import Dict
|
||||
|
||||
from bleach.linkifier import Linker
|
||||
from markdown import markdown
|
||||
|
||||
from .webfinger import get_actor_url
|
||||
from .activitypub import BACKEND
|
||||
from .activitypub import UninitializedBackendError
|
||||
from .webfinger import get_actor_url
|
||||
|
||||
|
||||
def _set_attrs(attrs, new=False):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Errors raised by this package."""
|
||||
from typing import Optional
|
||||
from typing import Dict
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
|
|
|
@ -3,22 +3,24 @@
|
|||
Mastodon instances won't accept requests that are not signed using this scheme.
|
||||
|
||||
"""
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlparse
|
||||
from typing import Any, Dict, Optional
|
||||
import base64
|
||||
import hashlib
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
# FIXME(tsileo): no more Flask
|
||||
from Crypto.Hash import SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from flask import request
|
||||
from requests.auth import AuthBase
|
||||
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.Hash import SHA256
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# FIXME(tsileo): no more Flask
|
||||
|
||||
|
||||
def _build_signed_string(
|
||||
signed_headers: str, method: str, path: str, headers: Any, body_digest: str
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Optional
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
|
||||
from Crypto.PublicKey import RSA
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
from pyld import jsonld
|
||||
import hashlib
|
||||
from datetime import datetime
|
||||
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.Hash import SHA256
|
||||
import base64
|
||||
|
||||
import hashlib
|
||||
import typing
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
|
||||
from Crypto.Hash import SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from pyld import jsonld
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from .key import Key # noqa: type checking
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ipaddress
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
import ipaddress
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from . import strtobool
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from urllib.parse import urlparse
|
||||
from typing import Dict
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import requests
|
||||
|
||||
from .urlutils import check_url
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
1
setup.py
1
setup.py
|
@ -3,6 +3,7 @@
|
|||
import io
|
||||
import os
|
||||
from distutils.core import setup
|
||||
|
||||
from setuptools import find_packages
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import binascii
|
||||
import os
|
||||
import json
|
||||
from typing import Optional
|
||||
import os
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
|
||||
from little_boxes.backend import Backend
|
||||
import little_boxes.activitypub as ap
|
||||
from little_boxes.backend import Backend
|
||||
|
||||
|
||||
def track_call(f):
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
from little_boxes import activitypub as ap
|
||||
from test_backend import InMemBackend
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
from unittest import mock
|
||||
import logging
|
||||
import json
|
||||
|
||||
from little_boxes import webfinger
|
||||
import logging
|
||||
from unittest import mock
|
||||
|
||||
import httpretty
|
||||
import pytest
|
||||
|
||||
from little_boxes import urlutils
|
||||
from little_boxes import webfinger
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
@ -48,3 +50,8 @@ def test_webfinger(_):
|
|||
webfinger.get_remote_follow_template("@dev@microblog.pub")
|
||||
== "https://microblog.pub/authorize_follow?profile={uri}"
|
||||
)
|
||||
|
||||
|
||||
def test_webfinger_invalid_url():
|
||||
with pytest.raises(urlutils.InvalidURLError):
|
||||
data = webfinger.webfinger("@dev@localhost:8080")
|
||||
|
|
Ładowanie…
Reference in New Issue