MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / _wrap_text

Function _wrap_text

site-packages/matplotlib/text.py:37–48  ·  view source on GitHub ↗

Temporarily inserts newlines to the text if the wrap option is enabled.

(textobj)

Source from the content-addressed store, hash-verified

35
36@contextlib.contextmanager
37def _wrap_text(textobj):
38 """Temporarily inserts newlines to the text if the wrap option is enabled.
39 """
40 if textobj.get_wrap():
41 old_text = textobj.get_text()
42 try:
43 textobj.set_text(textobj._get_wrapped_text())
44 yield textobj
45 finally:
46 textobj.set_text(old_text)
47 else:
48 yield textobj
49
50
51# Extracted from Text's method to serve as a function

Callers 1

drawMethod · 0.85

Calls 4

get_wrapMethod · 0.80
_get_wrapped_textMethod · 0.80
get_textMethod · 0.45
set_textMethod · 0.45

Tested by

no test coverage detected