Skip to content

Commit

Permalink
feat: logdir-gitignore (#527)
Browse files Browse the repository at this point in the history
* logdir-gitignore
---------

Co-authored-by: KAAANG <79990647+SAKURA-CAT@users.noreply.github.com>
  • Loading branch information
Zeyi-Lin and SAKURA-CAT committed May 1, 2024
1 parent d2d0942 commit ee52389
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions swanlab/data/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ def _init_logdir(logdir: str) -> str:
raise IOError
except IOError:
raise IOError("logdir must have Write permission.")
# 如果logdir是空的,创建.gitignore文件,写入*
if not os.listdir(logdir):
with open(os.path.join(logdir, ".gitignore"), "w") as f:
f.write("*")
return logdir


Expand Down

0 comments on commit ee52389

Please sign in to comment.