internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ManimCommunity/manim

Issue:
Minimal tests
closes #28 


Discussion:

Resolving patch:
diff --git a/manimlib/imports.py b/manimlib/imports.py
--- a/manimlib/imports.py
+++ b/manimlib/imports.py
@@ -65,14 +65,6 @@
 from manimlib.for_3b1b_videos.pi_creature_animations import *
 from manimlib.for_3b1b_videos.pi_creature_scene import *
 
-from manimlib.once_useful_constructs.arithmetic import *
-from manimlib.once_useful_constructs.combinatorics import *
-from manimlib.once_useful_constructs.complex_transformation_scene import *
-from manimlib.once_useful_constructs.counting import *
-from manimlib.once_useful_constructs.fractals import *
-from manimlib.once_useful_constructs.graph_theory import *
-from manimlib.once_useful_constructs.light import *
-
 from manimlib.scene.graph_scene import *
 from manimlib.scene.moving_camera_scene import *
 from manimlib.scene.reconfigurable_scene import *
diff --git a/example_scenes.py b/samples/sample_scenes.py
similarity index 100%
rename from example_scenes.py
rename to samples/sample_scenes.py


Test patch:
diff --git a/tests/tests_sample_scenes.py b/tests/tests_sample_scenes.py
new file mode 100644
--- /dev/null
+++ b/tests/tests_sample_scenes.py
@@ -0,0 +1,52 @@
+from manimlib.imports import *
+
+# This file is intended to test any new feature added. 
+# Feel free to add a test or to modify one when adding a new/changing a feature. 
+
+class Test_geometry(Scene): 
+    def construct(self):
+        circle = Circle()
+        square = Square()
+        square.flip(RIGHT)
+        square.rotate(-3 * TAU / 8)
+        circle.set_fill(PINK, opacity=0.5)
+        self.play(ShowCreation(square))
+        self.play(Transform(square, circle))
+        self.play(FadeOut(square))
+
+        text = Text("Testing !")
+        self.play(DrawBorderThenFill(text))
+
+        decimal = DecimalNumber(
+            0,
+            show_ellipsis=True,
+            num_decimal_places=3,
+            include_sign=True,
+        )
+        square = Square().to_edge(UP)
+
+        decimal.add_updater(lambda d: d.next_to(square, RIGHT))
+        decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
+        self.add(square, decimal)
+        self.play(
+            square.to_edge, DOWN,
+            rate_func=there_and_back,
+            run_time=1,
+        )
+        self.wait()
+
+class Test_plotting(GraphScene):
+    CONFIG = {
+        "x_min" : -10,
+        "x_max" : 10.3,
+        "y_min" : -1.5,
+        "y_max" : 1.5,
+        "graph_origin" : ORIGIN ,
+        "function_color" : RED ,
+        "axes_color" : GREEN,
+        "x_labeled_nums" :range(-10,12,2),
+    }  
+    def construct(self): 
+        self.setup_axes(animate=False)
+        func_graph = self.get_graph(lambda x : x**2, self.function_color)
+        self.play(ShowCreation(func_graph))
Repository: ManimCommunity/manim

Issue:
A small Bug in setup.py
In `install_requires` of `setup.py` the library `colour` is mentioned twice. This needed to be changed.


