MCPcopy Create free account
hub / github.com/astral-sh/ruff / is_mangled_private

Function is_mangled_private

crates/ruff_python_stdlib/src/identifiers.rs:50–52  ·  view source on GitHub ↗

Returns `true` if a string is a private identifier, such that, when the identifier is defined in a class definition, it will be mangled prior to code generation. See: .

(id: &str)

Source from the content-addressed store, hash-verified

48///
49/// See: <https://docs.python.org/3/reference/expressions.html#private-name-mangling>.
50pub fn is_mangled_private(id: &str) -> bool {
51 id.starts_with("__") && !id.ends_with("__")
52}
53
54/// Returns `true` if a string is a PEP 8-compliant module name (i.e., consists of lowercase
55/// letters, numbers, underscores, and is not a keyword).

Callers 8

check_class_declarationFunction · 0.85
check_instance_overridesFunction · 0.85
delattr_with_constantFunction · 0.85
setattr_with_constantFunction · 0.85
getattr_with_constantFunction · 0.85

Calls 2

ends_withMethod · 0.80
starts_withMethod · 0.45

Tested by

no test coverage detected