Skip to content

Commit 953ee00

Browse files
committed
style: fix issues
1 parent 462dff8 commit 953ee00

15 files changed

Lines changed: 38 additions & 24 deletions

sw360/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
__version__ = (1, 11, 2)
1111

12+
from .base import SW360Response
1213
from .sorting import (BaseSortMixin, ProjectSortColumn, ReleaseSortColumn,
1314
SortParam)
14-
from .base import SW360Response
1515
from .sw360_api import SW360
1616
from .sw360error import SW360Error
1717
from .sw360keycloak import SW360Keycloak

sw360/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def is_above_version_19(self) -> bool:
517517
"""Check if API version is above version 19.
518518
Used to check version >= 20 features."""
519519
return self.api_version >= (20, 0)
520+
520521
@classmethod
521522
def get_linked_id(cls, data: Dict[str, Any], link_key: str = "self") -> Optional[str]:
522523
"""Extract the resource ID from a HAL ``_links`` entry.

sw360/license.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2022 BMW CarIT GmbH
44
# All Rights Reserved.
55
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
6-
# Authors: helio.chissini-de-castro@bmw.de
6+
# Authors: helio.chissini-de-castro@bmw.de, mishra.gaurav@siemens.com
77
#
88
# Licensed under the MIT license.
99
# SPDX-License-Identifier: MIT
@@ -133,8 +133,6 @@ def get_all_licenses(self) -> List[Dict[str, Any]]:
133133
"""
134134

135135
fullbase_url = self.url + "resource/api/licenses"
136-
sort = LicenseSortColumn.SHORT_NAME.asc()
137-
138136
if self.is_above_version_18():
139137
resp = self.api_get_all(fullbase_url)
140138
else:

sw360/releases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2022 BMW CarIT GmbH
44
# All Rights Reserved.
55
# Authors: thomas.graf@siemens.com, gernot.hillier@siemens.com
6-
# Authors: helio.chissini-de-castro@bmw.de
6+
# Authors: helio.chissini-de-castro@bmw.de, mishra.gaurav@siemens.com
77
#
88
# Licensed under the MIT license.
99
# SPDX-License-Identifier: MIT
@@ -55,7 +55,7 @@ def __get_releases_filtered(
5555

5656
if (resp and
5757
"_embedded" in resp and
58-
"sw360:releases" in resp["_embedded"]):
58+
"sw360:releases" in resp["_embedded"]):
5959
return resp["_embedded"]["sw360:releases"]
6060

6161
return []
@@ -427,8 +427,8 @@ def upload_attachment_to_release(
427427
raise SW360Error(message="No release id provided!")
428428

429429
attachment_content = self._upload_resource_file(upload_file, upload_type, upload_comment)
430-
attachment_content['attachmentType'] = upload_type # Make sure the type is correct
431-
attachment_content['createdComment'] = upload_comment # Override
430+
attachment_content['attachmentType'] = upload_type # Make sure the type is correct
431+
attachment_content['createdComment'] = upload_comment # Override
432432

433433
current_release = self.get_release(release_id)
434434
attachments = self._get_attachments(current_release)

sw360/reports.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# SPDX-License-Identifier: MIT
88
# -------------------------------------------------------------------------------
99

10-
from typing import Any, Dict, List, Optional
11-
1210
import requests
1311

1412
from .base import BaseMixin

sw360/sorting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ class PackageSortColumn(BaseSortMixin, Enum):
7979
VERSION = "version"
8080
PACKAGE_MANAGER = "packageManager"
8181

82+
8283
class VendorSortColumn(BaseSortMixin, Enum):
8384
SCORE = "score"
8485
FULL_NAME = "fullName"
8586
SHORT_NAME = "shortName"
8687

88+
8789
class VulnerabilitySortColumn(BaseSortMixin, Enum):
8890
LAST_UPDATE_DATE = "lastUpdateDate"
8991
EXTERNAL_ID = "externalId"

sw360/sw360_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
self.default_batch_size = default_batch_size
102102
self.api_version = self.parse_version("18.0")
103103

104-
def login_api(self, token: str = "") -> bool:
104+
def login_api(self, token: str = "") -> bool: # noqa
105105
"""Login to SW360 REST API. This used to have a `token` parameter
106106
due to historic reasons which is ignored.
107107

tests/test_sw360_clearingrequests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def _add_version_response(self) -> None:
4848
responses.add(
4949
method=responses.GET,
5050
url=self.MYURL + "resource/api/version",
51-
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997","sw360Version":"20.1.0","gitBranch":"main"}',
51+
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997"'
52+
+ ',"sw360Version":"20.1.0","gitBranch":"main"}',
5253
status=200,
5354
content_type="application/json",
5455
)

tests/test_sw360_components.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def _add_version_response(self) -> None:
5151
responses.add(
5252
method=responses.GET,
5353
url=self.MYURL + "resource/api/version",
54-
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997","sw360Version":"20.1.0","gitBranch":"main"}',
54+
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997",'
55+
+ '"sw360Version":"20.1.0","gitBranch":"main"}',
5556
status=200,
5657
content_type="application/json",
5758
)

tests/test_sw360_health.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def _add_version_response(self) -> None:
4848
responses.add(
4949
method=responses.GET,
5050
url=self.MYURL + "resource/api/version",
51-
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997","sw360Version":"20.1.0","gitBranch":"main"}',
51+
body='{"apiVersion":"20.1.76","buildTime":"2026-08-14T13:17:47Z","buildNumber":"a8a0997",'
52+
+ '"sw360Version":"20.1.0","gitBranch":"main"}',
5253
status=200,
5354
content_type="application/json",
5455
)

0 commit comments

Comments
 (0)