From b4aa099e36884c94bce1c3572dfc0703f12fcd93 Mon Sep 17 00:00:00 2001 From: ZeYi Lin <944270057@qq.com> Date: Sat, 22 Jun 2024 21:04:06 +0800 Subject: [PATCH 1/3] Update env.py --- swankit/env.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swankit/env.py b/swankit/env.py index 342ba3c..53ceb8c 100644 --- a/swankit/env.py +++ b/swankit/env.py @@ -18,6 +18,7 @@ class SwanLabMode(Enum): """ swanlab的解析模式,枚举类 """ + DISABLED = "disabled" CLOUD = "cloud" # CLOUD_ONLY = "cloud-only" @@ -77,8 +78,7 @@ def is_windows() -> bool: def create_time() -> str: - """获取当前时间(UTC时区) - """ + """获取当前时间(UTC时区)""" return datetime.datetime.now(datetime.UTC).isoformat() From 69f92dfee7529899c04ce74c9cdbf90655cc5215 Mon Sep 17 00:00:00 2001 From: ZeYi Lin <944270057@qq.com> Date: Sat, 22 Jun 2024 21:07:08 +0800 Subject: [PATCH 2/3] update timezone --- swankit/env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swankit/env.py b/swankit/env.py index 53ceb8c..0cb650d 100644 --- a/swankit/env.py +++ b/swankit/env.py @@ -79,7 +79,7 @@ def is_windows() -> bool: def create_time() -> str: """获取当前时间(UTC时区)""" - return datetime.datetime.now(datetime.UTC).isoformat() + return datetime.datetime.now(datetime.timezone.utc).isoformat() def get_save_dir() -> str: From bc848a4a624b45cc51e98490bebf62ce73980ec3 Mon Sep 17 00:00:00 2001 From: ZeYi Lin <944270057@qq.com> Date: Sat, 22 Jun 2024 21:08:28 +0800 Subject: [PATCH 3/3] Update test_env.py --- test/unit/test_env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/test_env.py b/test/unit/test_env.py index d0b8fdb..ae8f0f0 100644 --- a/test/unit/test_env.py +++ b/test/unit/test_env.py @@ -20,7 +20,7 @@ def test_create_time(): t = E.create_time() assert t.endswith("+00:00") d = datetime.datetime.fromisoformat(t) - assert d.tzinfo == datetime.UTC + assert d.tzinfo == datetime.timezone.utc class TestGetFolder: