Remove unused import in alpine_linux.py and use a helper for loading yaml file
# for any legal advice.
# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
-import logging
+
from typing import Any
from typing import Iterable
from typing import List
from typing import Mapping
from typing import Set
-import yaml
from packageurl import PackageURL
from schema import Or
from schema import Regex
@@ -36,6 +35,7 @@ from schema import Schema
from vulnerabilities.data_source import Advisory
from vulnerabilities.data_source import GitDataSource
from vulnerabilities.data_source import Reference
+from vulnerabilities.helpers import load_yaml
def validate_schema(advisory_dict):
@@ -91,9 +91,7 @@ class AlpineDataSource(GitDataSource):
def _process_file(self, path) -> List[Advisory]:
advisories = []
- with open(path) as f:
- record = yaml.safe_load(f)
-
+ record = load_yaml(path)
if record["packages"] is None:
return advisories
validate_schema(record)
