superpathlib 2.0.10__tar.gz → 2.0.12__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.
Files changed (30) hide show
  1. {superpathlib-2.0.10/src/superpathlib.egg-info → superpathlib-2.0.12}/PKG-INFO +4 -3
  2. {superpathlib-2.0.10 → superpathlib-2.0.12}/pyproject.toml +23 -5
  3. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/common_folders.py +2 -1
  4. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/encryption.py +9 -5
  5. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/extra_functionality.py +7 -4
  6. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/override.py +2 -2
  7. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/tags.py +2 -1
  8. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/utils.py +0 -1
  9. {superpathlib-2.0.10 → superpathlib-2.0.12/src/superpathlib.egg-info}/PKG-INFO +4 -3
  10. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib.egg-info/requires.txt +3 -2
  11. {superpathlib-2.0.10 → superpathlib-2.0.12}/LICENSE +0 -0
  12. {superpathlib-2.0.10 → superpathlib-2.0.12}/README.md +0 -0
  13. {superpathlib-2.0.10 → superpathlib-2.0.12}/setup.cfg +0 -0
  14. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/__init__.py +0 -0
  15. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/base.py +0 -0
  16. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/cached_content.py +0 -0
  17. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/content_properties.py +0 -0
  18. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/metadata_properties.py +0 -0
  19. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/path.py +0 -0
  20. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib/py.typed +0 -0
  21. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib.egg-info/SOURCES.txt +0 -0
  22. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib.egg-info/dependency_links.txt +0 -0
  23. {superpathlib-2.0.10 → superpathlib-2.0.12}/src/superpathlib.egg-info/top_level.txt +0 -0
  24. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_cached_content.py +0 -0
  25. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_common_folders.py +0 -0
  26. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_content.py +0 -0
  27. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_encrypted_content.py +0 -0
  28. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_functionality.py +0 -0
  29. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_inheritance.py +0 -0
  30. {superpathlib-2.0.10 → superpathlib-2.0.12}/tests/test_metadata.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superpathlib
3
- Version: 2.0.10
3
+ Version: 2.0.12
4
4
  Summary: Extended Pathlib
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License-Expression: MIT
@@ -9,10 +9,11 @@ Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Requires-Dist: simple-classproperty<5,>=4.0.2
12
+ Requires-Dist: typing_extensions<5,>=4.0
12
13
  Provides-Extra: full
13
14
  Requires-Dist: dirhash<1,>=0.2.1; extra == "full"
14
15
  Requires-Dist: numpy<3,>=1.26.4; extra == "full"
15
- Requires-Dist: package-utils<1,>=0.6.1; extra == "full"
16
+ Requires-Dist: package-utils<1,>=0.8.1; extra == "full"
16
17
  Requires-Dist: PyYaml<7,>=6.0.1; extra == "full"
17
18
  Requires-Dist: xattr<2,>=0.10.1; extra == "full"
18
19
  Provides-Extra: dev
@@ -21,7 +22,7 @@ Requires-Dist: package-dev-tools<1,>=0.7.1; extra == "dev"
21
22
  Requires-Dist: types-PyYaml<7,>=6.0.12.12; extra == "dev"
22
23
  Requires-Dist: dirhash<1,>=0.2.1; extra == "dev"
23
24
  Requires-Dist: numpy<3,>=1.26.4; extra == "dev"
24
- Requires-Dist: package-utils<1,>=0.6.1; extra == "dev"
25
+ Requires-Dist: package-utils<1,>=0.8.0; extra == "dev"
25
26
  Requires-Dist: PyYaml<7,>=6.0.1; extra == "dev"
26
27
  Requires-Dist: xattr<2,>=0.10.1; extra == "dev"
27
28
  Dynamic: license-file
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "superpathlib"
3
- version = "2.0.10"
3
+ version = "2.0.12"
4
4
  description = "Extended Pathlib"
5
5
  authors = [{name = "Quinten Roets", email = "qdr2104@columbia.edu"}]
6
6
  license = "MIT"
@@ -8,13 +8,14 @@ readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
10
  "simple-classproperty >=4.0.2, <5",
11
+ "typing_extensions >=4.0, <5",
11
12
  ]
12
13
 
13
14
  [project.optional-dependencies]
14
15
  full = [
15
16
  "dirhash >=0.2.1, <1",
16
17
  "numpy >=1.26.4, <3",
17
- "package-utils >=0.6.1, <1",
18
+ "package-utils >=0.8.1, <1",
18
19
  "PyYaml >=6.0.1, <7",
19
20
  "xattr >=0.10.1, <2",
20
21
  ]
