[3.12] GH-121970: Replace custom abstract method directive with the ``:abstract:`` option (GH-129311) by AA-Turner · Pull Request #130440 · python/cpython
.. abstractmethod:: get_data(path) .. method:: get_data(path) :abstractmethod:
An abstract method to return the bytes for the data located at *path*. Loaders that have a file-like storage back-end
.. abstractmethod:: get_source(fullname) .. method:: get_source(fullname) :abstractmethod:
An abstract method to return the source of a module. It is returned as a text string using :term:`universal newlines`, translating all
.. abstractmethod:: get_filename(fullname) .. method:: get_filename(fullname) :abstractmethod:
An abstract method that is to return the value of :attr:`~module.__file__` for the specified module. If no path is
.. abstractmethod:: get_filename(fullname) .. method:: get_filename(fullname) :abstractmethod:
Returns :attr:`path`.
.. abstractmethod:: get_data(path) .. method:: get_data(path) :abstractmethod:
Reads *path* as a binary file and returns the bytes from it.
.. abstractmethod:: open_resource(resource) .. method:: open_resource(resource) :abstractmethod:
Returns an opened, :term:`file-like object` for binary reading of the *resource*.
If the resource cannot be found, :exc:`FileNotFoundError` is raised.
.. abstractmethod:: resource_path(resource) .. method:: resource_path(resource) :abstractmethod:
Returns the file system path to the *resource*.
If the resource does not concretely exist on the file system, raise :exc:`FileNotFoundError`.
.. abstractmethod:: is_resource(name) .. method:: is_resource(name) :abstractmethod:
Returns ``True`` if the named *name* is considered a resource. :exc:`FileNotFoundError` is raised if *name* does not exist.
.. abstractmethod:: contents() .. method:: contents() :abstractmethod:
Returns an :term:`iterable` of strings over the contents of the package. Do note that it is not required that all names
Abstract. The base name of this object without any parent references.
.. abstractmethod:: iterdir() .. method:: iterdir() :abstractmethod:
Yield ``Traversable`` objects in ``self``.
.. abstractmethod:: is_dir() .. method:: is_dir() :abstractmethod:
Return ``True`` if ``self`` is a directory.
.. abstractmethod:: is_file() .. method:: is_file() :abstractmethod:
Return ``True`` if ``self`` is a file.
.. abstractmethod:: joinpath(child) .. method:: joinpath(child) :abstractmethod:
Return Traversable child in ``self``.
.. abstractmethod:: __truediv__(child) .. method:: __truediv__(child) :abstractmethod:
Return ``Traversable`` child in ``self``.
.. abstractmethod:: open(mode='r', *args, **kwargs) .. method:: open(mode='r', *args, **kwargs) :abstractmethod:
*mode* may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as :attr:`pathlib.Path.open`).
.. abstractmethod:: files() .. method:: files() :abstractmethod:
Returns a :class:`importlib.resources.abc.Traversable` object for the loaded package.