mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
I ran reformat code on the whole project
This commit is contained in:
parent
3dee72f20e
commit
c581c8d08e
74 changed files with 1349 additions and 1311 deletions
|
@ -5,10 +5,9 @@
|
|||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1280"
|
||||
height="640"
|
||||
viewBox="0 0 338.66666 169.33335"
|
||||
|
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 21 KiB |
|
@ -6,11 +6,10 @@
|
|||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1280"
|
||||
height="640"
|
||||
viewBox="0 0 338.66666 169.33335"
|
||||
|
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 23 KiB |
|
@ -66,7 +66,6 @@ templates_path = ['_templates']
|
|||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import click
|
||||
import multiprocessing
|
||||
import toml
|
||||
import logging
|
||||
import multiprocessing
|
||||
|
||||
import click
|
||||
import toml
|
||||
|
||||
import royalnet.utils as ru
|
||||
|
||||
try:
|
||||
|
@ -34,7 +36,6 @@ try:
|
|||
except ImportError:
|
||||
coloredlogs = None
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ then run: ::
|
|||
"""
|
||||
|
||||
from .alchemy import Alchemy
|
||||
from .table_dfs import table_dfs
|
||||
from .errors import *
|
||||
from .table_dfs import table_dfs
|
||||
|
||||
__all__ = [
|
||||
"Alchemy",
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
from typing import *
|
||||
from contextlib import contextmanager, asynccontextmanager
|
||||
from royalnet.utils import asyncify
|
||||
from royalnet.alchemy.errors import TableNotFoundError
|
||||
from typing import *
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy.schema import Table
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.ext.declarative.api import DeclarativeMeta
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.orm.session import Session
|
||||
from sqlalchemy.schema import Table
|
||||
|
||||
from royalnet.alchemy.errors import TableNotFoundError
|
||||
from royalnet.utils import asyncify
|
||||
|
||||
|
||||
class Alchemy:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Imports go here!
|
||||
from .royalnetversion import RoyalnetversionCommand
|
||||
from .royalnetsync import RoyalnetsyncCommand
|
||||
from .royalnetroles import RoyalnetrolesCommand
|
||||
from .royalnetaliases import RoyalnetaliasesCommand
|
||||
from .royalnetroles import RoyalnetrolesCommand
|
||||
from .royalnetsync import RoyalnetsyncCommand
|
||||
from .royalnetversion import RoyalnetversionCommand
|
||||
|
||||
# Enter the commands of your Pack here!
|
||||
available_commands = [
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from typing import *
|
||||
import royalnet.commands as rc
|
||||
from ..tables import User
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from typing import *
|
||||
import royalnet.commands as rc
|
||||
from ..tables import User
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from typing import *
|
||||
import royalnet
|
||||
import royalnet.commands as rc
|
||||
import royalnet.utils as ru
|
||||
import royalnet.serf.telegram as rst
|
||||
import royalnet.serf.discord as rsd
|
||||
import royalnet.serf.matrix as rsm
|
||||
from ..tables.telegram import Telegram
|
||||
import royalnet.serf.telegram as rst
|
||||
import royalnet.utils as ru
|
||||
from ..tables.discord import Discord
|
||||
from ..tables.telegram import Telegram
|
||||
|
||||
|
||||
class RoyalnetsyncCommand(rc.Command):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pkg_resources
|
||||
|
||||
from royalnet.commands import *
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Imports go here!
|
||||
from .api_royalnet_version import ApiRoyalnetVersionStar
|
||||
from .api_auth_login_royalnet import ApiAuthLoginRoyalnetStar
|
||||
from .api_user_passwd import ApiUserPasswd
|
||||
from .api_auth_token import ApiAuthTokenStar
|
||||
from .api_royalnet_version import ApiRoyalnetVersionStar
|
||||
from .api_user_create import ApiUserCreateStar
|
||||
from .api_user_find import ApiUserFindStar
|
||||
from .api_user_get import ApiUserGetStar
|
||||
from .api_user_list import ApiUserListStar
|
||||
from .api_user_find import ApiUserFindStar
|
||||
from .api_user_create import ApiUserCreateStar
|
||||
from .api_user_passwd import ApiUserPasswd
|
||||
from .docs import DocsStar
|
||||
|
||||
# Enter the PageStars of your Pack here!
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import datetime
|
||||
import royalnet.utils as ru
|
||||
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.constellation.api.apierrors as rcae
|
||||
from ..tables.users import User
|
||||
import royalnet.utils as ru
|
||||
from ..tables.tokens import Token
|
||||
from ..tables.users import User
|
||||
|
||||
|
||||
class ApiAuthLoginRoyalnetStar(rca.ApiStar):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from typing import *
|
||||
import datetime
|
||||
import royalnet.utils as ru
|
||||
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
from ..tables.tokens import Token
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from typing import *
|
||||
import datetime
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
import royalnet.backpack.tables as rbt
|
||||
from ..tables import *
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import royalnet.utils as ru
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
|
||||
|
||||
class ApiUserFindStar(rca.ApiStar):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import royalnet.utils as ru
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
|
||||
|
||||
class ApiUserGetStar(rca.ApiStar):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from starlette.responses import *
|
||||
import royalnet.utils as ru
|
||||
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
|
||||
|
||||
class ApiUserListStar(rca.ApiStar):
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from typing import *
|
||||
import datetime
|
||||
import royalnet.utils as ru
|
||||
import royalnet.constellation.api as rca
|
||||
from typing import *
|
||||
|
||||
from sqlalchemy import and_
|
||||
|
||||
import royalnet.constellation.api as rca
|
||||
import royalnet.utils as ru
|
||||
from ..tables.tokens import Token
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import json
|
||||
from typing import *
|
||||
from royalnet.constellation import PageStar
|
||||
from royalnet.constellation.api import ApiStar
|
||||
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import Response, HTMLResponse
|
||||
import royalnet
|
||||
|
||||
import royalnet
|
||||
from royalnet.constellation import PageStar
|
||||
from royalnet.constellation.api import ApiStar
|
||||
|
||||
backtick = "\u0060"
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Imports go here!
|
||||
from .users import User
|
||||
from .telegram import Telegram
|
||||
from .aliases import Alias
|
||||
from .discord import Discord
|
||||
from .matrix import Matrix
|
||||
from .aliases import Alias
|
||||
from .tokens import Token
|
||||
from .roles import Role
|
||||
from .telegram import Telegram
|
||||
from .tokens import Token
|
||||
from .users import User
|
||||
|
||||
# Enter the tables of your Pack here!
|
||||
available_tables = {
|
||||
|
|
|
@ -2,8 +2,8 @@ from sqlalchemy import Column, \
|
|||
Integer, \
|
||||
String, \
|
||||
ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
|
||||
class Alias:
|
||||
|
|
|
@ -3,8 +3,9 @@ from sqlalchemy import Column, \
|
|||
String, \
|
||||
BigInteger, \
|
||||
ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .users import User
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import re
|
||||
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .users import User
|
||||
import re
|
||||
|
||||
|
||||
class Matrix:
|
||||
|
|
|
@ -2,8 +2,8 @@ from sqlalchemy import Column, \
|
|||
Integer, \
|
||||
String, \
|
||||
ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
|
||||
class Role:
|
||||
|
|
|
@ -3,8 +3,9 @@ from sqlalchemy import Column, \
|
|||
String, \
|
||||
BigInteger, \
|
||||
ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .users import User
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import datetime
|
||||
import secrets
|
||||
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import *
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from sqlalchemy.orm import *
|
||||
|
||||
import royalnet.utils as ru
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
from typing import *
|
||||
|
||||
import bcrypt
|
||||
import royalnet.utils as ru
|
||||
from sqlalchemy import Column, \
|
||||
Integer, \
|
||||
String, \
|
||||
LargeBinary, \
|
||||
inspect
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
from .roles import Role
|
||||
|
||||
import royalnet.utils as ru
|
||||
from .aliases import Alias
|
||||
from .roles import Role
|
||||
from ...utils import JSON, asyncify
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ try:
|
|||
except ImportError:
|
||||
raise ImportError("The `bard` extra is not installed. Please install it with `pip install royalnet[bard]`.")
|
||||
|
||||
from .ytdlinfo import YtdlInfo
|
||||
from .ytdlfile import YtdlFile
|
||||
from .errors import BardError, YtdlError, NotFoundError, MultipleFilesError
|
||||
from .ytdlfile import YtdlFile
|
||||
from .ytdlinfo import YtdlInfo
|
||||
|
||||
__all__ = [
|
||||
"YtdlInfo",
|
||||
|
|
|
@ -8,8 +8,8 @@ You can install them with: ::
|
|||
|
||||
"""
|
||||
|
||||
from .ytdldiscord import YtdlDiscord
|
||||
from .fileaudiosource import FileAudioSource
|
||||
from .ytdldiscord import YtdlDiscord
|
||||
|
||||
__all__ = [
|
||||
"YtdlDiscord",
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import typing
|
||||
import re
|
||||
import os
|
||||
import logging
|
||||
import ffmpeg
|
||||
import discord
|
||||
import os
|
||||
import re
|
||||
import typing
|
||||
from contextlib import asynccontextmanager
|
||||
from royalnet.utils import asyncify, MultiLock
|
||||
|
||||
import discord
|
||||
import ffmpeg
|
||||
|
||||
from royalnet.bard import YtdlInfo, YtdlFile
|
||||
from royalnet.utils import asyncify, MultiLock
|
||||
from .fileaudiosource import FileAudioSource
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -99,7 +101,8 @@ class YtdlDiscord:
|
|||
}
|
||||
embed = discord.Embed(title=self.info.title,
|
||||
colour=discord.Colour(colors.get(self.info.extractor, 0x4F545C)),
|
||||
url=self.info.webpage_url if (self.info.webpage_url and self.info.webpage_url.startswith("http")) else discord.embeds.EmptyEmbed)
|
||||
url=self.info.webpage_url if (self.info.webpage_url and self.info.webpage_url.startswith(
|
||||
"http")) else discord.embeds.EmptyEmbed)
|
||||
if self.info.thumbnail:
|
||||
embed.set_thumbnail(url=self.info.thumbnail)
|
||||
if self.info.uploader:
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import os
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import eyed3
|
||||
from asyncio import AbstractEventLoop, get_event_loop
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import *
|
||||
from royalnet.utils import *
|
||||
from asyncio import AbstractEventLoop, get_event_loop
|
||||
from .ytdlinfo import YtdlInfo
|
||||
from .errors import NotFoundError, MultipleFilesError
|
||||
|
||||
import eyed3
|
||||
from youtube_dl import YoutubeDL
|
||||
|
||||
from royalnet.utils import *
|
||||
from .errors import NotFoundError, MultipleFilesError
|
||||
from .ytdlinfo import YtdlInfo
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -74,6 +75,7 @@ class YtdlFile:
|
|||
|
||||
async def download_file(self) -> None:
|
||||
"""Download the file."""
|
||||
|
||||
def download():
|
||||
"""Download function block to be asyncified."""
|
||||
with YoutubeDL(self.ytdl_args) as ytdl:
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from typing import *
|
||||
import asyncio as aio
|
||||
import datetime
|
||||
import dateparser
|
||||
import logging
|
||||
import royalnet.utils as ru
|
||||
from typing import *
|
||||
|
||||
import dateparser
|
||||
import youtube_dl
|
||||
|
||||
import royalnet.utils as ru
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""The subpackage providing all classes related to Royalnet commands."""
|
||||
|
||||
from .command import Command
|
||||
from .commanddata import CommandData
|
||||
from .commandargs import CommandArgs
|
||||
from .heraldevent import HeraldEvent
|
||||
from .commanddata import CommandData
|
||||
from .configdict import ConfigDict
|
||||
from .errors import \
|
||||
CommandError, InvalidInputError, UnsupportedError, ConfigurationError, ExternalError, UserError, ProgramError
|
||||
from .heraldevent import HeraldEvent
|
||||
from .keyboardkey import KeyboardKey
|
||||
from .configdict import ConfigDict
|
||||
|
||||
__all__ = [
|
||||
"Command",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import abc
|
||||
import asyncio as aio
|
||||
from typing import *
|
||||
|
||||
from .commandargs import CommandArgs
|
||||
from .commanddata import CommandData
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import re
|
||||
import typing
|
||||
|
||||
from .errors import InvalidInputError
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from typing import *
|
||||
import contextlib
|
||||
import logging
|
||||
import asyncio as aio
|
||||
import royalnet.utils as ru
|
||||
import io
|
||||
from .errors import UnsupportedError
|
||||
import logging
|
||||
from typing import *
|
||||
|
||||
import royalnet.utils as ru
|
||||
from royalnet.backpack.tables.users import User
|
||||
from .errors import UnsupportedError
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .keyboardkey import KeyboardKey
|
||||
|
|
|
@ -2,6 +2,7 @@ class CommandError(Exception):
|
|||
"""Something went wrong during the execution of this command.
|
||||
|
||||
Display an error message to the user, explaining what went wrong."""
|
||||
|
||||
def __init__(self, message=""):
|
||||
self.message = message
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import *
|
||||
|
||||
from .commanddata import CommandData
|
||||
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ You can install them with: ::
|
|||
"""
|
||||
|
||||
from .constellation import Constellation
|
||||
from .star import Star
|
||||
from .pagestar import PageStar
|
||||
from .star import Star
|
||||
|
||||
__all__ = [
|
||||
"Constellation",
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from .apistar import ApiStar
|
||||
from .jsonapi import api_response, api_success, api_error
|
||||
from .apidata import ApiData
|
||||
from .apierrors import \
|
||||
ApiError, \
|
||||
|
@ -11,9 +9,10 @@ from .apierrors import \
|
|||
InvalidParameterError, \
|
||||
MethodNotImplementedError, \
|
||||
UnsupportedError
|
||||
from .apistar import ApiStar
|
||||
from .jsonapi import api_response, api_success, api_error
|
||||
from .magic import magic
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ApiStar",
|
||||
"api_response",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from typing import *
|
||||
import logging
|
||||
from .apierrors import MissingParameterError
|
||||
from typing import *
|
||||
|
||||
import royalnet.utils as ru
|
||||
from royalnet.backpack.tables.tokens import Token
|
||||
from royalnet.backpack.tables.users import User
|
||||
from .apierrors import *
|
||||
import royalnet.utils as ru
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
from typing import *
|
||||
from json import JSONDecodeError
|
||||
from abc import *
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import JSONResponse
|
||||
from ..pagestar import PageStar
|
||||
from .jsonapi import api_error, api_success
|
||||
from .apidata import ApiData
|
||||
from .apierrors import *
|
||||
import royalnet.utils as ru
|
||||
import logging
|
||||
import re
|
||||
from abc import *
|
||||
from json import JSONDecodeError
|
||||
from typing import *
|
||||
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
import royalnet.utils as ru
|
||||
from .apidata import ApiData
|
||||
from .apierrors import *
|
||||
from .jsonapi import api_error, api_success
|
||||
from ..pagestar import PageStar
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from typing import *
|
||||
import royalnet.utils as ru
|
||||
|
||||
try:
|
||||
from starlette.responses import JSONResponse
|
||||
except ImportError:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from typing import *
|
||||
import functools
|
||||
|
||||
|
||||
|
@ -12,4 +11,5 @@ def magic(func):
|
|||
@functools.wraps(func)
|
||||
async def f(*args, **kwargs):
|
||||
return await func(*args, **kwargs)
|
||||
|
||||
return f
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
from typing import *
|
||||
import asyncio as aio
|
||||
import logging
|
||||
import importlib
|
||||
import uvicorn
|
||||
import logging
|
||||
from typing import *
|
||||
|
||||
import starlette.applications
|
||||
import starlette.middleware
|
||||
import starlette.middleware.cors
|
||||
import uvicorn
|
||||
|
||||
import royalnet.alchemy as ra
|
||||
import royalnet.commands as rc
|
||||
import royalnet.herald as rh
|
||||
import royalnet.utils as ru
|
||||
import royalnet.commands as rc
|
||||
from .pagestar import PageStar
|
||||
from ..utils import init_logging
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
UVICORN_LOGGING_CONFIG = {
|
||||
|
@ -31,6 +32,7 @@ class Constellation:
|
|||
It runs multiple :class:`Star`, which represent the routes of the website.
|
||||
|
||||
It also handles the :class:`Alchemy` connection, and Herald connections too."""
|
||||
|
||||
def __init__(self,
|
||||
alchemy_cfg: Dict[str, Any],
|
||||
herald_cfg: Dict[str, Any],
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from typing import *
|
||||
from .star import Star
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from typing import *
|
||||
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import Response
|
||||
|
||||
|
@ -13,6 +14,7 @@ class Star:
|
|||
"""A Star is a class representing a part of the website.
|
||||
|
||||
It shouldn't be used directly: please use :class:`PageStar` and :class:`ExceptionStar` instead!"""
|
||||
|
||||
def __init__(self, constellation: "Constellation", config: "ConfigDict"):
|
||||
self.constellation: "Constellation" = constellation
|
||||
self.config: "ConfigDict" = config
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import toml
|
||||
import importlib
|
||||
|
||||
import click
|
||||
import toml
|
||||
|
||||
p = click.echo
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ You can install it with: ::
|
|||
|
||||
"""
|
||||
|
||||
from .broadcast import Broadcast
|
||||
from .config import Config
|
||||
from .errors import *
|
||||
from .link import Link
|
||||
|
@ -17,8 +18,6 @@ from .package import Package
|
|||
from .request import Request
|
||||
from .response import Response, ResponseSuccess, ResponseFailure
|
||||
from .server import Server
|
||||
from .broadcast import Broadcast
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Config",
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
from typing import *
|
||||
import asyncio as aio
|
||||
import uuid
|
||||
import functools
|
||||
import logging
|
||||
import uuid
|
||||
from typing import *
|
||||
|
||||
import websockets
|
||||
|
||||
from .broadcast import Broadcast
|
||||
from .config import Config
|
||||
from .errors import ConnectionClosedError, InvalidServerResponseError
|
||||
from .package import Package
|
||||
from .request import Request
|
||||
from .response import Response, ResponseSuccess, ResponseFailure
|
||||
from .broadcast import Broadcast
|
||||
from .errors import ConnectionClosedError, InvalidServerResponseError
|
||||
from .config import Config
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -39,6 +40,7 @@ def requires_connection(func):
|
|||
async def new_func(self, *args, **kwargs):
|
||||
await self.connect_event.wait()
|
||||
return await func(self, *args, **kwargs)
|
||||
|
||||
return new_func
|
||||
|
||||
|
||||
|
@ -47,6 +49,7 @@ def requires_identification(func):
|
|||
async def new_func(self, *args, **kwargs):
|
||||
await self.identify_event.wait()
|
||||
return await func(self, *args, **kwargs)
|
||||
|
||||
return new_func
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
from typing import *
|
||||
import asyncio as aio
|
||||
import re
|
||||
import datetime
|
||||
import uuid
|
||||
import logging
|
||||
import websockets
|
||||
import royalnet.utils as ru
|
||||
from .package import Package
|
||||
from .config import Config
|
||||
import re
|
||||
import uuid
|
||||
from typing import *
|
||||
|
||||
import websockets
|
||||
|
||||
import royalnet.utils as ru
|
||||
from .config import Config
|
||||
from .package import Package
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ConnectedClient:
|
||||
"""The :py:class:`Server`-side representation of a connected :py:class:`Link`."""
|
||||
|
||||
def __init__(self, socket: "websockets.WebSocketServerProtocol"):
|
||||
self.socket: "websockets.WebSocketServerProtocol" = socket
|
||||
self.nid: Optional[str] = None
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""The subpackage providing all Serf implementations."""
|
||||
|
||||
from .serf import Serf
|
||||
from .errors import SerfError
|
||||
from .serf import Serf
|
||||
|
||||
__all__ = [
|
||||
"Serf",
|
||||
|
|
|
@ -8,8 +8,8 @@ Install it with: ::
|
|||
|
||||
"""
|
||||
|
||||
from .escape import escape
|
||||
from .discordserf import DiscordSerf
|
||||
from .escape import escape
|
||||
from .playable import Playable
|
||||
from .voiceplayer import VoicePlayer
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import asyncio as aio
|
||||
import logging
|
||||
import io
|
||||
import logging
|
||||
import sys
|
||||
from typing import *
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.commands as rc
|
||||
from royalnet.utils import asyncify, sentry_exc
|
||||
from royalnet.serf import Serf
|
||||
from .escape import escape
|
||||
from .voiceplayer import VoicePlayer
|
||||
|
||||
import discord
|
||||
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.commands as rc
|
||||
from royalnet.serf import Serf
|
||||
from royalnet.utils import asyncify, sentry_exc
|
||||
from .escape import escape
|
||||
from .voiceplayer import VoicePlayer
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -128,6 +129,7 @@ class DiscordSerf(Serf):
|
|||
|
||||
def client_factory(self) -> Type["discord.Client"]:
|
||||
"""Create a custom class inheriting from :py:class:`discord.Client`."""
|
||||
|
||||
# noinspection PyMethodParameters
|
||||
class DiscordClient(discord.Client):
|
||||
# noinspection PyMethodMayBeStatic
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import logging
|
||||
from typing import Optional, AsyncGenerator, Tuple, Any, Dict
|
||||
|
||||
try:
|
||||
import discord
|
||||
except ImportError:
|
||||
discord = None
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Playable:
|
||||
"""An abstract class representing something that can be played back in a :class:`VoicePlayer`."""
|
||||
|
||||
def __init__(self):
|
||||
"""Create a :class:`Playable`.
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import asyncio
|
||||
import threading
|
||||
import logging
|
||||
import threading
|
||||
from typing import Optional
|
||||
|
||||
from .errors import *
|
||||
from .playable import Playable
|
||||
from ...utils import sentry_exc
|
||||
|
||||
try:
|
||||
import discord
|
||||
except ImportError:
|
||||
|
|
|
@ -8,8 +8,8 @@ Install it with: ::
|
|||
|
||||
"""
|
||||
|
||||
from .matrixserf import MatrixSerf
|
||||
from .escape import escape
|
||||
from .matrixserf import MatrixSerf
|
||||
|
||||
__all__ = [
|
||||
"MatrixSerf",
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
from typing import *
|
||||
import logging
|
||||
import datetime
|
||||
import asyncio as aio
|
||||
import datetime
|
||||
import logging
|
||||
from typing import *
|
||||
|
||||
import nio
|
||||
|
||||
import royalnet.backpack as rb
|
||||
import royalnet.commands as rc
|
||||
import royalnet.utils as ru
|
||||
from ..serf import Serf
|
||||
from .escape import escape
|
||||
import nio
|
||||
from ..serf import Serf
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import logging
|
||||
import importlib
|
||||
import abc
|
||||
import asyncio as aio
|
||||
import importlib
|
||||
import logging
|
||||
import sys
|
||||
import traceback
|
||||
from typing import *
|
||||
|
||||
from sqlalchemy.schema import Table
|
||||
import royalnet.commands as rc
|
||||
import royalnet.utils as ru
|
||||
|
||||
import royalnet.alchemy as ra
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.commands as rc
|
||||
import royalnet.herald as rh
|
||||
import traceback
|
||||
import abc
|
||||
import royalnet.utils as ru
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from typing import *
|
||||
import re
|
||||
from typing import *
|
||||
|
||||
|
||||
def escape(string: Optional[str]) -> Optional[str]:
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
from typing import *
|
||||
import asyncio as aio
|
||||
import contextlib
|
||||
import logging
|
||||
import asyncio as aio
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
from typing import *
|
||||
|
||||
import telegram
|
||||
import urllib3
|
||||
from telegram.utils.request import Request as TRequest
|
||||
from dataclasses import dataclass
|
||||
|
||||
import royalnet.backpack.tables as rbt
|
||||
import royalnet.commands as rc
|
||||
import royalnet.utils as ru
|
||||
import royalnet.backpack.tables as rbt
|
||||
|
||||
from .escape import escape
|
||||
from ..serf import Serf
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from .asyncify import asyncify
|
||||
from .sleep_until import sleep_until
|
||||
from .formatters import andformat, underscorize, ytdldateformat, numberemojiformat, ordinalformat
|
||||
from .urluuid import to_urluuid, from_urluuid
|
||||
from .multilock import MultiLock
|
||||
from .sentry import init_sentry, sentry_exc, sentry_wrap, sentry_async_wrap
|
||||
from .log import init_logging
|
||||
from .multilock import MultiLock
|
||||
from .royaltyping import JSON
|
||||
from .sentry import init_sentry, sentry_exc, sentry_wrap, sentry_async_wrap
|
||||
from .sleep_until import sleep_until
|
||||
from .strip_tabs import strip_tabs
|
||||
from .urluuid import to_urluuid, from_urluuid
|
||||
|
||||
__all__ = [
|
||||
"asyncify",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import typing
|
||||
import re
|
||||
import typing
|
||||
|
||||
|
||||
def andformat(coll: typing.Collection[str], middle=", ", final=" and ") -> str:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from typing import *
|
||||
import logging
|
||||
from typing import *
|
||||
|
||||
try:
|
||||
import coloredlogs
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import logging
|
||||
from asyncio import Event
|
||||
from contextlib import asynccontextmanager
|
||||
import logging
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MultiLock:
|
||||
"""A lock that can allow both simultaneous access and exclusive access to a resource."""
|
||||
|
||||
def __init__(self):
|
||||
self._counter: int = 0
|
||||
self._normal_event: Event = Event()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import functools
|
||||
import logging
|
||||
import sys
|
||||
import traceback
|
||||
from typing import *
|
||||
|
||||
import royalnet
|
||||
import functools
|
||||
|
||||
try:
|
||||
import sentry_sdk
|
||||
|
@ -16,7 +17,6 @@ except ImportError:
|
|||
SqlalchemyIntegration = None
|
||||
LoggingIntegration = None
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -57,7 +57,9 @@ def sentry_wrap(level: str = "ERROR"):
|
|||
except Exception as exc:
|
||||
sentry_exc(exc=exc, level=level)
|
||||
raise
|
||||
|
||||
return new_func
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
|
@ -70,5 +72,7 @@ def sentry_async_wrap(level: str = "ERROR"):
|
|||
except Exception as exc:
|
||||
sentry_exc(exc=exc, level=level)
|
||||
raise
|
||||
|
||||
return new_func
|
||||
|
||||
return decorator
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uuid as _uuid
|
||||
import base64
|
||||
import uuid as _uuid
|
||||
|
||||
|
||||
def to_urluuid(uuid: _uuid.UUID) -> str:
|
||||
|
|
Loading…
Reference in a new issue