Skip to content

Commit c93871a

Browse files
committed
ruff . --select COM --fix
1 parent 019b6f4 commit c93871a

40 files changed

+228
-228
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
5959

6060
@pytest.fixture
6161
def tmuxp_configdir_default(
62-
monkeypatch: pytest.MonkeyPatch, tmuxp_configdir: pathlib.Path
62+
monkeypatch: pytest.MonkeyPatch, tmuxp_configdir: pathlib.Path,
6363
) -> None:
6464
"""Set tmuxp configuration directory for ``TMUXP_CONFIGDIR``."""
6565
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmuxp_configdir))

docs/_ext/aafig.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040
def merge_dict(
41-
dst: t.Dict[str, t.Optional[str]], src: t.Dict[str, t.Optional[str]]
41+
dst: t.Dict[str, t.Optional[str]], src: t.Dict[str, t.Optional[str]],
4242
) -> t.Dict[str, t.Optional[str]]:
4343
for k, v in src.items():
4444
if k not in dst:
@@ -47,7 +47,7 @@ def merge_dict(
4747

4848

4949
def get_basename(
50-
text: str, options: t.Dict[str, str], prefix: t.Optional[str] = "aafig"
50+
text: str, options: t.Dict[str, str], prefix: t.Optional[str] = "aafig",
5151
) -> str:
5252
options = options.copy()
5353
if "format" in options:
@@ -106,7 +106,7 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
106106
if aafigure is None:
107107
logger.warn(
108108
"aafigure module not installed, ASCII art images "
109-
"will be rendered as literal text"
109+
"will be rendered as literal text",
110110
)
111111
for img in doctree.traverse(nodes.image):
112112
if not hasattr(img, "aafig"):
@@ -123,7 +123,7 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
123123
logger.warn(
124124
'unsupported builder format "%s", please '
125125
"add a custom entry in aafig_format config "
126-
"option for this builder" % format
126+
"option for this builder" % format,
127127
)
128128
img.replace_self(nodes.literal_block(text, text))
129129
continue
@@ -152,7 +152,7 @@ def __init__(self, *args: object, **kwargs: object) -> None:
152152

153153

154154
def render_aafigure(
155-
app: "Sphinx", text: str, options: t.Dict[str, str]
155+
app: "Sphinx", text: str, options: t.Dict[str, str],
156156
) -> t.Tuple[str, str, t.Optional[str], t.Optional[str]]:
157157
"""Render an ASCII art figure into the requested format output file."""
158158
if aafigure is None:
@@ -172,7 +172,7 @@ def render_aafigure(
172172
"aafig: the builder format %s is not officially "
173173
"supported, aafigure images could not work. "
174174
"Please report problems and working builder to "
175-
"avoid this warning in the future" % app.builder.format
175+
"avoid this warning in the future" % app.builder.format,
176176
)
177177
relfn = fname
178178
outfn = path.join(app.builder.outdir, fname)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"sidebar/navigation.html",
100100
"sidebar/projects.html",
101101
"sidebar/scroll-end.html",
102-
]
102+
],
103103
}
104104

105105
# linkify_issues

src/tmuxp/cli/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
CLIVerbosity: TypeAlias = t.Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
3636
CLISubparserName: TypeAlias = t.Literal[
37-
"ls", "load", "freeze", "convert", "edit", "import", "shell", "debug-info"
37+
"ls", "load", "freeze", "convert", "edit", "import", "shell", "debug-info",
3838
]
3939
CLIImportSubparserName: TypeAlias = t.Literal["teamocil", "tmuxinator"]
4040

@@ -60,21 +60,21 @@ def create_parser() -> argparse.ArgumentParser:
6060
load_parser = subparsers.add_parser("load", help="load tmuxp workspaces")
6161
create_load_subparser(load_parser)
6262
shell_parser = subparsers.add_parser(
63-
"shell", help="launch python shell for tmux server, session, window and pane"
63+
"shell", help="launch python shell for tmux server, session, window and pane",
6464
)
6565
create_shell_subparser(shell_parser)
6666
import_parser = subparsers.add_parser(
67-
"import", help="import workspaces from teamocil and tmuxinator."
67+
"import", help="import workspaces from teamocil and tmuxinator.",
6868
)
6969
create_import_subparser(import_parser)
7070

