mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Fix a lot of warnings
This commit is contained in:
parent
ad8a0016bc
commit
22d30b89f2
20 changed files with 21 additions and 23 deletions
|
@ -2,7 +2,6 @@ import typing
|
||||||
import logging as _logging
|
import logging as _logging
|
||||||
import os
|
import os
|
||||||
from youtube_dl import YoutubeDL
|
from youtube_dl import YoutubeDL
|
||||||
from contextlib import contextmanager
|
|
||||||
|
|
||||||
log = _logging.getLogger(__name__)
|
log = _logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ import telegram
|
||||||
import asyncio
|
import asyncio
|
||||||
import typing
|
import typing
|
||||||
import logging as _logging
|
import logging as _logging
|
||||||
import sys
|
|
||||||
from .generic import GenericBot
|
from .generic import GenericBot
|
||||||
from ..commands import NullCommand
|
from ..commands import NullCommand
|
||||||
from ..utils import asyncify, Call, Command
|
from ..utils import asyncify, Call, Command
|
||||||
from ..error import UnregisteredError, InvalidConfigError
|
from ..error import UnregisteredError, InvalidConfigError
|
||||||
from ..network import RoyalnetLink, Message, RequestError, RoyalnetConfig
|
from ..network import Message, RoyalnetConfig
|
||||||
from ..database import Alchemy, relationshiplinkchain, DatabaseConfig
|
from ..database import DatabaseConfig
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
log = _logging.getLogger(__name__)
|
log = _logging.getLogger(__name__)
|
||||||
|
|
|
@ -100,12 +100,19 @@ class DiarioCommand(Command):
|
||||||
message: telegram.Message = update.message
|
message: telegram.Message = update.message
|
||||||
reply: telegram.Message = message.reply_to_message
|
reply: telegram.Message = message.reply_to_message
|
||||||
creator = await call.get_author()
|
creator = await call.get_author()
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
quoted_account: typing.Optional[call.alchemy.Telegram]
|
quoted_account: typing.Optional[call.alchemy.Telegram]
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
quoted: typing.Optional[str]
|
quoted: typing.Optional[str]
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
text: typing.Optional[str]
|
text: typing.Optional[str]
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
context: typing.Optional[str]
|
context: typing.Optional[str]
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
timestamp: datetime.datetime
|
timestamp: datetime.datetime
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
media_url: typing.Optional[str]
|
media_url: typing.Optional[str]
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
spoiler: bool
|
spoiler: bool
|
||||||
if creator is None:
|
if creator is None:
|
||||||
await call.reply("⚠️ Devi essere registrato a Royalnet per usare questo comando!")
|
await call.reply("⚠️ Devi essere registrato a Royalnet per usare questo comando!")
|
||||||
|
|
|
@ -49,5 +49,5 @@ class PlayCommand(Command):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def common(cls, call: Call):
|
async def common(cls, call: Call):
|
||||||
guild, url = call.args.match(r"(?:\[(.+)])?\s*(.+)")
|
guild, url = call.args.match(r"(?:\[(.+)])?\s*(.+)")
|
||||||
response: RequestSuccessful = await call.net_request(PlayMessage(url, guild), "discord")
|
await call.net_request(PlayMessage(url, guild), "discord")
|
||||||
await call.reply(f"✅ Richiesta la riproduzione di [c]{url}[/c].")
|
await call.reply(f"✅ Richiesta la riproduzione di [c]{url}[/c].")
|
||||||
|
|
|
@ -13,9 +13,8 @@ class ReminderCommand(Command):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def common(cls, call: Call):
|
async def common(cls, call: Call):
|
||||||
date_str, reminder_text = call.args.match(r"\[ *(.+?) *] *(.+?) *$")
|
date_str, reminder_text = call.args.match(r"\[ *(.+?) *] *(.+?) *$")
|
||||||
date: typing.Optional[datetime.datetime]
|
|
||||||
try:
|
try:
|
||||||
date = dateparser.parse(date_str)
|
date: typing.Optional[datetime.datetime] = dateparser.parse(date_str)
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
date = None
|
date = None
|
||||||
if date is None:
|
if date is None:
|
||||||
|
|
|
@ -3,7 +3,6 @@ import discord
|
||||||
from ..network import Message, RequestSuccessful
|
from ..network import Message, RequestSuccessful
|
||||||
from ..utils import Command, Call, NetworkHandler
|
from ..utils import Command, Call, NetworkHandler
|
||||||
from ..error import TooManyFoundError, NoneFoundError
|
from ..error import TooManyFoundError, NoneFoundError
|
||||||
from ..audio import RoyalPCMAudio
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from ..bots import DiscordBot
|
from ..bots import DiscordBot
|
||||||
|
|
||||||
|
@ -45,5 +44,5 @@ class SkipCommand(Command):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def common(cls, call: Call):
|
async def common(cls, call: Call):
|
||||||
guild, = call.args.match(r"(?:\[(.+)])?")
|
guild, = call.args.match(r"(?:\[(.+)])?")
|
||||||
response: RequestSuccessful = await call.net_request(SkipMessage(guild), "discord")
|
await call.net_request(SkipMessage(guild), "discord")
|
||||||
await call.reply(f"✅ Richiesta lo skip della canzone attuale..")
|
await call.reply(f"✅ Richiesta lo skip della canzone attuale..")
|
||||||
|
|
|
@ -53,9 +53,8 @@ class SummonCommand(Command):
|
||||||
channel_name: str = call.args.optional(0)
|
channel_name: str = call.args.optional(0)
|
||||||
if channel_name:
|
if channel_name:
|
||||||
guild: typing.Optional[discord.Guild] = message.guild
|
guild: typing.Optional[discord.Guild] = message.guild
|
||||||
channels: typing.List[discord.abc.GuildChannel]
|
|
||||||
if guild is not None:
|
if guild is not None:
|
||||||
channels = guild.channels
|
channels: typing.List[discord.abc.GuildChannel] = guild.channels
|
||||||
else:
|
else:
|
||||||
channels = bot.get_all_channels()
|
channels = bot.get_all_channels()
|
||||||
matching_channels: typing.List[discord.VoiceChannel] = []
|
matching_channels: typing.List[discord.VoiceChannel] = []
|
||||||
|
|
|
@ -5,6 +5,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from contextlib import contextmanager, asynccontextmanager
|
from contextlib import contextmanager, asynccontextmanager
|
||||||
from ..utils import asyncify
|
from ..utils import asyncify
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from ..error import InvalidConfigError
|
from ..error import InvalidConfigError
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
|
@ -4,7 +4,9 @@ from sqlalchemy import Column, \
|
||||||
ForeignKey
|
ForeignKey
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .royals import Royal
|
from .royals import Royal
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .keygroup import Keygroup
|
from .keygroup import Keygroup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from sqlalchemy import Column, \
|
||||||
ForeignKey
|
ForeignKey
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .royals import Royal
|
from .royals import Royal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from sqlalchemy import Column, \
|
||||||
String
|
String
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .royals import Royal
|
from .royals import Royal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from sqlalchemy import Column, \
|
||||||
ForeignKey
|
ForeignKey
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .royals import Royal
|
from .royals import Royal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from sqlalchemy import Column, \
|
||||||
ForeignKey
|
ForeignKey
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .keygroup import Keygroup
|
from .keygroup import Keygroup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ from sqlalchemy import Column, \
|
||||||
Integer, \
|
Integer, \
|
||||||
String, \
|
String, \
|
||||||
BigInteger, \
|
BigInteger, \
|
||||||
LargeBinary, \
|
|
||||||
ForeignKey
|
ForeignKey
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from sqlalchemy.ext.declarative import declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from .royals import Royal
|
from .royals import Royal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import traceback
|
|
||||||
from ..error import RoyalnetError
|
from ..error import RoyalnetError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import typing
|
|
||||||
|
|
||||||
|
|
||||||
class RoyalnetConfig:
|
class RoyalnetConfig:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
master_uri: str,
|
master_uri: str,
|
||||||
|
|
|
@ -146,7 +146,6 @@ class RoyalnetLink:
|
||||||
assert isinstance(response, Message)
|
assert isinstance(response, Message)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
response = RequestError(exc=exc)
|
response = RequestError(exc=exc)
|
||||||
return
|
|
||||||
response_package: Package = package.reply(response)
|
response_package: Package = package.reply(response)
|
||||||
await self.send(response_package)
|
await self.send(response_package)
|
||||||
log.debug(f"Replied to request {response_package.source_conv_id}: {response_package}")
|
log.debug(f"Replied to request {response_package.source_conv_id}: {response_package}")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import typing
|
import typing
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
|
||||||
from ..network.messages import Message
|
from ..network.messages import Message
|
||||||
from .command import Command
|
from .command import Command
|
||||||
from .commandargs import CommandArgs
|
from .commandargs import CommandArgs
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import typing
|
import typing
|
||||||
from ..error import UnsupportedError
|
from ..error import UnsupportedError
|
||||||
from ..network import Message
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from .call import Call
|
from .call import Call
|
||||||
from ..utils import NetworkHandler
|
from ..utils import NetworkHandler
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
from ..network import Message
|
|
||||||
from ..error import UnsupportedError
|
|
||||||
|
|
||||||
|
|
||||||
class NetworkHandler:
|
class NetworkHandler:
|
||||||
"""The NetworkHandler functions are called when a specific Message type is received."""
|
"""The NetworkHandler functions are called when a specific Message type is received."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue