Module Exprs

Import path

semmle.python.Exprs

Imports

Classes

Attribute

An attribute expression, such as value.attr

AugLoad

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

AugStore

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

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}'

IfExp

A conditional expression such as, body if test else orelse

ImaginaryLiteral

An imaginary numeric constant, such as 3j

ImmutableLiteral

Immutable literal expressions (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

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

None

None

Num

A numerical constant expression, such as 7 or 4.2

Param

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

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