]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/jedi/common.py
Configuracion en desarrollo PC pega
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / jedi / common.py
CommitLineData
53e6db90
DC
1from contextlib import contextmanager
2
3
4@contextmanager
5def monkeypatch(obj, attribute_name, new_value):
6 """
7 Like pytest's monkeypatch, but as a value manager.
8 """
9 old_value = getattr(obj, attribute_name)
10 try:
11 setattr(obj, attribute_name, new_value)
12 yield
13 finally:
14 setattr(obj, attribute_name, old_value)
15
16
17def indent_block(text, indention=' '):
18 """This function indents a text block with a default of four spaces."""
19 temp = ''
20 while text and text[-1] == '\n':
21 temp += text[-1]
22 text = text[:-1]
23 lines = text.split('\n')
24 return '\n'.join(map(lambda s: indention + s, lines)) + temp