MCPcopy Index your code
hub / github.com/plotly/plotly.py / encode_as_sage

Method encode_as_sage

_plotly_utils/utils.py:257–268  ·  view source on GitHub ↗

Attempt to convert sage.all.RR to floats and sage.all.ZZ to ints

(obj)

Source from the content-addressed store, hash-verified

255
256 @staticmethod
257 def encode_as_sage(obj):
258 """Attempt to convert sage.all.RR to floats and sage.all.ZZ to ints"""
259 sage_all = get_module("sage.all")
260 if not sage_all:
261 raise NotEncodable
262
263 if obj in sage_all.RR:
264 return float(obj)
265 elif obj in sage_all.ZZ:
266 return int(obj)
267 else:
268 raise NotEncodable
269
270 @staticmethod
271 def encode_as_pandas(obj):

Callers

nothing calls this directly

Calls 2

get_moduleFunction · 0.90
intFunction · 0.85

Tested by

no test coverage detected