Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace datetime.datetime.utcnow which is deprecated #4067

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions deepmd/dpmodel/utils/serialization.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import datetime
import json
from datetime import (
datetime,
)
from pathlib import (
Path,
)
Expand Down Expand Up @@ -90,7 +88,7 @@ def save_dp_model(filename: str, model_dict: dict) -> None:
"software": "deepmd-kit",
"version": __version__,
# use UTC+0 time
"time": str(datetime.utcnow()),
"time": str(datetime.datetime.now(tz=datetime.timezone.utc)),
}
if filename_extension == ".dp":
variable_counter = Counter()
Expand Down
9 changes: 5 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@

# -- Path setup --------------------------------------------------------------

import datetime

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from datetime import (
date,
)

from deepmd.utils.argcheck import (
ACTIVATION_FN_DICT,
Expand All @@ -29,7 +28,9 @@
# -- Project information -----------------------------------------------------

project = "DeePMD-kit"
copyright = "2017-%d, DeepModeling" % date.today().year
copyright = (
"2017-%d, DeepModeling" % datetime.datetime.now(tz=datetime.timezone.utc).year
)
author = "DeepModeling"

autoapi_dirs = ["../deepmd"]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ select = [
"B904", # raise-without-from-inside-except
"N804", # invalid-first-argument-name-for-class-method
"N805", # invalid-first-argument-name-for-method
"DTZ", # datetime
]

ignore = [
Expand Down