ptera.selector
Specifications for call paths.
- class ptera.selector.Call(**kwargs)
Represents a call in the call stack.
- encode()
Return a string representation of the selector.
- problems()
Return a list of problems with this selector.
Wildcards are not allowed for cuntions.
All functions should be tooled.
All captured variables should exist in their respective functions.
For wildcard variables that specify a tag/category, at least one variable should match.
- specialize(specializations)
Replace $variables in the selector using a specializations dict.
- class ptera.selector.Element(**kwargs)
Represents a variable or some other atom.
- encode()
Return a string representation of the selector.
- specialize(specializations)
Replace $variables in the selector using a specializations dict.
- class ptera.selector.Evaluator
Evaluator that transforms the parse tree into a Selector.
- class ptera.selector.Selector(**kwargs)
Represents a selector for variables in a call stack.
- exception ptera.selector.SelectorError
Error raised for invalid selectors.
- ptera.selector.check_element(el, name, category)
Check if Element el matches the given name and category.
- ptera.selector.dict_resolver(env)
Resolve a symbol from a dictionary, e.g. the globals directory.
- ptera.selector.select(s, env=None, skip_modules=[], skip_frames=0, strict=False)
Create a selector from a string.
- Parameters
s – The string to compile to a Selector, or a Selector to return unchanged.
env – The environment to use to evaluate symbols in the selector. If not given, the environment chosen is the parent scope.
skip_modules – Modules to skip when looking for an environment. We will go up through the stack until we get to a scope that is outside these modules.
skip_frames – Number of frames to skip when looking for an environment.
strict – Whether to require functions and variables in the selector to be statically resolvable (will give better errors).
- ptera.selector.verify(selector, display=None)
Verify that the selector is resolvable.
This raises an exception if
problems()returns any problems.Wildcards are not allowed for cuntions.
All functions should be tooled.
All captured variables should exist in their respective functions.
For wildcard variables that specify a tag/category, at least one variable should match.