Class Import::Import

An import statement

Direct supertypes

Indirect supertypes

Predicates

getAModule

Use getAnImportedModuleName(), possibly combined with ModuleObject.importedAs() Gets a module imported by this import statement

getASubExpression

Gets an immediate (non-nested) sub-expression of this statement

getASubStatement

Gets an immediate (non-nested) sub-statement of this statement

getAnImportedModuleName

Gets the name of an imported module. For example, for the import statement import bar which is a relative import in package “foo”, this would return “foo.bar”. The import statment from foo import bar would return foo and foo.bar

isFromImport

Whether this a from ... import ... statement

Inherited predicates

contains

Whether this contains inner syntactically

from AstNode
containsInScope

Whether this contains inner syntactically and inner has the same scope as this

from AstNode
getAChildNode

Gets a child node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt().

from Stmt
getAFlowNode

Gets a flow node corresponding directly to this node. NOTE: For some statements and other purely syntactic elements, there may not be a ControlFlowNode

from AstNode
getAName

Gets an alias of this import statement.

from Import_
getAnEntryNode

Gets a control flow node for an entry into this statement.

from Stmt
getEnclosingModule

Gets the module enclosing this statement

from Stmt
getLastStatement

Gets the final statement in this statement, ordered by location. Will be this statement if not a compound statement.

from Stmt
getLocationfrom Stmt
getName

Gets the nth alias of this import statement.

from Import_
getNames

Gets the alias list of this import statement.

from Import_
getParentfrom Stmt_
getParentNode

Gets the parent node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt() applied to the parent.

from AstNode
getScope

Gets the scope immediately enclosing this statement

from Stmt
isArtificial

Whether this syntactic element is artificial, that is it is generated by the compiler and is not present in the source

from AstNode
isUnreachable

Holds if this statement cannot be reached

from Stmt
toStringfrom Import_