From d1a52712d387deb73796d5f6fa757c1a07d8e4a3 Mon Sep 17 00:00:00 2001 From: Nikhil Iyer Date: Thu, 30 Mar 2023 17:30:34 -0500 Subject: [PATCH 1/5] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index faeaeca..0f31dc4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -65,6 +65,7 @@ PASTE HERE
LaTeX details +Output of `latex --version`: + LaTeX distribution (e.g. TeX Live 2020): + Installed LaTeX packages: From 639fdf2c79a4762dcbda1e737caf29e732339520 Mon Sep 17 00:00:00 2001 From: Nikhil Iyer Date: Tue, 19 Sep 2023 17:38:30 -0500 Subject: [PATCH 2/5] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 172b990..1a72102 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ The general workflow for contributing to this project is as follows: To interact with the project, you will need to install some dependencies and configure git. 1. [Install git](https://git-scm.com/) -2. [Install Manim dependencies](https://docs.manim.community/en/stable/installation.html) +2. [Install Manim dependencies](https://docs.manim.community/en/stable/installation.html#installing-manim-locally) - Note: You do not need to install Manim itself (Poetry will handle that). 3. [Install Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer) 4. Fork the [project](https://github.com/ufosc/manim-data-structures). From ebafadebc57607d9cdae51d260dd72827e8c4686 Mon Sep 17 00:00:00 2001 From: Nikhil Iyer Date: Thu, 30 Nov 2023 17:33:06 -0600 Subject: [PATCH 3/5] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef845f0..8e70a15 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,4 @@ - + ## Overview: What does this pull request change? @@ -18,4 +18,5 @@ ## Reviewer Checklist - [ ] The PR title is descriptive enough for the changelog, and the PR is labeled correctly +- [ ] If applicable: newly added code segments are adequately covered by tests - [ ] If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section From bee77ec4d1d59d7e37b13ff9ca9678508760e8f3 Mon Sep 17 00:00:00 2001 From: MaximilianMeiler <113135205+MaximilianMeiler@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:32:05 -0500 Subject: [PATCH 4/5] Pyproject doc link fix (#18) * Added doc link to pyproject Poetry won't install properly if no link exists in the toml file. I've linked it to what is also placed on the repo. * Inserted updated doc link --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9c8f91b..7af7241 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Nikhil Iyer ", "Hammad Nasir Date: Tue, 18 Jun 2024 16:37:56 -0400 Subject: [PATCH 5/5] modified m_array.py MArray class to exclude MArrayDirection enum --- src/manim_data_structures/m_array.py | 78 +++++++++++++--------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/src/manim_data_structures/m_array.py b/src/manim_data_structures/m_array.py index 5131bea..2275aa7 100644 --- a/src/manim_data_structures/m_array.py +++ b/src/manim_data_structures/m_array.py @@ -580,13 +580,15 @@ class MArray(VGroup): Represents the array label. """ - __dir_map = [ - {"arr": UP, "index": RIGHT}, - {"arr": DOWN, "index": RIGHT}, - {"arr": RIGHT, "index": UP}, - {"arr": LEFT, "index": UP}, - ] - """Maps :class:`~.m_enum.MArrayDirection` to :class:`np.ndarray`.""" + __coor_alias_val = { + UP: {"index": RIGHT}, + DOWN: {"index": RIGHT}, + RIGHT: {"index": UP}, + LEFT: {"index": UP}, + } + ''' + """Maps :class:`np.ndarray` to :class:`np.ndarray`.""" + ''' def __sum_elem_len(self, index_start: int, index_end: int) -> int: """Sums the side_length of all elements' square mobject present in the array between the specified range. @@ -630,20 +632,21 @@ def __calc_label_pos_and_mob(self) -> typing.Tuple[Square, np.ndarray]: # Label position is parallel to array growth direction if np.array_equal( - self.__dir_map[self.__arr_label_pos.value]["arr"], - self.__dir_map[self.__arr_dir.value]["arr"], + # Compares two np.ndarrays + self.__arr_label_pos, + self.__arr_dir, ): return ( self.__mob_arr[-1].fetch_mob_square(), - self.__dir_map[self.__arr_label_pos.value]["arr"], + self.__arr_label_pos, ) elif np.array_equal( - self.__dir_map[self.__arr_label_pos.value]["arr"], - -self.__dir_map[self.__arr_dir.value]["arr"], + self.__arr_label_pos, + -self.__arr_dir, ): return ( self.__mob_arr[0].fetch_mob_square(), - self.__dir_map[self.__arr_label_pos.value]["arr"], + self.__arr_label_pos, ) # Label position is perpendicular to array growth direction @@ -659,9 +662,7 @@ def __calc_label_pos_and_mob(self) -> typing.Tuple[Square, np.ndarray]: ) return ( self.__mob_arr[middle_index].fetch_mob_square(), - self.__dir_map[self.__arr_label_pos.value]["arr"] - + self.__dir_map[self.__arr_dir.value]["arr"] - * ((len_after - len_before) / 2), + self.__arr_label_pos + self.__arr_dir * ((len_after - len_before) / 2), ) def __calc_index(self, index: int) -> typing.Union[int, str]: @@ -698,9 +699,9 @@ def __calc_index_pos(self) -> np.ndarray: """ return ( - self.__dir_map[self.__arr_dir.value]["index"] + self.__coor_alias_val[self.__arr_dir]["index"] if not self.__switch_index_pos - else self.__dir_map[self.__arr_dir.value]["index"] * -1 + else self.__coor_alias_val[self.__arr_dir]["index"] * -1 ) def __calc_label_shift_factor(self, mob: MArrayElement) -> float: @@ -718,13 +719,13 @@ def __calc_label_shift_factor(self, mob: MArrayElement) -> float: """ if np.array_equal( - self.__dir_map[self.__arr_label_pos.value]["arr"], - self.__dir_map[self.__arr_dir.value]["arr"], + self.__arr_label_pos, + self.__arr_dir, ): return mob.fetch_mob_square().side_length elif not np.array_equal( - self.__dir_map[self.__arr_label_pos.value]["arr"], - -self.__dir_map[self.__arr_dir.value]["arr"], + self.__arr_label_pos, + -self.__arr_dir, ): return mob.fetch_mob_square().side_length / 2 return 0 @@ -777,7 +778,7 @@ def __append_elem( mob_index_args=mob_index_args, index_pos=self.__calc_index_pos(), next_to_mob=self.__mob_arr[-1] if len(self.__mob_arr) else None, - next_to_dir=self.__dir_map[self.__arr_dir.value]["arr"], + next_to_dir=self.__arr_dir, ) ) self.add(self.__mob_arr[-1]) @@ -793,7 +794,7 @@ def __append_elem( anim_list.append( ApplyMethod( self.__mob_arr_label.shift, - self.__dir_map[self.__arr_dir.value]["arr"] * label_shift_factor, + self.__arr_dir * label_shift_factor, ) ) @@ -848,10 +849,7 @@ def __remove_elem( anims_shift.append( ApplyMethod( self.__mob_arr[i].shift, - -( - self.__dir_map[self.__arr_dir.value]["arr"] - * removed_mob.fetch_mob_square().side_length - ), + -(self.__arr_dir * removed_mob.fetch_mob_square().side_length), ) ) @@ -861,7 +859,7 @@ def __remove_elem( anims_shift.append( ApplyMethod( self.__mob_arr_label.shift, - -self.__dir_map[self.__arr_dir.value]["arr"] * label_shift_factor, + -self.__arr_dir * label_shift_factor, ) ) @@ -919,9 +917,9 @@ def __init_props( index_start: int, index_hex_display: bool, hide_index: bool, - arr_dir: MArrayDirection, + arr_dir: np.ndarray, switch_index_pos: bool, - arr_label_pos: MArrayDirection, + arr_label_pos: np.ndarray, arr_label_gap: float, ) -> None: """Initializes the attributes for the class. @@ -963,9 +961,9 @@ def __init_props( self.__index_start: int = index_start self.__index_hex_display: bool = index_hex_display self.__hide_index: int = hide_index - self.__arr_dir: MArrayDirection = arr_dir + self.__arr_dir: np.ndarray = arr_dir self.__switch_index_pos: bool = switch_index_pos - self.__arr_label_pos: MArrayDirection = arr_label_pos + self.__arr_label_pos: np.ndarray = arr_label_pos self.__arr_label_gap: float = arr_label_gap def __update_props( @@ -1007,8 +1005,7 @@ def __init_mobs( ) if len(self.__mob_arr) % 2 == 0: self.__mob_arr_label.shift( - -self.__dir_map[self.__arr_dir.value]["arr"] - * (next_to_mob.side_length / 2) + -self.__arr_dir * (next_to_mob.side_length / 2) ) self.add(self.__mob_arr_label) @@ -1021,9 +1018,9 @@ def __init__( index_start: int = 0, index_hex_display: bool = False, hide_index: bool = False, - arr_dir: MArrayDirection = MArrayDirection.RIGHT, + arr_dir: np.ndarray = RIGHT, switch_index_pos: bool = False, - arr_label_pos: MArrayDirection = MArrayDirection.LEFT, + arr_label_pos: np.ndarray = LEFT, arr_label_gap: float = 0.5, mob_arr_label_args: dict = {}, mob_square_args: dict = {}, @@ -1133,13 +1130,12 @@ def fetch_mob_arr_label(self) -> Text: return self.__mob_arr_label - def fetch_arr_dir(self) -> MArrayDirection: - """Fetches the growth direction enum of the array. + def fetch_arr_dir(self) -> np.ndarray: + """Fetches the growth direction. Returns ------- - :class:`~.m_enum.MArrayDirection` - :attr:`__arr_dir`. + """ return self.__arr_dir