def __init__(self, attribute_or_path): from pynamodb.attributes import Attribute # prevent circular import -- Attribute imports Path is_attribute = isinstance(attribute_or_path, Attribute) self.attribute = attribute_or_path if is_attribute else None self.short_attr_type = ATTR_TYPE_MAP[attribute_or_path.attr_type] if is_attribute else None path = attribute_or_path.attr_path if is_attribute else attribute_or_path if not path: raise ValueError("path cannot be empty") super(Path, self).__init__(get_path_segments(path))
def __init__(self, attribute_or_path: Union['Attribute', str, List[str]]) -> None: from pynamodb.attributes import Attribute # prevent circular import -- Attribute imports Path path: Union[str, List[str]] if isinstance(attribute_or_path, Attribute): self.attribute = attribute_or_path self.attr_type = attribute_or_path.attr_type path = attribute_or_path.attr_path else: self.attribute = None self.attr_type = None path = attribute_or_path if not path: raise ValueError("path cannot be empty") super(Path, self).__init__(get_path_segments(path))
def __init__(self, path): if not path: raise ValueError("path cannot be empty") self.path = get_path_segments(path)