From cb2b89f5ac9faf5d87af0ab3d4c345bc2727a0c5 Mon Sep 17 00:00:00 2001 From: Blazej Michalik <6691643+MrMino@users.noreply.github.com> Date: Sat, 20 Aug 2022 00:17:42 +0200 Subject: [PATCH] Document exceptions raised by functions in `utils` (#544) CLoses #543 Co-authored-by: Brett Cannon --- docs/utils.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/utils.rst b/docs/utils.rst index 192def74..7a4c2f74 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -63,6 +63,8 @@ Reference instance of :class:`~packaging.tags.Tag`. :param str filename: The name of the wheel file. + :raises InvalidWheelFilename: If the filename in question + does not follow conventions outlined in `PEP 427`_. .. doctest:: @@ -87,6 +89,9 @@ Reference represented by an instance of :class:`~packaging.version.Version`. :param str filename: The name of the sdist file. + :raises InvalidSdistFilename: If the filename does not end + with an sdist extension (``.zip`` or ``.tar.gz``), or if it does not + contain a dash separating the name and the version of the distribution. .. doctest:: @@ -98,4 +103,14 @@ Reference >>> ver == Version('1.0') True + +.. exception:: InvalidWheelFilename + + Raised when a file name for a wheel is invalid. + +.. exception:: InvalidSdistFilename + + Raised when a source distribution file name is considered invalid. + .. _Source distribution format: https://packaging.python.org/specifications/source-distribution-format/#source-distribution-file-name +.. _`PEP 427`: https://peps.python.org/pep-0427/#file-name-convention