From 07ee4c20c7ce23f6d940e9af6ef49c6131ca92df Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Fri, 29 Oct 2021 12:47:57 -0600 Subject: [PATCH] Add docstring to Atom class Signed-off-by: Nicolas Bock --- ebuildtester/atom.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ebuildtester/atom.py b/ebuildtester/atom.py index 9fd1323..d326e5f 100644 --- a/ebuildtester/atom.py +++ b/ebuildtester/atom.py @@ -1,4 +1,12 @@ +"""The Atom class represents a single atom. + +Raises: + AtomException: An AtomException is raised when an atom is invalid. +""" + + class AtomException(Exception): + """A basic Exception.""" pass @@ -16,9 +24,10 @@ def __init__(self, atom): try: self.category, self.package = self.atom.split("/") - except ValueError: + except ValueError as exc: raise AtomException( - "ATOM has to be of the form [=]SECTION/PACKAGE[-VERSION]") + "ATOM has to be of the form [=]SECTION/PACKAGE[-VERSION]") \ + from exc # Split off version. try: