daplapath 2.0.2__tar.gz → 2.0.3__tar.gz
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-2.0.2 → daplapath-2.0.3}/PKG-INFO +1 -1
- {daplapath-2.0.2 → daplapath-2.0.3}/daplapath/path.py +10 -6
- {daplapath-2.0.2 → daplapath-2.0.3}/pyproject.toml +1 -1
- {daplapath-2.0.2 → daplapath-2.0.3}/LICENSE.md +0 -0
- {daplapath-2.0.2 → daplapath-2.0.3}/README.md +0 -0
- {daplapath-2.0.2 → daplapath-2.0.3}/daplapath/__init__.py +0 -0
|
@@ -29,9 +29,8 @@ try:
|
|
|
29
29
|
except ImportError:
|
|
30
30
|
pass
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
# regex with the prefix '_v' followed by an integer of any length
|
|
34
|
-
VERSION_PATTERN = r"_v(\d+)"
|
|
33
|
+
VERSION_PATTERN = r"_v(\d+)\."
|
|
35
34
|
VERSION_PREFIX = "_v"
|
|
36
35
|
|
|
37
36
|
# regex with the prefix '_p' followed by four length integer (year) and OPTIONALLY month and date, separated by '-'
|
|
@@ -269,11 +268,16 @@ class Path(str, _PathBase):
|
|
|
269
268
|
"""Returns a PathSeries of all versions of the file."""
|
|
270
269
|
files_in_folder: Iterable[Path] = self.parent.glob("**", recursive=False)
|
|
271
270
|
|
|
271
|
+
if self.version_number:
|
|
272
|
+
start, _, end = re.split(self._version_pattern, self)
|
|
273
|
+
else:
|
|
274
|
+
start, end = self.stem, self.suffix
|
|
275
|
+
|
|
272
276
|
# create boolean mask. With numpy to make it work with both pandas and list
|
|
273
277
|
arr = np.array(files_in_folder)
|
|
274
|
-
is_version_of_this_file = (
|
|
275
|
-
|
|
276
|
-
)
|
|
278
|
+
is_version_of_this_file = (np_str_contains(arr, start)) & (
|
|
279
|
+
np_str_endswith(arr, end)
|
|
280
|
+
)
|
|
277
281
|
if not include_versionless:
|
|
278
282
|
is_version_of_this_file &= np_str_matches(arr, self._version_pattern)
|
|
279
283
|
|
|
@@ -505,7 +509,7 @@ class Path(str, _PathBase):
|
|
|
505
509
|
@property
|
|
506
510
|
def versionless_stem(self) -> str:
|
|
507
511
|
"""Return the file stem before the version pattern."""
|
|
508
|
-
return
|
|
512
|
+
return self.__class__(re.split(self._version_pattern, self._path.name)[0]).stem
|
|
509
513
|
|
|
510
514
|
@property
|
|
511
515
|
def parent(self) -> "Path":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|