Discussion:
Good catch! Do you want to submit a PR for this?
Yes. I would make an PR on this.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,6 @@
         ]
     },
     install_requires=[
-        "colour",
         "argparse",
         "colour",
         "numpy",


Test patch:
Repository: ManimCommunity/manim

Issue:
Remove argparse from setup.py
https://github.com/ManimCommunity/manim/blob/cf8c5b9938abafba9f6c2c1aeff9e15c8edbfdd1/setup.py#L17
Remove `argparse` from setup.py as it is a default library and need not be mentioned in `requirements.txt` and `setup.py`.


Discussion:
Agreed, it should be removed. @naveen521kk would you like to submit a PR?

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,6 @@
         ]
     },
     install_requires=[
-        "argparse",
         "colour",
         "numpy",
         "Pillow",


Test patch:
Repository: ManimCommunity/manim

Issue:
Reactivation of the gif export
There are still the optional arguments:
 ` "-i", "--save_as_gif"`  for saving scences into gif.
This feature was added to 3b1b's repo here https://github.com/3b1b/manim/commit/c42ae8a55bb2f1ef8259a719f17eaf519c46f3f8
and removed here https://github.com/3b1b/manim/commit/61bb4944fad2ee889145bbf8a3253fb07c71bf7d where Grant wrote:
> It seems strange to me that the "-c copy" line breaks things when you're trying to make a gif, is there a more natural way to address whatever the underlying issue is here? In a perfect world, we should be able to make things so that if you set "movie_file_extension" in the SceneFileWriter to ".gif", it figures out the settings it needs and renders the gif. Having a bunch of extra attributes for gifs strikes me as redundant.

So my idea would be to add to `manim/scene/scene_file_writer.py` something like
```py
if self.save_as_gif:
            os.system("ffmpeg -i PATH_TO_VIDEO/input.mp4  output.gif")
```
This way, the video get's first rendered to mp4 and then to gif, but I think that's the most forward option.


Discussion:

Resolving patch:
diff --git a/manim/extract_scene.py b/manim/extract_scene.py
--- a/manim/extract_scene.py
+++ b/manim/extract_scene.py
@@ -31,6 +31,8 @@ def open_file_if_needed(file_writer, **config):
             file_paths.append(file_writer.get_image_file_path())
         if config["file_writer_config"]["write_to_movie"]:
             file_paths.append(file_writer.get_movie_file_path())
+        if file_writer.save_as_gif:
+            file_paths.append(file_writer.gif_file_path)
 
         for file_path in file_paths:
             if current_os == "Windows":
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -491,9 +491,18 @@ def combine_movie_files(self):
             '-safe', '0',
             '-i', file_list,
             '-loglevel', 'error',
+        ]
+
+        if self.write_to_movie:
+            commands += [
             '-c', 'copy',
             movie_file_path
-        ]
+            ]
+
+        if self.save_as_gif:
+            commands += [
+                self.gif_file_path
+            ]
         if not self.includes_sound:
             commands.insert(-1, '-an')
 


Test patch:
Repository: ManimCommunity/manim

Issue:
Recompilation of file takes into account previous partial movie files
When running manim on a file twice with the same scene, if the second version of the file has fewer animations than the first version, the old animations that had a higher indexes than the second version are kept.
For example by running twice this file with `manim test_issue_partial.py -pl` :

#### Version 1
```python
from manim import *


class TestPartialsScene(Scene):
    def construct(self):
        square = Square()
        self.play(FadeIn(square))
        self.wait()
        self.play(FadeOut(square))

```
#### Version 2
```python
from manim import *


class TestPartialsScene(Scene):
    def construct(self):
        triangle = Triangle()
        self.play(FadeIn(triangle))
        self.wait()

```
Normally, three partial movie files should be created for the first version :
* square FadeIn
* wait
* square FadeOut

Of course deleting the partial movies solves the issue but I am guessing this operation should not be left to the user.
And two for the second version :
* triangle FadeIn
* wait

However, the current result is that the third partial movie of the first version is kept and the clip goes as follow :
* triangle FadeIn
* wait
* square FadeOut

Of course deleting the partial movies solves the issue, but I am guessing it is not an operation that should be left to the user.


Discussion:
In theory there is such a functionnality within manim.
In `get_sorted_integer_files` (L.31, file_ops.py), when `remove_indices_greater_than` is set partial movies files with an index to greater than the number of animations are deleted. I don't really know why is it broken. 
Anyway, #166 will fix that.

Resolving patch:
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -439,10 +439,10 @@ def combine_movie_files(self):
             "remove_non_integer_files": True,
             "extension": file_writer_config["movie_file_extension"],
         }
