MCPcopy Index your code
hub / github.com/RustPython/RustPython / visit_Subscript

Method visit_Subscript

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

Source from the content-addressed store, hash-verified

945 self.traverse(e)
946
947 def visit_Subscript(self, node):
948 def is_non_empty_tuple(slice_value):
949 return (
950 isinstance(slice_value, Tuple)
951 and slice_value.elts
952 )
953
954 self.set_precedence(_Precedence.ATOM, node.value)
955 self.traverse(node.value)
956 with self.delimit("[", "]"):
957 if is_non_empty_tuple(node.slice):
958 # parentheses can be omitted if the tuple isn't empty
959 self.items_view(self.traverse, node.slice.elts)
960 else:
961 self.traverse(node.slice)
962
963 def visit_Starred(self, node):
964 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