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

Issue:
Document that ShowCreation does not work on non-VMobjects
It can only work on VMobject. See #387.

Raising NotImplementedError seems like the thing to do. The fix should implement the exception, update the docstring, and change any relevant docs pages.
Document that ShowCreation does not work on non-VMobjects
It can only work on VMobject. See #387.

Raising NotImplementedError seems like the thing to do. The fix should implement the exception, update the docstring, and change any relevant docs pages.


Discussion:

Resolving patch:
diff --git a/manim/animation/creation.py b/manim/animation/creation.py
--- a/manim/animation/creation.py
+++ b/manim/animation/creation.py
@@ -29,18 +29,49 @@
 
 
 class ShowPartial(Animation):
+    """Abstract class for Animations that show the VMobject partially.
+
+    Raises
+    ------
+    :class:`TypeError`
+        If ``mobject`` is not an instance of :class:`~.VMobject`.
+
+    See Also
+    --------
+    :class:`ShowCreation`, :class:`~.ShowPassingFlash`
+
     """
-    Abstract class for ShowCreation and ShowPassingFlash
-    """
+
+    def __init__(self, mobject, **kwargs):
+        if not isinstance(mobject, VMobject):
+            raise TypeError("This Animation only works on vectorized mobjects")
+        super().__init__(mobject, **kwargs)
 
     def interpolate_submobject(self, submob, start_submob, alpha):
         submob.pointwise_become_partial(start_submob, *self.get_bounds(alpha))
 
     def get_bounds(self, alpha):
-        raise NotImplementedError()
+        raise NotImplementedError("Please use ShowCreation or ShowPassingFlash")
 
 
 class ShowCreation(ShowPartial):
+    """Incrementally shows the VMobject.
+
+    Examples
+    --------
+    .. manim:: ShowCreationScene
+
+        class ShowCreationScene(Scene):
+            def construct(self):
+                self.play(ShowCreation(Square()))
+
+
+    See Also
+    --------
+    :class:`~.ShowPassingFlash`
+
+    """
+
     CONFIG = {
         "lag_ratio": 1,
     }
diff --git a/manim/animation/indication.py b/manim/animation/indication.py
--- a/manim/animation/indication.py
+++ b/manim/animation/indication.py
@@ -148,6 +148,23 @@ def interpolate_mobject(self, alpha):
 
 
 class ShowPassingFlash(ShowPartial):
+    """Show only a sliver of the VMobject each frame.
+
+    Examples
+    --------
+    .. manim:: ShowPassingFlashScene
+
+        class ShowPassingFlashScene(Scene):
+            def construct(self):
+                self.play(ShowPassingFlash(Square()))
+
+
+    See Also
+    --------
+    :class:`~.ShowCreation`
+
+    """
+
     CONFIG = {
         "time_width": 0.1,
         "remover": True,


Test patch:
Repository: ManimCommunity/manim

Issue:
Running manim without any flags or render commands throws an error [BUG-General]  
It seems as if currently running just `manim` without any flag or scene to render it throws the following error:
```Traceback (most recent call last):
  File "c:\users\administrator\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\administrator\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Scripts\manim.exe\__main__.py", line 7, in <module>
  File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\manim\__main__.py", line 47, in main
    args = parse_args(sys.argv)
  File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\manim\_config\main_utils.py", line 110, in parse_args
    subcmd = _find_subcommand(args)
  File "c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages\manim\_config\main_utils.py", line 39, in _find_subcommand
    subcmd = args[1]
IndexError: list index out of range
```

@behackl has mentioned seeing the same bahaviour.
This isn't a major issue since otherwise everything seems to run fine (can still use `manim -h` or render scenes), but somehow who might know what's going on should have a look into it.


Discussion:
This is 99% probably my fault (#340)

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
@@ -107,6 +107,9 @@ def parse_args(args):
     if args[0] == "python" and args[1] == "-m":
         args = args[2:]
 
+    if len(args) == 1:
+        return _parse_args_no_subcmd(args)
+
     subcmd = _find_subcommand(args)
     if subcmd == "cfg":
         return _parse_args_cfg_subcmd(args)


Test patch:
Repository: ManimCommunity/manim

Issue:
"manim -" is not working
I broke this when revamping the config system. Thanks @naveen521kk for reporting


Discussion:

Resolving patch:
diff --git a/manim/utils/module_ops.py b/manim/utils/module_ops.py
--- a/manim/utils/module_ops.py
+++ b/manim/utils/module_ops.py
@@ -9,7 +9,7 @@
 
 
 def get_module(file_name):
-    if file_name == "-":
+    if str(file_name) == "-":
         module = types.ModuleType("input_scenes")
         logger.info(
             "Enter the animation's code & end with an EOF (CTRL+D on Linux/Unix, CTRL+Z on Windows):"


Test patch:
Repository: ManimCommunity/manim

Issue:
Removing temp ffmpeg's temp-files 
Before partial movie files are generated by ffmpeg, scenefilewriter creates temp partial movie file and then move them and rename them with their definitive name (which is the hash of the animation). 
Why ? Why not rendering directly partial movie files? 
I think we should, if there is no objection, remove this and make ffmpeg directly render partial movie files.  

<!-- Edit the body of your new issue then click the ✓ "Create Issue" button in the top right of the editor. The first line will be the issue title. Assignees and Labels follow after a blank line. Leave an empty line before beginning the body of the issue. -->


Discussion:
No objection here.
Is this still open? If it is, I would like to look into it. 
@farahash yes! Please feel free to discuss here or open a PR.
@farahash and to assign yourself on this issue if you work on it ;)
@huguesdevimeux it doesn't seem like I can do that myself. Do I need to be added as a collaborator to the repo to get access? 
(you can go ahead and assign it to me if that works too)
Sorry. I thought you could. 

Now you are assigned !

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
@@ -340,13 +340,7 @@ def open_movie_pipe(self):
         buffer.
         """
         file_path = self.partial_movie_files[self.renderer.num_plays]
