Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pytz dependency #175

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
djhoese marked this conversation as resolved.
Show resolved Hide resolved
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
Loading