Skip to content

Commit ab577dc

Browse files
authored
Add typings to manim/__main__.py (#4007)
* Add typings to __main__.py * Remove `Unused parameter.` from docstrings
1 parent a21a5e5 commit ab577dc

File tree

2 files changed

+45
-15
lines changed

2 files changed

+45
-15
lines changed

manim/__main__.py

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,49 @@
33
import click
44
import cloup
55

6-
from . import __version__, cli_ctx_settings, console
7-
from .cli.cfg.group import cfg
8-
from .cli.checkhealth.commands import checkhealth
9-
from .cli.default_group import DefaultGroup
10-
from .cli.init.commands import init
11-
from .cli.plugins.commands import plugins
12-
from .cli.render.commands import render
13-
from .constants import EPILOG
6+
from manim import __version__
7+
from manim._config import cli_ctx_settings, console
8+
from manim.cli.cfg.group import cfg
9+
from manim.cli.checkhealth.commands import checkhealth
10+
from manim.cli.default_group import DefaultGroup
11+
from manim.cli.init.commands import init
12+
from manim.cli.plugins.commands import plugins
13+
from manim.cli.render.commands import render
14+
from manim.constants import EPILOG
1415

1516

16-
def show_splash(ctx, param, value):
17+
def show_splash(ctx: click.Context, param: click.Option, value: str | None) -> None:
18+
"""When giving a value by console, show an initial message with the Manim
19+
version before executing any other command: ``Manim Community vA.B.C``.
20+
21+
Parameters
22+
----------
23+
ctx
24+
The Click context.
25+
param
26+
A Click option.
27+
value
28+
A string value given by console, or None.
29+
"""
1730
if value:
1831
console.print(f"Manim Community [green]v{__version__}[/green]\n")
1932

2033

21-
def print_version_and_exit(ctx, param, value):
34+
def print_version_and_exit(
35+
ctx: click.Context, param: click.Option, value: str | None
36+
) -> None:
37+
"""Same as :func:`show_splash`, but also exit when giving a value by
38+
console.
39+
40+
Parameters
41+
----------
42+
ctx
43+
The Click context.
44+
param
45+
A Click option.
46+
value
47+
A string value given by console, or None.
48+
"""
2249
show_splash(ctx, param, value)
2350
if value:
2451
ctx.exit()
@@ -53,8 +80,14 @@ def print_version_and_exit(ctx, param, value):
5380
expose_value=False,
5481
)
5582
@cloup.pass_context
56-
def main(ctx):
57-
"""The entry point for manim."""
83+
def main(ctx: click.Context) -> None:
84+
"""The entry point for Manim.
85+
86+
Parameters
87+
----------
88+
ctx
89+
The Click context.
90+
"""
5891
pass
5992

6093

mypy.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ ignore_errors = True
8686
ignore_errors = False
8787
warn_return_any = False
8888

89-
[mypy-manim.__main__]
90-
ignore_errors = True
91-
9289

9390
# ---------------- We can't properly type this ------------------------
9491

0 commit comments

Comments
 (0)