Skip to content

Commit 1a7a5d2

Browse files
committed
satisfy ruff
1 parent 931af90 commit 1a7a5d2

File tree

6 files changed

+9
-24
lines changed

6 files changed

+9
-24
lines changed

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
55
inputs.flake-utils.url = "github:numtide/flake-utils";
66
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
7-
inputs.pre-commit-hooks.inputs.nixkpgs.follows = "nixkpkgs";
7+
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
8+
inputs.pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs";
89

910
outputs = {
1011
self,

qbpm/main.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import inspect
2-
from os import environ
31
from pathlib import Path
42
from typing import Any, Callable, NoReturn, Optional
53

64
import click
7-
from xdg import BaseDirectory
85

9-
from . import __version__, operations, profiles
6+
from . import operations, profiles
107
from .profiles import Profile
118
from .utils import SUPPORTED_MENUS, default_profile_dir, error, user_data_dir
129

13-
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
10+
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}
1411

1512

1613
def creator_options(f: Callable[..., Any]) -> Callable[..., Any]:
@@ -100,7 +97,7 @@ def desktop(
10097
exit_with(operations.desktop(profile))
10198

10299

103-
@main.command(context_settings=dict(ignore_unknown_options=True))
100+
@main.command(context_settings={"ignore_unknown_options": True})
104101
@click.argument("profile_name")
105102
@click.argument("qb_args", nargs=-1, type=click.UNPROCESSED)
106103
@click.option(
@@ -116,7 +113,7 @@ def launch(profile_dir: Path, profile_name: str, **kwargs: Any) -> None:
116113
exit_with(operations.launch(profile, **kwargs))
117114

118115

119-
@main.command(context_settings=dict(ignore_unknown_options=True))
116+
@main.command(context_settings={"ignore_unknown_options": True})
120117
@click.argument("qb_args", nargs=-1, type=click.UNPROCESSED)
121118
@click.option(
122119
"-m",
@@ -173,7 +170,7 @@ def session_info(
173170
) -> tuple[Profile, Path]:
174171
user_session_dir = user_data_dir() / "sessions"
175172
session_paths = []
176-
if not "/" in session:
173+
if "/" not in session:
177174
session_paths.append(user_session_dir / (session + ".yml"))
178175
session_paths.append(Path(session))
179176
session_path = next(filter(lambda path: path.is_file(), session_paths), None)

qbpm/operations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import shutil
32
import subprocess
43
from pathlib import Path
@@ -9,7 +8,7 @@
98

109
from . import profiles
1110
from .profiles import Profile
12-
from .utils import AUTO_MENUS, error, installed_menus, user_data_dir
11+
from .utils import AUTO_MENUS, error, installed_menus
1312

1413

1514
def from_session(

qbpm/profiles.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ def __init__(self, name: str, profile_dir: Optional[Path]) -> None:
2121
)
2222
self.root = self.profile_dir / name
2323

24-
def of(args: object) -> "Profile":
25-
args = vars(args)
26-
name = args.get("profile_name")
27-
assert isinstance(name, str)
28-
return Profile(
29-
name,
30-
args.get(
31-
"profile_dir",
32-
Path(BaseDirectory.save_data_path("qutebrowser-profiles")),
33-
),
34-
)
35-
3624
def check(self) -> Optional["Profile"]:
3725
if "/" in self.name:
3826
error("profile name cannot contain slashes")

qbpm/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pathlib import Path
55
from shutil import which
66
from sys import exit, stderr
7-
from typing import Optional
87

98
from xdg import BaseDirectory
109

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ ignore = [
44
"E501", # line too long
55
"ANN101", # annotate self
66
"ANN102", # annotate cls
7+
"ANN401", # ban Any
78
]

0 commit comments

Comments
 (0)