Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing vector space scene #4130

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

henrikmidtiby
Copy link
Contributor

Overview: What does this pull request change?

This PR adds type annotations to vector_space_scene.py.

Motivation and Explanation: Why and how do your changes improve the library?

More work towards #3375

Links to added or changed documentation pages

Further Information and Comments

During work on the PR, a few inconsistencies between the existing implementation and the type annotations were found.
To find proper solutions to these, the following questions will have to be answered.

  1. What should the default value of "row_sep" be? (manim/_config/cli_colors.py)
def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
    formatter_settings: dict[str, str | int] = {
        "indent_increment": int(parser["indent_increment"]),
        "width": int(parser["width"]),
        "col1_max_width": int(parser["col1_max_width"]),
        "col2_min_width": int(parser["col2_min_width"]),
        "col_spacing": int(parser["col_spacing"]),
        # TODO
        # What should the default value of "row_sep" be?
        # I cannot be None according to the typing in line 12.
        "row_sep": parser["row_sep"] if parser["row_sep"] else None,
    }
  1. Is there a better solution than adding three additional properties to the MathTex class (in manim/mobject/text/tex_mobject.py), as some methods in manim/scene/vector_space_scene.py depend on these (see comment on line 945).

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@@ -32,7 +32,7 @@

from manim import config, logger
from manim.constants import *
from manim.mobject.geometry.line import Line
from manim.mobject.geometry.line import Line, Vector

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Line' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Line occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
@@ -32,7 +32,7 @@

from manim import config, logger
from manim.constants import *
from manim.mobject.geometry.line import Line
from manim.mobject.geometry.line import Line, Vector

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
'Vector' may not be defined if module
manim.mobject.geometry.line
is imported before module
manim.mobject.text.tex_mobject
, as the
definition
of Vector occurs after the cyclic
import
of manim.mobject.text.tex_mobject.
@henrikmidtiby henrikmidtiby marked this pull request as ready for review January 22, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant