File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -597,22 +597,15 @@ def buffer(self):
597
597
self ._buffer .clear ()
598
598
return value
599
599
600
- class _Block :
600
+ @contextmanager
601
+ def block (self ):
601
602
"""A context manager for preparing the source for blocks. It adds
602
603
the character':', increases the indentation on enter and decreases
603
604
the indentation on exit."""
604
- def __init__ (self , unparser ):
605
- self .unparser = unparser
606
-
607
- def __enter__ (self ):
608
- self .unparser .write (":" )
609
- self .unparser ._indent += 1
610
-
611
- def __exit__ (self , exc_type , exc_value , traceback ):
612
- self .unparser ._indent -= 1
613
-
614
- def block (self ):
615
- return self ._Block (self )
605
+ self .write (":" )
606
+ self ._indent += 1
607
+ yield
608
+ self ._indent -= 1
616
609
617
610
@contextmanager
618
611
def delimit (self , start , end ):
You can’t perform that action at this time.
0 commit comments