From 8d682a11406dd259fd12024425cd9749717b5e50 Mon Sep 17 00:00:00 2001 From: Arne Beer Date: Tue, 7 May 2024 01:52:02 +0200 Subject: [PATCH] fix: new lints --- stickerfinder/config.py | 1 + stickerfinder/db.py | 1 + stickerfinder/helper/display.py | 1 + stickerfinder/helper/plot.py | 1 + stickerfinder/helper/text.py | 1 + stickerfinder/i18n.py | 1 + stickerfinder/logic/cleanup.py | 1 + stickerfinder/logic/maintenance.py | 1 + stickerfinder/logic/sticker_set.py | 1 + stickerfinder/logic/tag.py | 1 + stickerfinder/models/change.py | 1 + stickerfinder/models/chat.py | 1 + stickerfinder/models/inline_query.py | 1 + stickerfinder/models/inline_query_request.py | 1 + stickerfinder/models/proposed_tags.py | 1 + stickerfinder/models/report.py | 1 + stickerfinder/models/sticker.py | 1 + stickerfinder/models/sticker_set.py | 1 + stickerfinder/models/sticker_usages.py | 1 + stickerfinder/models/tag.py | 1 + stickerfinder/models/task.py | 1 + stickerfinder/models/user.py | 1 + stickerfinder/sentry.py | 1 + stickerfinder/session.py | 1 + stickerfinder/stickerfinder.py | 1 + stickerfinder/telegram/commands/admin.py | 1 + stickerfinder/telegram/commands/chat.py | 1 + stickerfinder/telegram/commands/maintenance.py | 1 + stickerfinder/telegram/commands/misc.py | 1 + stickerfinder/telegram/commands/sticker_set.py | 1 + stickerfinder/telegram/commands/usage.py | 1 + stickerfinder/telegram/inline_query/context.py | 1 + stickerfinder/telegram/inline_query/search.py | 1 + stickerfinder/telegram/inline_query/sql_query.py | 1 + stickerfinder/telegram/jobs.py | 1 + stickerfinder/telegram/keyboard/maintenance.py | 1 + stickerfinder/telegram/keyboard/settings.py | 1 + stickerfinder/telegram/message_handlers.py | 1 + 38 files changed, 38 insertions(+) diff --git a/stickerfinder/config.py b/stickerfinder/config.py index 441d7b2..631f248 100644 --- a/stickerfinder/config.py +++ b/stickerfinder/config.py @@ -1,4 +1,5 @@ """Config values for stickerfinder.""" + import logging import os import sys diff --git a/stickerfinder/db.py b/stickerfinder/db.py index 8edea16..478ea4a 100644 --- a/stickerfinder/db.py +++ b/stickerfinder/db.py @@ -1,4 +1,5 @@ """Helper class to get a database engine and to get a session.""" + from sqlalchemy import create_engine from sqlalchemy.ext.compiler import compiles from sqlalchemy.ext.declarative import declarative_base diff --git a/stickerfinder/helper/display.py b/stickerfinder/helper/display.py index e3d2762..1824ff9 100644 --- a/stickerfinder/helper/display.py +++ b/stickerfinder/helper/display.py @@ -1,4 +1,5 @@ """Helper for compiling text.""" + from stickerfinder.i18n import i18n from stickerfinder.telegram.keyboard import get_help_keyboard diff --git a/stickerfinder/helper/plot.py b/stickerfinder/helper/plot.py index 459d8ec..127468a 100644 --- a/stickerfinder/helper/plot.py +++ b/stickerfinder/helper/plot.py @@ -1,4 +1,5 @@ """Module responsibel for plotting statistics.""" + import io import matplotlib diff --git a/stickerfinder/helper/text.py b/stickerfinder/helper/text.py index 66f7f00..8004fb9 100644 --- a/stickerfinder/helper/text.py +++ b/stickerfinder/helper/text.py @@ -1,4 +1,5 @@ """Helper for text handling.""" + MAX_LENGTH = 4096 diff --git a/stickerfinder/i18n.py b/stickerfinder/i18n.py index 25672e0..542dd80 100644 --- a/stickerfinder/i18n.py +++ b/stickerfinder/i18n.py @@ -1,4 +1,5 @@ """Translation module.""" + import i18n i18n.set("filename_format", "{locale}.{format}") diff --git a/stickerfinder/logic/cleanup.py b/stickerfinder/logic/cleanup.py index 1bd6c0b..a8beb0f 100644 --- a/stickerfinder/logic/cleanup.py +++ b/stickerfinder/logic/cleanup.py @@ -1,4 +1,5 @@ """Some functions to cleanup the database.""" + from datetime import datetime, timedelta from sqlalchemy import or_ diff --git a/stickerfinder/logic/maintenance.py b/stickerfinder/logic/maintenance.py index 2634bab..829658c 100644 --- a/stickerfinder/logic/maintenance.py +++ b/stickerfinder/logic/maintenance.py @@ -1,4 +1,5 @@ """Helper functions for maintenance.""" + from sqlalchemy import func from telegram.error import BadRequest, ChatMigrated, Unauthorized diff --git a/stickerfinder/logic/sticker_set.py b/stickerfinder/logic/sticker_set.py index 637037d..e3f9f13 100644 --- a/stickerfinder/logic/sticker_set.py +++ b/stickerfinder/logic/sticker_set.py @@ -1,4 +1,5 @@ """Helper functions for handling sticker sets.""" + from telegram.error import BadRequest from stickerfinder.config import config diff --git a/stickerfinder/logic/tag.py b/stickerfinder/logic/tag.py index 52347b9..2a4123b 100644 --- a/stickerfinder/logic/tag.py +++ b/stickerfinder/logic/tag.py @@ -1,4 +1,5 @@ """Helper functions for tagging.""" + from collections import OrderedDict from sqlalchemy import func diff --git a/stickerfinder/models/change.py b/stickerfinder/models/change.py index 6ef887c..6badae2 100644 --- a/stickerfinder/models/change.py +++ b/stickerfinder/models/change.py @@ -1,4 +1,5 @@ """The sqlite model for a change.""" + from sqlalchemy import Column, ForeignKey, Table, func from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship diff --git a/stickerfinder/models/chat.py b/stickerfinder/models/chat.py index c2d1d97..633c2a4 100644 --- a/stickerfinder/models/chat.py +++ b/stickerfinder/models/chat.py @@ -1,4 +1,5 @@ """The sqlite model for a chat.""" + import logging from sqlalchemy import Column, ForeignKey, Table, UniqueConstraint, func diff --git a/stickerfinder/models/inline_query.py b/stickerfinder/models/inline_query.py index 3d2ab25..828fe49 100644 --- a/stickerfinder/models/inline_query.py +++ b/stickerfinder/models/inline_query.py @@ -1,4 +1,5 @@ """The sqlite model for a inline search.""" + from sqlalchemy import Column, ForeignKey, func from sqlalchemy.orm import relationship from sqlalchemy.types import BigInteger, DateTime, String diff --git a/stickerfinder/models/inline_query_request.py b/stickerfinder/models/inline_query_request.py index 62e6f99..e4ae830 100644 --- a/stickerfinder/models/inline_query_request.py +++ b/stickerfinder/models/inline_query_request.py @@ -1,4 +1,5 @@ """The sqlite model for a inline query request.""" + from sqlalchemy import Boolean, Column, ForeignKey, UniqueConstraint, func from sqlalchemy.orm import relationship from sqlalchemy.types import BigInteger, DateTime, Interval, String diff --git a/stickerfinder/models/proposed_tags.py b/stickerfinder/models/proposed_tags.py index 7d2836f..23d34ce 100644 --- a/stickerfinder/models/proposed_tags.py +++ b/stickerfinder/models/proposed_tags.py @@ -1,4 +1,5 @@ """The sqlite model for a change.""" + from sqlalchemy import Column, ForeignKey, func from sqlalchemy.orm import relationship from sqlalchemy.types import BigInteger, DateTime, Integer, String diff --git a/stickerfinder/models/report.py b/stickerfinder/models/report.py index d994d1c..3ac50a1 100644 --- a/stickerfinder/models/report.py +++ b/stickerfinder/models/report.py @@ -1,4 +1,5 @@ """The sqlite model for a change.""" + from sqlalchemy import Column, ForeignKey, func from sqlalchemy.orm import relationship from sqlalchemy.types import DateTime, Integer, String diff --git a/stickerfinder/models/sticker.py b/stickerfinder/models/sticker.py index 1dcf5be..5845996 100644 --- a/stickerfinder/models/sticker.py +++ b/stickerfinder/models/sticker.py @@ -1,4 +1,5 @@ """The sqlite model for a sticker.""" + from sqlalchemy import ( Column, ForeignKey, diff --git a/stickerfinder/models/sticker_set.py b/stickerfinder/models/sticker_set.py index fd67a97..1677f6a 100644 --- a/stickerfinder/models/sticker_set.py +++ b/stickerfinder/models/sticker_set.py @@ -1,4 +1,5 @@ """The sqlite model for a sticker set.""" + from sqlalchemy import CheckConstraint, Column, Index, func from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import relationship diff --git a/stickerfinder/models/sticker_usages.py b/stickerfinder/models/sticker_usages.py index e775c16..ac6b7ab 100644 --- a/stickerfinder/models/sticker_usages.py +++ b/stickerfinder/models/sticker_usages.py @@ -1,4 +1,5 @@ """The sqlite model for a sticker.""" + from sqlalchemy import Column, ForeignKey, func from sqlalchemy.orm import relationship from sqlalchemy.types import BigInteger, DateTime, Integer, String diff --git a/stickerfinder/models/tag.py b/stickerfinder/models/tag.py index d54a859..82f7f1a 100644 --- a/stickerfinder/models/tag.py +++ b/stickerfinder/models/tag.py @@ -1,4 +1,5 @@ """The sqlite model for a tag.""" + from sqlalchemy import Column, Index, func from sqlalchemy.orm import relationship from sqlalchemy.types import Boolean, DateTime, String diff --git a/stickerfinder/models/task.py b/stickerfinder/models/task.py index de6aca3..87e4952 100644 --- a/stickerfinder/models/task.py +++ b/stickerfinder/models/task.py @@ -1,4 +1,5 @@ """The sqlite model for a task.""" + from uuid import uuid4 from sqlalchemy import CheckConstraint, Column, ForeignKey, func diff --git a/stickerfinder/models/user.py b/stickerfinder/models/user.py index 7e2a0b4..5df8b85 100644 --- a/stickerfinder/models/user.py +++ b/stickerfinder/models/user.py @@ -1,4 +1,5 @@ """The sqlite model for a user.""" + from sqlalchemy import Boolean, Column, func from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import relationship diff --git a/stickerfinder/sentry.py b/stickerfinder/sentry.py index 1303d8c..9f783c9 100644 --- a/stickerfinder/sentry.py +++ b/stickerfinder/sentry.py @@ -1,4 +1,5 @@ """Simple wrapper around sentry that allows for lazy initilization.""" + import sentry_sdk from sentry_sdk import configure_scope diff --git a/stickerfinder/session.py b/stickerfinder/session.py index 2dbbea9..1de612b 100644 --- a/stickerfinder/session.py +++ b/stickerfinder/session.py @@ -1,4 +1,5 @@ """Session helper functions.""" + import traceback from datetime import datetime, timedelta from functools import wraps diff --git a/stickerfinder/stickerfinder.py b/stickerfinder/stickerfinder.py index 65a16fd..44bc243 100644 --- a/stickerfinder/stickerfinder.py +++ b/stickerfinder/stickerfinder.py @@ -1,4 +1,5 @@ """A bot for stickers.""" + import logging from telegram.ext import ( diff --git a/stickerfinder/telegram/commands/admin.py b/stickerfinder/telegram/commands/admin.py index e8ea58b..e97b474 100644 --- a/stickerfinder/telegram/commands/admin.py +++ b/stickerfinder/telegram/commands/admin.py @@ -1,4 +1,5 @@ """General admin commands.""" + import secrets import time diff --git a/stickerfinder/telegram/commands/chat.py b/stickerfinder/telegram/commands/chat.py index c611079..fa6f53c 100644 --- a/stickerfinder/telegram/commands/chat.py +++ b/stickerfinder/telegram/commands/chat.py @@ -1,4 +1,5 @@ """Chat related commands.""" + from stickerfinder.logic.tag import send_tagged_count_message from stickerfinder.session import message_wrapper from stickerfinder.telegram.keyboard import get_main_keyboard diff --git a/stickerfinder/telegram/commands/maintenance.py b/stickerfinder/telegram/commands/maintenance.py index 5993ece..aae28b9 100644 --- a/stickerfinder/telegram/commands/maintenance.py +++ b/stickerfinder/telegram/commands/maintenance.py @@ -1,4 +1,5 @@ """Maintenance related commands.""" + from stickerfinder.logic.maintenance import check_maintenance_chat, check_newsfeed_chat from stickerfinder.session import message_wrapper diff --git a/stickerfinder/telegram/commands/misc.py b/stickerfinder/telegram/commands/misc.py index 6e2b86c..46b93d8 100644 --- a/stickerfinder/telegram/commands/misc.py +++ b/stickerfinder/telegram/commands/misc.py @@ -1,4 +1,5 @@ """Misc telegram commands.""" + from stickerfinder.helper.display import get_help_text_and_keyboard from stickerfinder.i18n import i18n from stickerfinder.session import message_wrapper diff --git a/stickerfinder/telegram/commands/sticker_set.py b/stickerfinder/telegram/commands/sticker_set.py index 514548d..bdb3629 100644 --- a/stickerfinder/telegram/commands/sticker_set.py +++ b/stickerfinder/telegram/commands/sticker_set.py @@ -1,4 +1,5 @@ """Sticker set related commands.""" + from stickerfinder.models import Report, Sticker from stickerfinder.session import message_wrapper diff --git a/stickerfinder/telegram/commands/usage.py b/stickerfinder/telegram/commands/usage.py index 67bd39f..953ab62 100644 --- a/stickerfinder/telegram/commands/usage.py +++ b/stickerfinder/telegram/commands/usage.py @@ -1,4 +1,5 @@ """Sticker usage related commands.""" + from stickerfinder.models import Sticker, StickerUsage from stickerfinder.session import message_wrapper diff --git a/stickerfinder/telegram/inline_query/context.py b/stickerfinder/telegram/inline_query/context.py index 38ddca7..6581ba8 100644 --- a/stickerfinder/telegram/inline_query/context.py +++ b/stickerfinder/telegram/inline_query/context.py @@ -1,4 +1,5 @@ """Object representing a inline query search for easier parameter handling.""" + from stickerfinder.logic.tag import get_tags_from_text diff --git a/stickerfinder/telegram/inline_query/search.py b/stickerfinder/telegram/inline_query/search.py index be29a0a..b5a8efe 100644 --- a/stickerfinder/telegram/inline_query/search.py +++ b/stickerfinder/telegram/inline_query/search.py @@ -1,4 +1,5 @@ """Entry points for inline query search.""" + import hashlib from datetime import datetime diff --git a/stickerfinder/telegram/inline_query/sql_query.py b/stickerfinder/telegram/inline_query/sql_query.py index 7c57d01..c36a51b 100644 --- a/stickerfinder/telegram/inline_query/sql_query.py +++ b/stickerfinder/telegram/inline_query/sql_query.py @@ -1,4 +1,5 @@ """Query composition for inline search.""" + from pprint import pprint from sqlalchemy import Numeric, and_, case, cast, func, or_ diff --git a/stickerfinder/telegram/jobs.py b/stickerfinder/telegram/jobs.py index 4435274..5663533 100644 --- a/stickerfinder/telegram/jobs.py +++ b/stickerfinder/telegram/jobs.py @@ -1,4 +1,5 @@ """Telegram job tasks.""" + from datetime import datetime, timedelta from sqlalchemy import and_, func diff --git a/stickerfinder/telegram/keyboard/maintenance.py b/stickerfinder/telegram/keyboard/maintenance.py index 4a05093..a598bb9 100644 --- a/stickerfinder/telegram/keyboard/maintenance.py +++ b/stickerfinder/telegram/keyboard/maintenance.py @@ -1,4 +1,5 @@ """Maintenance related keyboards.""" + from telegram import InlineKeyboardButton, InlineKeyboardMarkup from stickerfinder.helper.callback import CallbackResult, CallbackType, build_set_data diff --git a/stickerfinder/telegram/keyboard/settings.py b/stickerfinder/telegram/keyboard/settings.py index ce834f5..aa55842 100644 --- a/stickerfinder/telegram/keyboard/settings.py +++ b/stickerfinder/telegram/keyboard/settings.py @@ -1,4 +1,5 @@ """Maintenance related keyboards.""" + from telegram import InlineKeyboardButton, InlineKeyboardMarkup from stickerfinder.helper.callback import build_data, build_user_data diff --git a/stickerfinder/telegram/message_handlers.py b/stickerfinder/telegram/message_handlers.py index 1a914fc..4167b2a 100644 --- a/stickerfinder/telegram/message_handlers.py +++ b/stickerfinder/telegram/message_handlers.py @@ -1,4 +1,5 @@ """Message handler functions.""" + from stickerfinder.enums import TagMode from stickerfinder.logic.tag import ( current_sticker_tags_message,