MCPcopy Index your code
hub / github.com/python/mypy / good_repr

Function good_repr

mypy/test/helpers.py:355–364  ·  view source on GitHub ↗
(obj: object)

Source from the content-addressed store, hash-verified

353
354
355def good_repr(obj: object) -> str:
356 if isinstance(obj, str):
357 if obj.count("\n") > 1:
358 bits = ["'''\\"]
359 for line in obj.split("\n"):
360 # force repr to use ' not ", then cut it off
361 bits.append(repr('"' + line)[2:-1])
362 bits[-1] += "'''"
363 return "\n".join(bits)
364 return repr(obj)
365
366
367def assert_equal(a: object, b: object, fmt: str = "{} != {}") -> None:

Callers 1

assert_equalFunction · 0.85

Calls 6

isinstanceFunction · 0.85
reprFunction · 0.85
splitMethod · 0.80
appendMethod · 0.80
countMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…