firestryker's picture
download
raw
778 Bytes
from __future__ import annotations
def tracemalloc_message(source: object) -> str:
if source is None:
return ""
try:
import tracemalloc
except ImportError:
return ""
tb = tracemalloc.get_object_traceback(source)
if tb is not None:
formatted_tb = "\n".join(tb.format())
# Use a leading new line to better separate the (large) output
# from the traceback to the previous warning text.
return f"\nObject allocated at:\n{formatted_tb}"
# No need for a leading new line.
url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings"
return (
"Enable tracemalloc to get traceback where the object was allocated.\n"
f"See {url} for more info."
)

Xet Storage Details

Size:
778 Bytes
·
Xet hash:
e8d163812353b8322f80fac4d27f5543df79284ddbf6aeaa7ad3b0c8aa87afcf

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.