From 3a9ca33d3135c15510470f68f14936db043af6bd Mon Sep 17 00:00:00 2001 From: John Sirois Date: Fri, 24 Jan 2025 12:07:40 -0800 Subject: [PATCH] Trim obscene amount of output for Target reprs. --- pex/targets.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pex/targets.py b/pex/targets.py index e70323966..7efa6c342 100644 --- a/pex/targets.py +++ b/pex/targets.py @@ -43,7 +43,7 @@ def __bool__(self): __nonzero__ = __bool__ -@attr.s(frozen=True) +@attr.s(frozen=True, repr=False) class Target(object): id = attr.ib() # type: str platform = attr.ib() # type: Platform @@ -195,8 +195,12 @@ def __str__(self): def render_description(self): raise NotImplementedError() + def __repr__(self): + # type: () -> str + return "{clazz}({self!r})".format(clazz=type(self).__name__, self=str(self)) -@attr.s(frozen=True) + +@attr.s(frozen=True, repr=False) class LocalInterpreter(Target): @classmethod def create(cls, interpreter=None): @@ -248,7 +252,7 @@ def render_description(self): ) -@attr.s(frozen=True) +@attr.s(frozen=True, repr=False) class AbbreviatedPlatform(Target): @classmethod def create(cls, platform): @@ -273,7 +277,7 @@ def current(): return LocalInterpreter.create() -@attr.s(frozen=True) +@attr.s(frozen=True, repr=False) class CompletePlatform(Target): @classmethod def from_interpreter(cls, interpreter):