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

Function bytes_decode

crates/vm/src/bytes_inner.rs:1134–1147  ·  view source on GitHub ↗
(
    zelf: PyObjectRef,
    args: DecodeArgs,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

1132}
1133
1134pub fn bytes_decode(
1135 zelf: PyObjectRef,
1136 args: DecodeArgs,
1137 vm: &VirtualMachine,
1138) -> PyResult<PyStrRef> {
1139 let DecodeArgs { encoding, errors } = args;
1140 let encoding = match encoding.as_ref() {
1141 None => crate::codecs::DEFAULT_ENCODING,
1142 Some(e) => e.as_str(),
1143 };
1144 vm.state
1145 .codec_registry
1146 .decode_text(zelf, encoding, errors, vm)
1147}
1148
1149fn hex_impl_no_sep(bytes: &[u8]) -> String {
1150 let mut buf: Vec<u8> = vec![0; bytes.len() * 2];

Callers 2

decodeMethod · 0.85
decodeMethod · 0.85

Calls 3

decode_textMethod · 0.80
as_refMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected