Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable MultiplexedPath.joinpath to return MultiplexedPath for common subdirectories #272

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jooste
Copy link

@jooste jooste commented Oct 20, 2022

jooste added 3 commits Oct 20, 2022
Change MultiplexedPath.joinpath to return a MultiplexedPath when descendants refer to a subdirectory that is common to two or more paths in the parent MultiplexedPath
@jaraco jaraco self-assigned this Dec 6, 2022
Copy link
Member

@jaraco jaraco left a comment

Overall, this looks good. I've got some nitpicky comments and I'd like to explore it more to ensure I understand what's happening, but I don't have any major concerns.

@@ -83,12 +83,28 @@ def is_file(self):
return False

def joinpath(self, *descendants):
try:
return super().joinpath(*descendants)
Copy link
Member

@jaraco jaraco Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sad to lose the re-use of the generalized behavior, though I'm not confident there's any other way. I'd like to review the generalized behavior to see if there's yet any opportunity for re-use.

# One of the paths did not resolve (a directory does not exist).
# Just return something that will not exist.
Copy link
Member

@jaraco jaraco Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this comment is lost in the rewrite.

Copy link
Author

@jooste jooste Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. Although I would suggest a modified version of this comment since now there are more possible cases.

# Just return something that will not exist.
return self._paths[0].joinpath(*descendants)
# first try to find child in current paths
paths = []
Copy link
Member

@jaraco jaraco Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of the term 'path' is really overloaded in this method. Let's try to come up with some names that are more indicative of which path/paths are represented.

Copy link
Author

@jooste jooste Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's true. My first thought is to rename this to 'candidates', since we are exploring all of our base paths for the same sub path. Another synonym might be better though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible bug in MultiplexedPath with partially overlapping subdirectory structure
2 participants