Repository navigation
feat: dol.path_of(store, key) (#158) - #160
Merged
Merged
Conversation
…more tests (review)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #158
Adds
dol.path_of(store, key): the file-system path ofkeyin a file-backed store, however wrapped. It follows every layer's_id_of_key(the existinginner_most_keywalk) to the innermostFileSysCollection, validates the result there (a key leavingrootdirraisesKeyValidationError, aKeyError), and raisesTypeErrorwhen the core is not a file store. Nothing is read or created.Design note: a free function rather than a
Files.path_ofmethod, deliberately.Store.__getattr__forwards unknown attributes to the inner store with the outer key unmapped (the #83 trap), so a method propagated throughwrap_kvswould silently return a wrong path. The function needs no propagation, works for any stacking, and is purely additive. xdol can default itspath_of=to it.Tests:
dol/tests/test_filesys.py::test_path_of_follows_wrappers_and_validates+ doctests.