daplapath 2.1.1__py3-none-any.whl → 2.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- daplapath/path.py +8 -14
- {daplapath-2.1.1.dist-info → daplapath-2.1.3.dist-info}/METADATA +1 -1
- daplapath-2.1.3.dist-info/RECORD +6 -0
- daplapath-2.1.1.dist-info/RECORD +0 -6
- {daplapath-2.1.1.dist-info → daplapath-2.1.3.dist-info}/LICENSE.md +0 -0
- {daplapath-2.1.1.dist-info → daplapath-2.1.3.dist-info}/WHEEL +0 -0
daplapath/path.py
CHANGED
|
@@ -216,19 +216,13 @@ class Path(str, _PathBase):
|
|
|
216
216
|
@staticmethod
|
|
217
217
|
def _standardize_path(path: str | PurePosixPath) -> str:
|
|
218
218
|
"""Make sure delimiter is '/' and path ends without '/'."""
|
|
219
|
-
return (
|
|
220
|
-
str(path)
|
|
221
|
-
.replace("\\", "/")
|
|
222
|
-
.replace(r"\"", "/")
|
|
223
|
-
.replace("//", "/")
|
|
224
|
-
.rstrip("/")
|
|
225
|
-
)
|
|
219
|
+
return str(path).replace("\\", "/").replace(r"\"", "/")
|
|
226
220
|
|
|
227
221
|
def __new__(cls, gcs_path: str | PurePath | None = None, file_system=None):
|
|
228
222
|
"""Construct Path with '/' as delimiter."""
|
|
229
223
|
gcs_path = cls._standardize_path(gcs_path or "")
|
|
230
224
|
obj = super().__new__(cls, gcs_path)
|
|
231
|
-
obj._path =
|
|
225
|
+
obj._path = PurePosixPath(obj)
|
|
232
226
|
obj._file_system = file_system
|
|
233
227
|
return obj
|
|
234
228
|
|
|
@@ -729,7 +723,6 @@ class Path(str, _PathBase):
|
|
|
729
723
|
"""File size in terrabytes."""
|
|
730
724
|
return self.kb / 1_000_000_000
|
|
731
725
|
|
|
732
|
-
@property
|
|
733
726
|
def partition_root(self) -> "Path":
|
|
734
727
|
if not self.suffix or self.count(self.suffix) != 2:
|
|
735
728
|
return self
|
|
@@ -997,15 +990,16 @@ class PathSeries(pd.Series, _PathBase):
|
|
|
997
990
|
return self.files.apply(lambda x: x.buckets_path())
|
|
998
991
|
|
|
999
992
|
def partition_root(self, keep: str | None = "last") -> "PathSeries":
|
|
1000
|
-
return self.files.apply(lambda x: x.partition_root)[
|
|
993
|
+
return self.files.apply(lambda x: x.partition_root())[
|
|
1001
994
|
lambda x: ~x.duplicated(keep=keep)
|
|
1002
995
|
]
|
|
1003
996
|
|
|
1004
|
-
@property
|
|
1005
997
|
def partitioned_files(self) -> "PathSeries":
|
|
1006
|
-
return
|
|
1007
|
-
lambda x: x.str.count(r"\.parquet") == 2
|
|
1008
|
-
|
|
998
|
+
return (
|
|
999
|
+
self.files.loc[lambda x: x.str.count(r"\.parquet") == 2]
|
|
1000
|
+
.partition_root()
|
|
1001
|
+
.drop_duplicates()
|
|
1002
|
+
)
|
|
1009
1003
|
|
|
1010
1004
|
@property
|
|
1011
1005
|
def dirs(self) -> "PathSeries":
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
daplapath/__init__.py,sha256=Qdpwhl8y3-i_42-4-KVT-sPQtJqwWRENLFxROZ_rfbU,86
|
|
2
|
+
daplapath/path.py,sha256=lDbe6w3pA_PK7MBry3Rw7Hxf7fjZh-zNqzl5pLsMVvs,57168
|
|
3
|
+
daplapath-2.1.3.dist-info/LICENSE.md,sha256=hxspefYgWP3U6OZFhCifqWMI5ksnKzgFxNKgQnG7Ozc,1074
|
|
4
|
+
daplapath-2.1.3.dist-info/METADATA,sha256=HjPwtNd7fDZ1fHiJ4BEFH7KFhW9V55AhoA0YLPx44c8,14697
|
|
5
|
+
daplapath-2.1.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
+
daplapath-2.1.3.dist-info/RECORD,,
|
daplapath-2.1.1.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
daplapath/__init__.py,sha256=Qdpwhl8y3-i_42-4-KVT-sPQtJqwWRENLFxROZ_rfbU,86
|
|
2
|
-
daplapath/path.py,sha256=vSRuq0usBxtz4p6lbuLbWtpjribk0t6bV2EDtbN1CD4,57270
|
|
3
|
-
daplapath-2.1.1.dist-info/LICENSE.md,sha256=hxspefYgWP3U6OZFhCifqWMI5ksnKzgFxNKgQnG7Ozc,1074
|
|
4
|
-
daplapath-2.1.1.dist-info/METADATA,sha256=plv6x6q7kmhthrNUQgg1YwGnJJtroRWbicmSYgaufMY,14697
|
|
5
|
-
daplapath-2.1.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
6
|
-
daplapath-2.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|