ptera.utils

Miscellaneous utilities.

exception ptera.utils.CodeNotFoundError
class ptera.utils.Named(name)

A named object.

This class can be used to construct objects with a name that will be used for the string representation.

class ptera.utils.autocreate(fn)

Automatically create an instance when called on the class.

Basically makes it so that Klass.f() is equivalent to Klass().f().

class ptera.utils.cached_property(fn)

Property that caches its value when we get it for the first time.

ptera.utils.is_tooled(fn)

Return whether a function has been tooled for Ptera.

ptera.utils.keyword_decorator(deco)

Wrap a decorator to optionally takes keyword arguments.

ptera.utils.refstring(fn)

Return the canonical reference string to select fn.

For example, if fn is called bloop and is located in module squid.game, the refstring will be /squid.game/bloop.