-        if file_writer_config["from_animation_number"] is not None:
-            kwargs["min_index"] = file_writer_config["from_animation_number"]
-        if file_writer_config["upto_animation_number"] is not None:
-            kwargs["max_index"] = file_writer_config["upto_animation_number"]
+        if file_writer_config['from_animation_number'] is not None:
+            kwargs["min_index"] = file_writer_config['from_animation_number']
+        if file_writer_config['upto_animation_number'] not in [None, np.inf]:
+            kwargs["max_index"] = file_writer_config['upto_animation_number']
         else:
             kwargs["remove_indices_greater_than"] = self.scene.num_plays - 1
         partial_movie_files = get_sorted_integer_files(


Test patch:
Repository: ManimCommunity/manim

Issue:
-f broken on windows
Basically the title.
When passing -f on windows in show the video file with the default video browser (like -p does) and not in the file explorer. 


Discussion:

Resolving patch:
diff --git a/manim/__main__.py b/manim/__main__.py
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -36,7 +36,7 @@ def open_file_if_needed(file_writer):
 
         for file_path in file_paths:
             if current_os == "Windows":
-                os.startfile(file_path)
+                os.startfile(os.path.dirname(file_path))
             else:
                 commands = []
                 if current_os == "Linux":


Test patch:
Repository: ManimCommunity/manim

Issue:
Adding a log that shows which scene is rendered
Basically the title. 
This is useful when rendering several scenes at once (with `-a`)

Very easy PR! Feel free :D


Discussion:

Resolving patch:
diff --git a/manim/logger.py b/manim/logger.py
--- a/manim/logger.py
+++ b/manim/logger.py
@@ -63,6 +63,7 @@ def parse_theme(fp):
     "module",
     "File",
     "Rendering",
+    "Rendered",
 ]
 logging.basicConfig(
     level="NOTSET",
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -104,9 +104,11 @@ def __str__(self):
     def print_end_message(self):
         """
         Used internally to print the number of
-        animations played after the scene ends.
+        animations played after the scene ends, 
+        as well as the name of the scene rendered 
+        (useful when using the `-a` option).
         """
-        logger.info("Played {} animations".format(self.num_plays))
+        logger.info(f"Rendered {str(self)}\nPlayed {self.num_plays} animations")
 
     def set_variables_as_attrs(self, *objects, **newly_named_objects):
         """


Test patch:
Repository: ManimCommunity/manim

Issue:
Sector.get_arc_center() is broken.
Sector.get_arc_center() does not work and always returns a warning message.
```sh
UserWarning: Can't find Arc center, using ORIGIN instead
 warnings.warn("Can't find Arc center, using ORIGIN instead")
```
Above error can be reproduced using the below code.
```py
from manim import *
class Test(Scene):
    def construct(self):
        sec = Sector(start_angle=0, angle=5*PI/3).move_to([1,0,0])
        print(sec.get_arc_center())
```



Discussion:

Resolving patch:
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -288,6 +288,12 @@ def get_arc_center(self, warning=True):
         """
         # First two anchors and handles
         a1, h1, h2, a2 = self.points[:4]
+
+        if np.all(a1 == a2):
+            # For a1 and a2 to lie at the same point arc radius
+            # must be zero. Thus arc_center will also lie at
+            # that point.
+            return a1
         # Tangent vectors
         t1 = h1 - a1
         t2 = h2 - a2


Test patch:
diff --git a/tests/test_unit_geometry.py b/tests/test_unit_geometry.py
new file mode 100644
--- /dev/null
+++ b/tests/test_unit_geometry.py
@@ -0,0 +1,7 @@
+import pytest
+import numpy as np
+from manim import Sector
+
+
+def test_get_arc_center():
+    assert np.all(Sector(arc_center=[1, 2, 0]).get_arc_center() == [1, 2, 0])
Repository: ManimCommunity/manim

Issue:
ValueTracker must support increment also using +=
Just what the title says. Here's an example 
```python
class Test(Scene):
    def construct(self):
        tracker = ValueTracker(0.0)
        tracker.set_value(2.0)
        print(tracker.get_value()) # -> 2.000
        tracker.increment_value(3.0)
        print(tracker.get_value()) # -> 5.000
        tracker += 4.0 # NEW proposed feature
        print(tracker.get_value()) # -> 9.000
```



Discussion:
Very good idea. I would love to see a PR :) #
Hey, @huguesdevimeux I can take this if it's still open.

Resolving patch:
diff --git a/manim/mobject/value_tracker.py b/manim/mobject/value_tracker.py
--- a/manim/mobject/value_tracker.py
+++ b/manim/mobject/value_tracker.py
@@ -57,6 +57,10 @@ def set_value(self, value):
     def increment_value(self, d_value):
         self.set_value(self.get_value() + d_value)
 
