Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix DTZ004 `datetime.datetime.utcfromtimestamp()`.
Anders Kaseorg705460ff5885
diff --git a/zerver/lib/compatibility.py b/zerver/lib/compatibility.pyindex ddb1fa9f66b..3fc4c69adc3 100644--- a/zerver/lib/compatibility.py+++ b/zerver/lib/compatibility.py@@ -28,9 +28,9 @@ def is_outdated_server(user_profile: Optional[UserProfile]) -> bool:# someone has upgraded in the last year but to a release more than# a year old.git_version_path = os.path.join(settings.DEPLOY_ROOT, "version.py")- release_build_time = datetime.datetime.utcfromtimestamp(- os.path.getmtime(git_version_path)- ).replace(tzinfo=datetime.timezone.utc)+ release_build_time = datetime.datetime.fromtimestamp(+ os.path.getmtime(git_version_path), datetime.timezone.utc+ )version_no_newer_than = min(LAST_SERVER_UPGRADE_TIME, release_build_time)deadline = version_no_newer_than + datetime.timedelta(diff --git a/zerver/management/commands/export_search.py b/zerver/management/commands/export_search.pyindex 07c5c50f7c9..4904e49c4fd 100644--- a/zerver/management/commands/export_search.py+++ b/zerver/management/commands/export_search.py@@ -143,8 +143,8 @@ This is most often used for legal compliance.output = {"zerver_message": message_dicts}floatify_datetime_fields(output, "zerver_message")for item in output["zerver_message"]:- item["date_sent_utc"] = datetime.utcfromtimestamp(int(item["date_sent"])).strftime(- "%Y-%m-%d %H:%M:%S"- )+ item["date_sent_utc"] = datetime.fromtimestamp(+ int(item["date_sent"]), timezone.utc+ ).strftime("%Y-%m-%d %H:%M:%S")write_table_data(options["output"], output)