From 36ab2ad0d4fff5a5c44369a2322b76fd17707621 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Wed, 15 Nov 2023 10:55:57 -0600 Subject: [PATCH] Fix utcnow() deprecation warning Fixes: #187 Signed-off-by: Major Hayden --- src/mount_efs/__init__.py | 4 ++-- src/watchdog/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mount_efs/__init__.py b/src/mount_efs/__init__.py index 0e9dd20..fec8de5 100755 --- a/src/mount_efs/__init__.py +++ b/src/mount_efs/__init__.py @@ -47,7 +47,7 @@ import threading import time from contextlib import contextmanager -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from logging.handlers import RotatingFileHandler try: @@ -2333,7 +2333,7 @@ def get_utc_now(): """ Wrapped for patching purposes in unit tests """ - return datetime.utcnow() + return datetime.now(timezone.utc) def assert_root(): diff --git a/src/watchdog/__init__.py b/src/watchdog/__init__.py index c3d76e3..28c3bbb 100755 --- a/src/watchdog/__init__.py +++ b/src/watchdog/__init__.py @@ -25,7 +25,7 @@ import time from collections import namedtuple from contextlib import contextmanager -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from logging.handlers import RotatingFileHandler from signal import SIGHUP, SIGKILL, SIGTERM @@ -2229,7 +2229,7 @@ def get_utc_now(): """ Wrapped for patching purposes in unit tests """ - return datetime.utcnow() + return datetime.now(timezone.utc) def check_process_name(pid):