pub struct Python;Expand description
Python language support.
Trait Implementations§
Source§impl Language for Python
impl Language for Python
Source§fn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
File extensions this language handles (e.g., [“py”, “pyi”, “pyw”])
Source§fn grammar_name(&self) -> &'static str
fn grammar_name(&self) -> &'static str
Grammar name for arborium (e.g., “python”, “rust”)
Source§fn as_symbols(&self) -> Option<&dyn LanguageSymbols>
fn as_symbols(&self) -> Option<&dyn LanguageSymbols>
Capability query: returns
Some(self) if this language has code symbols
(functions, classes, types, etc.). Returns None for config/data languages.
Implement LanguageSymbols and override this to opt in.Source§fn extract_docstring(&self, node: &Node<'_>, content: &str) -> Option<String>
fn extract_docstring(&self, node: &Node<'_>, content: &str) -> Option<String>
Extract the docstring for a definition node.
Called by generic extraction for every tagged symbol.
Returns None if this language has no docstring convention or the node has no docstring.
Source§fn extract_implements(&self, node: &Node<'_>, content: &str) -> ImplementsInfo
fn extract_implements(&self, node: &Node<'_>, content: &str) -> ImplementsInfo
Extract interfaces/traits/superclasses that a container node implements/extends.
Called by generic extraction for container nodes only.
Source§fn build_signature(&self, node: &Node<'_>, content: &str) -> String
fn build_signature(&self, node: &Node<'_>, content: &str) -> String
Build the display signature for a definition node.
Default: first line of the node’s source text (trimmed).
Override for languages where first-line is incomplete (e.g. Rust, Go, Java).
Source§fn extract_imports(&self, node: &Node<'_>, content: &str) -> Vec<Import>
fn extract_imports(&self, node: &Node<'_>, content: &str) -> Vec<Import>
Extract imports from an import node (may return multiple)
Source§fn format_import(&self, import: &Import, names: Option<&[&str]>) -> String
fn format_import(&self, import: &Import, names: Option<&[&str]>) -> String
Format an import as source code.
If
names is Some, only include those names (for multi-import filtering).
If names is None, format the complete import.Source§fn extract_attributes(&self, node: &Node<'_>, content: &str) -> Vec<String>
fn extract_attributes(&self, node: &Node<'_>, content: &str) -> Vec<String>
Extract attributes/annotations/decorators attached to a definition node.
Called by generic extraction for every tagged symbol.
Returns empty vec if this language has no attribute convention.
Source§fn get_visibility(&self, node: &Node<'_>, content: &str) -> Visibility
fn get_visibility(&self, node: &Node<'_>, content: &str) -> Visibility
Get visibility of a node. Read more
Source§fn is_test_symbol(&self, symbol: &Symbol) -> bool
fn is_test_symbol(&self, symbol: &Symbol) -> bool
Check if a symbol is a test (for filtering).
Source§fn test_file_globs(&self) -> &'static [&'static str]
fn test_file_globs(&self) -> &'static [&'static str]
Glob patterns (relative, using
** wildcards) that identify dedicated test files.
Used to build a GlobSet for fast batch matching.
Return &[] for languages with no dedicated test files (e.g. those using only inline tests).Source§fn extract_module_doc(&self, src: &str) -> Option<String>
fn extract_module_doc(&self, src: &str) -> Option<String>
Extract the module-level doc comment from raw file source. Read more
Source§fn body_has_docstring(&self, body: &Node<'_>, content: &str) -> bool
fn body_has_docstring(&self, body: &Node<'_>, content: &str) -> bool
Detect if first child of body is a docstring
Source§fn container_body<'a>(&self, node: &'a Node<'a>) -> Option<Node<'a>>
fn container_body<'a>(&self, node: &'a Node<'a>) -> Option<Node<'a>>
Find the body node of a container (for prepend/append)
Source§fn analyze_container_body(
&self,
body_node: &Node<'_>,
content: &str,
inner_indent: &str,
) -> Option<ContainerBody>
fn analyze_container_body( &self, body_node: &Node<'_>, content: &str, inner_indent: &str, ) -> Option<ContainerBody>
Analyze a container body node and return the editable byte range.
body_node is the node returned by container_body.
Returns None if this language doesn’t support container body editing.Source§fn refine_kind(
&self,
node: &Node<'_>,
_content: &str,
tag_kind: SymbolKind,
) -> SymbolKind
fn refine_kind( &self, node: &Node<'_>, _content: &str, tag_kind: SymbolKind, ) -> SymbolKind
Refine the symbol kind for a tagged node.
Called after tag classification assigns an initial kind (e.g.
definition.class → Class).
Languages can override this to return a more specific kind based on the node’s concrete type.
Default: return tag_kind unchanged.Source§fn signature_suffix(&self) -> &'static str
fn signature_suffix(&self) -> &'static str
Suffix to append to signatures for tree-sitter parsing.
Function signatures are incomplete code fragments that need closing tokens
to parse correctly (e.g., Rust
fn foo() needs {}, Lua function foo() needs end).
Returns the suffix to append, or empty string if none needed.Source§fn as_embedded(&self) -> Option<&dyn LanguageEmbedded>
fn as_embedded(&self) -> Option<&dyn LanguageEmbedded>
Capability query: returns
Some(self) if this language can contain embedded blocks
in another language (e.g., JS in Vue, CSS in HTML). Returns None for most languages.
Implement LanguageEmbedded and override this to opt in.impl LanguageSymbols for Python
Auto Trait Implementations§
impl Freeze for Python
impl RefUnwindSafe for Python
impl Send for Python
impl Sync for Python
impl Unpin for Python
impl UnsafeUnpin for Python
impl UnwindSafe for Python
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request