srcmetrics 0.1.0

Language-independent source code metrics (size, complexity, nesting, Halstead, duplication, dependencies, documentation) for C, C++, Go, Java, JavaScript, Python, Rust and TypeScript
Documentation
//! Python mapping (tree-sitter-python).

use super::Mapping;
use crate::ir::NodeKind::*;

pub static MAPPING: Mapping = Mapping {
    language: "python",
    extensions: &["py"],
    grammar: || tree_sitter_python::LANGUAGE.into(),
    grammar_crate: ("tree-sitter-python", "0.25.0"),
    kinds: &[
        ("block", Block),
        ("expression_statement", Statement),
        ("pass_statement", Statement),
        ("assert_statement", Statement),
        ("delete_statement", Statement),
        ("global_statement", Statement),
        ("nonlocal_statement", Statement),
        ("with_statement", Statement),
        ("if_statement", Branch),
        ("elif_clause", Branch),
        ("else_clause", Else),
        ("if_clause", Branch),
        ("for_statement", Loop),
        ("while_statement", Loop),
        ("for_in_clause", Loop),
        ("case_clause", Case),
        ("except_clause", Catch),
        ("return_statement", Return),
        ("break_statement", Jump),
        ("continue_statement", Jump),
        ("raise_statement", Jump),
        ("call", Call),
        ("assignment", Assignment),
        ("augmented_assignment", Assignment),
        ("binary_operator", Binary),
        ("comparison_operator", Binary),
        ("boolean_operator", Logical),
        ("not_operator", Unary),
        ("unary_operator", Unary),
        ("conditional_expression", Conditional),
        ("subscript", Expression),
        ("attribute", Expression),
        ("parenthesized_expression", Expression),
        ("identifier", Identifier),
        ("integer", Literal),
        ("float", Literal),
        ("string", Literal),
        ("concatenated_string", Literal),
        ("true", Literal),
        ("false", Literal),
        ("none", Literal),
        ("import_statement", Import),
        ("import_from_statement", Import),
        ("function_definition", Function),
        ("lambda", Function),
    ],
    callee_fields: &["function"],
    logical_operators: &[],
    else_field: None,
    default_case_keyword: None,
    comments: &["comment"],
    literals: &[
        "integer",
        "float",
        "string",
        "concatenated_string",
        "true",
        "false",
        "none",
    ],
    interpolations: &["interpolation"],
    identifiers: &["identifier"],
    name_fields: &["name"],
    decorators: &["decorator"],
    docstring: Some("string"),
    parameter_fields: &["parameters"],
    ignored_parameters: &["*", "/"],
};