pydrepr/drepr/models/path.py
def deserialize(raw: dict) -> "Path":
        """
        Deserialize a dictionary to get back the Path object
        :param raw:
        :return:
        """
        steps = []
        for step in raw['steps']:
            if not isinstance(step, dict):
                steps.append(WildcardExpr(step))
            elif 'start' in step:
                # range index
                start = Expr(step['start']['expr']) if isinstance(step['start'], dict) else step['start']
                end = Expr(step['end']['expr']) if isinstance(step['end'], dict) else step['end']
                step1 = Expr(step['step']['expr']) if isinstance(step['step'], dict) else step['step']
                steps.append(RangeExpr(start, end, step1))
            elif 'val' in step:
                steps.append(IndexExpr(Expr(step['val']['expr']) if isinstance(step['val'], dict) else step['val']))
            elif 'vals' in step:
                steps.append(SetIndexExpr({
                    Expr(val['expr']) if isinstance(val, dict) else val
                    for val in step['vals']
                }))
        return Path(steps)

        Deserialize a dictionary to get back the Path object
        :param raw:
        :return:
        
Deserialize a dictionary to get back the Path object
Deserialize a dictionary to get back the Path object
def deserialize(raw: dict) -> "Path":
        steps = []
        for step in raw['steps']:
            if not isinstance(step, dict):
                steps.append(WildcardExpr(step))
            elif 'start' in step:
                start = Expr(step['start']['expr']) if isinstance(step['start'], dict) else step['start']
                end = Expr(step['end']['expr']) if isinstance(step['end'], dict) else step['end']
                step1 = Expr(step['step']['expr']) if isinstance(step['step'], dict) else step['step']
                steps.append(RangeExpr(start, end, step1))
            elif 'val' in step:
                steps.append(IndexExpr(Expr(step['val']['expr']) if isinstance(step['val'], dict) else step['val']))
            elif 'vals' in step:
                steps.append(SetIndexExpr({
                    Expr(val['expr']) if isinstance(val, dict) else val
                    for val in step['vals']
                }))
        return Path(steps)
def deserialize ( raw : dict ) -> "Path" : steps = [ ] for step in raw [ 'steps' ] : if not isinstance ( step , dict ) : steps . append ( WildcardExpr ( step ) ) elif 'start' in step : start = Expr ( step [ 'start' ] [ 'expr' ] ) if isinstance ( step [ 'start' ] , dict ) else step [ 'start' ] end = Expr ( step [ 'end' ] [ 'expr' ] ) if isinstance ( step [ 'end' ] , dict ) else step [ 'end' ] step1 = Expr ( step [ 'step' ] [ 'expr' ] ) if isinstance ( step [ 'step' ] , dict ) else step [ 'step' ] steps . append ( RangeExpr ( start , end , step1 ) ) elif 'val' in step : steps . append ( IndexExpr ( Expr ( step [ 'val' ] [ 'expr' ] ) if isinstance ( step [ 'val' ] , dict ) else step [ 'val' ] ) ) elif 'vals' in step : steps . append ( SetIndexExpr ( { Expr ( val [ 'expr' ] ) if isinstance ( val , dict ) else val for val in step [ 'vals' ] } ) ) return Path ( steps )
Deserialize a dictionary to get back the Path object
Deserialize a dictionary to get back the Path object
"""
        Deserialize a dictionary to get back the Path object
        :param raw:
        :return:
        """ # range index
None
raw
dict
None