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

Method _padder

xarray/core/accessor_str.py:1329–1346  ·  view source on GitHub ↗

Wrapper function to handle padding operations

(
        self,
        *,
        func: Callable,
        width: int | Any,
        fillchar: str | bytes | Any = " ",
    )

Source from the content-addressed store, hash-verified

1327 return func(width=width, fillchar=fillchar)
1328
1329 def _padder(
1330 self,
1331 *,
1332 func: Callable,
1333 width: int | Any,
1334 fillchar: str | bytes | Any = " ",
1335 ) -> T_DataArray:
1336 """
1337 Wrapper function to handle padding operations
1338 """
1339 fillchar = self._stringify(fillchar)
1340
1341 def overfunc(x, iwidth, ifillchar):
1342 if len(ifillchar) != 1:
1343 raise TypeError("fillchar must be a character, not str")
1344 return func(x, int(iwidth), ifillchar)
1345
1346 return self._apply(func=overfunc, func_args=(width, fillchar))
1347
1348 def center(
1349 self, width: int | Any, fillchar: str | bytes | Any = " "

Callers 3

centerMethod · 0.95
ljustMethod · 0.95
rjustMethod · 0.95

Calls 2

_stringifyMethod · 0.95
_applyMethod · 0.95

Tested by

no test coverage detected