(self, min_cftime_version=min_cftime_version)
| 131 | """Adapted from pandas.tseries.index._field_accessor""" |
| 132 | |
| 133 | def f(self, min_cftime_version=min_cftime_version): |
| 134 | if TYPE_CHECKING: |
| 135 | import cftime |
| 136 | else: |
| 137 | cftime = attempt_import("cftime") |
| 138 | |
| 139 | if Version(cftime.__version__) >= Version(min_cftime_version): |
| 140 | return get_date_field(self._data, name) |
| 141 | else: |
| 142 | raise ImportError( |
| 143 | f"The {name:!r} accessor requires a minimum " |
| 144 | f"version of cftime of {min_cftime_version}. Found an " |
| 145 | f"installed version of {cftime.__version__}." |
| 146 | ) |
| 147 | |
| 148 | f.__name__ = name |
| 149 | f.__doc__ = docstring |
nothing calls this directly
no test coverage detected