MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _to_float

Function _to_float

lib/matplotlib/_afm.py:51–59  ·  view source on GitHub ↗
(x: bytes | str)

Source from the content-addressed store, hash-verified

49
50
51def _to_float(x: bytes | str) -> float:
52 # Some AFM files use "," instead of "." as decimal separator -- this
53 # shouldn't be ambiguous (unless someone is wicked enough to use "," as
54 # thousands separator...).
55 if isinstance(x, bytes):
56 # Encoding doesn't really matter -- if we have codepoints >127 the call
57 # to float() will error anyways.
58 x = x.decode('latin-1')
59 return float(x.replace(',', '.'))
60
61
62def _to_str(x: bytes) -> str:

Callers 4

_to_list_of_floatsFunction · 0.85
_parse_char_metricsFunction · 0.85
_parse_kern_pairsFunction · 0.85
_parse_compositesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…