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

readers: add MultiplexedPath.paths #310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FFY00
Copy link
Member

@FFY00 FFY00 commented May 28, 2024

Fixes #309

@FFY00
Copy link
Member Author

FFY00 commented Jun 26, 2024

@jaraco what do you think of this?

Copy link
Member

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me. We should add some tests to ensure the use-case is covered. And should we include type annotations?

@@ -72,6 +72,10 @@ def __init__(self, *paths):
if not all(path.is_dir() for path in self._paths):
raise NotADirectoryError('MultiplexedPath only supports directories')

@property
def paths(self):
return self._paths.copy()
Copy link
Member

Choose a reason for hiding this comment

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

If we type-annotate this property to be a non-mutable Sequence, and because self._paths is not mutated internally (also treated like a non-mutable Sequence), there's no need to make a copy. But I'm okay either way.

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.

Expose base paths of MultiplexedPath
2 participants