summaryrefslogtreecommitdiff
path: root/text_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'text_utils.py')
-rw-r--r--text_utils.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/text_utils.py b/text_utils.py
index 46f3756..28ab755 100644
--- a/text_utils.py
+++ b/text_utils.py
@@ -307,12 +307,20 @@ def wrap_string(text: str, n: int) -> str:
class Indenter(contextlib.AbstractContextManager):
"""
- with Indenter(pad_count = 8) as i:
- i.print('test')
- with i:
- i.print('-ing')
+ Context manager that indents stuff (even recursively). e.g.::
+
+ with Indenter(pad_count = 8) as i:
+ i.print('test')
with i:
- i.print('1, 2, 3')
+ i.print('-ing')
+ with i:
+ i.print('1, 2, 3')
+
+ Yields::
+
+ test
+ -ing
+ 1, 2, 3
"""