(data: Mapping[str, str])
Inverse of `as_dict`
Inverse of `as_dict`
Inverse of as_dict
def from_dict(data: Mapping[str, str]) -> 'PathItem':
        """Inverse of `as_dict`"""
        try:
            type_ = data["type"]
            if type_ == "AbsPath":
                return AbsPath(data["path"])
            elif type_ == "VarPath":
                return VarPath(data["name"], data["relpath"])
            else:
                raise ValueError(f"{type_}: unknown type")
        except KeyError as err:
            raise ValueError() from err
def from_dict ( data : Mapping [ str , str ] ) -> 'PathItem' : try : type_ = data [ "type" ] if type_ == "AbsPath" : return AbsPath ( data [ "path" ] ) elif type_ == "VarPath" : return VarPath ( data [ "name" ] , data [ "relpath" ] ) else : raise ValueError ( f"{type_}: unknown type" ) except KeyError as err : raise ValueError ( ) from err