Skip to content

Commit a83f07f

Browse files
committed
chore(finders): Typings for valid file extensions
1 parent 4429cd7 commit a83f07f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/tmuxp/workspace/finders.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@
1111

1212
logger = logging.getLogger(__name__)
1313

14+
if t.TYPE_CHECKING:
15+
from typing_extensions import Literal, TypeAlias
1416

15-
def is_workspace_file(filename, extensions=[".yml", ".yaml", ".json"]):
17+
ValidExtensions: TypeAlias = Literal[".yml", ".yaml", ".json"]
18+
19+
20+
def is_workspace_file(
21+
filename: str,
22+
extensions: t.Union["ValidExtensions", t.List["ValidExtensions"]] = [
23+
".yml",
24+
".yaml",
25+
".json",
26+
],
27+
) -> bool:
1628
"""
1729
Return True if file has a valid workspace file type.
1830
@@ -32,8 +44,8 @@ def is_workspace_file(filename, extensions=[".yml", ".yaml", ".json"]):
3244

3345

3446
def in_dir(
35-
workspace_dir: pathlib.Path = os.path.expanduser("~/.tmuxp"),
36-
extensions: t.List[str] = [".yml", ".yaml", ".json"],
47+
workspace_dir: t.Union[pathlib.Path, str] = os.path.expanduser("~/.tmuxp"),
48+
extensions: t.List["ValidExtensions"] = [".yml", ".yaml", ".json"],
3749
) -> t.List[str]:
3850

3951
"""

0 commit comments

Comments
 (0)