diff --git a/sw360/components.py b/sw360/components.py index debb676..d2f48d4 100644 --- a/sw360/components.py +++ b/sw360/components.py @@ -9,7 +9,8 @@ # SPDX-License-Identifier: MIT # ------------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional +import sys +from typing import Any, Dict, List, Optional, Union import requests @@ -18,9 +19,11 @@ class ComponentsMixin(BaseMixin): + # return type List[Dict[str, Any]] | Optional[Dict[str, Any]] for Python 3.11 is good, + # Union[List[Dict[str, Any]], Optional[Dict[str, Any]]] for lower Python versions is not good def get_all_components(self, fields=None, page=-1, page_size=-1, all_details: bool = False, - sort: str = "") -> List[Dict[str, Any]] | Optional[Dict[str, Any]]: + sort: str = "") -> Any: """Get information of about all components API endpoint: GET /components diff --git a/sw360/releases.py b/sw360/releases.py index db7c83a..044d507 100644 --- a/sw360/releases.py +++ b/sw360/releases.py @@ -64,8 +64,10 @@ def get_releases_by_name(self, name: str) -> List[Any]: return [] + # return type List[Dict[str, Any]] | Optional[Dict[str, Any]] for Python 3.11 is good, + # Union[List[Dict[str, Any]], Optional[Dict[str, Any]]] for lower Python versions is not good def get_all_releases(self, fields: str = "", all_details: bool = False, page: int = -1, - page_size: int = -1, sort: str = "") -> List[Dict[str, Any]] | Optional[Dict[str, Any]]: + page_size: int = -1, sort: str = "") -> Any: """Get information of about all releases API endpoint: GET /releases