@@ -28,7 +29,7 @@ dev = [
28
29
  # full
29
30
  "dirhash >=0.2.1, <1",
30
31
  "numpy >=1.26.4, <3",
31
- "package-utils >=0.6.1, <1",
32
+ "package-utils >=0.8.0, <1",
32
33
  "PyYaml >=6.0.1, <7",
33
34
  "xattr >=0.10.1, <2",
34
35
  ]
@@ -70,7 +71,12 @@ fix = true
70
71
  select = ["ALL"]
71
72
  ignore = [
72
73
  "ANN401", # annotated with Any
73
- "D", # docstrings
74
+ "D1", # missing docstrings
75
+ "D200", # one-line docstring
76
+ "D203", # conflicts with D211
77
+ "D205", # blank line between summary and description
78
+ "D212", # conflicts with D213
79
+ "D401", # imperative first line
74
80
  "G004", # logging f-string
75
81
  ]
76
82
 
@@ -79,7 +85,19 @@ ignore = [
79
85
  "F401" # unused import
80
86
  ]
81
87
  "tests/*" = [
82
- "S101" # assert used
88
+ "S101", # assert used
89
+ ]
90
+ "src/superpathlib/cached_content.py" = [
91
+ "PLC0415", # lazy imports for optional dependency
92
+ ]
93
+ "src/superpathlib/content_properties.py" = [
94
+ "PLC0415", # lazy imports for optional dependencies
95
+ ]
96
+ "src/superpathlib/extra_functionality.py" = [
97
+ "PLC0415", # lazy imports for optional dependencies
98
+ ]
99
+ "src/superpathlib/metadata_properties.py" = [
100
+ "PLC0415", # lazy imports for optional dependencies
83
101
  ]
84
102
 
85
103
  [tool.setuptools.package-data]
@@ -35,7 +35,8 @@ class PropertyMeta(abc.ABCMeta):
35
35
 
36
36
 
37
37
  class Path(base.Path, metaclass=PropertyMeta):
38
- """Expose common folders as attributes.
38
+ """
39
+ Expose common folders as attributes.
39
40
 
40
41
  Use classmethod properties to ensure child classes return instance
41
42
  of child class. The classmethod and property decorators are combined
@@ -1,6 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import getpass
3
4
  import os
5
+ import shlex
4
6
  import subprocess
5
7
  from functools import cached_property
6
8
  from typing import Any
@@ -21,12 +23,14 @@ class Path(extra_functionality.Path):
21
23
  class EncryptedPath(Path):
22
24
  @cached_property
23
25
  def password(self) -> str: # pragma: nocover
26
+ if password := os.environ.get("FILE_ENCRYPTION_PASSWORD"):
27
+ return password
24
28
  if "GITHUB_ACTION" in os.environ:
25
- password = os.environ.get("FILE_ENCRYPTION", "github_action_password")
26
- else:
27
- command = 'ksshaskpass -- "Enter passphrase for file encryption: "'
28
- password = subprocess.getoutput(command) # noqa: S605
29
- return password
29
+ return "github_action_password"
30
+ if askpass := os.environ.get("FILE_ENCRYPTION_ASKPASS"):
31
+ command = shlex.split(askpass)
32
+ return subprocess.check_output(command).decode().strip() # noqa: S603
33
+ return getpass.getpass("Enter passphrase for file encryption: ")
30
34
 
31
35
  @property
32
36
  def encryption_command(self) -> tuple[str, ...]:
@@ -166,7 +166,8 @@ class Path(cached_content.Path):
166
166
  )
167
167
 
168
168
  def load_yaml(self) -> dict[Any, Any] | list[Any]:
169
- """Load yaml content of trusted path with an unsafe loader.
169
+ """
170
+ Load yaml content of trusted path with an unsafe loader.
170
171
 
171
172
  This can be used to instantiate any object
172
173
  :return: Content in path that contains yaml format
@@ -197,7 +198,8 @@ class Path(cached_content.Path):
197
198
  follow_symlinks: bool = False,
198
199
  only_folders: bool = False,
199
200
  ) -> Iterator[Self]:
200
- """Find all subpaths under path that match condition.
201
+ """
202
+ Find all subpaths under path that match condition.
201
203
 
202
204
  only_folders option can be used for efficiency reasons
203
205
  """
@@ -282,14 +284,15 @@ class Path(cached_content.Path):
282
284
  create: bool = True,
283
285
  **kwargs: Any,
284
286
  ) -> Self:
285
- """Usage:
287
+ """
288
+ Context manager for temporary file creation.
286
289
 
287
290
  with Path.tempfile() as tmp: run_command(log_file=tmp) logs = tmp.text
288
291
  process_logs(logs)
289
292
  """
290
293
  if in_memory:
291
294
  in_memory_folder = cls("/") / "dev" / "shm"
