From 76266d8d2fc9497f5f080290c9d4ba481cf85148 Mon Sep 17 00:00:00 2001 From: ducklet Date: Sun, 8 Nov 2020 10:52:50 +0100 Subject: [PATCH] make autoflake more aggressive & fix some lint --- hotdog/bot.py | 1 - hotdog/command/covid.py | 2 +- hotdog/command/dm.py | 2 +- hotdog/command/urlinfo_/imdb.py | 2 +- scripts/lint | 11 +++++++++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hotdog/bot.py b/hotdog/bot.py index bfa3957..ab850ca 100644 --- a/hotdog/bot.py +++ b/hotdog/bot.py @@ -203,7 +203,6 @@ class Bot: ) async def _run_timers(self) -> NoReturn: - client = self.client await asyncio.sleep(2) while True: await asyncio.sleep(0.2) diff --git a/hotdog/command/covid.py b/hotdog/command/covid.py index d7dca60..5adf0e9 100644 --- a/hotdog/command/covid.py +++ b/hotdog/command/covid.py @@ -8,7 +8,7 @@ from typing import * import requests -from ..functions import localizedtz, react, reply +from ..functions import localizedtz, reply from ..models import Job, Message from ..tz import cest diff --git a/hotdog/command/dm.py b/hotdog/command/dm.py index 480ea44..87517df 100644 --- a/hotdog/command/dm.py +++ b/hotdog/command/dm.py @@ -1,6 +1,6 @@ from random import choice -from ..functions import react, reply +from ..functions import reply from ..models import Message HELP = """ diff --git a/hotdog/command/urlinfo_/imdb.py b/hotdog/command/urlinfo_/imdb.py index 08de047..571e82e 100644 --- a/hotdog/command/urlinfo_/imdb.py +++ b/hotdog/command/urlinfo_/imdb.py @@ -148,7 +148,7 @@ async def extractor(info): info.extracted.rating_count = ld["aggregateRating"]["ratingCount"] -async def handle(message, url, info): +async def handle(message: Message, url, info): ex = clone(info.extracted) image_title = f"Poster for {ex.title} ({ex.published:%Y})" hosted_image = await import_image( diff --git a/scripts/lint b/scripts/lint index e382088..d292372 100755 --- a/scripts/lint +++ b/scripts/lint @@ -1,11 +1,18 @@ #!/bin/sh -e +autoflake_opts=' + --remove-duplicate-keys + --remove-unused-variables + --remove-all-unused-imports + --ignore-init-module-imports + ' + if [ "$1" = '--fix' ]; then ( set -x + autoflake --in-place --recursive $autoflake_opts . black . isort --profile black . - autoflake --in-place --recursive . mypy . || : # ignore ) exit @@ -13,9 +20,9 @@ fi error=0 +(set -x; autoflake --check --recursive $autoflake_opts . | uniq) || error=$? (set -x; black --check .) || error=$? (set -x; isort --profile black --check .) || error=$? -(set -x; autoflake --check --recursive . | uniq) || error=$? (set -x; mypy .) || : # ignore exit "$error"