Class 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.
Import path
import semmle.python.types.ImportTimeDirect supertypes
Predicates
| definesName | Whether this scope explicitly defines ‘name’. Does not cover implicit definitions be import * |
| entryEdge | Holds if the control flow passes from |
| getOuterVariable | Gets the global variable that is used during lookup, should |
Inherited predicates
| contains | from Scope | |
| containsInScope | Whether this contains | 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 |
| getEnclosingModule | from 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 |
| getLastStatement | from Scope | |
| getLocation | from 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 | 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 | from Scope |
| toString | Gets a textual representation of this element. | from Scope_ |