MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_class_signature

Method build_class_signature

atomic-semantic/src/parsers/python.rs:330–343  ·  view source on GitHub ↗

Build a class signature string.

(&self, node: &Node, source: &str)

Source from the content-addressed store, hash-verified

328
329 /// Build a class signature string.
330 fn build_class_signature(&self, node: &Node, source: &str) -> Option<String> {
331 let name_node = node.child_by_field_name("name")?;
332 let name = self.node_text(&name_node, source);
333
334 // Check for base classes in superclasses/argument_list
335 let bases = node
336 .child_by_field_name("superclasses")
337 .map(|n| self.node_text(&n, source));
338
339 match bases {
340 Some(b) if !b.is_empty() && b != "()" => Some(format!("class {}{}", name, b)),
341 _ => Some(format!("class {}", name)),
342 }
343 }
344
345 /// Get the text content of a node.
346 fn node_text(&self, node: &Node, source: &str) -> String {

Callers 1

extract_classMethod · 0.45

Calls 2

node_textMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected