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