Skip to content

Commit 05594ec

Browse files
Replace last os.path occurrencies by pathlib (ManimCommunity#3224)
This resolves [last comment](ManimCommunity#485 (comment)) of ManimCommunity#485. Removes one line of dead code. Co-authored-by: Benjamin Hackl <[email protected]>
1 parent 3366964 commit 05594ec

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

manim/scene/scene_file_writer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,8 @@ def clean_cache(self):
700700
)
701701
oldest_files_to_delete = sorted(
702702
cached_partial_movies,
703-
key=os.path.getatime,
703+
key=lambda path: path.stat().st_atime,
704704
)[:number_files_to_delete]
705-
# oldest_file_path = min(cached_partial_movies, key=os.path.getatime)
706705
for file_to_delete in oldest_files_to_delete:
707706
file_to_delete.unlink()
708707
logger.info(

manim/utils/file_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def modify_atime(file_path: str) -> None:
183183
file_path
184184
The path of the file.
185185
"""
186-
os.utime(file_path, times=(time.time(), os.path.getmtime(file_path)))
186+
os.utime(file_path, times=(time.time(), Path(file_path).stat().st_mtime))
187187

188188

189189
def open_file(file_path, in_browser=False):

0 commit comments

Comments
 (0)