| description | CodeQL AST node reference for the Python language |
|---|
This repo contains a variant of the open-source PrintAst.ql query for python language, with modifications for local testing:
Call- Function/method calls (e.g.,func(args))Attribute- Attribute access (e.g.,obj.attr,module.function)Subscript- Subscript operations (e.g.,obj[key],list[0])Name- Variable references and identifiersStringLiteral- String literals (e.g.,"hello",'world')Bytes- Byte string literalsList- List literals (e.g.,[1, 2, 3])Dict- Dictionary literals (e.g.,{"key": "value"})KeyValuePair- Key-value pairs in dictionariesBinOp- Binary operations (e.g.,+,-,*)UnaryExpr- Unary expressions (e.g.,not,-)
FunctionDef- Function definitionsFunctionExpr- Function expressionsFunction- Function objectsClassDef- Class definitionsClassExpr- Class expressionsClass- Class objectsImport- Import statements (import module)ImportFrom- From-import statements (from module import name)ImportExpr- Import expressionsAssign- Assignment statements (e.g.,x = y)AssignStmt- Assignment statement nodesIf- Conditional statementsFor- For loop statementsWhile- While loop statementsReturn- Return statementsExprStmt- Expression statementsPass- Pass statements
Parameter- Function parametersarguments- Function argument listsparameters- Function parameter lists
StmtList- Statement lists (body, orelse)body- Statement body containersorelse- Else clause containers
YamlScalar- YAML scalar valuesYamlMapping- YAML mapping/dictionary structuresYamlSequence- YAML sequence/list structuresYamlAliasNode- YAML alias references
The following links can be fetched to get the expected results for different unit tests of the open-source PrintAst.ql query for the python language: