◐ Shell
clean mode source ↗

[3.12] GH-121970: Replace custom abstract method directive with the ``:abstract:`` option (GH-129311) by AA-Turner · Pull Request #130440 · python/cpython

Expand Up @@ -390,7 +390,8 @@ ABC hierarchy:: This ABC is deprecated in favour of supporting resource loading through :class:`importlib.resources.abc.TraversableResources`.
.. 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 Expand Down Expand Up @@ -427,7 +428,8 @@ ABC hierarchy:: .. versionchanged:: 3.4 No longer abstract and a concrete implementation is provided.
.. 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 Expand Down Expand Up @@ -484,7 +486,8 @@ ABC hierarchy:: when implemented, helps a module to be executed as a script. The ABC represents an optional :pep:`302` protocol.
.. 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 Expand Down Expand Up @@ -524,11 +527,13 @@ ABC hierarchy:: .. deprecated-removed:: 3.4 3.15 Use :meth:`Loader.exec_module` instead.
.. 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.
Expand Down Expand Up @@ -664,27 +669,31 @@ ABC hierarchy:: .. deprecated-removed:: 3.12 3.14 Use :class:`importlib.resources.abc.TraversableResources` instead.
.. 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 Expand Down Expand Up @@ -720,27 +729,33 @@ ABC hierarchy::
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`). Expand Down Expand Up @@ -774,7 +789,8 @@ ABC hierarchy:: .. deprecated-removed:: 3.12 3.14 Use :class:`importlib.resources.abc.TraversableResources` instead.
.. abstractmethod:: files() .. method:: files() :abstractmethod:
Returns a :class:`importlib.resources.abc.Traversable` object for the loaded package. Expand Down