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
No related branches found
No related tags found
1 merge request!115Feature/update docs
......@@ -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",
......
......@@ -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)):
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment