MCPcopy
hub / github.com/pandas-dev/pandas / _TextAdjustment

Class _TextAdjustment

pandas/io/formats/printing.py:521–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519
520
521class _TextAdjustment:
522 def __init__(self) -> None:
523 self.encoding = get_option("display.encoding")
524
525 def len(self, text: str) -> int:
526 return len(text)
527
528 def justify(self, texts: Any, max_len: int, mode: str = "right") -> list[str]:
529 """
530 Perform ljust, center, rjust against string or list-like
531 """
532 if mode == "left":
533 return [x.ljust(max_len) for x in texts]
534 elif mode == "center":
535 return [x.center(max_len) for x in texts]
536 else:
537 return [x.rjust(max_len) for x in texts]
538
539 def adjoin(self, space: int, *lists: Any, **kwargs: Any) -> str:
540 return adjoin(space, *lists, strlen=self.len, justfunc=self.justify, **kwargs)
541
542
543class _EastAsianTextAdjustment(_TextAdjustment):

Callers 1

get_adjustmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected