Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
9dogs committed Jan 15, 2024
1 parent 843669c commit 3e35af6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ allow-star-arg-any = true
ignore-variadic-names = true

[tool.ruff.isort]
known-first-party = ["src", "tests"]
known-first-party = ["tg_odesli_bot", "tests"]

[tool.ruff.format]
quote-style = "single"
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import string
from http import HTTPStatus
from pathlib import Path
from typing import Union
from unittest import mock
from unittest.mock import Mock

Expand Down Expand Up @@ -157,7 +156,7 @@


def make_response(
song_id: Union[str, int] = 1, template: dict = TEST_RESPONSE_TEMPLATE
song_id: str | int = 1, template: dict = TEST_RESPONSE_TEMPLATE
) -> dict:
"""Prepare Odesli API test response with given song id.
Expand Down
6 changes: 3 additions & 3 deletions tg_odesli_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ async def _find_songs(
tasks = [self.find_song_by_url(song_url) for song_url in song_urls]
results = await asyncio.gather(*tasks, return_exceptions=True)
song_infos, exceptions = [], []
for item, song_url in zip(results, song_urls):
for item, song_url in zip(results, song_urls, strict=False):
if isinstance(item, SongInfo):
song_infos.append(item)
else:
Expand Down Expand Up @@ -497,7 +497,7 @@ async def handle_inline_query(self, inline_query: InlineQuery) -> None:
tasks.append(self.find_song_by_url(song_url))
results = await asyncio.gather(*tasks, return_exceptions=True)
seen_tracks = set()
for track, song_info in zip(tracks, results):
for track, song_info in zip(tracks, results, strict=False):
if isinstance(song_info, Exception) or not song_info:
continue
assert isinstance(song_info, SongInfo) # mypy
Expand Down Expand Up @@ -668,7 +668,7 @@ async def find_song_by_url(self, song_url: SongUrl) -> SongInfo:
logger.error('Invalid response data', exc_info=exc)
raise APIError(
status_code=None, message='Invalid data'
)
) from exc
else:
song_info = self.process_api_response(
data, song_url.url
Expand Down
4 changes: 2 additions & 2 deletions tg_odesli_bot/platforms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Supported platforms."""
import re
from abc import ABC
from typing import Pattern, Union
from re import Pattern

#: Supported platforms registry
PLATFORMS = {}
Expand All @@ -13,7 +13,7 @@ class PlatformABC(ABC):
# Platform's Odesli name
key: str
# RegEx to find platform's URL in a message text
url_re: Union[str, Pattern]
url_re: str | Pattern
# Human-readable name which will appear in a bot message
name: str
# Order of platform's link in a bot's message
Expand Down
4 changes: 2 additions & 2 deletions tg_odesli_bot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sentry_sdk
import structlog
from aiocache import caches
from pydantic import BaseSettings
from pydantic_settings import BaseSettings
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
from structlog_sentry import SentryProcessor

Expand Down Expand Up @@ -117,7 +117,7 @@ def init_logging(self) -> None:
)

@classmethod
def load(cls) -> 'Settings':
def load(cls) -> Settings:
"""Load config and init logging.
:returns: a config object
Expand Down

0 comments on commit 3e35af6

Please sign in to comment.