+    def __iadd__(self, d_value):
+        self.increment_value(d_value)
+        return self
+
     def interpolate(self, mobject1, mobject2, alpha, path_func=straight_path):
         """
         Turns self into an interpolation between mobject1


Test patch:
diff --git a/tests/test_value_tracker.py b/tests/test_value_tracker.py
new file mode 100644
--- /dev/null
+++ b/tests/test_value_tracker.py
@@ -0,0 +1,28 @@
+from manim.mobject.value_tracker import ValueTracker
+
+
+def test_value_tracker_set_value():
+    """Test ValueTracker.set_value()"""
+    tracker = ValueTracker()
+    tracker.set_value(10.0)
+    assert tracker.get_value() == 10.0
+
+
+def test_value_tracker_get_value():
+    """Test ValueTracker.get_value()"""
+    tracker = ValueTracker(10.0)
+    assert tracker.get_value() == 10.0
+
+
+def test_value_tracker_increment_value():
+    """Test ValueTracker.increment_value()"""
+    tracker = ValueTracker(0.0)
+    tracker.increment_value(10.0)
+    assert tracker.get_value() == 10.0
+
+
+def test_value_tracker_iadd():
+    """Test ValueTracker.__iadd__()"""
+    tracker = ValueTracker(0.0)
+    tracker += 10.0
+    assert tracker.get_value() == 10.0
Repository: ManimCommunity/manim

Issue:
 [BUG-General] Terminal output not formatted and uses ASCII in windows
**Describe the bug**
I am on Windows and command prompt and I `cd` into example_scenes directory and run 
```sh
manim basic.py
``` 
and I get a output like below.
![teminal-format](https://media.discordapp.net/attachments/581738732646957057/766319441209327728/unknown.png)
I should get in green colour though.

**To Reproduce**
Just running the one in example_scene in enough.

**Expected behavior**
The ill formatted thing should be in green colour.

**Logs**
<details><summary>Terminal output (Screenshots acceptable)</summary>

![teminal-format](https://media.discordapp.net/attachments/581738732646957057/766319441209327728/unknown.png)

<!-- Paste screenshot here -->

</details>

**System Specifications**

<details><summary>System Details</summary>

- OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 7
- Python version (`python/py/python3 --version`): 3.8



Discussion:
Isn't rich's fault ?  
Yeah it is rich. What we can do is to lock a stable version say v5. I know it works correctly on v5 but not on v8.
That's a shame. 
Maybe we should open an issue on rich's repo and lock to a stable version, as you said. 
Done https://github.com/willmcgugan/rich/issues/393

Also, I will make a PR to make sure we use rich version<=7.0.0.

Resolving patch:
diff --git a/manim/config/logger.py b/manim/config/logger.py
--- a/manim/config/logger.py
+++ b/manim/config/logger.py
@@ -10,12 +10,12 @@
 __all__ = ["logger", "console"]
 
 
-import configparser
 import logging
 
 from rich.console import Console
 from rich.logging import RichHandler
 from rich.theme import Theme
+from rich.traceback import install
 from rich import print as printf
 from rich import errors, color
 import json
@@ -114,7 +114,7 @@ def set_file_logger(log_file_path):
 logger = logging.getLogger("manim")
 # The console is set to None as it will be changed by set_rich_logger.
 console = None
-
+install()
 # TODO : This is only temporary to keep the terminal output clean when working with ImageMobject and matplotlib plots
 logging.getLogger("PIL").setLevel(logging.INFO)
 logging.getLogger("matplotlib").setLevel(logging.INFO)


Test patch:
Repository: ManimCommunity/manim

Issue:
Redesign manim-example blocks
At the very least the blocks should be easier to distinguish from each other.


Discussion:

Resolving patch:
diff --git a/docs/source/manim_directive.py b/docs/source/manim_directive.py
--- a/docs/source/manim_directive.py
+++ b/docs/source/manim_directive.py
@@ -251,6 +251,7 @@ def run(self):
             raise ValueError("Invalid combination of render flags received.")
 
         rendered_template = jinja2.Template(TEMPLATE).render(
+            clsname=clsname,
             hide_source=hide_source,
             filesrc_rel=os.path.relpath(filesrc, setup.confdir),
             output_file=output_file,
@@ -284,8 +285,6 @@ def setup(app):
 
     <div class="manim-example">
 
-{{ source_block }}
-{{ ref_block }}
 {% endif %}
 
 {% if not (save_as_gif or save_last_frame) %}
@@ -299,10 +298,16 @@ def setup(app):
 .. image:: /{{ filesrc_rel }}
     :align: center
 {% endif %}
-
 {% if not hide_source %}
 .. raw:: html
 
-    </div>
+    <div class="example-header">{{ clsname }}</div>
+
+{{ source_block }}
+{{ ref_block }}
 {% endif %}
+
+.. raw:: html
+
+    </div>
 """


Test patch:
Repository: ManimCommunity/manim

Issue:
The config value `html_favicon' has type `PosixPath'; expected `str'.
BTW when building the docs now I get
```
WARNING: The config value `html_favicon' has type `PosixPath'; expected `str'.
```

_Originally posted by @leotrs in https://github.com/ManimCommunity/manim/pull/631#issuecomment-719075737_


Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -80,7 +80,7 @@
 
 html_theme_path = guzzle_sphinx_theme.html_theme_path()
 html_theme = "guzzle_sphinx_theme"
-html_favicon = Path("_static/favicon.ico")
+html_favicon = str(Path("_static/favicon.ico"))
 
 # There's a standing issue with Sphinx's new-style sidebars.  This is a
 # workaround.  Taken from


