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

Function is_printable

crates/literal/src/char.rs:12–15  ·  view source on GitHub ↗

According to python following categories aren't printable: Cc (Other, Control) Cf (Other, Format) Cs (Other, Surrogate) Co (Other, Private Use) Cn (Other, Not Assigned) Zl Separator, Line ('\u2028', LINE SEPARATOR) Zp Separator, Paragraph ('\u2029', PARAGRAPH SEPARATOR) Zs (Separator, Space) other than ASCII space('\x20').

(c: char)

Source from the content-addressed store, hash-verified

10/// * Zp Separator, Paragraph ('\u2029', PARAGRAPH SEPARATOR)
11/// * Zs (Separator, Space) other than ASCII space('\x20').
12pub fn is_printable(c: char) -> bool {
13 let cat = GeneralCategory::of(c);
14 !(cat.is_other() || cat.is_separator())
15}

Callers 3

isprintableMethod · 0.85
escaped_char_lenMethod · 0.85
write_charMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected