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

Typing of str and dt accessors #6641

Merged
merged 3 commits into from
May 26, 2022
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
6 changes: 5 additions & 1 deletion xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import warnings
from datetime import datetime, timedelta
from functools import partial
from typing import TYPE_CHECKING

import numpy as np
import pandas as pd
Expand All @@ -27,6 +28,9 @@
except ImportError:
cftime = None

if TYPE_CHECKING:
from ..core.types import CFCalendar

# standard calendars recognized by cftime
_STANDARD_CALENDARS = {"standard", "gregorian", "proleptic_gregorian"}

Expand Down Expand Up @@ -344,7 +348,7 @@ def _infer_time_units_from_diff(unique_timedeltas):
return "seconds"


def infer_calendar_name(dates):
def infer_calendar_name(dates) -> "CFCalendar":
"""Given an array of datetimes, infer the CF calendar name"""
if is_np_datetime_like(dates.dtype):
return "proleptic_gregorian"
Expand Down
Loading