Skip to content

Add .open() to the Traversable API #81

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

Closed
jaraco opened this issue Oct 21, 2020 · 4 comments
Closed

Add .open() to the Traversable API #81

jaraco opened this issue Oct 21, 2020 · 4 comments
Milestone

Comments

@jaraco
Copy link
Member

jaraco commented Oct 21, 2020

In GitLab by @jaraco on Feb 29, 2020, 19:13

As is implied by the migration guide, Traversable objects require a .open() method.

The interface needs to be a limited subset of the usual open() operation, but it's basically this:

def open(self, mode='r', *args, **kwargs):
    """
    mode may be 'r' or 'rb' to open as text or binary. Return a handle
    suitable for reading (same as pathlib.Path.open).

    When opening as text, accepts encoding parameters such as those
    accepted by io.TextIOWrapper.
    """

Note, only with zipp 3.0 (and the Python 2 compatible zipp 1.2.0) does the zipp.Path object have a compatible interface, so importlib_resources should depend on these versions.

@jaraco jaraco added this to the 1.2 milestone Oct 21, 2020
@jaraco
Copy link
Member Author

jaraco commented Oct 21, 2020

In GitLab by @jaraco on Feb 29, 2020, 19:27

changed the description

@jaraco
Copy link
Member Author

jaraco commented Oct 21, 2020

In GitLab by @benthayer on Feb 29, 2020, 23:51

mentioned in merge request !88

@jaraco
Copy link
Member Author

jaraco commented Oct 21, 2020

In GitLab by @jaraco on Mar 2, 2020, 17:57

Fixed in !88. Thanks Ben.

@jaraco
Copy link
Member Author

jaraco commented Oct 21, 2020

In GitLab by @jaraco on Mar 2, 2020, 17:57

closed

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

No branches or pull requests

1 participant