Module Import alias Import alias Import alias ImportFrom alias ImportFrom alias identifier ImportFrom alias identifier ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr Dict Str Str BinOpMult ListLoad Num Call NameLoad AttributeLoad NameLoad attr BinOpMult ListLoad Num Call NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign NameStore BinOpAdd BinOpAdd AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Return Call AttributeLoad NameLoad attr NameLoad For NameStore AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr BinOpAdd BinOpAdd NameLoad Str AttributeLoad NameLoad attr orelse Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr BinOpAdd BinOpAdd NameLoad Str AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd BinOpAdd NameLoad Str AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Dict Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr If CompareIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Return NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str Call NameLoad Call NameLoad NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore BinOpAdd Str NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str NameLoad Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body AugAssignSub AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Call NameLoad Call NameLoad NameLoad If BoolOpOr Call NameLoad NameLoad AttributeLoad NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body If Call NameLoad NameLoad NameLoad body Assign NameStore BinOpSub Call NameLoad NameLoad Num For TupleStore NameStore NameStore Call NameLoad NameLoad body If Call NameLoad NameLoad AttributeLoad NameLoad attr body If CompareLt NameLoad NameLoad body Expr Call NameLoad NameLoad Str SubscriptLoad NameLoad Index BinOpAdd NameLoad Num orelse Expr Call NameLoad NameLoad Str NameLoad Expr Call NameLoad NameLoad Str NameLoad If Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad Str NameLoad Expr Call NameLoad NameLoad Str NameLoad If Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call NameLoad Call NameLoad AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A ast N/A logging N/A operator bandit.core constants bandit.core tester b_tester bandit.core utils b_utils bandit.core.utils InvalidModulePath N/A logger N/A N/A logging getLogger __name__ BanditNodeVisitor N/A object N/A __init__ N/A N/A self fname metaast testset debug nosec_lines metrics N/A N/A N/A N/A self debug debug N/A N/A self nosec_lines nosec_lines N/A N/A self seen 0 N/A N/A self scores N/A SEVERITY CONFIDENCE N/A N/A 0 N/A len N/A constants RANKING N/A N/A 0 N/A len N/A constants RANKING N/A N/A self depth 0 N/A N/A self fname fname N/A N/A self metaast metaast N/A N/A self testset testset N/A N/A self imports N/A set N/A N/A self import_aliases N/A N/A N/A self tester N/A N/A b_tester BanditTester N/A self testset N/A self debug nosec_lines N/A N/A N/A N/A self namespace N/A N/A b_utils get_module_qualname_from_path fname N/A N/A N/A InvalidModulePath N/A N/A N/A N/A logger info Unable to find qualified name for module: %s N/A self fname N/A N/A self namespace N/A N/A N/A logger debug Module qualified name: %s N/A self namespace N/A N/A self metrics metrics N/A visit_ClassDef N/A N/A self node N/A N/A N/A Visitor for AST ClassDef node

        Add class name to current namespace for all descendants.
        :param node: Node being inspected
        :return: -
         N/A N/A self namespace N/A N/A b_utils namespace_path_join N/A self namespace N/A node name N/A visit_FunctionDef N/A N/A self node N/A N/A N/A Visitor for AST FunctionDef nodes

        add relevant information about the node to
        the context for use in tests which inspect function definitions.
        Add the function name to the current namespace for all descendants.
        :param node: The node that is being inspected
        :return: -
         N/A N/A N/A self context N/A function node N/A qualname N/A N/A N/A self namespace . N/A N/A b_utils get_func_name node N/A name N/A N/A N/A qualname split . N/A -1 N/A N/A N/A self context N/A qualname qualname N/A N/A N/A self context N/A name name N/A N/A self namespace N/A N/A b_utils namespace_path_join N/A self namespace name N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context FunctionDef N/A visit_Call N/A N/A self node N/A N/A N/A Visitor for AST Call nodes

        add relevant information about the node to
        the context for use in tests which inspect function calls.
        :param node: The node that is being inspected
        :return: -
         N/A N/A N/A self context N/A call node N/A qualname N/A N/A b_utils get_call_name node N/A self import_aliases N/A name N/A N/A N/A qualname split . N/A -1 N/A N/A N/A self context N/A qualname qualname N/A N/A N/A self context N/A name name N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context Call N/A visit_Import N/A N/A self node N/A N/A N/A Visitor for AST Import nodes

        add relevant information about node to
        the context for use in tests which inspect imports.
        :param node: The node that is being inspected
        :return: -
         N/A nodename N/A node names N/A N/A N/A nodename asname N/A N/A N/A N/A self import_aliases N/A N/A nodename asname N/A nodename name N/A N/A N/A N/A self imports add N/A nodename name N/A N/A N/A self context N/A module N/A nodename name N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context Import N/A visit_ImportFrom N/A N/A self node N/A N/A N/A Visitor for AST ImportFrom nodes

        add relevant information about node to
        the context for use in tests which inspect imports.
        :param node: The node that is being inspected
        :return: -
         N/A module N/A node module N/A N/A module None N/A N/A N/A N/A self visit_Import node N/A nodename N/A node names N/A N/A N/A nodename asname N/A N/A N/A N/A self import_aliases N/A N/A nodename asname N/A N/A module . N/A nodename name N/A N/A N/A N/A self import_aliases N/A N/A nodename name N/A N/A module . N/A nodename name N/A N/A N/A N/A self imports add N/A N/A module . N/A nodename name N/A N/A N/A self context N/A module module N/A N/A N/A self context N/A name N/A nodename name N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context ImportFrom N/A visit_Str N/A N/A self node N/A N/A N/A Visitor for AST String nodes

        add relevant information about node to
        the context for use in tests which inspect strings.
        :param node: The node that is being inspected
        :return: -
         N/A N/A N/A self context N/A str N/A node s N/A N/A N/A isinstance N/A node parent N/A ast Expr N/A N/A N/A N/A self context N/A linerange N/A N/A b_utils linerange_fix N/A node parent N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context Str N/A visit_Bytes N/A N/A self node N/A N/A N/A Visitor for AST Bytes nodes

        add relevant information about node to
        the context for use in tests which inspect strings.
        :param node: The node that is being inspected
        :return: -
         N/A N/A N/A self context N/A bytes N/A node s N/A N/A N/A isinstance N/A node parent N/A ast Expr N/A N/A N/A N/A self context N/A linerange N/A N/A b_utils linerange_fix N/A node parent N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context Bytes N/A pre_visit N/A N/A self node N/A N/A N/A N/A self context N/A N/A N/A N/A self context N/A imports N/A self imports N/A N/A N/A self context N/A import_aliases N/A self import_aliases N/A N/A self debug N/A N/A N/A N/A logger debug N/A N/A ast dump node N/A N/A N/A N/A self metaast add_node node N/A self depth N/A N/A hasattr node lineno N/A N/A N/A N/A self context N/A lineno N/A node lineno N/A N/A N/A node lineno N/A self nosec_lines N/A N/A N/A N/A logger debug skipped, nosec N/A N/A N/A N/A self metrics note_nosec N/A False N/A N/A N/A self context N/A node node N/A N/A N/A self context N/A linerange N/A N/A b_utils linerange_fix node N/A N/A N/A self context N/A filename N/A self fname N/A N/A self seen 1 N/A N/A N/A logger debug entering: %s %s [%s] N/A hex N/A id node N/A type node N/A self depth N/A N/A self depth 1 N/A N/A N/A logger debug N/A self context N/A True N/A visit N/A N/A self node N/A N/A N/A name N/A N/A node __class__ __name__ N/A method N/A visit_ name N/A visitor N/A getattr self method None N/A N/A visitor None N/A N/A N/A self debug N/A N/A N/A N/A logger debug %s called (%s) method N/A N/A ast dump node N/A N/A visitor node N/A N/A N/A N/A self update_scores N/A N/A N/A self tester run_tests N/A self context name N/A post_visit N/A N/A self node N/A N/A N/A N/A self depth 1 N/A N/A N/A logger debug %s	exiting : %s N/A self depth N/A hex N/A id node N/A N/A N/A isinstance node N/A ast FunctionDef N/A isinstance node N/A ast ClassDef N/A N/A N/A self namespace N/A N/A N/A b_utils namespace_path_split N/A self namespace N/A 0 N/A generic_visit N/A N/A self node N/A N/A N/A Drive the visitor. N/A N/A _ value N/A N/A ast iter_fields node N/A N/A N/A isinstance value list N/A N/A max_idx N/A N/A len value 1 N/A N/A idx item N/A enumerate value N/A N/A N/A isinstance item N/A ast AST N/A N/A N/A idx max_idx N/A N/A N/A setattr item sibling N/A value N/A N/A idx 1 N/A N/A N/A setattr item sibling None N/A N/A setattr item parent node N/A N/A N/A self pre_visit item N/A N/A N/A N/A self visit item N/A N/A N/A self generic_visit item N/A N/A N/A self post_visit item N/A N/A N/A isinstance value N/A ast AST N/A N/A N/A setattr value sibling None N/A N/A setattr value parent node N/A N/A N/A self pre_visit value N/A N/A N/A N/A self visit value N/A N/A N/A self generic_visit value N/A N/A N/A self post_visit value N/A update_scores N/A N/A self scores N/A N/A N/A Score updater

        Since we moved from a single score value to a map of scores per
        severity, this is needed to update the stored list.
        :param score: The score list to update our scores with
         N/A score_type N/A self scores N/A N/A N/A N/A self scores N/A score_type N/A list N/A map N/A operator add N/A N/A self scores N/A score_type N/A scores N/A score_type N/A process N/A N/A self data N/A N/A N/A Main process loop

        Build and process the AST
        :param lines: lines code to process
        :return score: the aggregated score for the current file
         N/A f_ast N/A N/A ast parse data N/A N/A N/A self generic_visit f_ast N/A N/A self scores N/A N/A