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

Method name

crates/stdlib/src/unicodedata.rs:142–157  ·  view source on GitHub ↗
(
            &self,
            character: PyStrRef,
            default: OptionalArg<PyObjectRef>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

140
141 #[pymethod]
142 fn name(
143 &self,
144 character: PyStrRef,
145 default: OptionalArg<PyObjectRef>,
146 vm: &VirtualMachine,
147 ) -> PyResult {
148 let c = self.extract_char(character, vm)?;
149
150 if let Some(c) = c
151 && self.check_age(c)
152 && let Some(name) = c.to_char().and_then(unicode_names2::name)
153 {
154 return Ok(vm.ctx.new_str(name.to_string()).into());
155 }
156 default.ok_or_else(|| vm.new_value_error("no such name"))
157 }
158
159 #[pymethod]
160 fn bidirectional(

Callers

nothing calls this directly

Calls 6

extract_charMethod · 0.80
check_ageMethod · 0.80
to_stringMethod · 0.80
ok_or_elseMethod · 0.80
to_charMethod · 0.45
new_strMethod · 0.45

Tested by

no test coverage detected