Skip to content
Myr

🎨 Ensure `ty` runs without errors (#1628)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix ty issues * uncomment ty in precommit * fix formatting * fix name to be consistent with the others

authored by Sofie Van Landeghem · committed by GitHub · parent 60743b9 · Browse files · 3 files+9 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−8 removed

  • other:+9 added−8 removed

3 files+9 added−8 removed

modified:typer/cli.py+1 added
129 unmodified lines
130 typer.echo(f"Could not import as Python file: {state.file}", err=True)131 else:132 typer.echo(f"Could not import as Python module: {state.module}", err=True)133 sys.exit(1)134 assert spec is not None135 module = importlib.util.module_from_spec(spec)136 spec.loader.exec_module(module) # type: ignore137 obj = get_typer_from_module(module)138 return obj
180 unmodified lines
modified:typer/main.py+2 added-2 removed
71 unmodified lines
72 ):73 _original_except_hook(exc_type, exc_value, tb)74 return75 typer_path = os.path.dirname(__file__)76 click_path = os.path.dirname(click.__file__)76 click_path = os.path.dirname(click.__file__) # ty: ignore77 internal_dir_names = [typer_path, click_path]78 exc = exc_value79 if HAS_RICH:80 from . import rich_utils
1304 unmodified lines
1385 pretty_exceptions_short: bool,1386 rich_markup_mode: MarkupMode,1387) -> click.Command:1388 assert command_info.callback, "A command must have a callback function"1389 name = command_info.name or get_command_name(command_info.callback.__name__) # ty:ignore[unresolved-attribute]1389 name = command_info.name or get_command_name(command_info.callback.__name__) # ty: ignore1390 use_help = command_info.help1391 if use_help is None:1392 use_help = inspect.getdoc(command_info.callback)1393 else:
620 unmodified lines
modified:.pre-commit-config.yaml+6 added-6 removed