Skip to content

Commit

Permalink
update dict with Dict from typing
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijeetSaroha committed Oct 4, 2024
1 parent efbc713 commit 906a86a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/makim/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import sys

from typing import Any, Callable, Optional, Type, Union, cast
from typing import Any, Callable, Dict, Optional, Type, Union, cast

import click
import typer
Expand Down Expand Up @@ -185,7 +185,7 @@ def create_args_string(args: dict[str, str]) -> str:
')'
)

args_data = cast(dict[str, dict[str, str]], args.get('args', {}))
args_data = cast(Dict[str, dict[str, str]], args.get('args', {}))
for name, spec in args_data.items():
name_clean = name.replace('-', '_')
arg_type = normalize_string_type(spec.get('type', 'str'))
Expand Down Expand Up @@ -236,7 +236,7 @@ def apply_click_options(
str, Optional[Union[str, int, float, bool, Type[Any]]]
] = {}

opt_data = cast(dict[str, str], opt_details)
opt_data = cast(Dict[str, str], opt_details)
opt_type_str = normalize_string_type(opt_data.get('type', 'str'))
opt_default = get_default_value(opt_type_str, opt_data.get('default'))

Expand Down Expand Up @@ -277,7 +277,7 @@ def create_dynamic_command(name: str, args: dict[str, str]) -> None:
args_str = create_args_string(args)
args_param_list = [f'"task": "{name}"']

args_data = cast(dict[str, dict[str, str]], args.get('args', {}))
args_data = cast(Dict[str, dict[str, str]], args.get('args', {}))

for arg, arg_details in args_data.items():
arg_clean = arg.replace('-', '_')
Expand Down Expand Up @@ -309,7 +309,7 @@ def create_dynamic_command(name: str, args: dict[str, str]) -> None:

# Apply Click options to the Typer command
if 'args' in args:
options_data = cast(dict[str, dict[str, Any]], args.get('args', {}))
options_data = cast(Dict[str, dict[str, Any]], args.get('args', {}))
dynamic_command = apply_click_options(dynamic_command, options_data)


Expand Down
2 changes: 1 addition & 1 deletion src/makim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _load_shell_app(self) -> None:
shell_config = tmp_config

cmd_name = str(shell_config.get('app', ''))
cmd_args: list[str] = cast(list[str], shell_config.get('args', []))
cmd_args: list[str] = cast(List[str], shell_config.get('args', []))
cmd_tmp_suffix: str = str(
shell_config.get('suffix', tmp_suffix_default)
)
Expand Down

0 comments on commit 906a86a

Please sign in to comment.