Skip to content

Commit

Permalink
Relax type assertion from PurePosixPath to PosixPath in RIA patches
Browse files Browse the repository at this point in the history
The patched code is new patch-code, introduced in
datalad#669

The assertions were added to make sure that no platform paths are
passed around. The Debian maintainer observed non-pure paths coming in.
This may need an investigation, but this changeset maintains the spirit
of the assertions while relaxing them enough to let the tests pass in
a Debian build environment.
  • Loading branch information
mih committed May 20, 2024
1 parent 851b13c commit 7503479
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions datalad_next/patches/add_method_url2transport_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def local_io_url2transport_path(
self,
url_path: PurePosixPath
) -> Path | PurePosixPath:
assert url_path.__class__ is PurePosixPath
assert isinstance(url_path, PurePosixPath)
if on_windows:
return str2windows_path(url_path)
else:
Expand All @@ -57,7 +57,7 @@ def http_remote_io_url2transport_path(
self,
url_path: PurePosixPath
) -> Path | PurePosixPath:
assert url_path.__class__ is PurePosixPath
assert isinstance(url_path, PurePosixPath)
return url_path


Expand Down
2 changes: 1 addition & 1 deletion datalad_next/patches/replace_ora_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(self, annex):
# PATCH: add a helper to assert the type of a path.
@staticmethod
def _assert_pure_posix_path(path):
assert path.__class__ is PurePosixPath
assert isinstance(path, PurePosixPath)

# PATCH: add a close function to ensure that all IO-abstraction objects are
# closed.
Expand Down
4 changes: 2 additions & 2 deletions datalad_next/patches/ria_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def ria_utils__ensure_version(io, base_path, version):
target layout version of the store (dataset tree)
"""
# PATCH: ensure that `base_path` is an instance of `PurePosixPath`.
assert base_path.__class__ is PurePosixPath
assert isinstance(base_path, PurePosixPath)

# PATCH: convert abstract `ria-layout-version`-path to concrete IO-specific
# path
Expand Down Expand Up @@ -137,7 +137,7 @@ def ria_utils_create_ds_in_store(io,
'annex/objects')
"""
# PATCH: ensure that `base_path` is an instance of `PurePosixPath`.
assert base_path.__class__ is PurePosixPath
assert isinstance(base_path, PurePosixPath)

# TODO: Note for RF'ing, that this is about setting up a valid target
# for the special remote not a replacement for create-sibling-ria.
Expand Down

0 comments on commit 7503479

Please sign in to comment.