CodeQL library for Python
codeql/python-all 2.2.0 (changelog, source)
Search

Class ModuleMetrics

Import path

import python

Direct supertypes

Indirect supertypes

Predicates

getAfferentCoupling

Gets the afferent coupling of a class – the number of classes that directly depend on it.

getEfferentCoupling

Gets the efferent coupling of a class – the number of classes that it directly depends on.

getNumberOfLines

Gets the total number of lines (including blank lines) in the module

getNumberOfLinesOfCode

Gets the number of lines of code in the module

getNumberOfLinesOfComments

Gets the number of lines of comments in the module

getNumberOfLinesOfDocStrings

Gets the number of lines of docstrings in the module

Inherited predicates

contains

Whether this contains inner syntactically

from Module
containsInScopefrom Module
declaredInAll

Whether name is declared in the all list of this module

from Module
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 Module
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
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 module

from Module
getAnExitNode

Gets an exit from this Scope’s control flow graph

from Scope
getAnExport

Gets a name exported by this module, that is the names that will be added to a namespace by ‘from this-module import *’

from Module
getAnImportedModuleNamefrom Module
getBody

Gets the statements forming the body of this module

from Module
getDocString

Gets the docstring for this scope

from Scope
getEnclosingModule

Gets this module

from Module
getEnclosingScope

Gets the enclosing scope of this module (always none)

from Module
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
getFile

Gets the source file for this module

from Module
getHash

Gets the hash (not populated) of this module.

from Module_
getInitModule

Gets the init module of this module if the module is a package and it has an init module

from Module
getKind

Gets the kind of this module.

from Module
getLastStatementfrom Scope
getLoadPath

Gets the path element from which this module was loaded.

from Module
getLocation

Gets the location for this AST node

from Module
getMetrics

Gets the metrics for this module

from Module
getName

Gets the name of this module

from Module
getPackage

Gets the package containing this module (or parent package if this is a package)

from Module
getPackageName

Gets the name of the package containing this module

from Module
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
getPath

Gets the source file or folder for this module or package

from Module
getReturnNode

Gets the exit of this scope following from a return statement

from Scope
getScope

Gets the enclosing scope of this module (always none).

from Module
getShortName

Gets the short name of the module. For example the short name of module x.y.z is ‘z’

from Module
getStmt

Gets the nth statement of this module

from Module
getSubModule

Gets a child module or package of this package

from Module
hasFromFuturefrom Module
inSource

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

from Scope
inStdLib

Holds if this module is in the standard library

from Module
inStdLib

Holds if this module is in the standard library for version major.minor

from Module
isArtificial

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

from AstNode
isPackage

Whether this is a package

from Module
isPackageInit

Whether this module is a package initializer

from Module
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 Module