diff --git a/gso/services/subscriptions.py b/gso/services/subscriptions.py index 8198c7c586869d6ecc203aaf0ea58173e9eab1a2..be283789507c03b10262bb6391effa5690cb8eb6 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 44cb8fe3eff1fa31037b39915af2617357bfb890..d59b6d8595b188d3c054ddcae94ddeff3ae4b9ca 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 7be387eb83f9163503c64bd614c8d0e64e621626..51276207c79408c96ce40172cbb28f7cbe23f92c 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: