superpathlib 1.2.4__tar.gz → 1.3.1__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.
- {superpathlib-1.2.4/superpathlib.egg-info → superpathlib-1.3.1}/PKG-INFO +9 -1
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/metadata_properties.py +12 -3
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/override.py +4 -2
- {superpathlib-1.2.4 → superpathlib-1.3.1}/pyproject.toml +13 -2
- {superpathlib-1.2.4 → superpathlib-1.3.1/superpathlib.egg-info}/PKG-INFO +9 -1
- {superpathlib-1.2.4 → superpathlib-1.3.1}/superpathlib.egg-info/requires.txt +9 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/tests/test_content.py +2 -2
- {superpathlib-1.2.4 → superpathlib-1.3.1}/tests/test_metadata.py +9 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/LICENSE +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/README.md +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/__init__.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/base.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/common_folders.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/content_properties.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/encryption.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/extra_functionality.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/py.typed +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/tags.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/plib/utils.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/setup.cfg +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/superpathlib.egg-info/SOURCES.txt +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/superpathlib.egg-info/dependency_links.txt +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/superpathlib.egg-info/top_level.txt +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/tests/test_common_folders.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/tests/test_encrypted_content.py +0 -0
- {superpathlib-1.2.4 → superpathlib-1.3.1}/tests/test_functionality.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: superpathlib
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Extended Pathlib
|
|
5
5
|
Author-email: Quinten Roets <qdr2104@columbia.edu>
|
|
6
6
|
License: MIT
|
|
@@ -13,11 +13,19 @@ Provides-Extra: dev
|
|
|
13
13
|
Requires-Dist: bump2version; extra == "dev"
|
|
14
14
|
Requires-Dist: pre-commit; extra == "dev"
|
|
15
15
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
16
|
+
Provides-Extra: full
|
|
17
|
+
Requires-Dist: dirhash; extra == "full"
|
|
18
|
+
Requires-Dist: numpy; extra == "full"
|
|
19
|
+
Requires-Dist: pytest; extra == "full"
|
|
20
|
+
Requires-Dist: PyYaml; extra == "full"
|
|
21
|
+
Requires-Dist: xattr; extra == "full"
|
|
16
22
|
Provides-Extra: test
|
|
23
|
+
Requires-Dist: dirhash; extra == "test"
|
|
17
24
|
Requires-Dist: hypothesis; extra == "test"
|
|
18
25
|
Requires-Dist: numpy; extra == "test"
|
|
19
26
|
Requires-Dist: pytest; extra == "test"
|
|
20
27
|
Requires-Dist: PyYaml; extra == "test"
|
|
28
|
+
Requires-Dist: xattr; extra == "test"
|
|
21
29
|
|
|
22
30
|
[](https://badge.fury.io/py/superpathlib)
|
|
23
31
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import mimetypes
|
|
2
3
|
import os
|
|
3
4
|
import subprocess
|
|
@@ -48,13 +49,13 @@ class Path(content_properties.Path):
|
|
|
48
49
|
|
|
49
50
|
@property
|
|
50
51
|
def tags(self) -> list[str]:
|
|
51
|
-
from .tags import XDGTags # noqa:
|
|
52
|
+
from .tags import XDGTags # noqa: E402, autoimport
|
|
52
53
|
|
|
53
54
|
return XDGTags(self).get()
|
|
54
55
|
|
|
55
56
|
@tags.setter
|
|
56
57
|
def tags(self, values: list[str | int | None]) -> None:
|
|
57
|
-
from .tags import XDGTags # noqa:
|
|
58
|
+
from .tags import XDGTags # noqa: E402, autoimport
|
|
58
59
|
|
|
59
60
|
if len(values) == 0:
|
|
60
61
|
XDGTags(self).clear()
|
|
@@ -67,7 +68,7 @@ class Path(content_properties.Path):
|
|
|
67
68
|
|
|
68
69
|
@tag.setter
|
|
69
70
|
def tag(self, value: str | int | None) -> None:
|
|
70
|
-
from .tags import XDGTags # noqa:
|
|
71
|
+
from .tags import XDGTags # noqa: E402, autoimport
|
|
71
72
|
|
|
72
73
|
XDGTags(self).set(value)
|
|
73
74
|
|
|
@@ -100,6 +101,10 @@ class Path(content_properties.Path):
|
|
|
100
101
|
|
|
101
102
|
@property
|
|
102
103
|
def content_hash(self) -> str:
|
|
104
|
+
return self.file_content_hash if self.is_file() else self.dir_content_hash
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def dir_content_hash(self) -> str:
|
|
103
108
|
# dirhash package throws annoying warnings
|
|
104
109
|
warnings.filterwarnings(
|
|
105
110
|
action="ignore", module="pkg_resources|dirhash", category=DeprecationWarning
|
|
@@ -110,3 +115,7 @@ class Path(content_properties.Path):
|
|
|
110
115
|
# use default algorithm used in cloud provider checksums
|
|
111
116
|
# can be efficient because not used for cryptographic security
|
|
112
117
|
return dirhash.dirhash(self, "md5")
|
|
118
|
+
|
|
119
|
+
@property
|
|
120
|
+
def file_content_hash(self) -> str:
|
|
121
|
+
return hashlib.new("sha512", data=self.byte_content).hexdigest()
|
|
@@ -5,11 +5,13 @@ import shutil
|
|
|
5
5
|
from collections.abc import Callable, Generator
|
|
6
6
|
from functools import wraps
|
|
7
7
|
from pathlib import PurePath
|
|
8
|
-
from typing import IO, Any
|
|
8
|
+
from typing import IO, Any, TypeVar
|
|
9
9
|
|
|
10
10
|
from . import encryption
|
|
11
11
|
from .metadata_properties import catch_missing
|
|
12
12
|
|
|
13
|
+
T = TypeVar("T", bound="Path")
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
def create_parent_on_missing(func: Callable) -> Callable:
|
|
15
17
|
@wraps(func)
|
|
@@ -42,7 +44,7 @@ class Path(encryption.Path):
|
|
|
42
44
|
def rmdir(self) -> None:
|
|
43
45
|
return super().rmdir()
|
|
44
46
|
|
|
45
|
-
def iterdir(self, missing_ok: bool = True) -> Generator[
|
|
47
|
+
def iterdir(self: T, missing_ok: bool = True) -> Generator[T, None, None]:
|
|
46
48
|
if self.exists() or not missing_ok:
|
|
47
49
|
yield from super().iterdir()
|
|
48
50
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "superpathlib"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.3.1"
|
|
4
4
|
description = "Extended Pathlib"
|
|
5
5
|
authors = [{name = "Quinten Roets", email = "qdr2104@columbia.edu"}]
|
|
6
6
|
license = {text = "MIT"}
|
|
@@ -19,11 +19,22 @@ dev = [
|
|
|
19
19
|
"pre-commit",
|
|
20
20
|
"types-PyYAML"
|
|
21
21
|
]
|
|
22
|
+
|
|
23
|
+
full = [
|
|
24
|
+
"dirhash",
|
|
25
|
+
"numpy",
|
|
26
|
+
"pytest",
|
|
27
|
+
"PyYaml",
|
|
28
|
+
"xattr",
|
|
29
|
+
]
|
|
30
|
+
|
|
22
31
|
test = [
|
|
32
|
+
"dirhash",
|
|
23
33
|
"hypothesis",
|
|
24
34
|
"numpy",
|
|
25
35
|
"pytest",
|
|
26
|
-
"PyYaml"
|
|
36
|
+
"PyYaml",
|
|
37
|
+
"xattr",
|
|
27
38
|
]
|
|
28
39
|
|
|
29
40
|
[tool.setuptools.package-data]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: superpathlib
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Extended Pathlib
|
|
5
5
|
Author-email: Quinten Roets <qdr2104@columbia.edu>
|
|
6
6
|
License: MIT
|
|
@@ -13,11 +13,19 @@ Provides-Extra: dev
|
|
|
13
13
|
Requires-Dist: bump2version; extra == "dev"
|
|
14
14
|
Requires-Dist: pre-commit; extra == "dev"
|
|
15
15
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
16
|
+
Provides-Extra: full
|
|
17
|
+
Requires-Dist: dirhash; extra == "full"
|
|
18
|
+
Requires-Dist: numpy; extra == "full"
|
|
19
|
+
Requires-Dist: pytest; extra == "full"
|
|
20
|
+
Requires-Dist: PyYaml; extra == "full"
|
|
21
|
+
Requires-Dist: xattr; extra == "full"
|
|
16
22
|
Provides-Extra: test
|
|
23
|
+
Requires-Dist: dirhash; extra == "test"
|
|
17
24
|
Requires-Dist: hypothesis; extra == "test"
|
|
18
25
|
Requires-Dist: numpy; extra == "test"
|
|
19
26
|
Requires-Dist: pytest; extra == "test"
|
|
20
27
|
Requires-Dist: PyYaml; extra == "test"
|
|
28
|
+
Requires-Dist: xattr; extra == "test"
|
|
21
29
|
|
|
22
30
|
[](https://badge.fury.io/py/superpathlib)
|
|
23
31
|
|
|
@@ -11,9 +11,9 @@ from utils import ignore_fixture_warning
|
|
|
11
11
|
|
|
12
12
|
from plib import Path
|
|
13
13
|
|
|
14
|
+
suppressed_health_checks = (HealthCheck.function_scoped_fixture,)
|
|
14
15
|
slower_test_settings = settings(
|
|
15
|
-
max_examples=10,
|
|
16
|
-
suppress_health_check=(HealthCheck.function_scoped_fixture,),
|
|
16
|
+
max_examples=10, suppress_health_check=suppressed_health_checks
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import math
|
|
2
3
|
import time
|
|
3
4
|
|
|
@@ -45,3 +46,11 @@ def test_filetypes(path: Path) -> None:
|
|
|
45
46
|
filetype_mappings = {"text": "txt", "video": "mp4", "image": "jpg"}
|
|
46
47
|
for filetype, extension in filetype_mappings.items():
|
|
47
48
|
assert path.with_suffix(f".{extension}").filetype == filetype
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@ignore_fixture_warning
|
|
52
|
+
@byte_content
|
|
53
|
+
def test_content_hash(path: Path, content: bytes) -> None:
|
|
54
|
+
path.byte_content = content
|
|
55
|
+
content_hash = hashlib.new("sha512", data=content).hexdigest()
|
|
56
|
+
assert path.content_hash == content_hash
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|