pickle-debug 2.0__tar.gz → 2.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.
- {pickle_debug-2.0/src/pickle_debug.egg-info → pickle_debug-2.1}/PKG-INFO +3 -2
- {pickle_debug-2.0 → pickle_debug-2.1}/README.md +2 -1
- {pickle_debug-2.0 → pickle_debug-2.1}/pyproject.toml +1 -1
- {pickle_debug-2.0 → pickle_debug-2.1}/src/pickle_debug/__init__.py +11 -8
- {pickle_debug-2.0 → pickle_debug-2.1/src/pickle_debug.egg-info}/PKG-INFO +3 -2
- {pickle_debug-2.0 → pickle_debug-2.1}/src/pickle_debug.egg-info/SOURCES.txt +1 -0
- pickle_debug-2.1/src/test/ntest.py +15 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/LICENSE +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/setup.cfg +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/src/pickle_debug.egg-info/dependency_links.txt +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/src/pickle_debug.egg-info/top_level.txt +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/src/test/patch_test.py +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/src/test/pd_test.py +0 -0
- {pickle_debug-2.0 → pickle_debug-2.1}/src/test/ttest.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pickle_debug
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1
|
|
4
4
|
Summary: Store expensive objects from debugging
|
|
5
5
|
Author: Gerard
|
|
6
6
|
Author-email: gweatherby@uchc.edu
|
|
@@ -90,9 +90,10 @@ plain functions.
|
|
|
90
90
|
|
|
91
91
|
## API
|
|
92
92
|
|
|
93
|
-
### `enable(directory)`
|
|
93
|
+
### `enable(directory: str | Path | None)`
|
|
94
94
|
Turn caching on, storing results in `directory` (a `str` or `Path`). The directory is created if
|
|
95
95
|
needed and checked for writability. Raises `OSError` if it cannot be created or written.
|
|
96
|
+
enable(None) disables caching.
|
|
96
97
|
|
|
97
98
|
### `cached(func)`
|
|
98
99
|
Decorator. Returns a wrapper (using `functools.wraps`) that:
|
|
@@ -78,9 +78,10 @@ plain functions.
|
|
|
78
78
|
|
|
79
79
|
## API
|
|
80
80
|
|
|
81
|
-
### `enable(directory)`
|
|
81
|
+
### `enable(directory: str | Path | None)`
|
|
82
82
|
Turn caching on, storing results in `directory` (a `str` or `Path`). The directory is created if
|
|
83
83
|
needed and checked for writability. Raises `OSError` if it cannot be created or written.
|
|
84
|
+
enable(None) disables caching.
|
|
84
85
|
|
|
85
86
|
### `cached(func)`
|
|
86
87
|
Decorator. Returns a wrapper (using `functools.wraps`) that:
|
|
@@ -18,16 +18,19 @@ _CACHE_DIRECTORY: Path | None = None
|
|
|
18
18
|
_SUFFIX = '.pickle'
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def enable(directory: Path | str) -> None:
|
|
21
|
+
def enable(directory: Path | str|None) -> None:
|
|
22
22
|
"""Enable caching in specified directory. Raises OSError if directory can't be created or written"""
|
|
23
23
|
global _CACHE_DIRECTORY
|
|
24
|
-
directory
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if directory is not None:
|
|
25
|
+
directory = Path(directory)
|
|
26
|
+
directory.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
# verify we can create and write files
|
|
28
|
+
with tempfile.TemporaryFile(dir=directory) as f:
|
|
29
|
+
f.write(b'test')
|
|
30
|
+
_CACHE_DIRECTORY = directory
|
|
31
|
+
pickle_debug_logger.debug(f"caching to {directory}")
|
|
32
|
+
else:
|
|
33
|
+
_CACHE_DIRECTORY = None
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
def reset() -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pickle_debug
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1
|
|
4
4
|
Summary: Store expensive objects from debugging
|
|
5
5
|
Author: Gerard
|
|
6
6
|
Author-email: gweatherby@uchc.edu
|
|
@@ -90,9 +90,10 @@ plain functions.
|
|
|
90
90
|
|
|
91
91
|
## API
|
|
92
92
|
|
|
93
|
-
### `enable(directory)`
|
|
93
|
+
### `enable(directory: str | Path | None)`
|
|
94
94
|
Turn caching on, storing results in `directory` (a `str` or `Path`). The directory is created if
|
|
95
95
|
needed and checked for writability. Raises `OSError` if it cannot be created or written.
|
|
96
|
+
enable(None) disables caching.
|
|
96
97
|
|
|
97
98
|
### `cached(func)`
|
|
98
99
|
Decorator. Returns a wrapper (using `functools.wraps`) that:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|