292
- if in_memory_folder.exists():
295
+ if in_memory_folder.exists(): # pragma: nocover
293
296
  kwargs["dir"] = in_memory_folder
294
297
  file_handle, path_str = tempfile.mkstemp(**kwargs)
295
298
  os.close(file_handle)
@@ -64,7 +64,7 @@ class Path(encryption.Path):
64
64
  if exist_ok and "Directory not empty" in str(exception):
65
65
  target_path.rmtree()
66
66
  target_path = rename(target_path)
67
- elif "Invalid cross-device link" in str(exception):
67
+ elif "Invalid cross-device link" in str(exception): # pragma: nocover
68
68
  # target is on different file system
69
69
  if target_path.exists():
70
70
  if exist_ok:
@@ -77,7 +77,7 @@ class Path(encryption.Path):
77
77
  raise RuntimeError(message) from exception
78
78
  else:
79
79
  target_path.create_parent()
80
- target_path = shutil.move(self, target_path)
80
+ target_path = self.__class__(shutil.move(self, target_path))
81
81
  else:
82
82
  raise
83
83
  return target_path
@@ -17,7 +17,8 @@ default_tag_name = "user.xdg.tags"
17
17
 
18
18
 
19
19
  class XDGTags:
20
- """More user-friendly way to interact with tags.
20
+ """
21
+ More user-friendly way to interact with tags.
21
22
 
22
23
  - Work with strings and integers instead of bytes
23
24
  - Use xdg tags by default ->
@@ -8,7 +8,6 @@ def find_first_match(condition: Callable[..., bool]) -> int:
8
8
  from an initial value.
9
9
  :return: First integer for which condition is valid.
10
10
  """
11
-
12
11
  # exponential increase for logarithmic search
13
12
  upper_bound = 1
14
13
  while not condition(upper_bound):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superpathlib
3
- Version: 2.0.10
3
+ Version: 2.0.12
4
4
  Summary: Extended Pathlib
5
5
  Author-email: Quinten Roets <qdr2104@columbia.edu>
6
6
  License-Expression: MIT
@@ -9,10 +9,11 @@ Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Requires-Dist: simple-classproperty<5,>=4.0.2
12
+ Requires-Dist: typing_extensions<5,>=4.0
12
13
  Provides-Extra: full
13
14
  Requires-Dist: dirhash<1,>=0.2.1; extra == "full"
14
15
  Requires-Dist: numpy<3,>=1.26.4; extra == "full"
15
- Requires-Dist: package-utils<1,>=0.6.1; extra == "full"
16
+ Requires-Dist: package-utils<1,>=0.8.1; extra == "full"
16
17
  Requires-Dist: PyYaml<7,>=6.0.1; extra == "full"
17
18
  Requires-Dist: xattr<2,>=0.10.1; extra == "full"
18
19
  Provides-Extra: dev
@@ -21,7 +22,7 @@ Requires-Dist: package-dev-tools<1,>=0.7.1; extra == "dev"
21
22
  Requires-Dist: types-PyYaml<7,>=6.0.12.12; extra == "dev"
22
23
  Requires-Dist: dirhash<1,>=0.2.1; extra == "dev"
23
24
  Requires-Dist: numpy<3,>=1.26.4; extra == "dev"
24
- Requires-Dist: package-utils<1,>=0.6.1; extra == "dev"
25
+ Requires-Dist: package-utils<1,>=0.8.0; extra == "dev"
25
26
  Requires-Dist: PyYaml<7,>=6.0.1; extra == "dev"
26
27
  Requires-Dist: xattr<2,>=0.10.1; extra == "dev"
27
28
  Dynamic: license-file
@@ -1,4 +1,5 @@
1
1
  simple-classproperty<5,>=4.0.2
2
+ typing_extensions<5,>=4.0
2
3
 
3
4
  [dev]
4
5
  hypothesis<7,>=6.97.1
@@ -6,13 +7,13 @@ package-dev-tools<1,>=0.7.1
6
7
  types-PyYaml<7,>=6.0.12.12
7
8
  dirhash<1,>=0.2.1
8
9
  numpy<3,>=1.26.4
9
- package-utils<1,>=0.6.1
10
+ package-utils<1,>=0.8.0
10
11
  PyYaml<7,>=6.0.1
11
12
  xattr<2,>=0.10.1
12
13
 
13
14
  [full]
14
15
  dirhash<1,>=0.2.1
15
16
  numpy<3,>=1.26.4
16
- package-utils<1,>=0.6.1
17
+ package-utils<1,>=0.8.1
17
18
  PyYaml<7,>=6.0.1
18
19
  xattr<2,>=0.10.1
File without changes
File without changes
File without changes