module documentation

Do comparisons involving abstract values.

Exception CmpTypeError Comparing incompatible primitive constants.
Function cmp_rel Compare two variables.
Function compatible_with Returns the conditions under which the value could be True or False.
Constant NUMERIC Undocumented
Constant STRING Undocumented
Function _compare_as_constant_tuples Checks if the values are constant tuples and compares them if so.
Function _compare_class Undocumented
Function _compare_constant_tuple_prefix Compares a tuple's constant prefix against a constant tuple.
Function _compare_constants Undocumented
Function _compare_dict Undocumented
Function _compare_primitive Undocumented
Function _compare_primitive_constant Undocumented
Function _compare_sequence_length Compare sequence lengths for pattern matching.
Function _compare_tuple Undocumented
Function _get_constant_tuple_prefix Given a tuple, get its longest prefix of constant elements.
Function _incompatible Incompatible primitive types can never be equal.
Function _is_equality_cmp Undocumented
Function _is_primitive Undocumented
Function _is_primitive_constant Undocumented
Constant _CONTAINER_NAMES Undocumented
def cmp_rel(ctx, op, left, right): (source)

Compare two variables.

def compatible_with(value, logical_value): (source)

Returns the conditions under which the value could be True or False. Args: value: An abstract value. logical_value: Either True or False. Returns: False: If the value could not evaluate to logical_value under any circumstance (e.g. value is the empty list and logical_value is True). True: If it is possible for the value to evaluate to the logical_value, and any ambiguity cannot be resolved by additional bindings.

Undocumented

Value
frozenset(set(['builtins.bool',
               'builtins.int',
               'builtins.float',
               'builtins.complex']))

Undocumented

Value
frozenset(set(['builtins.str', 'builtins.unicode']))
def _compare_as_constant_tuples(op, left, right): (source)

Checks if the values are constant tuples and compares them if so.

def _compare_class(op, left, right): (source)

Undocumented

def _compare_constant_tuple_prefix(op, prefix, constant_tuple, reverse): (source)

Compares a tuple's constant prefix against a constant tuple. Args: op: A comparison operator, such as LT (less than). prefix: A constant prefix of a non-constant tuple (referred to as "left" in the inline comments). So if left=(3, 2, ...), prefix=(3, 2). constant_tuple: A constant tuple (referred to as "right"). reverse: Whether left and right should be reversed for the comparison. Returns: A bool of the comparison result if it can be determined, None otherwise.

def _compare_constants(op, left, right): (source)

Undocumented

def _compare_dict(op, left, right): (source)

Undocumented

def _compare_primitive(op, left, right): (source)

Undocumented

def _compare_primitive_constant(ctx, op, left, right): (source)

Undocumented

def _compare_sequence_length(op, left: abstract.SequenceLength, right: abstract.ConcreteValue): (source)

Compare sequence lengths for pattern matching.

def _compare_tuple(op, left, right): (source)

Undocumented

def _get_constant_tuple_prefix(value: abstract.Tuple): (source)

Given a tuple, get its longest prefix of constant elements.

def _incompatible(left_name, right_name): (source)

Incompatible primitive types can never be equal.

def _is_equality_cmp(op): (source)

Undocumented

def _is_primitive(ctx, value): (source)

Undocumented

def _is_primitive_constant(ctx, value): (source)

Undocumented

_CONTAINER_NAMES = (source)

Undocumented

Value
frozenset(set(['builtins.list', 'builtins.set', 'builtins.frozenset']))