types(workspace-imports) Example typings via `NotRequried` by tony · Pull Request #981 · tmux-python/tmuxp · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions src/tmuxp/_internal/types.py
8 changes: 6 additions & 2 deletions src/tmuxp/cli/import_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
if t.TYPE_CHECKING:
import argparse

from tmuxp._internal.types import WorkspaceConfig


def get_tmuxinator_dir() -> pathlib.Path:
"""Return tmuxinator configuration directory.
Expand Down Expand Up @@ -132,7 +134,7 @@ def create_import_subparser(
class ImportConfigFn(t.Protocol):
"""Typing for import configuration callback function."""

def __call__(self, workspace_dict: dict[str, t.Any]) -> dict[str, t.Any]:
def __call__(self, workspace_dict: dict[str, t.Any]) -> WorkspaceConfig:
"""Execute tmuxp import function."""
...

Expand All @@ -144,7 +146,9 @@ def import_config(
) -> None:
"""Import a configuration from a workspace_file."""
existing_workspace_file = ConfigReader._from_file(pathlib.Path(workspace_file))
cfg_reader = ConfigReader(importfunc(existing_workspace_file))
cfg_reader = ConfigReader(
t.cast(dict[t.Any, t.Any], importfunc(existing_workspace_file))
)

workspace_file_format = prompt_choices(
"Convert to",
Expand Down
62 changes: 37 additions & 25 deletions src/tmuxp/workspace/importers.py
Loading