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

Function chr

crates/vm/src/stdlib/builtins.rs:87–94  ·  view source on GitHub ↗
(i: PyIntRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

85
86 #[pyfunction]
87 fn chr(i: PyIntRef, vm: &VirtualMachine) -> PyResult<CodePoint> {
88 let value = i
89 .as_bigint()
90 .to_u32()
91 .and_then(CodePoint::from_u32)
92 .ok_or_else(|| vm.new_value_error("chr() arg not in range(0x110000)"))?;
93 Ok(value)
94 }
95
96 #[derive(FromArgs)]
97 #[allow(dead_code)]

Callers 15

Proc0Function · 0.85
__calc_date_timeMethod · 0.85
unicode_internal_decodeFunction · 0.85
PyUnicode_DecodeUTF7Function · 0.85
unicodeescape_stringFunction · 0.85
PyUnicode_DecodeASCIIFunction · 0.85
PyUnicode_DecodeLatin1Function · 0.85
hexescapeFunction · 0.85
PyUnicode_DecodeCharmapFunction · 0.85

Calls 3

ok_or_elseMethod · 0.80
as_bigintMethod · 0.80
to_u32Method · 0.45

Tested by 15

test_raw_encodeMethod · 0.68
test_raw_decodeMethod · 0.68
test_escape_encodeMethod · 0.68
test_decode_warningsMethod · 0.68
test_raw_encodeMethod · 0.68
test_raw_decodeMethod · 0.68
test_escape_encodeMethod · 0.68
test_escape_decodeMethod · 0.68
test_xmlcharrefvaluesMethod · 0.68