Skip to content

Commit 5033af7

Browse files
committed
Use standard header and streamline imports
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 1cb8ead commit 5033af7

17 files changed

+87
-314
lines changed

vulntotal/datasources/deps.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23-
24-
import json
9+
2510
import logging
2611
from typing import Iterable
2712
from urllib.parse import quote
2813

2914
import requests
30-
from packageurl import PackageURL
3115

3216
from vulntotal.validator import DataSource
3317
from vulntotal.validator import VendorData

vulntotal/datasources/github.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23-
249

2510
import logging
2611
from typing import Iterable
2712

28-
from packageurl import PackageURL
29-
3013
from vulnerabilities import utils
3114
from vulntotal.validator import DataSource
3215
from vulntotal.validator import VendorData

vulntotal/datasources/gitlab.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

24-
25-
import json
2610
import logging
2711
import os
2812
import shutil
@@ -33,7 +17,6 @@
3317
import requests
3418
import saneyaml
3519
from fetchcode import fetch
36-
from packageurl import PackageURL
3720

3821
from vulntotal.validator import DataSource
3922
from vulntotal.validator import VendorData
@@ -55,7 +38,9 @@ def datasource_advisory(self, purl) -> Iterable[VendorData]:
5538
casesensitive_package_slug = get_casesensitive_slug(path, package_slug)
5639
location = download_subtree(casesensitive_package_slug)
5740
if location:
58-
interesting_advisories = parse_interesting_advisories(location, purl.version, delete_download=True)
41+
interesting_advisories = parse_interesting_advisories(
42+
location, purl.version, delete_download=True
43+
)
5944
return interesting_advisories
6045
clear_download(location)
6146

vulntotal/datasources/oss_index.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

24-
import json
2510
import logging
2611
import os
2712
from typing import Iterable

vulntotal/datasources/osv.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import Iterable
1212

1313
import requests
14-
from packageurl import PackageURL
1514

1615
from vulntotal.ecosystem.nuget import get_closest_nuget_package_name
1716
from vulntotal.validator import DataSource
@@ -27,7 +26,7 @@ class OSVDataSource(DataSource):
2726
url = "https://api.osv.dev/v1/query"
2827

2928
def fetch_advisory(self, payload):
30-
"""Fetch JSON advisory from OSV API for a given package payload """
29+
"""Fetch JSON advisory from OSV API for a given package payload"""
3130

3231
response = requests.post(self.url, data=str(payload))
3332
if not response.status_code == 200:

vulntotal/datasources/snyk.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23-
24-
import json
9+
2510
import logging
2611
from typing import Iterable
2712
from urllib.parse import quote
2813

2914
import requests
3015
from bs4 import BeautifulSoup
31-
from packageurl import PackageURL
3216

3317
from vulntotal.validator import DataSource
3418
from vulntotal.validator import VendorData

vulntotal/datasources/vulnerablecode.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

24-
import json
2510
import logging
2611
from typing import Iterable
2712
from urllib.parse import urljoin

vulntotal/tests/test_deps.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

2410
import json
2511
from pathlib import Path

vulntotal/tests/test_github.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

2410
import json
2511
from pathlib import Path

vulntotal/tests/test_gitlab.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
#
22
# Copyright (c) nexB Inc. and others. All rights reserved.
3-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4-
# The VulnTotal software is licensed under the Apache License version 2.0.
5-
# Data generated with VulnTotal require an acknowledgment.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
68
#
7-
# You may not use this software except in compliance with the License.
8-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9-
# Unless required by applicable law or agreed to in writing, software distributed
10-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12-
# specific language governing permissions and limitations under the License.
13-
#
14-
# When you publish or redistribute any data created with VulnTotal or any VulnTotal
15-
# derivative work, you must accompany this data with the following acknowledgment:
16-
#
17-
# Generated with VulnTotal and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
18-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19-
# VulnTotal should be considered or used as legal advice. Consult an Attorney
20-
# for any legal advice.
21-
# VulnTotal is a free software tool from nexB Inc. and others.
22-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
239

24-
import json
2510
from pathlib import Path
2611

2712
from commoncode import testcase

0 commit comments

Comments
 (0)