MCPcopy Create free account
hub / github.com/Glyphack/enderpy / get_value

Function get_value

compat/ast_python.py:90–110  ·  view source on GitHub ↗
(attr_value)

Source from the content-addressed store, hash-verified

88
89
90def get_value(attr_value):
91 if attr_value is None:
92 return attr_value
93 if isinstance(attr_value, BUILTIN_PURE):
94 return attr_value
95 if isinstance(attr_value, BUILTIN_BYTES):
96 return decode_bytes(attr_value)
97 if isinstance(attr_value, BUILTIN_STR):
98 return decode_str(attr_value)
99 if isinstance(attr_value, complex):
100 return str(attr_value)
101 if isinstance(attr_value, list):
102 return [get_value(x) for x in attr_value]
103 if isinstance(attr_value, AST):
104 return ast2json(attr_value)
105 if isinstance(attr_value, type(Ellipsis)):
106 return "..."
107 else:
108 raise Exception(
109 "Unknown case for '%s' of type '%s'" % (attr_value, type(attr_value))
110 )
111
112
113# -------------------------------------------------------------------- End inline dependency ------

Callers 1

ast2jsonFunction · 0.85

Calls 3

decode_bytesFunction · 0.85
decode_strFunction · 0.85
ast2jsonFunction · 0.85

Tested by

no test coverage detected