cleanup/minor
This commit is contained in:
parent
685ac5f2f6
commit
97808e388f
2
api.py
2
api.py
@ -43,7 +43,7 @@ class API:
|
|||||||
|
|
||||||
|
|
||||||
def __init__():
|
def __init__():
|
||||||
import util # pylint: disable=redefined-outer-name, reimported, import-outside-toplevel
|
import util
|
||||||
importlib.reload(util)
|
importlib.reload(util)
|
||||||
|
|
||||||
__init__()
|
__init__()
|
@ -224,7 +224,7 @@ class Meme(commands.Cog):
|
|||||||
for meme in memes:
|
for meme in memes:
|
||||||
if not meme:
|
if not meme:
|
||||||
continue
|
continue
|
||||||
(meme_id, meme_title, meme_url) = meme # pylint: disable=unused-variable
|
(meme_id, meme_title, meme_url) = meme
|
||||||
request = requests.get(meme_url, stream=True, timeout=(5, 30), headers=headers)
|
request = requests.get(meme_url, stream=True, timeout=(5, 30), headers=headers)
|
||||||
if not request.status_code == 200:
|
if not request.status_code == 200:
|
||||||
continue
|
continue
|
||||||
|
@ -3,13 +3,13 @@ import traceback
|
|||||||
import urllib
|
import urllib
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
from typing import Optional, LiteralString
|
from typing import Optional
|
||||||
import logging
|
import logging
|
||||||
import discord
|
import discord
|
||||||
from cogs.misc_util import Util
|
from cogs.misc_util import Util
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
from sh import cowsay as cow_say, fortune # pylint: disable=no-name-in-module
|
from sh import cowsay as cow_say, fortune
|
||||||
from discord.ext import bridge, commands, tasks
|
from discord.ext import bridge, commands
|
||||||
from disc_havoc import Havoc
|
from disc_havoc import Havoc
|
||||||
from constructors import MiscException
|
from constructors import MiscException
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import traceback
|
|||||||
import random
|
import random
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
from typing import Any, Optional, LiteralString, Union
|
from typing import Optional, LiteralString, Union
|
||||||
import regex
|
import regex
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
from aiohttp import ClientSession, ClientTimeout
|
from aiohttp import ClientSession, ClientTimeout
|
||||||
@ -418,7 +418,7 @@ class Util:
|
|||||||
day=25,
|
day=25,
|
||||||
tzinfo=pytz.UTC,
|
tzinfo=pytz.UTC,
|
||||||
)
|
)
|
||||||
td: datetime.timedelta = (xmas - today) # pylint: disable=superfluous-parens
|
td: datetime.timedelta = (xmas - today)
|
||||||
days, hours, minutes, seconds, us, ms = self.tdTuple(td)
|
days, hours, minutes, seconds, us, ms = self.tdTuple(td)
|
||||||
|
|
||||||
return (days, hours, minutes, seconds, ms, us)
|
return (days, hours, minutes, seconds, ms, us)
|
||||||
|
@ -116,8 +116,6 @@ class Radio(commands.Cog):
|
|||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
# pylint: enable=superfluous-parens
|
|
||||||
|
|
||||||
def cog_unload(self) -> None:
|
def cog_unload(self) -> None:
|
||||||
"""Run on Cog Unload"""
|
"""Run on Cog Unload"""
|
||||||
self.radio_state_loop.cancel()
|
self.radio_state_loop.cancel()
|
||||||
|
@ -62,7 +62,7 @@ class Havoc(bridge.Bot):
|
|||||||
load_method(f'cogs.{cog}')
|
load_method(f'cogs.{cog}')
|
||||||
|
|
||||||
importlib.reload(api)
|
importlib.reload(api)
|
||||||
from api import API # pylint: disable=unused-import
|
from api import API
|
||||||
api_config = hypercorn.config.Config()
|
api_config = hypercorn.config.Config()
|
||||||
api_config.bind = ["10.10.10.100:5992"]
|
api_config.bind = ["10.10.10.100:5992"]
|
||||||
api_instance = api.API(self)
|
api_instance = api.API(self)
|
||||||
|
@ -11,7 +11,7 @@ class DB:
|
|||||||
"sqlite_dbs", "lovehate.db")
|
"sqlite_dbs", "lovehate.db")
|
||||||
|
|
||||||
async def get_wholovehates(self, thing: str, loves: bool = False,
|
async def get_wholovehates(self, thing: str, loves: bool = False,
|
||||||
hates: bool = False) -> list[tuple]|bool:
|
hates: bool = False) -> Union[list[tuple], bool]:
|
||||||
"""
|
"""
|
||||||
Get a list of users who have professed their love OR hatred for <thing>
|
Get a list of users who have professed their love OR hatred for <thing>
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ class DB:
|
|||||||
loves (bool): Are we looking for loves?
|
loves (bool): Are we looking for loves?
|
||||||
hates (bool): ...or are we looking for hates?
|
hates (bool): ...or are we looking for hates?
|
||||||
Returns:
|
Returns:
|
||||||
list[tuple]
|
Union[list[tuple], bool]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
query: str = "SELECT display_name FROM lovehate WHERE thing LIKE ? AND flag = ?"
|
query: str = "SELECT display_name FROM lovehate WHERE thing LIKE ? AND flag = ?"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user