MCPcopy Index your code
hub / github.com/RustPython/RustPython / fromhex

Method fromhex

crates/vm/src/builtins/float.rs:391–395  ·  view source on GitHub ↗
(cls: PyTypeRef, string: PyUtf8StrRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

389
390 #[pyclassmethod]
391 fn fromhex(cls: PyTypeRef, string: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult {
392 let result = crate::literal::float::from_hex(string.as_str().trim())
393 .ok_or_else(|| vm.new_value_error("invalid hexadecimal floating-point string"))?;
394 PyType::call(&cls, vec![vm.ctx.new_float(result).into()].into(), vm)
395 }
396
397 #[pymethod]
398 fn hex(&self) -> String {

Callers

nothing calls this directly

Calls 5

from_hexFunction · 0.85
ok_or_elseMethod · 0.80
trimMethod · 0.80
callFunction · 0.50
as_strMethod · 0.45

Tested by

no test coverage detected