Skip to content

Commit

Permalink
[beetsplug/fish] Replace 'typing.*' with built-ins
Browse files Browse the repository at this point in the history
  • Loading branch information
Arav K. committed Sep 12, 2024
1 parent fe40f7f commit 31c8175
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions beetsplug/fish.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import os
import textwrap
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Set, cast
from typing import Iterable

import beets.ui.commands
from beets import library, ui
Expand Down Expand Up @@ -198,12 +198,12 @@ def set_array(self, name: str, values: Iterable[str]):

def complete(
self,
values: Optional[str] = None,
conditions: Optional[List[str]] = None,
long: Optional[str] = None,
short: Optional[str] = None,
required: Optional[bool] = None,
description: Optional[str] = None,
values: str | None = None,
conditions: list[str] | None = None,
long: str | None = None,
short: str | None = None,
required: bool | None = None,
description: str | None = None,
files: bool = False,
):
"""
Expand Down Expand Up @@ -231,11 +231,11 @@ def complete(

def complete_global(
self,
long: Optional[str] = None,
short: Optional[str] = None,
values: Optional[str] = None,
long: str | None = None,
short: str | None = None,
values: str | None = None,
files: bool = False,
description: Optional[str] = None,
description: str | None = None,
):
"""
Add a completion for a global Beets option.
Expand All @@ -252,7 +252,7 @@ def complete_global(


class FishPlugin(BeetsPlugin):
def commands(self) -> List[ui.Subcommand]:
def commands(self) -> list[ui.Subcommand]:
cmd = ui.Subcommand(
"fish", help="generate a completion script for the Fish shell"
)
Expand Down Expand Up @@ -292,11 +292,11 @@ def run(
self,
lib: library.Library,
opts: optparse.Values,
args: List[str],
args: list[str],
):
# Get the user-provided options.
include_fields = not opts.noFields
extra_comp_fields = cast(List[str], opts.extravalues)
extra_comp_fields: list[str] = opts.extravalues
output = Path(opts.output)

if len(args) != 0:
Expand All @@ -317,7 +317,7 @@ def run(
script.complete(files=False)

# The commands supported by 'beet', including from plugins.
commands: List[ui.Subcommand] = [
commands: list[ui.Subcommand] = [
*beets.ui.commands.default_commands,
*beets.ui.commands.plugins.commands(),
]
Expand Down Expand Up @@ -383,7 +383,7 @@ def run(

if extra_comp_fields:
# The set of values for every user-specified extra field.
extra_values: Dict[str, Set[str]] = dict.fromkeys(
extra_values: dict[str, set[str]] = dict.fromkeys(
extra_comp_fields, set()
)
for item in lib.items():
Expand Down

0 comments on commit 31c8175

Please sign in to comment.