-
-        # TODO #486 Why does ffmpeg need temp files ?
-        temp_file_path = (
-            os.path.splitext(file_path)[0] + "_temp" + config["movie_file_extension"]
-        )
         self.partial_movie_file_path = file_path
-        self.temp_partial_movie_file_path = temp_file_path
 
         fps = config["frame_rate"]
         height = config["pixel_height"]
@@ -373,21 +367,16 @@ def open_movie_pipe(self):
             command += ["-vcodec", "qtrle"]
         else:
             command += ["-vcodec", "libx264", "-pix_fmt", "yuv420p"]
-        command += [temp_file_path]
+        command += [file_path]
         self.writing_process = subprocess.Popen(command, stdin=subprocess.PIPE)
 
     def close_movie_pipe(self):
         """
-        Used internally by Manim to gracefully stop writing to FFMPEG's
-        input buffer, and move the temporary files into their permananant
-        locations
+        Used internally by Manim to gracefully stop writing to FFMPEG's input buffer
         """
         self.writing_process.stdin.close()
         self.writing_process.wait()
-        shutil.move(
-            self.temp_partial_movie_file_path,
-            self.partial_movie_file_path,
-        )
+
         logger.info(
             f"Animation {self.renderer.num_plays} : Partial movie file written in %(path)s",
             {"path": {self.partial_movie_file_path}},


Test patch:
Repository: ManimCommunity/manim

Issue:
Sound in manimce
I want to add sound to my video in manimce like manim by 3b1b 

I use the following code -: 

`self.add_sound(" sound file name in assets folder", gain = value)`

But it's giving an error in manimce

![20210102172136](https://user-images.githubusercontent.com/76893489/103471739-ab14a200-4da9-11eb-978d-74ff95788ee5.jpg)

I think there will be some other syntax in manimce.

Please resolve this!!



Discussion:
Hello @Analytical1703 and thanks for reporting.

Could you please use the rest of the issue template? In particular, we *need* to know what version of manim (and its dependencies) you are using. Otherwise there is no way of helping you.

Resolving patch:
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -880,5 +880,5 @@ def add_sound(self, sound_file, time_offset=0, gain=None, **kwargs):
         """
         if self.renderer.skip_animations:
             return
-        time = self.time + time_offset
+        time = self.renderer.time + time_offset
         self.renderer.file_writer.add_sound(sound_file, time, gain, **kwargs)


Test patch:
diff --git a/tests/test_sound.py b/tests/test_sound.py
new file mode 100644
--- /dev/null
+++ b/tests/test_sound.py
@@ -0,0 +1,20 @@
+import os, struct, wave
+
+from manim import Scene
+
+
+def test_add_sound():
+    # create sound file
+    f = wave.open("noise.wav", "w")
+    f.setparams((2, 2, 44100, 0, "NONE", "not compressed"))
+    for _ in range(22050):  # half a second of sound
+        packed_value = struct.pack("h", 14242)
+        f.writeframes(packed_value)
+        f.writeframes(packed_value)
+
+    f.close()
+
+    scene = Scene()
+    scene.add_sound("noise.wav")
+
+    os.remove("noise.wav")
Repository: ManimCommunity/manim

Issue:
Logging creates {media_dir}/logs
## Description of bug / unexpected behavior

If `--log_to_file` is set, Manim creates the directory `{media_dir}/logs` instead of using `media_dir + "/logs"`


## How to reproduce the issue

`manim foo.py --log_to_file && ls`




Discussion:

Resolving patch:
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -753,8 +753,9 @@ def log_to_file(self):
     def log_to_file(self, val: str) -> None:
         self._set_boolean("log_to_file", val)
         if val:
-            if not os.path.exists(self["log_dir"]):
-                os.makedirs(self["log_dir"])
+            log_dir = self.get_dir("log_dir")
+            if not os.path.exists(log_dir):
+                os.makedirs(log_dir)
             set_file_logger(self, self["verbosity"])
 
     sound = property(


Test patch:
diff --git a/tests/test_logging/basic_scenes_wirte_stuff.py b/tests/test_logging/basic_scenes_write_stuff.py
similarity index 100%
rename from tests/test_logging/basic_scenes_wirte_stuff.py
rename to tests/test_logging/basic_scenes_write_stuff.py
Repository: ManimCommunity/manim

Issue:
ManimConfig Write Bug
## Description of bug / unexpected behavior
<!-- Add a clear and concise description of the problem you encountered. -->
```
(manim) C:\Users\a\Documents\repos\ManimCommunity\manim>manim cfg export
You are reading the config from the same directory you are exporting to.
This means that the exported config will overwrite the config for this directory.
Are you sure you want to continue? (y/n)y
Traceback (most recent call last):
  File "C:\Users\a\anaconda3\envs\manim\Scripts\manim", line 5, in <module>
    main()
  File "C:\Users\a\Documents\repos\ManimCommunity\manim\manim\__main__.py", line 65, in main
    cfg_subcmds.export(args.dir)
  File "C:\Users\a\Documents\repos\ManimCommunity\manim\manim\_config\cfg_subcmds.py", line 245, in export
    config.write(outpath)
AttributeError: 'ManimConfig' object has no attribute 'write'
```
```
(manim) C:\Users\a\Documents\repos\ManimCommunity\manim>manim cfg export --dir test
Creating folder: test.
Traceback (most recent call last):
  File "C:\Users\a\anaconda3\envs\manim\Scripts\manim", line 5, in <module>
    main()
  File "C:\Users\a\Documents\repos\ManimCommunity\manim\manim\__main__.py", line 65, in main
    cfg_subcmds.export(args.dir)
  File "C:\Users\a\Documents\repos\ManimCommunity\manim\manim\_config\cfg_subcmds.py", line 245, in export
    config.write(outpath)
AttributeError: 'ManimConfig' object has no attribute 'write'

```
## Expected behavior
A manim.cfg file populated at the specified directory (defaults to cwd).

## How to reproduce the issue
<!-- Provide a piece of code illustrating the undesired behavior. -->
Clone the master branch and run as I did in the CLI above:
`manim cfg export`
`manim cfg export --dir test`

## System specifications
- OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)):

## Additional comments
This also seems to be in the case in Ubuntu 20.04 as tested by @huguesdevimeux 



Discussion:
cc @Aathish04, author of `cfg` command (a while ago, so maybe it's outdated)

Resolving patch:
diff --git a/manim/_config/cfg_subcmds.py b/manim/_config/cfg_subcmds.py
--- a/manim/_config/cfg_subcmds.py
+++ b/manim/_config/cfg_subcmds.py
@@ -238,11 +238,12 @@ def export(path):
     else:
         proceed = True
     if proceed:
+        parser = make_config_parser()
         if not os.path.isdir(path):
             console.print(f"Creating folder: {path}.", style="red bold")
             os.mkdir(path)
         with open(os.path.join(path, "manim.cfg"), "w") as outpath:
-            config.write(outpath)
+            parser.write(outpath)
             from_path = os.path.join(os.getcwd(), "manim.cfg")
             to_path = os.path.join(path, "manim.cfg")
         console.print(f"Exported final Config at {from_path} to {to_path}.")


Test patch:
Repository: ManimCommunity/manim

Issue:
New "max-width" option for media output in jupyter notebooks.
When using jupyter notebooks, currently a lot of space is occupied by the output images, and sometimes it is nice to have things a bit tighter together.
Here a current screenshot (even with the lowest quality):
![image](https://user-images.githubusercontent.com/44469195/107761257-5c084800-6d2b-11eb-8025-488cd7797777.png)
For comparison:
The standard output size for matplotlib is 375 × 248 pixel in jupyter notebooks:
![image](https://user-images.githubusercontent.com/44469195/107761402-97a31200-6d2b-11eb-86ed-29b30989f2b6.png)

An additional benefit from this would be even faster rendering.


Discussion:

Resolving patch:
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -263,6 +263,7 @@ class MyScene(Scene):
         "from_animation_number",
         "images_dir",
         "input_file",
+        "media_width",
         "webgl_renderer_path",
         "leave_progress_bars",
         "log_dir",
@@ -576,6 +577,10 @@ def digest_parser(self, parser: configparser.ConfigParser) -> "ManimConfig":
         if val:
             setattr(self, "ffmpeg_loglevel", val)
 
+        val = parser["jupyter"].get("media_width")
+        if val:
+            setattr(self, "media_width", val)
+
         return self
 
     def digest_args(self, args: argparse.Namespace) -> "ManimConfig":
@@ -854,6 +859,12 @@ def verbosity(self, val: str) -> None:
         doc="Verbosity level of ffmpeg (no flag).",
     )
 
+    media_width = property(
+        lambda self: self._d["media_width"],
+        lambda self, val: self._d.__setitem__("media_width", val),
+        doc="Media width in Jupyter notebook",
+    )
+
     pixel_width = property(
         lambda self: self._d["pixel_width"],
         lambda self, val: self._set_pos_number("pixel_width", val, False),
diff --git a/manim/utils/ipython_magic.py b/manim/utils/ipython_magic.py
--- a/manim/utils/ipython_magic.py
+++ b/manim/utils/ipython_magic.py
@@ -103,7 +103,7 @@ def construct(self):
                 display(
                     Video(
                         tmpfile,
-                        html_attributes='controls autoplay loop style="max-width: 100%;"',
+                        html_attributes=f'controls autoplay loop style="max-width: {config["media_width"]};"',
                         embed=video_embed,
                     )
                 )


Test patch:
Repository: ManimCommunity/manim

Issue:
Paragraph and Code mobjects do not obey line_spacing
## Description of bug / unexpected behavior
The `line_spacing` parameter passed to `Paragraph` mobjects (and by extension, `Code` mobjects) is ignored.


## Expected behavior
Passing different values of `line_spacing` will properly change the spacing between lines in a paragraph/code listing.


## How to reproduce the issue
Rendering the following `Code` object results in a code listing with default-spaced lines.

<details><summary>Code for reproducing the problem</summary>

```python
listing = Code(
    "helloworldcpp.cpp",
    tab_width=4,
    background_stroke_width=1,
    background_stroke_color=WHITE,
    insert_line_no=True,
    style=Code.styles_list[15],
    background="window",
    language="cpp",
    line_spacing=0.7,
)
```

</details>


## Additional comments
As per a conversation on discord, @behackl believes the issue can be solved by modifying `text_mobject.py` on line 446 and properly forwarding the `line_spacing` parameter to the `Text` constructor.



Discussion:
Does passing the `line_spacing` parameter actually fixes this?
It did when I tried it locally.
So, did that fix that?

Resolving patch:
diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.py
--- a/manim/mobject/svg/text_mobject.py
+++ b/manim/mobject/svg/text_mobject.py
@@ -442,7 +442,7 @@ def __init__(self, *text, line_spacing=-1, alignment=None, **config):
         VGroup.__init__(self, **config)
 
         lines_str = "\n".join(list(text))
-        self.lines_text = Text(lines_str, **config)
+        self.lines_text = Text(lines_str, line_spacing=line_spacing, **config)
         lines_str_list = lines_str.split("\n")
         self.chars = self.gen_chars(lines_str_list)
 


Test patch:
Repository: ManimCommunity/manim

Issue:
ManimDirective needs a `ref_methods`
Some of the current documentation uses `:ref_functions:` in the example documentation which is supposed to link to the proper function; however, it is often the case that the function is actually a method. In these instances, a ref_methods would be appropriate to have, and the usage of this in the examples should be updated accordingly.

See https://github.com/ManimCommunity/manim/blob/master/docs/source/manim_directive.py#L133-L135


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
@@ -64,7 +64,11 @@ def construct(self):
         rendered in a reference block after the source code.
 
     ref_functions
-        A list of functions and methods, separated by spaces,
+        A list of functions, separated by spaces,
+        that is rendered in a reference block after the source code.
+
+    ref_methods
+        A list of methods, separated by spaces,
         that is rendered in a reference block after the source code.
 
 """
@@ -133,6 +137,7 @@ class ManimDirective(Directive):
         "ref_modules": lambda arg: process_name_list(arg, "mod"),
         "ref_classes": lambda arg: process_name_list(arg, "class"),
         "ref_functions": lambda arg: process_name_list(arg, "func"),
+        "ref_methods": lambda arg: process_name_list(arg, "meth"),
     }
     final_argument_whitespace = True
 
@@ -163,6 +168,7 @@ def run(self):
             self.options.get("ref_modules", [])
             + self.options.get("ref_classes", [])
             + self.options.get("ref_functions", [])
+            + self.options.get("ref_methods", [])
         )
         if ref_content:
             ref_block = f"""


Test patch:
Repository: ManimCommunity/manim

Issue:
Seemingly broken creation animations
## Description of bug / unexpected behavior
It seems to me that the following animations are broken. Rather than doing what the class name suggests, they all just add the mobjects passed to them to the scene.

- `AddIncreasingSubsets`
- `AddTextLetterByLetter`
- `ShowSubmobjectsOneByOne`
- `AddTextWordByWord` - this one is known to be broken per the comment in manim's code

Likely, `AddIncreasingSubsets` is broken and caused the others to break.

## Additional comments
It's _possible_ that I am trying to use these wrong, but I'm 90% sure that isn't the case. It would be helpful if someone could confirm that they're broken.



Discussion:
https://docs.manim.community/en/latest/reference/manim.animation.creation.html#module-manim.animation.creation does indeed show the animations as broken
I compared against there before and also tried using a few of them with the Manimator bot as a control. We really need a way to test animations 😬 

Resolving patch:
diff --git a/manim/animation/creation.py b/manim/animation/creation.py
--- a/manim/animation/creation.py
+++ b/manim/animation/creation.py
@@ -408,6 +408,8 @@ def __init__(
     ) -> None:
         self.all_submobs = list(group.submobjects)
         self.int_func = int_func
+        for mobj in self.all_submobs:
+            mobj.set_opacity(0)
         super().__init__(
             group, suspend_mobject_updating=suspend_mobject_updating, **kwargs
         )
@@ -418,7 +420,8 @@ def interpolate_mobject(self, alpha: float) -> None:
         self.update_submobject_list(index)
 
     def update_submobject_list(self, index: int) -> None:
-        self.mobject.submobjects = self.all_submobs[:index]
+        for mobj in self.all_submobs[:index]:
+            mobj.set_opacity(1)
 
 
 class AddTextLetterByLetter(ShowIncreasingSubsets):
@@ -474,10 +477,11 @@ def __init__(
         super().__init__(new_group, int_func=int_func, **kwargs)
 
     def update_submobject_list(self, index: int) -> None:
-        if index == 0:
-            self.mobject.submobjects = []
-        else:
-            self.mobject.submobjects = self.all_submobs[index - 1]
+        current_submobjects = self.all_submobs[:index]
+        for mobj in current_submobjects[:-1]:
+            mobj.set_opacity(0)
+        if len(current_submobjects) > 0:
+            current_submobjects[-1].set_opacity(1)
 
 
 # TODO, this is broken...


Test patch: