Skip to content
Snippets Groups Projects
Commit d2ed1e7e authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Neda Moeini
Browse files

make all docstrings Sphinx-style

parent 3e66347d
Branches
Tags 0.7
1 merge request!115Feature/update docs
...@@ -124,10 +124,8 @@ def get_active_subscriptions_by_field_and_value(field_name: str, field_value: st ...@@ -124,10 +124,8 @@ def get_active_subscriptions_by_field_and_value(field_name: str, field_value: st
def count_incomplete_validate_products() -> int: def count_incomplete_validate_products() -> int:
"""Count the number of incomplete validate_products processes. """Count the number of incomplete validate_products processes.
Returns :return: The count of incomplete 'validate_products' processes.
------- :rtype: int
int
The count of incomplete 'validate_products' processes.
""" """
return ProcessTable.query.filter( return ProcessTable.query.filter(
ProcessTable.workflow_name == "validate_products", ProcessTable.workflow_name == "validate_products",
......
...@@ -117,13 +117,11 @@ def available_lags_choices(router_id: UUID) -> Choice | None: ...@@ -117,13 +117,11 @@ def available_lags_choices(router_id: UUID) -> Choice | None:
def get_router_vendor(router_id: UUID) -> str: def get_router_vendor(router_id: UUID) -> str:
"""Retrieve the vendor of a router. """Retrieve the vendor of a router.
Args: :param router_id: The :term:`UUID` of the router.
---- :type router_id: :class:`uuid.UUID`
router_id (UUID): The {term}`UUID` of the router.
Returns: :return: The vendor of the router.
------- :rtype: str:
str: The vendor of the router.
""" """
return Router.from_subscription(router_id).router.router_vendor return Router.from_subscription(router_id).router.router_vendor
...@@ -140,16 +138,16 @@ def iso_from_ipv4(ipv4_address: IPv4Address) -> str: ...@@ -140,16 +138,16 @@ def iso_from_ipv4(ipv4_address: IPv4Address) -> str:
return f"49.51e5.0001.{re_split}.00" 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. """Verify if a device exists in Netbox.
Args: Raises a :class:`ValueError` if the device is not found.
----
subscription_id (UUID): The {term}`UUID` of the router subscription.
Returns: :param subscription_id: The :term:`UUID` of the router subscription.
------- :type subscription_id: :class:`UUIDstr`
UUID: The {term}`UUID` of the router subscription or raises an error.
:return: The :term:`UUID` of the router subscription.
:rtype: :class:`UUIDstr`
""" """
router = Router.from_subscription(subscription_id).router router = Router.from_subscription(subscription_id).router
if router.router_vendor == RouterVendor.NOKIA: if router.router_vendor == RouterVendor.NOKIA:
...@@ -163,13 +161,13 @@ def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr | None: ...@@ -163,13 +161,13 @@ def validate_router_in_netbox(subscription_id: UUIDstr) -> UUIDstr | None:
def validate_iptrunk_unique_interface(interfaces: list[LAGMember]) -> list[LAGMember]: def validate_iptrunk_unique_interface(interfaces: list[LAGMember]) -> list[LAGMember]:
"""Verify if the interfaces are unique. """Verify if the interfaces are unique.
Args: Raises a :class:`ValueError` if the interfaces are not unique.
----
interfaces (list[LAGMember]): The list of interfaces. :param interfaces: The list of interfaces.
:type interfaces: list[:class:`LAGMember`]
Returns: :return: The list of interfaces
------- :rtype: list[:class:`LAGMember`]
list[LAGMember]: The list of interfaces or raises an error.
""" """
interface_names = [member.interface_name for member in interfaces] interface_names = [member.interface_name for member in interfaces]
if len(interface_names) != len(set(interface_names)): if len(interface_names) != len(set(interface_names)):
......
...@@ -23,9 +23,8 @@ from gso.services.crm import get_customer_by_name ...@@ -23,9 +23,8 @@ from gso.services.crm import get_customer_by_name
def _get_site_by_name(site_name: str) -> Site: def _get_site_by_name(site_name: str) -> Site:
"""Get a site by its name. """Get a site by its name.
Args: :param site_name: The name of the site.
---- :type site_name: str
site_name (str): The name of the site.
""" """
subscription = subscriptions.get_active_subscriptions_by_field_and_value("site_name", site_name)[0] subscription = subscriptions.get_active_subscriptions_by_field_and_value("site_name", site_name)[0]
if not subscription: if not subscription:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment