Skip to content

Commit 495830e

Browse files
committed
ci(ruff): Automated fixes
1 parent 395969e commit 495830e

31 files changed

+119
-172
lines changed

conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
import typing as t
1111

1212
import pytest
13-
1413
from _pytest.doctest import DoctestItem
15-
1614
from libtmux.test import namer
15+
1716
from tests.fixtures import utils as test_utils
1817
from tmuxp.workspace.finders import get_workspace_dir
1918

docs/_ext/aafig.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
logger = logging.getLogger(__name__)
3030

31-
DEFAULT_FORMATS = dict(html="svg", latex="pdf", text=None)
31+
DEFAULT_FORMATS = {"html": "svg", "latex": "pdf", "text": None}
3232

3333

3434
def merge_dict(dst, src):
@@ -58,21 +58,21 @@ class AafigDirective(images.Image):
5858

5959
has_content = True
6060
required_arguments = 0
61-
own_option_spec = dict(
62-
line_width=float,
63-
background=str,
64-
foreground=str,
65-
fill=str,
66-
aspect=nonnegative_int,
67-
textual=flag,
68-
proportional=flag,
69-
)
61+
own_option_spec = {
62+
"line_width": float,
63+
"background": str,
64+
"foreground": str,
65+
"fill": str,
66+
"aspect": nonnegative_int,
67+
"textual": flag,
68+
"proportional": flag,
69+
}
7070
option_spec = images.Image.option_spec.copy()
7171
option_spec.update(own_option_spec)
7272

7373
def run(self):
74-
aafig_options = dict()
75-
own_options_keys = [self.own_option_spec.keys()] + ["scale"]
74+
aafig_options = {}
75+
own_options_keys = [self.own_option_spec.keys(), "scale"]
7676
for (k, v) in self.options.items():
7777
if k in own_options_keys:
7878
# convert flags to booleans
@@ -88,7 +88,7 @@ def run(self):
8888
if isinstance(image_node, nodes.system_message):
8989
return [image_node]
9090
text = "\n".join(self.content)
91-
image_node.aafig = dict(options=aafig_options, text=text)
91+
image_node.aafig = {"options": aafig_options, "text": text}
9292
return [image_node]
9393

9494

@@ -206,7 +206,7 @@ def setup(app):
206206
app.add_directive("aafig", AafigDirective)
207207
app.connect("doctree-read", render_aafig_images)
208208
app.add_config_value("aafig_format", DEFAULT_FORMATS, "html")
209-
app.add_config_value("aafig_default_options", dict(), "html")
209+
app.add_config_value("aafig_default_options", {}, "html")
210210

211211

212212
# vim: set expandtab shiftwidth=4 softtabstop=4 :

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
aafig_default_options = dict(scale=0.75, aspect=0.5, proportional=True)
178178

179179

180-
def linkcode_resolve(domain, info): # NOQA: C901
180+
def linkcode_resolve(domain, info):
181181
"""
182182
Determine the URL corresponding to Python object
183183

src/tmuxp/cli/debug_info.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import typing as t
88

99
from colorama import Fore
10-
1110
from libtmux.__about__ import __version__ as libtmux_version
1211
from libtmux.common import get_version, tmux_cmd
1312

@@ -34,7 +33,7 @@ def prepend_tab(strings):
3433
"""
3534
Prepend tab to strings in list.
3635
"""
37-
return list(map(lambda x: "\t%s" % x, strings))
36+
return ["\t%s" % x for x in strings]
3837

3938
def output_break():
4039
"""

src/tmuxp/cli/freeze.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import typing as t
66

77
from libtmux.server import Server
8+
89
from tmuxp.config_reader import ConfigReader
910
from tmuxp.exc import TmuxpException
1011
from tmuxp.workspace.finders import get_workspace_dir

src/tmuxp/cli/import_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ def import_config(
149149
"Save to [%s]" % os.getcwd(), value_proc=_resolve_path_no_overwrite
150150
)
151151

152-
# dest = dest_prompt
153152
if prompt_yes_no("Save to %s?" % dest_path):
154153
dest = dest_path
155154

src/tmuxp/cli/load.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from libtmux.common import has_gte_version
1717
from libtmux.server import Server
1818
from libtmux.session import Session
19+
1920
from tmuxp.types import StrPath
2021

2122
from .. import config_reader, exc, log, util
@@ -122,8 +123,7 @@ def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
122123
plugins.append(plugin())
123124
except exc.TmuxpPluginException as error:
124125
if not prompt_yes_no(
125-
"%sSkip loading %s?"
126-
% (style(str(error), fg="yellow"), plugin_name),
126+
"{}Skip loading {}?".format(style(str(error), fg="yellow"), plugin_name),
127127
default=True,
128128
):
129129
tmuxp_echo(

src/tmuxp/cli/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def command_shell(
166166
session=session, window_name=args.window_name, current_pane=current_pane
167167
)
168168

169-
pane = util.get_pane(window=window, current_pane=current_pane) # NOQA: F841
169+
pane = util.get_pane(window=window, current_pane=current_pane)
170170

171171
if args.command is not None:
172172
exec(args.command)

src/tmuxp/cli/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def prompt_choices(
126126
if isinstance(choice, str):
127127
options.append(choice)
128128
elif isinstance(choice, tuple):
129-
options.append("%s [%s]" % (choice, choice[0]))
129+
options.append(f"{choice} [{choice[0]}]")
130130
choice = choice[0]
131131
_choices.append(choice)
132132

src/tmuxp/shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def has_ipython() -> bool:
3232

3333
def has_ptpython() -> bool:
3434
try:
35-
from ptpython.repl import embed, run_config # NOQA F841
35+
from ptpython.repl import embed, run_config # F841
3636
except ImportError:
3737
try:
3838
from prompt_toolkit.contrib.repl import embed, run_config # NOQA F841
@@ -44,8 +44,8 @@ def has_ptpython() -> bool:
4444

4545
def has_ptipython() -> bool:
4646
try:
47-
from ptpython.ipython import embed # NOQA F841
48-
from ptpython.repl import run_config # NOQA F841
47+
from ptpython.ipython import embed # F841
48+
from ptpython.repl import run_config # F841
4949
except ImportError:
5050
try:
5151
from prompt_toolkit.contrib.ipython import embed # NOQA F841
@@ -80,7 +80,7 @@ def get_bpython(options, extra_args=None):
8080
if extra_args is None:
8181
extra_args = {}
8282

83-
from bpython import embed # NOQA F841
83+
from bpython import embed # F841
8484

8585
def launch_bpython():
8686
imported_objects = get_launch_args(**options)

0 commit comments

Comments
 (0)