Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <[email protected]>
  • Loading branch information
Adam.Dybbroe committed Jul 19, 2024
1 parent 26ce23d commit f68b9c4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyorbital/orbital.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,12 @@ def _get_tz_unaware_utctime(utc_time):
The input *utc_time* is either a timezone unaware object assumed to be in
UTC, or a timezone aware datetime object in UTC.
"""
if not hasattr(utc_time, 'tzinfo') or utc_time.tzinfo is None:
return utc_time
if isinstance(utc_time, datetime):
if utc_time.tzinfo and utc_time.tzinfo != pytz.utc:
raise AttributeError("UTC time expected! Parsing a timezone aware datetime object requires it to be UTC!")
return utc_time.replace(tzinfo=None)

if utc_time.tzinfo != pytz.utc:
raise AttributeError("UTC time expected! Parsing a timezone aware datetime object requires it to be UTC!")

return utc_time.replace(tzinfo=None)
return utc_time


def kep2xyz(kep):
Expand Down

0 comments on commit f68b9c4

Please sign in to comment.