manim-data-structures icon indicating copy to clipboard operation
manim-data-structures copied to clipboard

Use PEP 585 syntax for types

Open cclauss opened this issue 9 months ago • 2 comments

https://peps.python.org/pep-0585/#implementation

Fixes https://github.com/ManimCommunity/manim/pull/3719#issuecomment-2081482865

File "/Users/michol/opt/anaconda3/lib/python3.9/site-packages/manim_data_structures/m_array.py", line 630, in MArray
def __calc_label_pos_and_mob(self) -> typing.Tuple[Square, np.ndarray]:
AttributeError: module 'manim.typing' has no attribute 'Tuple'

A rapid migration to https://peps.python.org/pep-0585/#implementation might improve reliability.

The wildcard import from manim import * on line 7 is a bad idea as discussed in PEP 8.

  • https://peps.python.org/pep-0008/#imports
  • https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/
  • https://github.com/asmeurer/removestar

cclauss avatar Apr 28 '24 17:04 cclauss

I'd appreciate if you'd cater to all instances of tuple.* in both m_variable.py and m_array.py file. Secondly, please generate the PR for the dev branch.

drageelr avatar Apr 28 '24 22:04 drageelr

I'd appreciate if you'd cater to all instances of tuple.* in both m_variable.py and m_array.py file.

This is already done because neither Tuple nor List appear in m_variable.py.

Secondly, please generate the PR for the dev branch.

Done.

  • #25

cclauss avatar Apr 29 '24 21:04 cclauss