Skip to content

Commit

Permalink
Merge pull request #39 from neuro-ml/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
STNLd2 authored Apr 8, 2024
2 parents 68f77a5 + fd55592 commit 12ed7b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bev/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.3"
__version__ = "0.11.4"
8 changes: 7 additions & 1 deletion bev/cli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import typer
from rich.progress import track
from tarn.utils import value_to_buffer
from typing_extensions import Annotated

from ..exceptions import HashError
Expand Down Expand Up @@ -130,7 +131,12 @@ def save_hash(value, file, repo, fetch):
f.write(value)


def copy_value(value, file):
with value_to_buffer(value) as f, open(file, 'wb') as file:
shutil.copyfileobj(f, file)


PULL_MODES = {
PullMode.copy: lambda h, dst, repo, fetch: repo.storage.read(shutil.copyfile, h, dst, fetch=fetch),
PullMode.copy: lambda h, dst, repo, fetch: repo.storage.read(copy_value, h, dst, fetch=fetch),
PullMode.hash: save_hash,
}
3 changes: 2 additions & 1 deletion bev/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .vc import VC, CommittedVersion, SubprocessGit, Version
from .wc import BevLocalGlob, BevVCGlob


_NoArg = object()


Expand Down Expand Up @@ -139,7 +140,7 @@ def _resolve(path):
raise NameConflict(f'Both the path "{relative}" and its hash "{to_hash(relative)}" found')
return absolute.resolve()

key = self.get_key(relative, version=version, fetch=fetch)
key = self.get_key(*parts, version=version, fetch=fetch)
return self.storage.read(_resolve, key, fetch=fetch)

def glob(self, *parts: PathOrStr, version: Optional[Version] = None,
Expand Down

0 comments on commit 12ed7b9

Please sign in to comment.