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

Function lookup

crates/vm/src/stdlib/_codecs.rs:31–39  ·  view source on GitHub ↗
(encoding: PyUtf8StrRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

29
30 #[pyfunction]
31 fn lookup(encoding: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult {
32 if encoding.as_str().contains('\0') {
33 return Err(cstring_error(vm));
34 }
35 vm.state
36 .codec_registry
37 .lookup(encoding.as_str(), vm)
38 .map(|codec| codec.into_tuple().into())
39 }
40
41 #[derive(FromArgs)]
42 struct CodeArgs {

Callers 9

find_cookieFunction · 0.90
openFunction · 0.50
EncodedFileFunction · 0.50
getencoderFunction · 0.50
getdecoderFunction · 0.50
getincrementalencoderFunction · 0.50
getincrementaldecoderFunction · 0.50
getreaderFunction · 0.50
getwriterFunction · 0.50

Calls 7

cstring_errorFunction · 0.85
ErrClass · 0.50
containsMethod · 0.45
as_strMethod · 0.45
mapMethod · 0.45
lookupMethod · 0.45
into_tupleMethod · 0.45

Tested by

no test coverage detected