Skip to content

Commit e1ab9e7

Browse files
committed
ruff format (after adding flake8-commas)
1 parent c93871a commit e1ab9e7

23 files changed

+215
-82
lines changed

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ 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,
63+
tmuxp_configdir: pathlib.Path,
6364
) -> None:
6465
"""Set tmuxp configuration directory for ``TMUXP_CONFIGDIR``."""
6566
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmuxp_configdir))

docs/_ext/aafig.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
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]],
42+
src: t.Dict[str, t.Optional[str]],
4243
) -> t.Dict[str, t.Optional[str]]:
4344
for k, v in src.items():
4445
if k not in dst:
@@ -47,7 +48,9 @@ def merge_dict(
4748

4849

4950
def get_basename(
50-
text: str, options: t.Dict[str, str], prefix: t.Optional[str] = "aafig",
51+
text: str,
52+
options: t.Dict[str, str],
53+
prefix: t.Optional[str] = "aafig",
5154
) -> str:
5255
options = options.copy()
5356
if "format" in options:
@@ -152,7 +155,9 @@ def __init__(self, *args: object, **kwargs: object) -> None:
152155

153156

154157
def render_aafigure(
155-
app: "Sphinx", text: str, options: t.Dict[str, str],
158+
app: "Sphinx",
159+
text: str,
160+
options: t.Dict[str, str],
156161
) -> t.Tuple[str, str, t.Optional[str], t.Optional[str]]:
157162
"""Render an ASCII art figure into the requested format output file."""
158163
if aafigure is None:

src/tmuxp/cli/__init__.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@
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",
38+
"load",
39+
"freeze",
40+
"convert",
41+
"edit",
42+
"import",
43+
"shell",
44+
"debug-info",
3845
]
3946
CLIImportSubparserName: TypeAlias = t.Literal["teamocil", "tmuxinator"]
4047

@@ -60,21 +67,25 @@ def create_parser() -> argparse.ArgumentParser:
6067
load_parser = subparsers.add_parser("load", help="load tmuxp workspaces")
6168
create_load_subparser(load_parser)
6269
shell_parser = subparsers.add_parser(
63-
"shell", help="launch python shell for tmux server, session, window and pane",
70+
"shell",
71+
help="launch python shell for tmux server, session, window and pane",
6472
)
6573
create_shell_subparser(shell_parser)
6674
import_parser = subparsers.add_parser(
67-
"import", help="import workspaces from teamocil and tmuxinator.",
75+
"import",
76+
help="import workspaces from teamocil and tmuxinator.",
6877
)
6978
create_import_subparser(import_parser)
7079

7180
convert_parser = subparsers.add_parser(
72-
"convert", help="convert workspace files between yaml and json.",
81+
"convert",
82+
help="convert workspace files between yaml and json.",
7383
)
7484
create_convert_subparser(convert_parser)
7585

7686
debug_info_parser = subparsers.add_parser(
77-
"debug-info", help="print out all diagnostic info",
87+
"debug-info",
88+
help="print out all diagnostic info",
7889
)
7990
create_debug_info_subparser(debug_info_parser)
8091

@@ -85,7 +96,8 @@ def create_parser() -> argparse.ArgumentParser:
8596
create_edit_subparser(edit_parser)
8697

8798
freeze_parser = subparsers.add_parser(
88-
"freeze", help="freeze a live tmux session to a tmuxp workspace file",
99+
"freeze",
100+
help="freeze a live tmux session to a tmuxp workspace file",
89101
)
90102
create_freeze_subparser(freeze_parser)
91103

src/tmuxp/cli/convert.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ 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,
61+
workspace_dir=get_workspace_dir(),
6162
)
6263

6364
if isinstance(workspace_file, str):

