MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _repr_base

Class _repr_base

lib/sqlalchemy/sql/util.py:561–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559
560
561class _repr_base:
562 _LIST: int = 0
563 _TUPLE: int = 1
564 _DICT: int = 2
565
566 __slots__ = ("max_chars",)
567
568 max_chars: int
569
570 def trunc(self, value: Any) -> str:
571 rep = repr(value)
572 lenrep = len(rep)
573 if lenrep > self.max_chars:
574 segment_length = self.max_chars // 2
575 rep = (
576 rep[0:segment_length]
577 + (
578 " ... (%d characters truncated) ... "
579 % (lenrep - self.max_chars)
580 )
581 + rep[-segment_length:]
582 )
583 return rep
584
585
586def _repr_single_value(value):

Callers 1

_repr_single_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected