Skip to content

Commit de97612

Browse files
committed
chore:SP-2974 Fixes linter issues on inspect module
1 parent 3161af9 commit de97612

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

src/scanoss/export/dependency_track.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
from ..scanossbase import ScanossBase
3535
from ..utils.file import validate_json_file
3636

37+
HTTP_OK = 200
38+
3739

3840
@dataclass
3941
class DependencyTrackExporterConfig:
@@ -185,7 +187,7 @@ def get_project_by_name_version(self, name, version):
185187
params=params
186188
)
187189

188-
if project_response.status_code == 200:
190+
if project_response.status_code == HTTP_OK:
189191
project_data = project_response.json()
190192
return project_data
191193

@@ -236,7 +238,10 @@ def upload_sbom(self, input_file: str) -> bool:
236238
project_data = self.get_project_by_name_version(self.dt_projectname, self.dt_projectversion)
237239
if project_data.get("uuid"):
238240
project_uuid = project_data.get("uuid")
239-
token_json = json.dumps({"token": response_data["token"], "project_uuid": project_uuid }, indent=2)
241+
token_json = json.dumps(
242+
{"token": response_data["token"], "project_uuid": project_uuid},
243+
indent=2
244+
)
240245
self.print_stdout(token_json)
241246
except json.JSONDecodeError:
242247
pass

src/scanoss/inspection/dependency_track/project_violation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import json
22
import time
33
from datetime import datetime
4-
from typing import Dict, Any, Optional, List, TypedDict
4+
from typing import Any, Dict, List, Optional, TypedDict
5+
56
import requests
67

78
from ..policy_check import PolicyCheck, PolicyStatus
@@ -207,7 +208,7 @@ def _get_dependency_track_project_violations(self):
207208
"""
208209
status = self._get_project_status()
209210
max_tries = 10
210-
while status['processing'] == True and max_tries>0:
211+
while status['processing'] and max_tries > 0:
211212
max_tries = max_tries - 1
212213
time.sleep(1)
213214
status = self._get_project_status()

src/scanoss/inspection/policy_check.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424

2525
from abc import abstractmethod
2626
from enum import Enum
27-
from typing import Any, Callable, Dict, List, TypeVar, Generic
28-
from .utils.license_utils import LicenseUtil
27+
from typing import Any, Callable, Dict, Generic, List, TypeVar
28+
2929
from ..scanossbase import ScanossBase
30+
from .utils.license_utils import LicenseUtil
3031

3132

3233
class PolicyStatus(Enum):

src/scanoss/inspection/raw/copyleft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
from dataclasses import dataclass
2727
from typing import Any, Dict, List
2828

29-
from .raw_base import RawBase
3029
from ..policy_check import PolicyStatus
30+
from .raw_base import RawBase
3131

3232

3333
@dataclass

src/scanoss/inspection/raw/undeclared_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
from dataclasses import dataclass
2727
from typing import Any, Dict, List
2828

29-
from .raw_base import RawBase
3029
from ..policy_check import PolicyStatus
30+
from .raw_base import RawBase
3131

3232
@dataclass
3333
class License:

0 commit comments

Comments
 (0)