superpathlib 2.1.0__tar.gz → 2.1.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-2.1.0/src/superpathlib.egg-info → superpathlib-2.1.1}/PKG-INFO +1 -1
- {superpathlib-2.1.0 → superpathlib-2.1.1}/pyproject.toml +1 -1
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/content_properties.py +1 -1
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/utils.py +3 -3
- {superpathlib-2.1.0 → superpathlib-2.1.1/src/superpathlib.egg-info}/PKG-INFO +1 -1
- {superpathlib-2.1.0 → superpathlib-2.1.1}/tests/test_content.py +8 -1
- {superpathlib-2.1.0 → superpathlib-2.1.1}/LICENSE +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/README.md +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/setup.cfg +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/__init__.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/archive.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/base.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/common_folders.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/encrypted.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/extra_functionality.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/metadata_properties.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/override.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/path.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib/py.typed +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib.egg-info/SOURCES.txt +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib.egg-info/dependency_links.txt +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib.egg-info/requires.txt +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/src/superpathlib.egg-info/top_level.txt +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/tests/test_common_folders.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/tests/test_functionality.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/tests/test_inheritance.py +0 -0
- {superpathlib-2.1.0 → superpathlib-2.1.1}/tests/test_metadata.py +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from typing import Any, TypeVar
|
|
2
|
+
from typing import Any, TypeVar, cast
|
|
3
3
|
|
|
4
4
|
T = TypeVar("T")
|
|
5
5
|
Getter = Callable[[Any], T]
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def catch_missing(default:
|
|
8
|
+
def catch_missing(default: object) -> Callable[[Getter[T]], Getter[T]]:
|
|
9
9
|
def wrap_getter(function: Getter[T]) -> Getter[T]:
|
|
10
10
|
def wrapper(self: Any) -> T:
|
|
11
11
|
try:
|
|
12
12
|
return function(self)
|
|
13
13
|
except FileNotFoundError:
|
|
14
|
-
return default
|
|
14
|
+
return cast("T", default)
|
|
15
15
|
|
|
16
16
|
return wrapper
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import operator
|
|
2
2
|
from collections.abc import Callable, Iterator
|
|
3
3
|
from functools import partial
|
|
4
|
-
from typing import Any, NamedTuple
|
|
4
|
+
from typing import Any, NamedTuple, assert_type
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pytest
|
|
@@ -104,6 +104,13 @@ def test_missing_content(path: Path) -> None:
|
|
|
104
104
|
assert missing_path.json is None
|
|
105
105
|
|
|
106
106
|
|
|
107
|
+
def test_content_types(path: Path) -> None:
|
|
108
|
+
path.text = 1
|
|
109
|
+
assert_type(path.text, str)
|
|
110
|
+
assert_type(path.json, Any)
|
|
111
|
+
assert_type(path.yaml, Any)
|
|
112
|
+
|
|
113
|
+
|
|
107
114
|
@pytest.fixture
|
|
108
115
|
def cache_path(path: Path) -> Iterator[Path]:
|
|
109
116
|
with path.with_name(path.name + ".cache") as cache_path:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|