- def __call__(self, part):
- return {
- PartId.Index: "[{part}]",
- PartId.Attribute: ".{part}",
- PartId.Hash: "{{{part}}}",
- }[self].format(part=part)
+ def __str__(self):
+ return self.__path.__str__()
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}({str(self)})"
+
+ @property
+ def path(self):
+ return self.__path
+
+
+class IndexPath(GenericPath):
+ def __str__(self):
+ return f"[{self.path}]"
+
+
+class AttributePath(GenericPath):
+ def __str__(self):
+ return f".{self.path}]"
+
+
+class HashPath(GenericPath):
+ def __str__(self):
+ return f"{{{self.path}}}"