src/tmuxp/cli/freeze.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ 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",
49+
dest="socket_path",
50+
metavar="socket-path",
51+
help="pass-through for tmux -S",
4952
)
5053
parser.add_argument(
51-
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L",
54+
"-L",
55+
dest="socket_name",
56+
metavar="socket-name",
57+
help="pass-through for tmux -L",
5258
)
5359
parser.add_argument(
5460
"-f",
@@ -187,7 +193,10 @@ def extract_workspace_format(
187193

188194
if workspace_format == "yaml":
189195
workspace = configparser.dump(
190-
format="yaml", indent=2, default_flow_style=False, safe=True,
196+
format="yaml",
197+
indent=2,
198+
default_flow_style=False,
199+
safe=True,
191200
)
192201
elif workspace_format == "json":
193202
workspace = configparser.dump(format="json", indent=2)

src/tmuxp/cli/import_config.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ 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",
71+
description="valid commands",
72+
help="additional help",
7173
)
7274

7375
import_teamocil = importsubparser.add_parser(
74-
"teamocil", help="convert and import a teamocil config",
76+
"teamocil",
77+
help="convert and import a teamocil config",
7578
)
7679

7780
import_teamocilgroup = import_teamocil.add_mutually_exclusive_group(required=True)
@@ -83,11 +86,13 @@ def create_import_subparser(
8386
help="checks current ~/.teamocil and current directory for yaml files",
8487
)
8588
import_teamocil.set_defaults(
86-
callback=command_import_teamocil, import_subparser_name="teamocil",
89+
callback=command_import_teamocil,
90+
import_subparser_name="teamocil",
8791
)
8892

8993
import_tmuxinator = importsubparser.add_parser(
90-
"tmuxinator", help="convert and import a tmuxinator config",
94+
"tmuxinator",
95+
help="convert and import a tmuxinator config",
9196
)
9297

9398
import_tmuxinatorgroup = import_tmuxinator.add_mutually_exclusive_group(
@@ -102,7 +107,8 @@ def create_import_subparser(
102107
)
103108

104109
import_tmuxinator.set_defaults(
105-
callback=command_import_tmuxinator, import_subparser_name="tmuxinator",
110+
callback=command_import_tmuxinator,
111+
import_subparser_name="tmuxinator",
106112
)
107113

108114
try:
@@ -134,7 +140,9 @@ def import_config(
134140
cfg_reader = ConfigReader(importfunc(existing_workspace_file))
135141

136142
workspace_file_format = prompt_choices(
137-
"Convert to", choices=["yaml", "json"], default="yaml",
143+
"Convert to",
144+
choices=["yaml", "json"],
145+
default="yaml",
138146
)
139147

140148
if workspace_file_format == "yaml":
@@ -155,7 +163,8 @@ def import_config(
155163
dest = None
156164
while not dest:
157165
dest_path = prompt(
158-
"Save to [%s]" % os.getcwd(), value_proc=_resolve_path_no_overwrite,
166+
"Save to [%s]" % os.getcwd(),
167+
value_proc=_resolve_path_no_overwrite,
159168
)
160169

161170
# dest = dest_prompt
@@ -185,7 +194,8 @@ def command_import_tmuxinator(
185194
it into tmuxp.
186195
"""
187196
workspace_file = find_workspace_file(
188-
workspace_file, workspace_dir=get_tmuxinator_dir(),
197+
workspace_file,
198+
workspace_dir=get_tmuxinator_dir(),
189199
)
190200
import_config(workspace_file, importers.import_tmuxinator)
191201

@@ -200,7 +210,8 @@ def command_import_teamocil(
200210
it into tmuxp.
201211
"""
202212
workspace_file = find_workspace_file(
203-
workspace_file, workspace_dir=get_teamocil_dir(),
213+
workspace_file,
214+
workspace_dir=get_teamocil_dir(),
204215
)
205216

206217
import_config(workspace_file, importers.import_teamocil)

src/tmuxp/cli/load.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ def load_workspace(
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,
385+
cwd=os.path.dirname(workspace_file),
385386
)
386387

387388
# Overridden session name
@@ -636,7 +637,8 @@ def command_load(
636637

637638
for idx, workspace_file in enumerate(args.workspace_files):
638639
workspace_file = find_workspace_file(
639-
workspace_file, workspace_dir=get_workspace_dir(),
640+
workspace_file,
641+
workspace_dir=get_workspace_dir(),
640642
)
641643

642644
detached = original_detached_option

src/tmuxp/cli/shell.py

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

1515
CLIColorsLiteral: TypeAlias = t.Literal[56, 88]
1616
CLIShellLiteral: TypeAlias = t.Literal[
17-
"best", "pdb", "code", "ptipython", "ptpython", "ipython", "bpython",
17+
"best",
18+
"pdb",
19+
"code",
20+
"ptipython",
21+
"ptpython",
22+
"ipython",
23+
"bpython",
1824
]
1925

2026

@@ -38,10 +44,16 @@ def create_shell_subparser(parser: argparse.ArgumentParser) -> argparse.Argument
3844
parser.add_argument("session_name", metavar="session-name", nargs="?")
3945
parser.add_argument("window_name", metavar="window-name", nargs="?")
4046
parser.add_argument(
41-
"-S", dest="socket_path", metavar="socket-path", help="pass-through for tmux -S",
47+
"-S",
48+
dest="socket_path",
49+
metavar="socket-path",
50+
help="pass-through for tmux -S",
4251
)
4352
parser.add_argument(
44-
"-L", dest="socket_name", metavar="socket-name", help="pass-through for tmux -L",
53+
"-L",
54+
dest="socket_name",
55+
metavar="socket-name",
56+
help="pass-through for tmux -L",
4557
)
4658
parser.add_argument(
4759
"-c",
@@ -163,11 +175,15 @@ def command_shell(
163175
current_pane = util.get_current_pane(server=server)
164176

165177
session = util.get_session(
166-
server=server, session_name=args.session_name, current_pane=current_pane,
178+
server=server,
179+
session_name=args.session_name,
180+
current_pane=current_pane,
167181
)
168182

169183
window = util.get_window(
170-
session=session, window_name=args.window_name, current_pane=current_pane,
184+
session=session,
185+
window_name=args.window_name,
186+
current_pane=current_pane,
171187
)
172188

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

src/tmuxp/cli/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ def strip_ansi(value: str) -> str:
200200

201201

202202
def _interpret_color(
203-
color: t.Union[int, t.Tuple[int, int, int], str], offset: int = 0,
203+
color: t.Union[int, t.Tuple[int, int, int], str],
204+
offset: int = 0,
204205
) -> str:
205206
if isinstance(color, int):
206207
return f"{38 + offset};5;{color:d}"

src/tmuxp/exc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ class BeforeLoadScriptError(Exception):
111111
"""
112112

113113
def __init__(
114-
self, returncode: int, cmd: str, output: t.Optional[str] = None,
114+
self,
115+
returncode: int,
116+
cmd: str,
117+
output: t.Optional[str] = None,
115118
) -> None:
116119
self.returncode = returncode
117120
self.cmd = cmd

0 commit comments

Comments
 (0)