Skip to content

Commit a851230

Browse files
committed
chore(ruff): Manual fixes for workspace/finders.py
1 parent d4a5aa0 commit a851230

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/tmuxp/workspace/finders.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def is_workspace_file(
4242

4343

4444
def in_dir(
45-
workspace_dir: t.Union[pathlib.Path, str] = os.path.expanduser("~/.tmuxp"),
45+
workspace_dir: t.Union[pathlib.Path, str, None] = None,
4646
extensions: t.Optional[t.List["ValidExtensions"]] = None,
4747
) -> t.List[str]:
4848
"""
@@ -59,13 +59,17 @@ def in_dir(
5959
-------
6060
list
6161
"""
62+
if workspace_dir is None:
63+
workspace_dir = os.path.expanduser("~/.tmuxp")
64+
6265
if extensions is None:
6366
extensions = [".yml", ".yaml", ".json"]
64-
workspace_files = []
6567

66-
for filename in os.listdir(workspace_dir):
67-
if is_workspace_file(filename, extensions) and not filename.startswith("."):
68-
workspace_files.append(filename)
68+
workspace_files = [
69+
filename
70+
for filename in os.listdir(workspace_dir)
71+
if is_workspace_file(filename, extensions) and not filename.startswith(".")
72+
]
6973

7074
return workspace_files
7175

@@ -86,11 +90,11 @@ def in_cwd() -> t.List[str]:
8690
>>> sorted(in_cwd())
8791
['.tmuxp.json', '.tmuxp.yaml']
8892
"""
89-
workspace_files = []
90-
91-
for filename in os.listdir(os.getcwd()):
92-
if filename.startswith(".tmuxp") and is_workspace_file(filename):
93-
workspace_files.append(filename)
93+
workspace_files = [
94+
filename
95+
for filename in os.listdir(os.getcwd())
96+
if filename.startswith(".tmuxp") and is_workspace_file(filename)
97+
]
9498

9599
return workspace_files
96100

0 commit comments

Comments
 (0)