Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ d93ddf8dd43e4f9ed072a03829e287c78d2570a2
# Moved ui.commands._utils into ui.commands.utils
25ae330044abf04045e3f378f72bbaed739fb30d
# Refactor test_ui_command.py into multiple modules
a59e41a88365e414db3282658d2aa456e0b3468a
a59e41a88365e414db3282658d2aa456e0b3468a
# pyupgrade Python 3.10
301637a1609831947cb5dd90270ed46c24b1ab1b
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.platform }}
env:
IS_MAIN_PYTHON: ${{ matrix.python-version == '3.9' && matrix.platform == 'ubuntu-latest' }}
IS_MAIN_PYTHON: ${{ matrix.python-version == '3.10' && matrix.platform == 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v5
- name: Install Python tools
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
workflow_dispatch:
schedule:
- cron: "0 0 * * SUN" # run every Sunday at midnight

env:
PYTHON_VERSION: "3.10"

jobs:
test_integration:
runs-on: ubuntu-latest
Expand All @@ -12,7 +16,7 @@ jobs:
uses: BrandonLWhite/[email protected]
- uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"

jobs:
changed-files:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true

env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"
NEW_VERSION: ${{ inputs.version }}
NEW_TAG: v${{ inputs.version }}

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ command. Instead, you can activate the virtual environment in your shell with:

$ poetry shell

You should see ``(beets-py3.9)`` prefix in your shell prompt. Now you can run
You should see ``(beets-py3.10)`` prefix in your shell prompt. Now you can run
commands directly, for example:

::

$ (beets-py3.9) pytest
$ (beets-py3.10) pytest

Additionally, poethepoet_ task runner assists us with the most common
operations. Formatting, linting, testing are defined as ``poe`` tasks in
Expand Down
6 changes: 3 additions & 3 deletions beets/autotag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import warnings
from importlib import import_module
from typing import TYPE_CHECKING, Union
from typing import TYPE_CHECKING

from beets import config, logging

Expand Down Expand Up @@ -117,8 +117,8 @@ def __getattr__(name: str):


def _apply_metadata(
info: Union[AlbumInfo, TrackInfo],
db_obj: Union[Album, Item],
info: AlbumInfo | TrackInfo,
db_obj: Album | Item,
nullable_fields: Sequence[str] = [],
):
"""Set the db_obj's metadata to match the info."""
Expand Down
11 changes: 9 additions & 2 deletions beets/dbcore/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@
import time
from abc import ABC
from collections import defaultdict
from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence
from collections.abc import (
Callable,
Generator,
Iterable,
Iterator,
Mapping,
Sequence,
)
from sqlite3 import Connection, sqlite_version_info
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic
from typing import TYPE_CHECKING, Any, AnyStr, Generic

from typing_extensions import TypeVar # default value support
from unidecode import unidecode
Expand Down
4 changes: 3 additions & 1 deletion beets/importer/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import os
import time
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING

from beets import config, dbcore, library, logging, plugins, util
from beets.importer.tasks import Action
Expand All @@ -25,6 +25,8 @@
from .state import ImportState

if TYPE_CHECKING:
from collections.abc import Sequence

from beets.util import PathBytes

from .tasks import ImportTask
Expand Down
4 changes: 3 additions & 1 deletion beets/importer/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import itertools
import logging
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

from beets import config, plugins
from beets.util import MoveOperation, displayable_path, pipeline
Expand All @@ -30,6 +30,8 @@
)

if TYPE_CHECKING:
from collections.abc import Callable

from beets import library

from .session import ImportSession
Expand Down
3 changes: 2 additions & 1 deletion beets/importer/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import shutil
import time
from collections import defaultdict
from collections.abc import Callable, Iterable, Sequence
from enum import Enum
from tempfile import mkdtemp
from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Any

import mediafile

Expand Down
4 changes: 3 additions & 1 deletion beets/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
RootLogger,
StreamHandler,
)
from typing import TYPE_CHECKING, Any, Mapping, TypeVar, Union, overload
from typing import TYPE_CHECKING, Any, TypeVar, Union, overload

__all__ = [
"DEBUG",
Expand All @@ -54,6 +54,8 @@
]

if TYPE_CHECKING:
from collections.abc import Mapping

T = TypeVar("T")
from types import TracebackType

Expand Down
4 changes: 2 additions & 2 deletions beets/metadata_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import abc
import re
from functools import cache, cached_property
from typing import TYPE_CHECKING, Generic, Literal, Sequence, TypedDict, TypeVar
from typing import TYPE_CHECKING, Generic, Literal, TypedDict, TypeVar

import unidecode
from confuse import NotFoundError
Expand All @@ -22,7 +22,7 @@
from .plugins import BeetsPlugin, find_plugins, notify_info_yielded, send

if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Iterable, Sequence

from .autotag.hooks import AlbumInfo, Item, TrackInfo

Expand Down
4 changes: 0 additions & 4 deletions beets/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from functools import cached_property, wraps
from importlib import import_module
from pathlib import Path
from types import GenericAlias
from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar

