Skip to content

Commit dd49569

Browse files
Merge branch 'feature/move-to-adaptor-backend' of https://github.com/nathanjmcdougall/pins-python into feature/move-to-adaptor-backend
2 parents 1540500 + d0fa9c9 commit dd49569

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

pins/boards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def _create_meta(
753753
else:
754754
p_obj = str(Path(pin_dir_path) / object_name)
755755
# file is saved locally in order to hash, calc size
756-
file_names = save_data(x._d, p_obj, type, apply_suffix)
756+
file_names = save_data(x, p_obj, type, apply_suffix)
757757

758758
meta = self.meta_factory.create(
759759
pin_dir_path,

pins/drivers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
from typing import Any
44

5-
from pins._adaptors import create_adaptor
5+
from pins._adaptors import Adaptor, create_adaptor
66

77
from .config import PINS_ENV_INSECURE_READ, get_allow_pickle_read
88
from .errors import PinsInsecureReadError
@@ -120,7 +120,7 @@ def load_data(
120120

121121

122122
def save_data(
123-
obj, fname, pin_type=None, apply_suffix: bool = True
123+
obj: "Adaptor | Any", fname, pin_type=None, apply_suffix: bool = True
124124
) -> "str | Sequence[str]":
125125
# TODO: extensible saving with deferred importing
126126
# TODO: how to encode arguments to saving / loading drivers?
@@ -129,7 +129,10 @@ def save_data(
129129
# as argument to board, and then type dispatchers for explicit cases
130130
# of saving / loading objects different ways.
131131

132-
adaptor = create_adaptor(obj)
132+
if isinstance(obj, Adaptor):
133+
adaptor, obj = obj, obj._d
134+
else:
135+
adaptor = create_adaptor(obj)
133136

134137
if apply_suffix:
135138
if pin_type == "file":

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ azure = ["adlfs"]
4040
check = [
4141
"pre-commit",
4242
"pyright==1.1.372", # Pinned; manually sync with .github/workflows/code-checks.yml
43+
"ruff==0.5.4", # Pinned; manually sync with pre-commit-config.yaml
4344
"types-appdirs",
4445
]
4546
doc = [

0 commit comments

Comments
 (0)