mirror of
https://github.com/OpenVGLab/OmniLottie.git
synced 2026-09-17 07:36:27 +00:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
@contextmanager
|
||||
def open_file(file_or_name, mode="w"):
|
||||
if isinstance(file_or_name, str):
|
||||
obj = open(file_or_name, mode)
|
||||
try:
|
||||
yield obj
|
||||
finally:
|
||||
obj.close()
|
||||
else:
|
||||
yield file_or_name
|
||||
Reference in New Issue
Block a user