diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b021663..6a50ac4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,6 @@ repos: - types-setuptools - types-PyYAML - types-requests - - types-pytz args: ["--python-version", "3.10", "--ignore-missing-imports"] - repo: https://github.com/pycqa/isort rev: 5.13.2 diff --git a/pyorbital/orbital.py b/pyorbital/orbital.py index 6f4e273..b33c9db 100644 --- a/pyorbital/orbital.py +++ b/pyorbital/orbital.py @@ -26,11 +26,10 @@ import logging import warnings -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from functools import partial import numpy as np -import pytz from scipy import optimize from pyorbital import astronomy, dt2np, tlefile @@ -1230,7 +1229,7 @@ def _get_tz_unaware_utctime(utc_time): UTC, or a timezone aware datetime object in UTC. """ if isinstance(utc_time, datetime): - if utc_time.tzinfo and utc_time.tzinfo != pytz.utc: + if utc_time.tzinfo and utc_time.tzinfo != timezone.utc: raise ValueError("UTC time expected! Parsing a timezone aware datetime object requires it to be UTC!") return utc_time.replace(tzinfo=None) diff --git a/pyorbital/tests/test_orbital.py b/pyorbital/tests/test_orbital.py index dbc5762..a05af24 100644 --- a/pyorbital/tests/test_orbital.py +++ b/pyorbital/tests/test_orbital.py @@ -23,12 +23,11 @@ """Test the geoloc orbital.""" import unittest -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from unittest import mock import numpy as np import pytest -import pytz from pyorbital import orbital @@ -415,7 +414,7 @@ def test_63(self): @pytest.mark.parametrize("dtime", [datetime(2024, 6, 25, 11, 0, 18), - datetime(2024, 6, 25, 11, 5, 0, 0, pytz.UTC), + datetime(2024, 6, 25, 11, 5, 0, 0, timezone.utc), np.datetime64("2024-06-25T11:10:00.000000") ] ) @@ -432,7 +431,7 @@ def test_get_last_an_time_scalar_input(dtime): @pytest.mark.parametrize("dtime", - [datetime(2024, 6, 25, 11, 5, 0, 0, pytz.timezone("Europe/Stockholm")), + [datetime(2024, 6, 25, 11, 5, 0, 0, timezone(timedelta(hours=1))), ] ) def test_get_last_an_time_wrong_input(dtime): diff --git a/pyproject.toml b/pyproject.toml index a648767..b1e41c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,6 @@ authors = [ dependencies = ["numpy>=1.19.0", "scipy", "requests", - "pytz", "defusedxml", ] readme = "README.md"