Skip to content

Commit 8832966

Browse files
style: format code with Black
This commit fixes the style issues introduced in b37a211 according to the output from Black. Details: #23
1 parent b37a211 commit 8832966

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

codeinsight_sdk/experimental.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ def get_project_vulnerabilities(
2424
"""
2525
# First we get the inventory for the project
2626
# Then we iterate over the inventory items and calling the inventory vulnerability endpoint for each item with a vulnerability
27-
inventory = self.client.projects.get_inventory(project_id,
28-
skip_vulnerabilities=False,
29-
include_files=True
27+
inventory = self.client.projects.get_inventory(
28+
project_id, skip_vulnerabilities=False, include_files=True
3029
)
3130

3231
# Iterate over the inventory items, find which have vulnerabilities.
@@ -38,6 +37,6 @@ def get_project_vulnerabilities(
3837
# If the item no no vulnerabilities, ignore it
3938
if len(item.vulnerabilities) == 0:
4039
continue
41-
#TODO: Summarize the vulnerabilities?
40+
# TODO: Summarize the vulnerabilities?
4241
vuln_items.append(item)
4342
return vuln_items

examples/example-9-dataframe.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from codeinsight_sdk.client import CodeInsightClient
44

55
print("Example 9: Working with Pandas DataFrames")
6-
PROJECT_ID = 1 # Update this to your project ID
6+
PROJECT_ID = 1 # Update this to your project ID
77

8-
client = CodeInsightClient(shared.BASE_URL, shared.AUTH_TOKEN,experimental=True)
8+
client = CodeInsightClient(shared.BASE_URL, shared.AUTH_TOKEN, experimental=True)
99

1010
# Get all the project vulnerabilities.
1111
# This will return a list of Vulnerability objects.
@@ -16,17 +16,17 @@
1616

1717
# Now "explode" list of vulnerabilities into separate rows.
1818
# This will create a new row for each vulnerability.
19-
df = df.explode('vulnerabilities', ignore_index=True)
19+
df = df.explode("vulnerabilities", ignore_index=True)
2020

2121
# Next we convert the vulnerabilities column into another DataFrame
2222
# and then merge it back into the original DataFrame so that we can
2323
# access the vulnerability properties as columns.
24-
df_vul = pd.json_normalize(df['vulnerabilities'])
24+
df_vul = pd.json_normalize(df["vulnerabilities"])
2525
df = df.merge(df_vul, left_index=True, right_index=True)
2626

2727
# Optionally we can drop the original vulnerabilities column
2828
# since we no longer need it. You can also drop other columns
29-
df.drop(columns=['vulnerabilities'],inplace=True)
29+
df.drop(columns=["vulnerabilities"], inplace=True)
3030

3131
# Finally we write the output to excel
32-
df.to_excel('example-9-output.xlsx', index=False)
32+
df.to_excel("example-9-output.xlsx", index=False)

tests/test_experimental.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ def test_get_project_vulnerabilities(self, client):
5959
)
6060
assert len(vulnerable_items) == 1
6161
assert vulnerable_items[0].vulnerabilities is not None
62-
assert (vulnerable_items[0].vulnerabilities[1].vulnerabilityName == "CVE-987-65432")
62+
assert (
63+
vulnerable_items[0].vulnerabilities[1].vulnerabilityName == "CVE-987-65432"
64+
)

0 commit comments

Comments
 (0)