Skip to content

Commit

Permalink
Update file save procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
tdh8316 committed Jun 4, 2020
1 parent a0b222d commit 58b7711
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions triangler/mod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import time
from datetime import datetime
from typing import Union

from numpy.core.multiarray import ndarray
Expand Down Expand Up @@ -72,7 +72,7 @@ def save(self, source: Union[str, ndarray], output: str = None, **kwargs) -> Non
"""
_is_source_string: bool = isinstance(source, str)
_out = output or (
"Triangler_{}.jpg".format(int(time.time()))
"Triangler_{}.jpg".format(datetime.now().strftime("%H-%M-%b-%d-%G"))
if not _is_source_string
else (str().join(source.split(".")[:-1]) + "_tri." + source.split(".")[-1])
)
Expand All @@ -87,4 +87,4 @@ def save(self, source: Union[str, ndarray], output: str = None, **kwargs) -> Non
)

if kwargs["print_log"]:
print("Saved {}".format(output))
print("Saved {}".format(_out))

0 comments on commit 58b7711

Please sign in to comment.