File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 8
8
import copy
9
9
import itertools as it
10
10
import operator as op
11
- import os
12
11
import random
13
12
import sys
14
13
14
+ from pathlib import Path
15
15
from colour import Color
16
16
import numpy as np
17
17
@@ -199,7 +199,7 @@ def show(self, camera=None):
199
199
200
200
def save_image (self , name = None ):
201
201
self .get_image ().save (
202
- os . path . join (file_writer_config ["video_dir" ], (name or str (self )) + ".png" )
202
+ Path (file_writer_config ["video_dir" ]). joinpath ( (name or str (self )) + ".png" )
203
203
)
204
204
205
205
def copy (self ):
Original file line number Diff line number Diff line change 1
- import os
1
+ from pathlib import Path
2
2
from manim import Mobject , BraceLabel , file_writer_config
3
3
4
4
@@ -20,11 +20,11 @@ def test_bracelabel_copy(tmp_path):
20
20
# For this test to work, we need to tweak some folders temporarily
21
21
original_text_dir = file_writer_config ["text_dir" ]
22
22
original_tex_dir = file_writer_config ["tex_dir" ]
23
- mediadir = os . path . join (tmp_path , "deepcopy" )
24
- file_writer_config ["text_dir" ] = os . path . join (mediadir , "Text" )
25
- file_writer_config ["tex_dir" ] = os . path . join (mediadir , "Tex" )
23
+ mediadir = Path (tmp_path ) / "deepcopy"
24
+ file_writer_config ["text_dir" ] = str (mediadir . joinpath ( "Text" ) )
25
+ file_writer_config ["tex_dir" ] = str (mediadir . joinpath ( "Tex" ) )
26
26
for el in ["text_dir" , "tex_dir" ]:
27
- os . makedirs (file_writer_config [el ])
27
+ Path (file_writer_config [el ]). mkdir ( parents = True )
28
28
29
29
# Before the refactoring of Mobject.copy(), the class BraceLabel was the
30
30
# only one to have a non-trivial definition of copy. Here we test that it
Original file line number Diff line number Diff line change 1
1
import pytest
2
- import os
3
2
3
+ from pathlib import Path
4
4
5
5
from manim import file_writer_config
6
6
7
7
8
8
@pytest .fixture
9
9
def manim_cfg_file ():
10
- return os . path . join ( os . path . dirname (__file__ ), "manim.cfg" )
10
+ return str ( Path (__file__ ). parent / "manim.cfg" )
11
11
12
12
13
13
@pytest .fixture
14
14
def simple_scenes_path ():
15
- return os . path . join ( os . path . dirname (__file__ ), "simple_scenes.py" )
15
+ return str ( Path (__file__ ). parent / "simple_scenes.py" )
You can’t perform that action at this time.
0 commit comments