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

Module Exprs

Import path

import semmle.python.Exprs

Imports

Classes

AssignExpr

An assignment expression, such as x := y

Attribute

An attribute expression, such as value.attr

AugLoad

The context of an augmented load. This is an artifact of the Python grammar which includes an AugLoad context, even though it is never used.

AugStore

The augmented store context, the context of var in var += 1

Await

An await expression such as await coro.

BooleanLiteral

A boolean named constant, either True or False

Bytes

A bytes constant, such as b'ascii'. Note that unadorned string constants such as "hello" are treated as Bytes for Python2, but Unicode for Python3.

Call

A call expression, such as func(...)

Del

The delete context, the context of var in del var

Dict

A dictionary expression, such as {'key':'value'}

Ellipsis

An ellipsis expression, such as ...

Expr

An expression

ExprContext

A context in which an expression used

False

The boolean named constant False

Filter
FloatLiteral

A floating point numeric constant, such as 0.4 or 4e3

FormattedValue

A formatted value (within a formatted string literal). For example, in the string f'hello {world!s}' the formatted value is world!s.

Fstring

A formatted string literal expression, such as f'hello {world!s}'

Guard

A guard in a case statement

IfExp

A conditional expression such as, body if test else orelse

ImaginaryLiteral

An imaginary numeric constant, such as 3j

ImmutableLiteral

An immutable literal expression (except tuples). Consists of string (both unicode and byte) literals and numeric literals.

IntegerLiteral

An integer numeric constant, such as 7 or 0x9

List

A list expression, such as [ 1, 3, 5, 7, 9 ]

Load

The load context, the context of var in len(var)

Name

A (plain variable) name expression, such as var. None, True and False are excluded.

NameConstant

A named constant, one of None, True or False

NegativeIntegerLiteral
None

The None constant.

Num

A numerical constant expression, such as 7 or 4.2

Param

The parameter context, the context of var in def f(var): pass

PlaceHolder
Repr

A repr (backticks) expression, such as `value`

Set

A set expression such as { 1, 3, 5, 7, 9 }

Slice

A slice. E.g 0:1 in the expression x[0:1]

Starred

A starred expression, such as the *rest in the assignment first, *rest = seq

Store

The store context, the context of var in var = 0

StrConst

A string constant.

Subscript

A subscript expression, such as value[slice]

True

The boolean named constant True

Tuple

A tuple expression such as ( 1, 3, 5, 7, 9 )

Unicode

A unicode string expression, such as u"\u20ac". Note that unadorned string constants such as “hello” are treated as Bytes for Python2, but Unicode for Python3.

Yield

A yield expression, such as yield value

YieldFrom

A yield expression, such as yield from value

Aliases

Str

A string constant. This is a placeholder class – use StrConst instead.