Test patch:
Repository: ManimCommunity/manim

Issue:
Remove the --background_opacity flag
For most users, I can see two possible values for the background opacity: 1 (fully opaque) or 0 (fully transparent). The former is the default, and the latter can be activated by passing the `-t` flag. Therefore, I see no reason to also support a separate `--background_opacity` flag. If the user *actually* needs a value in between 0 and 1, they can use a .cfg file.

What do you think?


Discussion:
I think background_opacity is something really specific, that does not need its own flag.
So yes, we can remove it.

+1 for removing the CLI flag.

Resolving patch:
diff --git a/manim/config/main_utils.py b/manim/config/main_utils.py
--- a/manim/config/main_utils.py
+++ b/manim/config/main_utils.py
@@ -262,10 +262,6 @@ def _parse_args_no_subcmd(args):
         "--background_color",
         help="Specify background color",
     )
-    parser.add_argument(
-        "--background_opacity",
-        help="Specify background opacity",
-    )
     parser.add_argument(
         "--media_dir",
         help="Directory to store media (including video files)",


Test patch:
Repository: ManimCommunity/manim

Issue:
Add (opengraph) metadata to documentation
Previews to links to the documentation are currently not available due to missing opengraph metadata.

Also, a description meta tag should be added.






Discussion:
Isn't adding this https://docs.readthedocs.io/en/stable/guides/technical-docs-seo-guide.html#use-meta-tags enough?
How difficult is it to implement this?
I think it will very easy to do it.
Are you volunteering? :)

On Mon, Sep 14, 2020 at 11:00 PM Naveen M K <notifications@github.com>
wrote:

> I think it will very easy to do it.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/ManimCommunity/manim/issues/407#issuecomment-692432765>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAILYAGRDZPFGF7GKU7DI7DSF3KEJANCNFSM4QURFKCQ>
> .
>


-- 
www.leotrs.com | leo@leotrs.com
PhD candidate at the Network Science Institute, Northeastern University

Yes, it should only require a change to the templates `module.rst` and `class.rst`.

But we should wait until we have settled for a logo to have a image for the preview cards.
@behackl I think we forgot to do this before the v0.1 releasee :sweat_smile: 

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -56,6 +56,7 @@
     "sphinx.ext.napoleon",
     "sphinx.ext.autosummary",
     "sphinx.ext.doctest",
+    "sphinxext.opengraph",
     "manim_directive",
 ]
 
@@ -101,3 +102,8 @@
 
 # This specifies any additional css files that will override the theme's
 html_css_files = ["custom.css"]
+
+# opengraph settings
+ogp_image = "https://www.manim.community/logo.png"
+ogp_site_name = "Manim Community | Documentation"
+ogp_site_url = "https://docs.manim.community/"


Test patch:
Repository: ManimCommunity/manim

Issue:
AddTextLetterByLetter animation no longer working
**Describe the bug**
The AddTextLetterByLetter animation was broken by a recent PR
https://github.com/ManimCommunity/manim/pull/568#issuecomment-720717465

All the text appears immediately - even though `self.mobject.submobjects ` is updated correctly in the ShowIncreasingSubsets Animation object.

**To Reproduce**

```py
class lbl(Scene):
    def construct(self):
        t = Tex("this is a test")
        self.play(AddTextLetterByLetter(t[0]))
        #this works on the last releases branch (0.1.0), but not on master
```

</details>

**Expected behavior**
I expect the letters to appear on screen one at a time




Discussion:
In the meantime, if y'all want to write text letter by letter, you can try something like this:
```
def LetterByLetter(txt):
    n = len(txt)
    return AnimationGroup(
        *[Write(txt[i], run_time=0.25) for i in range(n)], lag_ratio=0.9, run_time=0.25 * 0.9 * n
    )
```
perhaps replacing `Write` with something more abrupt. (Is there an add Animation just as there is (now) a Wait Animation?)

Resolving patch:
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -800,6 +800,9 @@ def play_internal(self, *args, **kwargs):
             self.add_static_frames(animations[0].duration)
             return
 
+        for animation in animations:
+            animation.begin()
+
         moving_mobjects = None
         static_mobjects = None
         duration = None
@@ -823,9 +826,6 @@ def play_internal(self, *args, **kwargs):
             self.static_image = self.renderer.get_frame()
             time_progression = self.get_animation_time_progression(animations)
 
-        for animation in animations:
-            animation.begin()
-
         last_t = 0
         for t in time_progression:
             dt = t - last_t


Test patch: