scenic.core.utils

Assorted utility functions and common exceptions.

Summary of Module Members

Functions

areEquivalent

Whether two objects are equivalent, i.e.

argsToString

cached

Decorator for making a method with no arguments cache its result

Exceptions

InconsistentScenarioError

Error for scenarios with inconsistent requirements.

InvalidScenarioError

Error raised for syntactically-valid but otherwise problematic Scenic programs.

ParseError

An error produced by attempting to parse an invalid Scenic program.

RuntimeParseError

A Scenic parse error generated during execution of the translated Python.

Member Details

cached(oldMethod)[source]

Decorator for making a method with no arguments cache its result

areEquivalent(a, b)[source]

Whether two objects are equivalent, i.e. have the same properties.

This is only used for debugging, e.g. to check that a Distribution is the same before and after pickling. We don’t want to define __eq__ for such objects since for example two values sampled with the same distribution are equivalent but not semantically identical: the code:

X = (0, 1)
Y = (0, 1)

does not make X and Y always have equal values!

exception ParseError[source]

Bases: Exception

An error produced by attempting to parse an invalid Scenic program.

exception RuntimeParseError[source]

Bases: scenic.core.utils.ParseError

A Scenic parse error generated during execution of the translated Python.

exception InvalidScenarioError[source]

Bases: Exception

Error raised for syntactically-valid but otherwise problematic Scenic programs.

exception InconsistentScenarioError(line, message)[source]

Bases: scenic.core.utils.InvalidScenarioError

Error for scenarios with inconsistent requirements.