MCPcopy Index your code
hub / github.com/python/mypy / _encode_float_values

Function _encode_float_values

mypyc/codegen/literals.py:272–284  ·  view source on GitHub ↗

Encode float values into a C array values. The result contains the number of values followed by individual values.

(values: dict[float, int])

Source from the content-addressed store, hash-verified

270
271
272def _encode_float_values(values: dict[float, int]) -> list[str]:
273 """Encode float values into a C array values.
274
275 The result contains the number of values followed by individual values.
276 """
277 value_by_index = {index: value for value, index in values.items()}
278 result = []
279 num = len(values)
280 result.append(str(num))
281 for i in range(num):
282 value = value_by_index[i]
283 result.append(float_to_c(value))
284 return result
285
286
287def _encode_complex_values(values: dict[complex, int]) -> list[str]:

Callers 1

encoded_float_valuesMethod · 0.85

Calls 6

lenFunction · 0.85
strClass · 0.85
rangeClass · 0.85
float_to_cFunction · 0.85
appendMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…