import mediafile
Expand Down Expand Up @@ -450,9 +449,6 @@ def _get_plugin(name: str) -> BeetsPlugin | None:
for obj in reversed(namespace.__dict__.values()):
if (
inspect.isclass(obj)
and not isinstance(
obj, GenericAlias
) # seems to be needed for python <= 3.9 only
and issubclass(obj, BeetsPlugin)
and obj != BeetsPlugin
and not inspect.isabstract(obj)
Expand Down
5 changes: 4 additions & 1 deletion beets/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from difflib import SequenceMatcher
from functools import cache
from itertools import chain
from typing import Any, Callable, Literal
from typing import TYPE_CHECKING, Any, Literal

import confuse

Expand All @@ -42,6 +42,9 @@
from beets.util import as_string
from beets.util.functemplate import template

if TYPE_CHECKING:
from collections.abc import Callable

# On Windows platforms, use colorama to support "ANSI" terminal colors.
if sys.platform == "win32":
try:
Expand Down
3 changes: 1 addition & 2 deletions beets/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import traceback
import warnings
from collections import Counter
from collections.abc import Sequence
from collections.abc import Callable, Sequence
from contextlib import suppress
from enum import Enum
from functools import cache
Expand All @@ -41,7 +41,6 @@
TYPE_CHECKING,
Any,
AnyStr,
Callable,
ClassVar,
Generic,
NamedTuple,
Expand Down
5 changes: 4 additions & 1 deletion beets/util/artresizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from abc import ABC, abstractmethod
from enum import Enum
from itertools import chain
from typing import Any, ClassVar, Mapping
from typing import TYPE_CHECKING, Any, ClassVar
from urllib.parse import urlencode

from beets import logging, util
Expand All @@ -37,6 +37,9 @@
syspath,
)

if TYPE_CHECKING:
from collections.abc import Mapping

PROXY_URL = "https://images.weserv.nl/"

log = logging.getLogger("beets")
Expand Down
2 changes: 0 additions & 2 deletions beets/util/functemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ def compile_func(arg_names, statements, name="_the_func", debug=False):
decorator_list=[],
)

# The ast.Module signature changed in 3.8 to accept a list of types to
# ignore.
mod = ast.Module([func_def], [])

ast.fix_missing_locations(mod)
Expand Down
3 changes: 1 addition & 2 deletions beets/util/hidden.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
import stat
import sys
from pathlib import Path
from typing import Union


def is_hidden(path: Union[bytes, Path]) -> bool:
def is_hidden(path: bytes | Path) -> bool:
"""
Determine whether the given path is treated as a 'hidden file' by the OS.
"""
Expand Down
5 changes: 4 additions & 1 deletion beets/util/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
import queue
import sys
from threading import Lock, Thread
from typing import Callable, Generator, TypeVar
from typing import TYPE_CHECKING, TypeVar

from typing_extensions import TypeVarTuple, Unpack

if TYPE_CHECKING:
from collections.abc import Callable, Generator

BUBBLE = "__PIPELINE_BUBBLE__"
POISON = "__PIPELINE_POISON__"

Expand Down
11 changes: 3 additions & 8 deletions beetsplug/beatport.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@
import json
import re
from datetime import datetime, timedelta
from typing import (
TYPE_CHECKING,
Iterable,
Iterator,
Literal,
Sequence,
overload,
)
from typing import TYPE_CHECKING, Literal, overload

import confuse
from requests_oauthlib import OAuth1Session
Expand All @@ -42,6 +35,8 @@
from beets.metadata_plugins import MetadataSourcePlugin

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator, Sequence

from beets.importer import ImportSession
from beets.library import Item

Expand Down
2 changes: 1 addition & 1 deletion beetsplug/bpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _ctrl_send(self, message):
if not self.ctrl_sock:
self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.ctrl_sock.connect((self.ctrl_host, self.ctrl_port))
self.ctrl_sock.sendall((f"{message}\n").encode("utf-8"))
self.ctrl_sock.sendall((f"{message}\n").encode())

def _send_event(self, event):
"""Notify subscribed connections of an event."""
Expand Down
2 changes: 1 addition & 1 deletion beetsplug/chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import re
from collections import defaultdict
from collections.abc import Iterable
from functools import cached_property, partial
from typing import Iterable

import acoustid
import confuse
Expand Down
4 changes: 3 additions & 1 deletion beetsplug/deezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import collections
import time
from typing import TYPE_CHECKING, Literal, Sequence
from typing import TYPE_CHECKING, Literal

import requests

Expand All @@ -32,6 +32,8 @@
)

if TYPE_CHECKING:
from collections.abc import Sequence

from beets.library import Item, Library

from ._typing import JSONDict
Expand Down
4 changes: 2 additions & 2 deletions beetsplug/discogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import traceback
from functools import cache
from string import ascii_lowercase
from typing import TYPE_CHECKING, Sequence, cast
from typing import TYPE_CHECKING, cast

import confuse
from discogs_client import Client, Master, Release
Expand All @@ -43,7 +43,7 @@
from beets.metadata_plugins import MetadataSourcePlugin

if TYPE_CHECKING:
from collections.abc import Callable, Iterable
from collections.abc import Callable, Iterable, Sequence

from beets.library import Item

Expand Down
Loading
Loading