CodeQL library for Python
Search

Class ModuleValue

Class representing modules in the Python program Each ModuleValue represents a module object in the Python program.

Import path

import python

Direct supertypes

Indirect supertypes

Predicates

exports

Holds if this module “exports” name. That is, does it define name in __all__ or is __all__ not defined and name a global variable that does not start with “_” This is the set of names imported by from ... import *.

getAnImportedModule

Get a module that this module imports

getPath

Gets the container path for this module. Will be the file for a Python module, the folder for a package and no result for a builtin module.

getScope

Gets the scope for this module, provided that it is a Python module.

hasCompleteExportInfo

Whether the complete set of names “exported” by this module can be accurately determined

importedAs

Whether this module is imported by ‘import name’. For example on a linux system, the module ‘posixpath’ is imported as ‘os.path’ or as ‘posixpath’

isPackage

Whether this module is a package.

isUsedAsModule

When used as a normal module (for example, imported and used by other modules)

isUsedAsScript

When used (exclusively) as a script (will not include normal modules that can also be run as a script)

Inherited predicates

attr

Gets a Value that represents the attribute name of this object.

from Value
getABooleanValue

Gets the boolean interpretation of this value. Could be both true and false, if we can’t determine the result more precisely.

from Value
getACall

Gets a call to this object

from Value
getACall

Gets a call to this object with the given caller context.

from Value
getAReference

Gets a ControlFlowNode that refers to this object.

from Value
getClass

Gets the class of this object. Strictly, the Value representing the class of the objects represented by this Value.

from Value
getDefiniteBooleanValue

Gets the boolean interpretation of this value, only if we can determine the result precisely. The result can be none(), but never both true and false.

from Value
getName

Gets the name of this value, if it has one. Note this is the innate name of the object, not necessarily all the names by which it can be called.

from Value
getOrigin

Gets the origin CFG node for this value.

from Value
hasAttribute

Holds if this value has the attribute name

from Value
hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

from Value
isAbsent

Whether this value is absent from the database, but has been inferred to likely exist

from Value
isBuiltin

Holds if this value is builtin. Applies to built-in functions and methods, but also integers and strings.

from Value
overrides

Whether this overrides v. In this context, “overrides” means that this object is a named attribute of a some class C and v is a named attribute of another class S, both attributes having the same name, and S is a super class of C.

from Value
toString

Gets a textual representation of this element.

from Value

Charpred