7171
convert_parser = subparsers.add_parser(
72-
"convert", help="convert workspace files between yaml and json."
72+
"convert", help="convert workspace files between yaml and json.",
7373
)
7474
create_convert_subparser(convert_parser)
7575

7676
debug_info_parser = subparsers.add_parser(
77-
"debug-info", help="print out all diagnostic info"
77+
"debug-info", help="print out all diagnostic info",
7878
)
7979
create_debug_info_subparser(debug_info_parser)
8080

@@ -85,7 +85,7 @@ def create_parser() -> argparse.ArgumentParser:
8585
create_edit_subparser(edit_parser)
8686

8787
freeze_parser = subparsers.add_parser(
88-
"freeze", help="freeze a live tmux session to a tmuxp workspace file"
88+
"freeze", help="freeze a live tmux session to a tmuxp workspace file",
8989
)
9090
create_freeze_subparser(freeze_parser)
9191

src/tmuxp/cli/convert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ConvertUnknownFileType(exc.TmuxpException):
4646

4747
def __init__(self, ext: str, *args: object, **kwargs: object) -> None:
4848
return super().__init__(
49-
f"Unknown filetype: {ext} (valid: [.json, .yaml, .yml])"
49+
f"Unknown filetype: {ext} (valid: [.json, .yaml, .yml])",
5050
)
5151

5252

@@ -57,7 +57,7 @@ def command_convert(
5757
) -> None:
5858
"""Entrypoint for ``tmuxp convert`` convert a tmuxp config between JSON and YAML."""
5959
workspace_file = find_workspace_file(
60-
workspace_file, workspace_dir=get_workspace_dir()
60+
workspace_file, workspace_dir=get_workspace_dir(),
6161
)
6262

6363
if isinstance(workspace_file, str):

src/tmuxp/cli/debug_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def format_tmux_resp(std_resp: tmux_cmd) -> str:
4545
Fore.RED,
4646
"\n".join(prepend_tab(std_resp.stderr)),
4747
Fore.RESET,
48-
]
48+
],
4949
)
5050

5151
output = [
@@ -58,8 +58,8 @@ def format_tmux_resp(std_resp: tmux_cmd) -> str:
5858
"arch: %s" % platform.machine(),
5959
"uname: %s" % "; ".join(platform.uname()[:3]),
6060
"version: %s" % platform.version(),
61-
]
62-
)
61+
],
62+
),
6363
),
6464
output_break(),
6565
"python version: %s" % " ".join(sys.version.split("\n")),

