make autoflake more aggressive & fix some lint
This commit is contained in:
parent
7c7a1fcde2
commit
76266d8d2f
5 changed files with 12 additions and 6 deletions
|
|
@ -203,7 +203,6 @@ class Bot:
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _run_timers(self) -> NoReturn:
|
async def _run_timers(self) -> NoReturn:
|
||||||
client = self.client
|
|
||||||
await asyncio.sleep(2)
|
await asyncio.sleep(2)
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(0.2)
|
await asyncio.sleep(0.2)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from typing import *
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from ..functions import localizedtz, react, reply
|
from ..functions import localizedtz, reply
|
||||||
from ..models import Job, Message
|
from ..models import Job, Message
|
||||||
from ..tz import cest
|
from ..tz import cest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
from ..functions import react, reply
|
from ..functions import reply
|
||||||
from ..models import Message
|
from ..models import Message
|
||||||
|
|
||||||
HELP = """
|
HELP = """
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ async def extractor(info):
|
||||||
info.extracted.rating_count = ld["aggregateRating"]["ratingCount"]
|
info.extracted.rating_count = ld["aggregateRating"]["ratingCount"]
|
||||||
|
|
||||||
|
|
||||||
async def handle(message, url, info):
|
async def handle(message: Message, url, info):
|
||||||
ex = clone(info.extracted)
|
ex = clone(info.extracted)
|
||||||
image_title = f"Poster for {ex.title} ({ex.published:%Y})"
|
image_title = f"Poster for {ex.title} ({ex.published:%Y})"
|
||||||
hosted_image = await import_image(
|
hosted_image = await import_image(
|
||||||
|
|
|
||||||
11
scripts/lint
11
scripts/lint
|
|
@ -1,11 +1,18 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
autoflake_opts='
|
||||||
|
--remove-duplicate-keys
|
||||||
|
--remove-unused-variables
|
||||||
|
--remove-all-unused-imports
|
||||||
|
--ignore-init-module-imports
|
||||||
|
'
|
||||||
|
|
||||||
if [ "$1" = '--fix' ]; then
|
if [ "$1" = '--fix' ]; then
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
|
autoflake --in-place --recursive $autoflake_opts .
|
||||||
black .
|
black .
|
||||||
isort --profile black .
|
isort --profile black .
|
||||||
autoflake --in-place --recursive .
|
|
||||||
mypy . || : # ignore
|
mypy . || : # ignore
|
||||||
)
|
)
|
||||||
exit
|
exit
|
||||||
|
|
@ -13,9 +20,9 @@ fi
|
||||||
|
|
||||||
error=0
|
error=0
|
||||||
|
|
||||||
|
(set -x; autoflake --check --recursive $autoflake_opts . | uniq) || error=$?
|
||||||
(set -x; black --check .) || error=$?
|
(set -x; black --check .) || error=$?
|
||||||
(set -x; isort --profile black --check .) || error=$?
|
(set -x; isort --profile black --check .) || error=$?
|
||||||
(set -x; autoflake --check --recursive . | uniq) || error=$?
|
|
||||||
(set -x; mypy .) || : # ignore
|
(set -x; mypy .) || : # ignore
|
||||||
|
|
||||||
exit "$error"
|
exit "$error"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue