Skip to content

Commit 771db7c

Browse files
authored
Ruff: Add and fix PYI024 (+ merge PYI) (#13002)
1 parent 7819707 commit 771db7c

3 files changed

Lines changed: 53 additions & 62 deletions

File tree

dojo/tools/blackduck/model.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
from collections import namedtuple
1+
from typing import NamedTuple
22

3-
# this class can be updated to use @dataclass in Python 3.7
4-
# note that all types are strings except for 'locations' which is a set of
5-
# strings
6-
BlackduckFinding = namedtuple(
7-
"BlackduckFinding",
8-
[
9-
"vuln_id",
10-
"description",
11-
"security_risk",
12-
"impact",
13-
"component_name",
14-
"component_version",
15-
"vuln_source",
16-
"url",
17-
"channel_version_origin_id",
18-
"component_origin_id",
19-
"published_date",
20-
"updated_date",
21-
"base_score",
22-
"exploitability",
23-
"remediation_status",
24-
"remediation_target_date",
25-
"remediation_actual_date",
26-
"remediation_comment",
27-
"locations",
28-
],
29-
)
3+
4+
class BlackduckFinding(NamedTuple):
5+
vuln_id: str
6+
description: str
7+
security_risk: str
8+
impact: str
9+
component_name: str
10+
component_version: str
11+
vuln_source: str
12+
url: str
13+
channel_version_origin_id: str
14+
component_origin_id: str
15+
published_date: str
16+
updated_date: str
17+
base_score: str
18+
exploitability: str
19+
remediation_status: str
20+
remediation_target_date: str
21+
remediation_actual_date: str
22+
remediation_comment: str
23+
locations: str
Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
from collections import namedtuple
1+
from typing import NamedTuple
22

3-
BlackduckBinaryAnalysisFinding = namedtuple(
4-
"BlackduckBinaryAnalysisFinding",
5-
[
6-
"report_name",
7-
"component",
8-
"version",
9-
"latest_version",
10-
"cve",
11-
"matching_type",
12-
"cvss_v2",
13-
"cve_publication_date",
14-
"object_compilation_date",
15-
"object_name",
16-
"object_full_path",
17-
"object_sha1",
18-
"cvss_v3",
19-
"cvss_vector_v2",
20-
"cvss_vector_v3",
21-
"summary",
22-
"distribution_package",
23-
"cvss_distribution_v2",
24-
"cvss_distribution_v3",
25-
"triage_vectors",
26-
"unresolving_triage_vectors",
27-
"note_type",
28-
"note_reason",
29-
"vulnerability_url",
30-
"missing_exploit_mitigations",
31-
"bdsa",
32-
"version_override_type",
33-
],
34-
)
3+
4+
class BlackduckBinaryAnalysisFinding(NamedTuple):
5+
report_name: str
6+
component: str
7+
version: str
8+
latest_version: str
9+
cve: str
10+
matching_type: str
11+
cvss_v2: str
12+
cve_publication_date: str
13+
object_compilation_date: str
14+
object_name: str
15+
object_full_path: str
16+
object_sha1: str
17+
cvss_v3: str
18+
cvss_vector_v2: str
19+
cvss_vector_v3: str
20+
summary: str
21+
distribution_package: str
22+
cvss_distribution_v2: str
23+
cvss_distribution_v3: str
24+
triage_vectors: str
25+
unresolving_triage_vectors: str
26+
note_type: str
27+
note_reason: str
28+
vulnerability_url: str
29+
missing_exploit_mitigations: str
30+
bdsa: str
31+
version_override_type: str

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ select = [
5757
"INP",
5858
"PIE",
5959
"T20",
60-
"PYI00", "PYI01", "PYI020", "PYI021", "PYI025", "PYI026", "PYI029", "PYI03", "PYI04", "PYI05", "PYI06",
60+
"PYI",
6161
"PT001", "PT002", "PT003", "PT006", "PT007", "PT008", "PT01", "PT020", "PT021", "PT022", "PT023", "PT024", "PT025", "PT026", "PT028", "PT029", "PT03",
6262
"Q",
6363
"RSE",

0 commit comments

Comments
 (0)