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

Method is_normalized

crates/stdlib/src/unicodedata.rs:202–211  ·  view source on GitHub ↗
(&self, form: super::NormalizeForm, unistr: PyStrRef)

Source from the content-addressed store, hash-verified

200
201 #[pymethod]
202 fn is_normalized(&self, form: super::NormalizeForm, unistr: PyStrRef) -> PyResult<bool> {
203 let text = unistr.as_wtf8();
204 let normalized: Wtf8Buf = match form {
205 Nfc => text.map_utf8(|s| s.nfc()).collect(),
206 Nfkc => text.map_utf8(|s| s.nfkc()).collect(),
207 Nfd => text.map_utf8(|s| s.nfd()).collect(),
208 Nfkd => text.map_utf8(|s| s.nfkd()).collect(),
209 };
210 Ok(text == &*normalized)
211 }
212
213 #[pymethod]
214 fn mirrored(&self, character: PyStrRef, vm: &VirtualMachine) -> PyResult<i32> {

Callers 1

Calls 3

collectMethod · 0.80
map_utf8Method · 0.80
as_wtf8Method · 0.45

Tested by 1