MCPcopy
hub / github.com/pydata/xarray / _stringify

Method _stringify

xarray/core/accessor_str.py:212–221  ·  view source on GitHub ↗

Convert a string-like to the correct string/bytes type. This is mostly here to tell mypy a pattern is a str/bytes not a re.Pattern.

(self, invar: Any)

Source from the content-addressed store, hash-verified

210 self._obj = obj
211
212 def _stringify(self, invar: Any) -> str | bytes | Any:
213 """
214 Convert a string-like to the correct string/bytes type.
215
216 This is mostly here to tell mypy a pattern is a str/bytes not a re.Pattern.
217 """
218 if hasattr(invar, "astype"):
219 return invar.astype(self._obj.dtype.kind)
220 else:
221 return self._obj.dtype.type(invar)
222
223 def _apply(
224 self,

Callers 15

_re_compileMethod · 0.95
__mod__Method · 0.95
slice_replaceMethod · 0.95
funcMethod · 0.95
catMethod · 0.95
formatMethod · 0.95
startswithMethod · 0.95
endswithMethod · 0.95
_padderMethod · 0.95
containsMethod · 0.95
stripMethod · 0.95
findMethod · 0.95

Calls 1

astypeMethod · 0.45

Tested by

no test coverage detected