1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 13:04:20 +00:00

🧹 Run reformat code on the whole repository

This commit is contained in:
Steffo 2022-03-06 17:48:16 +01:00
parent b20f20f387
commit 94d0ae7d05
Signed by: steffo
GPG key ID: 6965406171929D01
36 changed files with 736 additions and 712 deletions

8
poetry.lock generated
View file

@ -428,7 +428,7 @@ pyasn1 = ">=0.1.3"
[[package]]
name = "sentry-sdk"
version = "1.5.6"
version = "1.5.5"
description = "Python client for Sentry (https://sentry.io)"
category = "main"
optional = false
@ -619,7 +619,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "4d75b8fb7e3dfb1b0c87e6f31ab9e033e96a990b0e74a1212acd76d673cd06f9"
content-hash = "f1333f44e4018f9a78626bfaf5db96ab65db60cec6607a6395f9f9213981105f"
[metadata.files]
aiohttp = [
@ -1064,8 +1064,8 @@ rsa = [
{ file = "rsa-4.8.tar.gz", hash = "sha256:5c6bd9dc7a543b7fe4304a631f8a8a3b674e2bbfc49c2ae96200cdbe55df6b17" },
]
sentry-sdk = [
{file = "sentry-sdk-1.5.6.tar.gz", hash = "sha256:ac2a50128409d57655279817aedcb7800cace1f76b266f3dd62055d5afd6e098"},
{file = "sentry_sdk-1.5.6-py2.py3-none-any.whl", hash = "sha256:1ab34e3851a34aeb3d1af1a0f77cec73978c4e9698e5210d050e4932953cb241"},
{ file = "sentry-sdk-1.5.5.tar.gz", hash = "sha256:98fd155fa5d5fec1dbabed32a1a4ae2705f1edaa5dae4e7f7b62a384ba30e759" },
{ file = "sentry_sdk-1.5.5-py2.py3-none-any.whl", hash = "sha256:3817274fba2498c8ebf6b896ee98ac916c5598706340573268c07bf2bb30d831" },
]
six = [
{ file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" },

View file

@ -1,18 +1,18 @@
import logging
import pathlib
import re
import coloredlogs
import discord
import pkg_resources
import royalnet.engineer as engi
import royalnet.scrolls as sc
import royalnet_telethon as rt
import royalnet_discordpy as rd
import pathlib
import re
import coloredlogs
import sentry_sdk
import royalnet_telethon as rt
import sentry_sdk.integrations.atexit
import sentry_sdk.integrations.dedupe
import sentry_sdk.integrations.modules
import sentry_sdk.integrations.threading
import logging
from . import commands
from .database import engine, base
@ -101,11 +101,13 @@ register_telegram(tg_router, commands.whoami, ["whoami"])
register_telegram(tg_router, commands.fiorygi_balance_self, ["balance"])
register_telegram(tg_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)")
register_telegram(tg_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_telegram(tg_router, commands.fiorygi_magick, ["magick"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_telegram(tg_router, commands.fiorygi_magick, ["magick"],
r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_telegram(tg_router, commands.fiorygi_transactions_self, ["transactions"])
register_telegram(tg_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)")
register_telegram(tg_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
register_telegram(tg_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_telegram(tg_router, commands.fiorygi_bury, ["bury"],
r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_telegram(tg_router, commands.version, ["version"])
register_telegram(tg_router, commands.cv, ["cv", "civù"])
register_telegram(tg_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
@ -135,11 +137,13 @@ register_discord(ds_router, commands.whoami, ["whoami"])
register_discord(ds_router, commands.fiorygi_balance_self, ["balance"])
register_discord(ds_router, commands.fiorygi_balance_other, ["balance"], r"(?P<target>\S+)")
register_discord(ds_router, commands.fiorygi_give, ["give"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_discord(ds_router, commands.fiorygi_magick, ["magick"], r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_discord(ds_router, commands.fiorygi_magick, ["magick"],
r"(?P<target>\S+)\s+(?P<amount>[0-9]+)\s+(?P<reason>.+)")
register_discord(ds_router, commands.fiorygi_transactions_self, ["transactions"])
register_discord(ds_router, commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)")
register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
register_discord(ds_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_discord(ds_router, commands.fiorygi_bury, ["bury"],
r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_discord(ds_router, commands.version, ["version"])
register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
register_discord(ds_router, commands.hack, ["hack"], r'(?P<activity>.+)')
@ -149,5 +153,4 @@ register_discord(ds_router, commands.loginprogress, ["loginprogress"])
pda.implementations["telethon.1"].register_conversation(tg_router)
pda.implementations["discordpy.2"].register_conversation(ds_router)
pda.run()

View file

@ -1,3 +1,3 @@
from .login import *
from .target import *
from .sentry import *
from .target import *

View file

@ -6,6 +6,7 @@ from __future__ import annotations
import functools
import logging
import sentry_sdk
log = logging.getLogger(__name__)

View file

@ -3,21 +3,21 @@ from .answer import *
from .cat import *
from .ciaoruozi import *
from .color import *
from .ping import *
from .ship import *
from .emojify import *
from .cv import *
from .diobot import *
from .dog import *
from .emojify import *
from .fiorygi import *
from .fortune import *
from .pmots import *
from .spell import *
from .smecds import *
from .man import *
from .hack import *
from .login import *
from .loginprogress import *
from .whoami import *
from .fiorygi import *
from .version import *
from .cv import *
from .man import *
from .ping import *
from .pmots import *
from .rocoinflip import *
from .hack import *
from .diobot import *
from .ship import *
from .smecds import *
from .spell import *
from .version import *
from .whoami import *

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import datetime
import random
import royalnet.engineer as engi
import royalpack.bolts as rb
ANSWERS = [
# Cerchiamo di tenere bilanciate le tre colonne, o almeno le prime due.

View file

@ -3,6 +3,7 @@ import logging
import aiohttp
import royalnet.engineer as engi
import royalpack.bolts as rb
log = logging.getLogger(__name__)

View file

@ -1,6 +1,7 @@
import royalnet.engineer as engi
import royalnet_telethon
import royalnet_telethon.bullet.contents
import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,10 +1,12 @@
import royalnet.royaltyping as t
import royalnet.engineer as engi
import royalnet_discordpy as rd
import royalpack.bolts as rb
import itertools
import discord
import discord.channel
import itertools
import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy as rd
import royalpack.bolts as rb
@rb.capture_errors

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import datetime
import random
import royalnet.engineer as engi
import royalpack.bolts as rb
WHO = [
# A chi sarà diretto l'insulto
["Dio", "o"],

View file

@ -2,6 +2,7 @@ import io
import aiohttp
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import royalpack.bolts as rb
import random
import royalnet.engineer as engi
import royalpack.bolts as rb
_emojis = {
"abcd": ["🔡", "🔠"],

View file

@ -1,10 +1,12 @@
import royalnet.royaltyping as t
import royalnet.engineer as engi
import royalpack.database as db
import royalpack.bolts as rb
import sqlalchemy.sql as ss
import functools
import arrow
import royalnet.engineer as engi
import royalnet.royaltyping as t
import sqlalchemy.sql as ss
import royalpack.bolts as rb
import royalpack.database as db
@rb.capture_errors

View file

@ -1,8 +1,9 @@
import royalnet.engineer as engi
import random
import datetime
import royalpack.bolts as rb
import random
import royalnet.engineer as engi
import royalpack.bolts as rb
# Tutte le fortunes qui devono essere positive :)
# O almeno neutrali...

View file

@ -1,10 +1,9 @@
import royalnet.royaltyping as t
import royalnet.engineer as engi
import royalnet_discordpy
import royalnet_discordpy.bullet.contents
import discord
import discord.http
import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy
import royalnet_discordpy.bullet.contents
activities = {
"yt": 755600276941176913,

View file

@ -1,17 +1,19 @@
import discord
import royalnet.royaltyping as t
import royalnet.engineer as engi
import sqlalchemy.orm as so
import royalpack.database as db
import royalpack.config as cfg
import royalnet_telethon.bullet.contents
import royalnet_discordpy
import royalpack.bolts as rb
import aiohttp
import asyncio
import logging
import aiohttp
import arrow
import async_timeout
import discord
import royalnet.engineer as engi
import royalnet.royaltyping as t
import royalnet_discordpy
import royalnet_telethon.bullet.contents
import sqlalchemy.orm as so
import royalpack.bolts as rb
import royalpack.config as cfg
import royalpack.database as db
log = logging.getLogger(__name__)

View file

@ -1,9 +1,9 @@
import royalnet.engineer as engi
import royalpack.database as db
import sqlalchemy.orm as so
import sqlalchemy.sql as ss
import royalpack.bolts as rb
import royalpack.bolts as rb
import royalpack.database as db
expected = [
"mrdima",
@ -78,7 +78,6 @@ async def loginprogress(*, _msg: engi.Message, _session: so.Session, **__):
discord = list(map(_has_discord_account, expected))
def _render_line(index: int) -> str:
def _telegram_emoji() -> str:
return telegram_emoji(telegram[index])

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import royalnet.engineer as engi
import royalpack.bolts as rb

View file

@ -1,4 +1,5 @@
import random
import royalnet.engineer as engi

View file

@ -1,9 +1,10 @@
import logging
import re
import royalpack.bolts as rb
import royalnet.engineer as engi
import royalpack.bolts as rb
log = logging.getLogger(__name__)

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import random
import royalpack.bolts as rb
import royalnet.engineer as engi
import royalpack.bolts as rb
_ds_list = ["della secca", "del seccatore", "del secchiello", "del secchio", "del secchione", "del secondino",
"del sedano", "del sedativo", "della sedia", "del sedicente", "del sedile", "della sega", "del segale",

View file

@ -1,5 +1,6 @@
import royalnet.engineer as engi
import royalspells
import royalpack.bolts as rb

View file

@ -1,7 +1,8 @@
import royalnet.engineer as engi
import royalnet_telethon as rt
import royalnet_discordpy as rd
import pkg_resources
import royalnet.engineer as engi
import royalnet_discordpy as rd
import royalnet_telethon as rt
import royalpack.bolts as rb
@ -21,9 +22,11 @@ async def version(*, _imp: engi.PDAImplementation, _msg: engi.Message, **__):
msg.append(f"- \uE01Croyalnet\uE00C \uE01B{pkg_resources.get_distribution('royalnet').version}\uE00B")
if isinstance(_imp, rt.TelethonPDAImplementation):
msg.append(f"- \uE01Croyalnet_telethon\uE00C \uE01B{pkg_resources.get_distribution('royalnet_telethon').version}\uE00B")
msg.append(
f"- \uE01Croyalnet_telethon\uE00C \uE01B{pkg_resources.get_distribution('royalnet_telethon').version}\uE00B")
elif isinstance(_imp, rd.DiscordpyPDAImplementation):
msg.append(f"- \uE01Croyalnet_discordpy\uE00C \uE01B{pkg_resources.get_distribution('royalnet_discordpy').version}\uE00B")
msg.append(
f"- \uE01Croyalnet_discordpy\uE00C \uE01B{pkg_resources.get_distribution('royalnet_discordpy').version}\uE00B")
msg.append(f"- \uE01Croyalpack\uE00C \uE01B{pkg_resources.get_distribution('royalpack').version}\uE00B")

View file

@ -1,6 +1,7 @@
import royalnet.engineer as engi
import royalpack.database as db
import royalpack.bolts as rb
import royalpack.database as db
@rb.capture_errors

View file

@ -1,11 +1,10 @@
import pathlib
import royalnet.scrolls as s
import royalnet.lazy as l
import royalnet.lazy as l
import royalnet.scrolls as s
lazy_config = l.Lazy(lambda: s.Scroll.from_file("ROYALPACK", pathlib.Path("royalpack.cfg.toml")))
__all__ = (
"lazy_config",
)

View file

@ -1,17 +1,14 @@
import logging.config
import sqlalchemy
import sqlalchemy.pool
import alembic
from royalpack.config import lazy_config
from royalpack.database.base import Base
from royalpack.database.engine import lazy_engine
from royalpack.config import lazy_config
# Set up logging
logging.config.fileConfig(alembic.context.config.config_file_name)
# Get the metadata
target_metadata = Base.metadata

View file

@ -6,7 +6,6 @@ Create Date: 2021-04-25 23:17:50.846179
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.

View file

@ -5,10 +5,9 @@ Revises:
Create Date: 2021-04-25 01:00:49.131019
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from alembic import op
# revision identifiers, used by Alembic.
revision = 'c6aacbd5d796'

View file

@ -5,10 +5,9 @@ Revises: c6aacbd5d796
Create Date: 2021-04-25 02:18:44.248837
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e6b0d97063a1'
@ -19,8 +18,10 @@ depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('fiorygi_transactions', sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
op.add_column('fiorygi_treasures', sa.Column('creation_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
op.add_column('fiorygi_transactions',
sa.Column('timestamp', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
op.add_column('fiorygi_treasures',
sa.Column('creation_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
op.add_column('fiorygi_treasures', sa.Column('find_time', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False))
# ### end Alembic commands ###

View file

@ -1,17 +1,17 @@
from __future__ import annotations
import typing as t
import sqlalchemy as s
import sqlalchemy.sql as ss
import sqlalchemy.orm as so
import sqlalchemy.ext.declarative as sed
import sqlalchemy_utils as su
import royalnet.alchemist as ra
import colour
import typing as t
import colour
import royalnet.alchemist as ra
import sqlalchemy as s
import sqlalchemy.ext.declarative as sed
import sqlalchemy.orm as so
import sqlalchemy.sql as ss
import sqlalchemy_utils as su
Base: sed.declarative_base = sed.declarative_base()
user_title_association = s.Table(
"user_title_association",
Base.metadata,

View file

@ -1,9 +1,8 @@
import sqlalchemy.orm
import royalnet.lazy
import sqlalchemy.orm
from ..config import *
lazy_engine = royalnet.lazy.Lazy(lambda c: sqlalchemy.create_engine(c["database.uri"]), c=lazy_config)
"""
The uninitialized sqlalchemy engine.

View file

@ -7,11 +7,12 @@ Data is fetched from the `Toofz API`_, which in turn fetches it from the Steam l
.. _SteamKit: https://github.com/SteamRE/SteamKit
"""
import royalnet.royaltyping as t
import aiohttp
import asyncio
import datetime
import aiohttp
import royalnet.royaltyping as t
async def get_leaderboards_info() -> list[t.JSON]:
"""
@ -50,7 +51,8 @@ async def get_all_leaderboard_entries(lbid):
while total is None or offset < total:
async with aiohttp.ClientSession() as session:
async with session.get(f"https://api.toofz.com/leaderboards/dailies/{lbid}/entries?offset={offset}&limit=100") as request:
async with session.get(
f"https://api.toofz.com/leaderboards/dailies/{lbid}/entries?offset={offset}&limit=100") as request:
print(f"{total=} {offset=} {result=}")
data = await request.json()
assert data["leaderboard"]["id"] == lbid