MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _repr_base

Class _repr_base

lib/sqlalchemy/sql/util.py:551–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549
550
551class _repr_base:
552 _LIST: int = 0
553 _TUPLE: int = 1
554 _DICT: int = 2
555
556 __slots__ = ("max_chars",)
557
558 max_chars: int
559
560 def trunc(self, value: Any) -> str:
561 rep = repr(value)
562 lenrep = len(rep)
563 if lenrep > self.max_chars:
564 segment_length = self.max_chars // 2
565 rep = (
566 rep[0:segment_length]
567 + (
568 " ... (%d characters truncated) ... "
569 % (lenrep - self.max_chars)
570 )
571 + rep[-segment_length:]
572 )
573 return rep
574
575
576def _repr_single_value(value):

Callers 1

_repr_single_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected