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

Method visit_Subscript

Lib/_ast_unparse.py:951–965  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

949 self.traverse(e)
950
951 def visit_Subscript(self, node):
952 def is_non_empty_tuple(slice_value):
953 return (
954 isinstance(slice_value, Tuple)
955 and slice_value.elts
956 )
957
958 self.set_precedence(_Precedence.ATOM, node.value)
959 self.traverse(node.value)
960 with self.delimit("[", "]"):
961 if is_non_empty_tuple(node.slice):
962 # parentheses can be omitted if the tuple isn't empty
963 self.items_view(self.traverse, node.slice.elts)
964 else:
965 self.traverse(node.slice)
966
967 def visit_Starred(self, node):
968 self.write("*")

Callers

nothing calls this directly

Calls 4

set_precedenceMethod · 0.95
traverseMethod · 0.95
delimitMethod · 0.95
items_viewMethod · 0.95

Tested by

no test coverage detected