instagram.gdpr: use ZipPath instead of adhoc zipfile methods

this allows using the module more agnostic whether the gpdr archive is packed or unpacked
This commit is contained in:
Dima Gerasimov 2022-04-15 11:59:26 +01:00 committed by karlicoss
parent 7c0f304f94
commit 706ec03a3f
2 changed files with 28 additions and 19 deletions

View file

@ -164,6 +164,15 @@ class ZipPath(ZipPathBase):
assert self.root == other.root, (self.root, other.root)
return Path(self.at).relative_to(Path(other.at))
@property
def parts(self) -> Sequence[str]:
# messy, but might be ok..
return Path(self.filename).parts + Path(self.at).parts
@property
def stem(self) -> str:
return Path(self.at).stem
@property # type: ignore[misc]
def __class__(self):
return Path