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

bpo-32248 - Implement importlib.resources #4911

Merged
merged 18 commits into from
Dec 30, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up
  • Loading branch information
warsaw committed Dec 17, 2017
commit d41bac368765df1a3a491f526d26a5fa4916799c
14 changes: 7 additions & 7 deletions Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ The following types are defined.

The following functions are available.

.. function:: importlib.resources.open_binary(package, resource)
.. function:: open_binary(package, resource)

Open for binary reading the *resource* within *package*.

Expand All @@ -831,7 +831,7 @@ The following functions are available.
:rtype: ``typing.io.BinaryIO``


.. function:: importlib.resources.open_text(package, resource, encoding='utf-8', errors='strict')
.. function:: open_text(package, resource, encoding='utf-8', errors='strict')

Open for text reading the *resource* within *package*. By default, the
resource is opened for reading as UTF-8.
Expand All @@ -851,7 +851,7 @@ The following functions are available.
:returns: an I/O stream open for reading.
:rtype: ``typing.TextIO``

.. function:: importlib.resources.read_binary(package, resource)
.. function:: read_binary(package, resource)

Read and return the contents of the *resource* within *package* as
``bytes``.
Expand All @@ -866,7 +866,7 @@ The following functions are available.
:returns: the contents of the resource.
:rtype: ``bytes``

.. function:: importlib.resources.read_text(package, resource, encoding='utf-8', errors='strict')
.. function:: read_text(package, resource, encoding='utf-8', errors='strict')

Read and return the contents of *resource* within *package* as a ``str``.
By default, the contents are read as strict UTF-8.
Expand All @@ -886,7 +886,7 @@ The following functions are available.
:returns: the contents of the resource.
:rtype: ``str``

.. function:: importlib.resources.path(package, resource)
.. function:: path(package, resource)

Return the path to the *resource* as an actual file system path. This
function returns a context manager for use in a :keyword:`with` statement.
Expand All @@ -908,7 +908,7 @@ The following functions are available.
:rtype: context manager providing a :class:`pathlib.Path` object


.. function:: importlib.resources.is_resource(package, name)
.. function:: is_resource(package, name)

Return ``True`` if there is a resource named *name* in the package,
otherwise ``False``. Remember that directories are *not* resources!
Expand All @@ -924,7 +924,7 @@ The following functions are available.
:rtype: ``bool``


.. function:: importlib.resources.contents(package)
.. function:: contents(package)

Return an iterator over the contents of the package. The iterator can
return resources (e.g. files) and non-resources (e.g. directories). The
Expand Down