drepr.models.path#
Classes
|
|
|
|
|
|
|
|
|
|
|
- class RangeExpr(start: 'Union[int, Expr]', end: 'Optional[Union[int, Expr]]', step: 'Union[int, Expr]')[source]#
Bases:
object
- class WildcardExpr(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
Enum- Values = '*'#
- Names = '*~'#
- class Path(steps: 'List[StepExpr]')[source]#
Bases:
object- Parameters:
steps (List[Union[RangeExpr, IndexExpr, SetIndexExpr, WildcardExpr]]) –
- steps: List[Union[RangeExpr, IndexExpr, SetIndexExpr, WildcardExpr]]#
- static deserialize(raw: dict) Path[source]#
Deserialize a dictionary to get back the Path object :param raw: :return:
- has_optional_steps() bool[source]#
Check if this path has any optional steps, an optional step is a step that the key may not appear in the data source
- Return type:
- get_optional_steps() list[int][source]#
Get the indices of optional steps in this path in sorted order
- has_same_or_less_optional_steps(path: Path) bool[source]#
Check if another path has the same or less optional steps as this path.
In order for two paths to share the same optional steps, any previous steps of the optional step must be the same and the number of optional steps must be the same.
In order for this path to have less optional steps than the other path, the number of optional steps must be less and the previous steps of the optional steps must be the same.