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

Method _get_res

xarray/core/accessor_str.py:2251–2265  ·  view source on GitHub ↗
(val, ipat, imaxcount=maxcount, dtype=self._obj.dtype)

Source from the content-addressed store, hash-verified

2249 )
2250
2251 def _get_res(val, ipat, imaxcount=maxcount, dtype=self._obj.dtype):
2252 if ipat.groups == 0:
2253 raise ValueError("No capture groups found in pattern.")
2254 matches = ipat.findall(val)
2255 res = np.zeros([maxcount, ipat.groups], dtype)
2256
2257 if ipat.groups == 1:
2258 for imatch, match in enumerate(matches):
2259 res[imatch, 0] = match
2260 else:
2261 for imatch, match in enumerate(matches):
2262 for jmatch, submatch in enumerate(match):
2263 res[imatch, jmatch] = submatch
2264
2265 return res
2266
2267 return duck_array_ops.astype(
2268 self._apply(

Callers

nothing calls this directly

Calls 1

findallMethod · 0.80

Tested by

no test coverage detected