MCPcopy
hub / github.com/psf/black / visit_dictsetmaker

Method visit_dictsetmaker

src/black/linegen.py:246–266  ·  view source on GitHub ↗
(self, node: Node)

Source from the content-addressed store, hash-verified

244 node.children[1].prefix = ""
245
246 def visit_dictsetmaker(self, node: Node) -> Iterator[Line]:
247 if Preview.wrap_long_dict_values_in_parens in self.mode:
248 for i, child in enumerate(node.children):
249 if i == 0:
250 continue
251 if node.children[i - 1].type == token.COLON:
252 if (
253 child.type == syms.atom
254 and child.children[0].type in OPENING_BRACKETS
255 and not is_walrus_assignment(child)
256 ):
257 maybe_make_parens_invisible_in_atom(
258 child,
259 parent=node,
260 mode=self.mode,
261 features=self.features,
262 remove_brackets_around_comma=False,
263 )
264 else:
265 wrap_in_parentheses(node, child, visible=False)
266 yield from self.visit_default(node)
267
268 def visit_funcdef(self, node: Node) -> Iterator[Line]:
269 """Visit function definition."""

Callers

nothing calls this directly

Calls 4

visit_defaultMethod · 0.95
is_walrus_assignmentFunction · 0.90
wrap_in_parenthesesFunction · 0.90

Tested by

no test coverage detected