INNER CODE UNIT · Python
__process_type
robusta-dev/krr · robusta_krr/main.py:41
def __process_type(_T: type) -> type:
"""Process type to a python literal"""
if _T in (int, float, str, bool, datetime, UUID):
return _T
elif _T is Optional:
return Optional[{__process_type(_T.__args__[0])}] # type: ignore
else:
return str # If the type is unknown, just use str and let pydantic handle it
def load_commands() -> None:
for strategy_name, strategy_type in BaseStrategy.get_all().items(): # type: ignore
# NOTE: This wrapper here is needed to avoid the strategy_name being overwritten in the loop
def strategy_wrapper(_strategy_name: str = strategy_name):
def run_strategy(
ctx: typer.Context,
kubeconfig: Optional[str] = typer.Option(
None,