MCPcopy Index your code
hub / github.com/pydata/xarray / __sub__

Method __sub__

xarray/coding/cftime_offsets.py:135–146  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

133 return self.__apply__(other)
134
135 def __sub__(self, other):
136 if TYPE_CHECKING:
137 import cftime
138 else:
139 cftime = attempt_import("cftime")
140
141 if isinstance(other, cftime.datetime):
142 raise TypeError("Cannot subtract a cftime.datetime from a time offset.")
143 elif type(other) is type(self):
144 return type(self)(self.n - other.n)
145 else:
146 return NotImplemented
147
148 def __mul__(self, other: int) -> Self:
149 if not isinstance(other, int):

Callers

nothing calls this directly

Calls 2

attempt_importFunction · 0.90
typeFunction · 0.85

Tested by

no test coverage detected