download
raw
668 Bytes
from contextlib import contextmanager
@contextmanager
def monkeypatch(obj, attribute_name, new_value):
"""
Like pytest's monkeypatch, but as a value manager.
"""
old_value = getattr(obj, attribute_name)
try:
setattr(obj, attribute_name, new_value)
yield
finally:
setattr(obj, attribute_name, old_value)
def indent_block(text, indention=' '):
"""This function indents a text block with a default of four spaces."""
temp = ''
while text and text[-1] == '\n':
temp += text[-1]
text = text[:-1]
lines = text.split('\n')
return '\n'.join(map(lambda s: indention + s, lines)) + temp

Xet Storage Details

Size:
668 Bytes
·
Xet hash:
50c5b2dadb55462ed4a47a63b39a2b143f4da783742601c98932584804dcef80

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