Skip to content

Commit

Permalink
Merge pull request #175 from djhoese/remove-pytz-dep
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese authored Dec 12, 2024
2 parents 03e220f + 16f71f7 commit b3bb0ad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions pyorbital/orbital.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 3 additions & 4 deletions pyorbital/tests/test_orbital.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
]
)
Expand All @@ -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):
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ authors = [
dependencies = ["numpy>=1.19.0",
"scipy",
"requests",
"pytz",
"defusedxml",
]
readme = "README.md"
Expand Down

0 comments on commit b3bb0ad

Please sign in to comment.