diff --git a/swankit/env.py b/swankit/env.py index 342ba3c..0cb650d 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,9 +78,8 @@ def is_windows() -> bool: def create_time() -> str: - """获取当前时间(UTC时区) - """ - return datetime.datetime.now(datetime.UTC).isoformat() + """获取当前时间(UTC时区)""" + return datetime.datetime.now(datetime.timezone.utc).isoformat() def get_save_dir() -> str: 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: