diff --git a/setup.py b/setup.py index 8670519..bda7a78 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ # pylint: disable=missing-function-docstring -""" setup.py for setuptools """ +"""setup.py for setuptools""" import os.path diff --git a/src/common/utils.py b/src/common/utils.py index 414a3f4..2ca1620 100644 --- a/src/common/utils.py +++ b/src/common/utils.py @@ -4,7 +4,7 @@ # pylint: disable=abstract-method -""" sbomnix utils """ +"""sbomnix utils""" import argparse import csv diff --git a/src/nixgraph/graph.py b/src/nixgraph/graph.py index fb6c7cb..df47ec9 100644 --- a/src/nixgraph/graph.py +++ b/src/nixgraph/graph.py @@ -7,7 +7,7 @@ # pylint: disable=too-few-public-methods # pylint: disable=too-many-instance-attributes -""" Python script to query and visualize nix package dependencies """ +"""Python script to query and visualize nix package dependencies""" import html import logging @@ -19,8 +19,14 @@ import graphviz as gv import pandas as pd -from common.utils import (LOG, LOG_SPAM, df_regex_filter, df_to_csv_file, - exec_cmd, regex_match) +from common.utils import ( + LOG, + LOG_SPAM, + df_regex_filter, + df_to_csv_file, + exec_cmd, + regex_match, +) from sbomnix.nix import find_deriver ############################################################################### diff --git a/src/nixgraph/main.py b/src/nixgraph/main.py index 2f80df7..0a32c7a 100755 --- a/src/nixgraph/main.py +++ b/src/nixgraph/main.py @@ -4,14 +4,18 @@ # # SPDX-License-Identifier: Apache-2.0 -""" Python script to query and visualize nix package dependencies """ +"""Python script to query and visualize nix package dependencies""" import argparse import pathlib -from common.utils import (check_positive, exit_unless_nix_artifact, - get_py_pkg_version, set_log_verbosity, - try_resolve_flakeref) +from common.utils import ( + check_positive, + exit_unless_nix_artifact, + get_py_pkg_version, + set_log_verbosity, + try_resolve_flakeref, +) from nixgraph.graph import NixDependencies ############################################################################### diff --git a/src/nixmeta/main.py b/src/nixmeta/main.py index 7d1c81b..17bb70e 100755 --- a/src/nixmeta/main.py +++ b/src/nixmeta/main.py @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) # SPDX-License-Identifier: Apache-2.0 -""" Python script for summarizing nixpkgs meta-attributes """ +"""Python script for summarizing nixpkgs meta-attributes""" import argparse import pathlib diff --git a/src/nixmeta/scanner.py b/src/nixmeta/scanner.py index 4aaa50c..00b03b5 100755 --- a/src/nixmeta/scanner.py +++ b/src/nixmeta/scanner.py @@ -12,8 +12,7 @@ import pandas as pd -from common.utils import (LOG, LOG_SPAM, df_from_csv_file, df_to_csv_file, - exec_cmd) +from common.utils import LOG, LOG_SPAM, df_from_csv_file, df_to_csv_file, exec_cmd ############################################################################### diff --git a/src/nixupdate/nix_outdated.py b/src/nixupdate/nix_outdated.py index cc8167f..7de4d51 100755 --- a/src/nixupdate/nix_outdated.py +++ b/src/nixupdate/nix_outdated.py @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 -""" Command-line tool to list outdated nix dependencies in priority order""" +"""Command-line tool to list outdated nix dependencies in priority order""" import logging import os @@ -15,10 +15,18 @@ from tabulate import tabulate import repology.repology_cli -from common.utils import (LOG, LOG_SPAM, df_from_csv_file, df_log, - df_to_csv_file, exec_cmd, exit_unless_nix_artifact, - nix_to_repology_pkg_name, set_log_verbosity, - try_resolve_flakeref) +from common.utils import ( + LOG, + LOG_SPAM, + df_from_csv_file, + df_log, + df_to_csv_file, + exec_cmd, + exit_unless_nix_artifact, + nix_to_repology_pkg_name, + set_log_verbosity, + try_resolve_flakeref, +) from sbomnix.sbomdb import SbomDb ############################################################################### diff --git a/src/repology/repology_cli.py b/src/repology/repology_cli.py index c2749e0..20b0a70 100755 --- a/src/repology/repology_cli.py +++ b/src/repology/repology_cli.py @@ -7,7 +7,7 @@ # pylint: disable=too-few-public-methods, too-many-statements # pylint: disable=too-many-instance-attributes, too-many-locals -""" Command-line interface to repology.org """ +"""Command-line interface to repology.org""" import json import os @@ -22,9 +22,16 @@ from tabulate import tabulate import repology.exceptions -from common.utils import (LOG, LOG_SPAM, CachedLimiterSession, df_regex_filter, - df_to_csv_file, nix_to_repology_pkg_name, - parse_version, set_log_verbosity) +from common.utils import ( + LOG, + LOG_SPAM, + CachedLimiterSession, + df_regex_filter, + df_to_csv_file, + nix_to_repology_pkg_name, + parse_version, + set_log_verbosity, +) ############################################################################### diff --git a/src/repology/repology_cve.py b/src/repology/repology_cve.py index 911de6b..f0ee33c 100755 --- a/src/repology/repology_cve.py +++ b/src/repology/repology_cve.py @@ -6,7 +6,7 @@ # pylint: disable=too-many-locals -""" Command-line interface to query CVE info from repology.org """ +"""Command-line interface to query CVE info from repology.org""" import os import re @@ -20,8 +20,14 @@ from tabulate import tabulate import repology.exceptions -from common.utils import (LOG, LOG_SPAM, CachedLimiterSession, df_to_csv_file, - parse_version, set_log_verbosity) +from common.utils import ( + LOG, + LOG_SPAM, + CachedLimiterSession, + df_to_csv_file, + parse_version, + set_log_verbosity, +) ############################################################################### diff --git a/src/sbomnix/cdx.py b/src/sbomnix/cdx.py index 0e8daf5..26a00ee 100644 --- a/src/sbomnix/cdx.py +++ b/src/sbomnix/cdx.py @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 -""" CycloneDX utils """ +"""CycloneDX utils""" import re diff --git a/src/sbomnix/derivation.py b/src/sbomnix/derivation.py index a162895..5eb735b 100644 --- a/src/sbomnix/derivation.py +++ b/src/sbomnix/derivation.py @@ -7,7 +7,7 @@ # pylint: disable=invalid-name, eval-used # pylint: disable=too-many-instance-attributes -""" Nix derivation, originally from https://github.com/flyingcircusio/vulnix """ +"""Nix derivation, originally from https://github.com/flyingcircusio/vulnix""" import bisect import json diff --git a/src/sbomnix/dfcache.py b/src/sbomnix/dfcache.py index ff768c4..6504a48 100644 --- a/src/sbomnix/dfcache.py +++ b/src/sbomnix/dfcache.py @@ -29,7 +29,6 @@ def __init__(self): self.dflock = FileLock(DFCACHE_LOCK) def __getattr__(self, name): - def wrap(*a, **k): with self.dflock: # We intentionally do not store the dfcache as object variable diff --git a/src/sbomnix/main.py b/src/sbomnix/main.py index 55d4924..3bb5729 100755 --- a/src/sbomnix/main.py +++ b/src/sbomnix/main.py @@ -4,14 +4,18 @@ # # SPDX-License-Identifier: Apache-2.0 -""" Python script that generates SBOMs from nix packages """ +"""Python script that generates SBOMs from nix packages""" import argparse import pathlib -from common.utils import (check_positive, exit_unless_nix_artifact, - get_py_pkg_version, set_log_verbosity, - try_resolve_flakeref) +from common.utils import ( + check_positive, + exit_unless_nix_artifact, + get_py_pkg_version, + set_log_verbosity, + try_resolve_flakeref, +) from sbomnix.sbomdb import SbomDb ############################################################################### diff --git a/src/sbomnix/nix.py b/src/sbomnix/nix.py index 4900212..6a70493 100644 --- a/src/sbomnix/nix.py +++ b/src/sbomnix/nix.py @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2022-2023 Technology Innovation Institute (TII) -""" Nix store, originally from https://github.com/flyingcircusio/vulnix """ +"""Nix store, originally from https://github.com/flyingcircusio/vulnix""" import json import os diff --git a/src/sbomnix/sbomdb.py b/src/sbomnix/sbomdb.py index 4bd7bc6..1e4886c 100644 --- a/src/sbomnix/sbomdb.py +++ b/src/sbomnix/sbomdb.py @@ -7,7 +7,7 @@ # pylint: disable=too-many-instance-attributes, too-many-arguments # pylint: disable=too-many-locals, too-many-statements -""" Module for generating SBOMs in various formats """ +"""Module for generating SBOMs in various formats""" import argparse import json @@ -23,8 +23,7 @@ from common.utils import LOG, df_to_csv_file, get_py_pkg_version from nixgraph.graph import NixDependencies -from sbomnix.cdx import (_drv_to_cdx_component, _drv_to_cdx_dependency, - _vuln_to_cdx_vuln) +from sbomnix.cdx import _drv_to_cdx_component, _drv_to_cdx_dependency, _vuln_to_cdx_vuln from sbomnix.meta import Meta from sbomnix.nix import Store, find_deriver from vulnxscan.vulnscan import VulnScan diff --git a/src/vulnxscan/osv.py b/src/vulnxscan/osv.py index 6ded9d0..4391d19 100755 --- a/src/vulnxscan/osv.py +++ b/src/vulnxscan/osv.py @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 -""" Demonstrate querying OSV db for vulnerabilities based on cdx SBOM """ +"""Demonstrate querying OSV db for vulnerabilities based on cdx SBOM""" import argparse import json diff --git a/src/vulnxscan/utils.py b/src/vulnxscan/utils.py index fdd5de5..d9322c8 100644 --- a/src/vulnxscan/utils.py +++ b/src/vulnxscan/utils.py @@ -10,7 +10,6 @@ Utility functions """ - import json import re import time @@ -18,9 +17,15 @@ import pandas as pd -from common.utils import (LOG, LOG_SPAM, CachedLimiterSession, df_log, - nix_to_repology_pkg_name, parse_version, - version_distance) +from common.utils import ( + LOG, + LOG_SPAM, + CachedLimiterSession, + df_log, + nix_to_repology_pkg_name, + parse_version, + version_distance, +) from repology.exceptions import RepologyNoMatchingPackages from repology.repology_cli import Repology from repology.repology_cli import getargs as cli_getargs diff --git a/src/vulnxscan/vulnscan.py b/src/vulnxscan/vulnscan.py index e44baa2..5fac0ce 100644 --- a/src/vulnxscan/vulnscan.py +++ b/src/vulnxscan/vulnscan.py @@ -21,13 +21,16 @@ import pandas as pd from tabulate import tabulate -from common.utils import (LOG, LOG_SPAM, df_from_csv_file, df_to_csv_file, - exec_cmd) +from common.utils import LOG, LOG_SPAM, df_from_csv_file, df_to_csv_file, exec_cmd from vulnxscan.osv import OSV -from vulnxscan.utils import (_is_patched, _reformat_scanner, _triage, - _vuln_sortcol, _vuln_url) -from vulnxscan.whitelist import (df_apply_whitelist, df_drop_whitelisted, - load_whitelist) +from vulnxscan.utils import ( + _is_patched, + _reformat_scanner, + _triage, + _vuln_sortcol, + _vuln_url, +) +from vulnxscan.whitelist import df_apply_whitelist, df_drop_whitelisted, load_whitelist class VulnScan: diff --git a/src/vulnxscan/vulnxscan_cli.py b/src/vulnxscan/vulnxscan_cli.py index 124708a..bc705a0 100755 --- a/src/vulnxscan/vulnxscan_cli.py +++ b/src/vulnxscan/vulnxscan_cli.py @@ -9,16 +9,19 @@ open-source vulnerability scanners. """ - import argparse import logging import pathlib import sys from tempfile import NamedTemporaryFile -from common.utils import (LOG, exit_unless_command_exists, - exit_unless_nix_artifact, set_log_verbosity, - try_resolve_flakeref) +from common.utils import ( + LOG, + exit_unless_command_exists, + exit_unless_nix_artifact, + set_log_verbosity, + try_resolve_flakeref, +) from sbomnix.sbomdb import SbomDb from vulnxscan.utils import _is_json from vulnxscan.vulnscan import VulnScan diff --git a/src/vulnxscan/whitelist.py b/src/vulnxscan/whitelist.py index 0255f5b..d1d55f0 100644 --- a/src/vulnxscan/whitelist.py +++ b/src/vulnxscan/whitelist.py @@ -12,7 +12,6 @@ # Whitelist - import sys from common.utils import LOG, LOG_SPAM, df_from_csv_file, df_log diff --git a/tests/compare_deps.py b/tests/compare_deps.py index f7273ec..89a1e21 100755 --- a/tests/compare_deps.py +++ b/tests/compare_deps.py @@ -6,7 +6,7 @@ # pylint: disable=too-many-locals -""" Python script that compares dependencies between sbomnix and nixgraph """ +"""Python script that compares dependencies between sbomnix and nixgraph""" import argparse import json @@ -17,8 +17,14 @@ import pandas as pd -from common.utils import (LOG, LOG_SPAM, df_from_csv_file, df_to_csv_file, - regex_match, set_log_verbosity) +from common.utils import ( + LOG, + LOG_SPAM, + df_from_csv_file, + df_to_csv_file, + regex_match, + set_log_verbosity, +) ############################################################################### diff --git a/tests/compare_sboms.py b/tests/compare_sboms.py index 1cbffae..e85df87 100755 --- a/tests/compare_sboms.py +++ b/tests/compare_sboms.py @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 -""" Python script that compares two sboms """ +"""Python script that compares two sboms""" import argparse import json