MCPcopy Index your code
hub / github.com/python/cpython / block

Method block

Lib/_ast_unparse.py:119–130  ·  view source on GitHub ↗

A context manager for preparing the source for blocks. It adds the character':', increases the indentation on enter and decreases the indentation on exit. If *extra* is given, it will be directly appended after the colon character.

(self, *, extra = None)

Source from the content-addressed store, hash-verified

117
118 @contextmanager
119 def block(self, *, extra = None):
120 """A context manager for preparing the source for blocks. It adds
121 the character':', increases the indentation on enter and decreases
122 the indentation on exit. If *extra* is given, it will be directly
123 appended after the colon character.
124 """
125 self.write(":")
126 if extra:
127 self.write(extra)
128 self._indent += 1
129 yield
130 self._indent -= 1
131
132 @contextmanager
133 def delimit(self, start, end):

Callers 12

do_visit_tryMethod · 0.95
visit_ExceptHandlerMethod · 0.95
visit_ClassDefMethod · 0.95
_function_helperMethod · 0.95
_for_helperMethod · 0.95
visit_IfMethod · 0.95
visit_WhileMethod · 0.95
visit_WithMethod · 0.95
visit_AsyncWithMethod · 0.95
visit_MatchMethod · 0.95
visit_match_caseMethod · 0.95
test_blockMethod · 0.45

Calls 1

writeMethod · 0.95

Tested by 1

test_blockMethod · 0.36