src/tmuxp/cli/freeze.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ def create_freeze_subparser(
4545
action="store",
4646
)
4747
parser.add_argument(
48-
"-S", dest="socket_path", metavar="socket-path", help="pass-through for tmux -S"
48+
"-S", dest="socket_path", metavar="socket-path", help="pass-through for tmux -S",
4949
)
5050
parser.add_argument(
51-
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L"
51+
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L",
5252
)
5353
parser.add_argument(
5454
"-f",
@@ -118,19 +118,19 @@ def command_freeze(
118118
print(
119119
"---------------------------------------------------------------"
120120
"\n"
121-
"Freeze does its best to snapshot live tmux sessions.\n"
121+
"Freeze does its best to snapshot live tmux sessions.\n",
122122
)
123123
if not (
124124
args.answer_yes
125125
or prompt_yes_no(
126-
"The new workspace will require adjusting afterwards. Save workspace file?"
126+
"The new workspace will require adjusting afterwards. Save workspace file?",
127127
)
128128
):
129129
if not args.quiet:
130130
print(
131131
"tmuxp has examples in JSON and YAML format at "
132132
"<http://tmuxp.git-pull.com/examples.html>\n"
133-
"View tmuxp docs at <http://tmuxp.git-pull.com/>."
133+
"View tmuxp docs at <http://tmuxp.git-pull.com/>.",
134134
)
135135
sys.exit()
136136

@@ -143,7 +143,7 @@ def command_freeze(
143143
frozen_workspace.get("session_name"),
144144
args.workspace_format or "yaml",
145145
),
146-
)
146+
),
147147
)
148148
dest_prompt = prompt(
149149
"Save to: %s" % save_to,
@@ -187,7 +187,7 @@ def extract_workspace_format(
187187

188188
if workspace_format == "yaml":
189189
workspace = configparser.dump(
190-
format="yaml", indent=2, default_flow_style=False, safe=True
190+
format="yaml", indent=2, default_flow_style=False, safe=True,
191191
)
192192
elif workspace_format == "json":
193193
workspace = configparser.dump(format="json", indent=2)

src/tmuxp/cli/import_config.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def create_import_subparser(
6767
) -> argparse.ArgumentParser:
6868
"""Augment :class:`argparse.ArgumentParser` with ``import`` subparser."""
6969
importsubparser = parser.add_subparsers(
70-
title="commands", description="valid commands", help="additional help"
70+
title="commands", description="valid commands", help="additional help",
7171
)
7272

7373
import_teamocil = importsubparser.add_parser(
74-
"teamocil", help="convert and import a teamocil config"
74+
"teamocil", help="convert and import a teamocil config",
7575
)
7676

7777
import_teamocilgroup = import_teamocil.add_mutually_exclusive_group(required=True)
@@ -83,15 +83,15 @@ def create_import_subparser(
8383
help="checks current ~/.teamocil and current directory for yaml files",
8484
)
8585
import_teamocil.set_defaults(
86-
callback=command_import_teamocil, import_subparser_name="teamocil"
86+
callback=command_import_teamocil, import_subparser_name="teamocil",
8787
)
8888

8989
import_tmuxinator = importsubparser.add_parser(
90-
"tmuxinator", help="convert and import a tmuxinator config"
90+
"tmuxinator", help="convert and import a tmuxinator config",
9191
)
9292

9393
import_tmuxinatorgroup = import_tmuxinator.add_mutually_exclusive_group(
94-
required=True
94+
required=True,
9595
)
9696
tmuxinator_workspace_file = import_tmuxinatorgroup.add_argument(
9797
dest="workspace_file",
@@ -102,7 +102,7 @@ def create_import_subparser(
102102
)
103103

104104
import_tmuxinator.set_defaults(
105-
callback=command_import_tmuxinator, import_subparser_name="tmuxinator"
105+
callback=command_import_tmuxinator, import_subparser_name="tmuxinator",
106106
)
107107

108108
try:
@@ -134,7 +134,7 @@ def import_config(
134134
cfg_reader = ConfigReader(importfunc(existing_workspace_file))
135135

136136
workspace_file_format = prompt_choices(
137-
"Convert to", choices=["yaml", "json"], default="yaml"
137+
"Convert to", choices=["yaml", "json"], default="yaml",
138138
)
139139

140140
if workspace_file_format == "yaml":
@@ -147,15 +147,15 @@ def import_config(
147147
tmuxp_echo(
148148
new_config + "---------------------------------------------------------------"
149149
"\n"
150-
"Configuration import does its best to convert files.\n"
150+
"Configuration import does its best to convert files.\n",
151151
)
152152
if prompt_yes_no(
153-
"The new config *WILL* require adjusting afterwards. Save config?"
153+
"The new config *WILL* require adjusting afterwards. Save config?",
154154
):
155155
dest = None
156156
while not dest:
157157
dest_path = prompt(
158-
"Save to [%s]" % os.getcwd(), value_proc=_resolve_path_no_overwrite
158+
"Save to [%s]" % os.getcwd(), value_proc=_resolve_path_no_overwrite,
159159
)
160160

161161
# dest = dest_prompt
@@ -170,7 +170,7 @@ def import_config(
170170
tmuxp_echo(
171171
"tmuxp has examples in JSON and YAML format at "
172172
"<http://tmuxp.git-pull.com/examples.html>\n"
173-
"View tmuxp docs at <http://tmuxp.git-pull.com/>"
173+
"View tmuxp docs at <http://tmuxp.git-pull.com/>",
174174
)
175175
sys.exit()
176176

@@ -185,7 +185,7 @@ def command_import_tmuxinator(
185185
it into tmuxp.
186186
"""
187187
workspace_file = find_workspace_file(
188-
workspace_file, workspace_dir=get_tmuxinator_dir()
188+
workspace_file, workspace_dir=get_tmuxinator_dir(),
189189
)
190190
import_config(workspace_file, importers.import_tmuxinator)
191191

@@ -200,7 +200,7 @@ def command_import_teamocil(
200200
it into tmuxp.
201201
"""
202202
workspace_file = find_workspace_file(
203-
workspace_file, workspace_dir=get_teamocil_dir()
203+
workspace_file, workspace_dir=get_teamocil_dir(),
204204
)
205205

206206
import_config(workspace_file, importers.import_teamocil)

src/tmuxp/cli/load.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
117117
tmuxp_echo(
118118
style("[Plugin Error] ", fg="red")
119119
+ f"Couldn't load {plugin}\n"
120-
+ style(f"{error}", fg="yellow")
120+
+ style(f"{error}", fg="yellow"),
121121
)
122122
sys.exit(1)
123123

@@ -137,14 +137,14 @@ def load_plugins(session_config: t.Dict[str, t.Any]) -> t.List[t.Any]:
137137
):
138138
tmuxp_echo(
139139
style("[Not Skipping] ", fg="yellow")
140-
+ "Plugin versions constraint not met. Exiting..."
140+
+ "Plugin versions constraint not met. Exiting...",
141141
)
142142
sys.exit(1)
143143
except Exception as error:
144144
tmuxp_echo(
145145
style("[Plugin Error] ", fg="red")
146146
+ f"Couldn't load {plugin}\n"
147-
+ style(f"{error}", fg="yellow")
147+
+ style(f"{error}", fg="yellow"),
148148
)
149149
sys.exit(1)
150150

@@ -373,15 +373,15 @@ def load_workspace(
373373

374374
tmuxp_echo(
375375
style("[Loading] ", fg="green")
376-
+ style(str(workspace_file), fg="blue", bold=True)
376+
+ style(str(workspace_file), fg="blue", bold=True),
377377
)
378378

379379
# ConfigReader allows us to open a yaml or json file as a dict
380380
raw_workspace = config_reader.ConfigReader._from_file(workspace_file) or {}
381381

382382
# shapes workspaces relative to config / profile file location
383383
expanded_workspace = loader.expand(
384-
raw_workspace, cwd=os.path.dirname(workspace_file)
384+
raw_workspace, cwd=os.path.dirname(workspace_file),
385385
)
386386

387387
# Overridden session name
@@ -636,7 +636,7 @@ def command_load(
636636

637637
for idx, workspace_file in enumerate(args.workspace_files):
638638
workspace_file = find_workspace_file(
639-
workspace_file, workspace_dir=get_workspace_dir()
639+
workspace_file, workspace_dir=get_workspace_dir(),
640640
)
641641

642642
detached = original_detached_option

src/tmuxp/cli/shell.py

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

1515
CLIColorsLiteral: TypeAlias = t.Literal[56, 88]
1616
CLIShellLiteral: TypeAlias = t.Literal[
17-
"best", "pdb", "code", "ptipython", "ptpython", "ipython", "bpython"
17+
"best", "pdb", "code", "ptipython", "ptpython", "ipython", "bpython",
1818
]
1919

2020

@@ -38,10 +38,10 @@ def create_shell_subparser(parser: argparse.ArgumentParser) -> argparse.Argument
3838
parser.add_argument("session_name", metavar="session-name", nargs="?")
3939
parser.add_argument("window_name", metavar="window-name", nargs="?")
4040
parser.add_argument(
41-
"-S", dest="socket_path", metavar="socket-path", help="pass-through for tmux -S"
41+
"-S", dest="socket_path", metavar="socket-path", help="pass-through for tmux -S",
4242
)
4343
parser.add_argument(
44-
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L"
44+
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L",
4545
)
4646
parser.add_argument(
4747
"-c",
@@ -163,11 +163,11 @@ def command_shell(
163163
current_pane = util.get_current_pane(server=server)
164164

165165
session = util.get_session(
166-
server=server, session_name=args.session_name, current_pane=current_pane
166+
server=server, session_name=args.session_name, current_pane=current_pane,
167167
)
168168

169169
window = util.get_window(
170-
session=session, window_name=args.window_name, current_pane=current_pane
170+
session=session, window_name=args.window_name, current_pane=current_pane,
171171
)
172172

173173
pane = util.get_pane(window=window, current_pane=current_pane)

0 commit comments

Comments
 (0)