From 82ab96ad0671219e73ad311b8455cb0d1d3fc9ed Mon Sep 17 00:00:00 2001 From: Antoine Lambert Date: Tue, 2 Feb 2021 11:29:13 +0100 Subject: [PATCH] gnu: Remove dependency on pytz UTC timezone settings can be obtained from the datetime.timezone module from Python standard library so remove dependency on external pytz module. --- requirements.txt | 1 - swh/lister/gnu/tree.py | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index bd9bfc3..4c710cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,5 @@ setuptools xmltodict iso8601 beautifulsoup4 -pytz launchpadlib tenacity diff --git a/swh/lister/gnu/tree.py b/swh/lister/gnu/tree.py index f666cb5..ba74e04 100644 --- a/swh/lister/gnu/tree.py +++ b/swh/lister/gnu/tree.py @@ -1,9 +1,9 @@ -# Copyright (C) 2019 The Software Heritage developers +# Copyright (C) 2019-2021 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from datetime import datetime +from datetime import datetime, timezone import gzip import json import logging @@ -13,7 +13,6 @@ import re from typing import Any, List, Mapping, Sequence, Tuple from urllib.parse import urlparse -from pytz import utc import requests logger = logging.getLogger(__name__) @@ -334,4 +333,4 @@ def format_date(timestamp: str) -> str: """Format a string timestamp to an isoformat string """ - return datetime.fromtimestamp(int(timestamp), tz=utc).isoformat() + return datetime.fromtimestamp(int(timestamp), tz=timezone.utc).isoformat()