Configure ruff for py310

This commit is contained in:
Šarūnas Nejus 2025-12-27 23:38:55 +00:00
parent b964d8b7eb
commit 078ffc1c57
No known key found for this signature in database
6 changed files with 27 additions and 29 deletions

View file

@ -25,7 +25,7 @@ from datetime import datetime, timedelta
from functools import cached_property, reduce
from operator import mul, or_
from re import Pattern
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union
from typing import TYPE_CHECKING, Any, Generic, TypeVar
from beets import util
from beets.util.units import raw_seconds_short
@ -124,7 +124,7 @@ class Query(ABC):
return hash(type(self))
SQLiteType = Union[str, bytes, float, int, memoryview, None]
SQLiteType = str | bytes | float | int | memoryview | None
AnySQLiteType = TypeVar("AnySQLiteType", bound=SQLiteType)
FieldQueryType = type["FieldQuery"]

View file

@ -37,7 +37,23 @@ from logging import (
NullHandler,
StreamHandler,
)
from typing import TYPE_CHECKING, Any, TypeVar, Union, overload
from typing import TYPE_CHECKING, Any, TypeVar, overload
if TYPE_CHECKING:
from collections.abc import Mapping
from logging import RootLogger
from types import TracebackType
T = TypeVar("T")
# see https://github.com/python/typeshed/blob/main/stdlib/logging/__init__.pyi
_SysExcInfoType = (
tuple[type[BaseException], BaseException, TracebackType | None]
| tuple[None, None, None]
)
_ExcInfoType = _SysExcInfoType | BaseException | bool | None
_ArgsType = tuple[object, ...] | Mapping[str, object]
__all__ = [
"DEBUG",
@ -53,22 +69,6 @@ __all__ = [
"getLogger",
]
if TYPE_CHECKING:
from collections.abc import Mapping
from logging import RootLogger
T = TypeVar("T")
from types import TracebackType
# see https://github.com/python/typeshed/blob/main/stdlib/logging/__init__.pyi
_SysExcInfoType = Union[
tuple[type[BaseException], BaseException, Union[TracebackType, None]],
tuple[None, None, None],
]
_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException]
_ArgsType = Union[tuple[object, ...], Mapping[str, object]]
# Regular expression to match:
# - C0 control characters (0x00-0x1F) except useful whitespace (\t, \n, \r)
# - DEL control character (0x7f)

View file

@ -44,7 +44,6 @@ from typing import (
Generic,
NamedTuple,
TypeVar,
Union,
cast,
)
@ -63,8 +62,8 @@ if TYPE_CHECKING:
MAX_FILENAME_LENGTH = 200
WINDOWS_MAGIC_PREFIX = "\\\\?\\"
T = TypeVar("T")
PathLike = Union[str, bytes, Path]
StrPath = Union[str, Path]
StrPath = str | Path
PathLike = StrPath | bytes
Replacements = Sequence[tuple[Pattern[str], str]]
# Here for now to allow for a easy replace later on

View file

@ -28,7 +28,7 @@ import os
import traceback
from functools import singledispatchmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any
import pylast
import yaml
@ -39,6 +39,7 @@ from beets.util import plurality, unique_list
if TYPE_CHECKING:
import optparse
from collections.abc import Callable
from beets.library import LibModel

View file

@ -27,7 +27,7 @@ import re
import threading
import time
import webbrowser
from typing import TYPE_CHECKING, Any, Literal, Union
from typing import TYPE_CHECKING, Any, Literal
import confuse
import requests
@ -86,9 +86,7 @@ class AudioFeaturesUnavailableError(Exception):
class SpotifyPlugin(
SearchApiMetadataSourcePlugin[
Union[SearchResponseAlbums, SearchResponseTracks]
]
SearchApiMetadataSourcePlugin[SearchResponseAlbums | SearchResponseTracks]
):
item_types = {
"spotify_track_popularity": types.INTEGER,

View file

@ -290,7 +290,7 @@ extend-exclude = [
]
[tool.ruff]
target-version = "py39"
target-version = "py310"
line-length = 80
[tool.ruff.lint]
@ -308,7 +308,7 @@ select = [
"PT", # flake8-pytest-style
# "RUF", # ruff
"UP", # pyupgrade
"TCH", # flake8-type-checking
"TC", # flake8-type-checking
"W", # pycodestyle
]
ignore = [