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

Function asdl_of

Parser/asdl_c.py:95–109  ·  view source on GitHub ↗
(name, obj)

Source from the content-addressed store, hash-verified

93 )
94
95def asdl_of(name, obj):
96 if isinstance(obj, asdl.Product) or isinstance(obj, asdl.Constructor):
97 fields = ", ".join(map(str, obj.fields))
98 if fields:
99 fields = "({})".format(fields)
100 return "{}{}".format(name, fields)
101 else:
102 if is_simple(obj):
103 types = " | ".join(type.name for type in obj.types)
104 else:
105 sep = "\n{}| ".format(" " * (len(name) + 1))
106 types = sep.join(
107 asdl_of(type.name, type) for type in obj.types
108 )
109 return "{} = {}".format(name, types)
110
111class EmitVisitor(asdl.VisitorBase):
112 """Visit that emits lines"""

Callers 3

visitProductMethod · 0.85
visitSumMethod · 0.85
visitConstructorMethod · 0.85

Calls 3

is_simpleFunction · 0.85
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…