Class ImportTime::ImportTimeScope

An ImportTimeScope is any scope that is not nested within a function and will thus be executed if its enclosing module is imported. Note however, that if a scope is not an ImportTimeScope it may still be executed at import time. This is an artificial approximation, which is necessary for static analysis.

Direct supertypes

Indirect supertypes

Predicates

definesName

Whether this scope explicitly defines ‘name’. Does not cover implicit definitions be import *

entryEdge

Holds if the control flow passes from outer to inner when this scope starts executing

getOuterVariable

Gets the global variable that is used during lookup, should var be undefined.

Inherited predicates

containsfrom Scope
containsInScope

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

from Scope
getANormalExit

Gets an exit from this Scope’s control flow graph, that does not result from an exception

from Scope
getAStmt

Gets a top-level statement in this scope

from Scope
getAnExitNode

Gets an exit from this Scope’s control flow graph

from Scope
getBody

Gets the statements forming the body of this scope

from Scope
getDocString

Gets the docstring for this scope

from Scope
getEnclosingModulefrom Scope
getEnclosingScope

Gets the scope enclosing this scope (modules have no enclosing scope)

from Scope
getEntryNode

Gets the entry point into this Scope’s control flow graph

from Scope
getEvaluatingScope

Gets the evaluation scope for code in this (lexical) scope. This is usually the scope itself, but may be an enclosing scope. Notably, for list comprehensions in Python 2.

from Scope
getFallthroughNode

Gets the non-explicit exit from this Scope’s control flow graph

from Scope
getLastStatementfrom Scope
getLocationfrom Scope
getName

Gets the name of this scope

from Scope
getReturnNode

Gets the exit of this scope following from a return statement

from Scope
getScope

This method will be deprecated in the next release. Please use getEnclosingScope() instead. The reason for this is to avoid confusion around use of x.getScope+() where x might be an AstNode or a Variable. Forcing the users to write x.getScope().getEnclosingScope*() ensures that the apparent semantics and the actual semantics coincide. [ Gets the scope enclosing this scope (modules have no enclosing scope) ]

from Scope
getStmt

Gets the nth statement of this scope

from Scope
inSource

Holds if this scope is in the source archive, that is it is part of the code specified, not library code

from Scope
isPublic

Holds if this scope is deemed to be public

from Scope
isTopLevel

Holds if this a top-level (non-nested) class or function

from Scope
precedes

Holds if this scope can be expected to execute before other. Modules precede functions and methods in those modules __init__ precedes other methods. __enter__ precedes __exit__. NOTE that this is context-insensitive, so a module “precedes” a function in that module, even if that function is called from the module scope.

from Scope
toStringfrom Scope_

Charpred