From d2ed1e7e71af7c55fcfeb1e6d75c777b4897521d Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Fri, 17 Nov 2023 10:21:16 +0100
Subject: [PATCH] make all docstrings Sphinx-style

---
 gso/services/subscriptions.py        |  6 ++---
 gso/utils/helpers.py                 | 36 +++++++++++++---------------
 gso/workflows/tasks/import_router.py |  5 ++--
 3 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/gso/services/subscriptions.py b/gso/services/subscriptions.py
index 8198c7c5..be283789 100644
--- a/gso/services/subscriptions.py
+++ b/gso/services/subscriptions.py
@@ -124,10 +124,8 @@ def get_active_subscriptions_by_field_and_value(field_name: str, field_value: st
 def count_incomplete_validate_products() -> int:
     """Count the number of incomplete validate_products processes.
 
-    Returns
-    -------
-    int
-        The count of incomplete 'validate_products' processes.
+    :return: The count of incomplete 'validate_products' processes.
+    :rtype: int
     """
     return ProcessTable.query.filter(
         ProcessTable.workflow_name == "validate_products",
diff --git a/gso/utils/helpers.py b/gso/utils/helpers.py
index 44cb8fe3..d59b6d85 100644
--- a/gso/utils/helpers.py
+++ b/gso/utils/helpers.py
@@ -117,13 +117,11 @@ def available_lags_choices(router_id: UUID) -> Choice | None:
 def get_router_vendor(router_id: UUID) -> str:
     """Retrieve the vendor of a router.
 
-    Args:
-    ----
-    router_id (UUID): The {term}`UUID` of the router.
+    :param router_id: The :term:`UUID` of the router.
+    :type router_id: :class:`uuid.UUID`
 
-    Returns:
-    -------
-    str: The vendor of the router.
+    :return: The vendor of the router.
+    :rtype: str:
     """
     return Router.from_subscription(router_id).router.router_vendor
 
@@ -140,16 +138,16 @@ def iso_from_ipv4(ipv4_address: IPv4Address) -> str:
     return f"49.51e5.0001.{re_split}.00"
 
 
-def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr | None:
+def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr:
     """Verify if a device exists in Netbox.
 
-    Args:
-    ----
-    subscription_id (UUID): The {term}`UUID` of the router subscription.
+    Raises a :class:`ValueError` if the device is not found.
 
-    Returns:
-    -------
-    UUID: The {term}`UUID` of the router subscription or raises an error.
+    :param subscription_id: The :term:`UUID` of the router subscription.
+    :type subscription_id: :class:`UUIDstr`
+
+    :return: The :term:`UUID` of the router subscription.
+    :rtype: :class:`UUIDstr`
     """
     router = Router.from_subscription(subscription_id).router
     if router.router_vendor == RouterVendor.NOKIA:
@@ -163,13 +161,13 @@ def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr | None:
 def validate_iptrunk_unique_interface(interfaces: list[LAGMember]) -> list[LAGMember]:
     """Verify if the interfaces are unique.
 
-    Args:
-    ----
-    interfaces (list[LAGMember]): The list of interfaces.
+    Raises a :class:`ValueError` if the interfaces are not unique.
+
+    :param interfaces: The list of interfaces.
+    :type interfaces: list[:class:`LAGMember`]
 
-    Returns:
-    -------
-    list[LAGMember]: The list of interfaces or raises an error.
+    :return: The list of interfaces
+    :rtype: list[:class:`LAGMember`]
     """
     interface_names = [member.interface_name for member in interfaces]
     if len(interface_names) != len(set(interface_names)):
diff --git a/gso/workflows/tasks/import_router.py b/gso/workflows/tasks/import_router.py
index 7be387eb..51276207 100644
--- a/gso/workflows/tasks/import_router.py
+++ b/gso/workflows/tasks/import_router.py
@@ -23,9 +23,8 @@ from gso.services.crm import get_customer_by_name
 def _get_site_by_name(site_name: str) -> Site:
     """Get a site by its name.
 
-    Args:
-    ----
-    site_name (str): The name of the site.
+    :param site_name: The name of the site.
+    :type site_name: str
     """
     subscription = subscriptions.get_active_subscriptions_by_field_and_value("site_name", site_name)[0]
     if not subscription:
-- 
GitLab