Skip to content

Commit

Permalink
Apply isort changes
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <henri.rosten@unikie.com>
  • Loading branch information
henrirosten committed Jan 5, 2025
1 parent 74d65f2 commit 4f20a5f
Show file tree
Hide file tree
Showing 24 changed files with 112 additions and 156 deletions.
13 changes: 6 additions & 7 deletions src/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@

""" sbomnix utils """

import os
import argparse
import re
import sys
import csv
import importlib.metadata
import logging
import os
import re
import subprocess
import importlib.metadata
import sys
import urllib.error
from shutil import which

import packaging.version
from tabulate import tabulate
from colorlog import ColoredFormatter, default_log_colors
import pandas as pd

from colorlog import ColoredFormatter, default_log_colors
from requests import Session
from requests_cache import CacheMixin
from requests_ratelimiter import LimiterMixin
from tabulate import tabulate

###############################################################################

Expand Down
21 changes: 7 additions & 14 deletions src/nixgraph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,20 @@

""" Python script to query and visualize nix package dependencies """

import sys
import html
import logging
import os
import re
import logging
import html
import sys
from dataclasses import dataclass
import pandas as pd
import graphviz as gv

from common.utils import (
LOG,
LOG_SPAM,
exec_cmd,
df_to_csv_file,
regex_match,
df_regex_filter,
)
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 sbomnix.nix import find_deriver


###############################################################################


Expand Down
11 changes: 4 additions & 7 deletions src/nixgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@

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 nixgraph.graph import NixDependencies
from common.utils import (
set_log_verbosity,
get_py_pkg_version,
check_positive,
exit_unless_nix_artifact,
try_resolve_flakeref,
)

###############################################################################

Expand Down
4 changes: 2 additions & 2 deletions src/nixmeta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import argparse
import pathlib
from nixmeta.scanner import NixMetaScanner
from common.utils import set_log_verbosity, exit_unless_command_exists

from common.utils import exit_unless_command_exists, set_log_verbosity
from nixmeta.scanner import NixMetaScanner

################################################################################

Expand Down
15 changes: 6 additions & 9 deletions src/nixmeta/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@

"""Summarize nixpkgs meta-attributes"""

import re
import pathlib
import json
import pathlib
import re
from tempfile import NamedTemporaryFile

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)

###############################################################################

Expand Down
22 changes: 8 additions & 14 deletions src/nixupdate/nix_outdated.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@
import logging
import os
import pathlib
from tempfile import NamedTemporaryFile
from argparse import ArgumentParser
from tempfile import NamedTemporaryFile

from tabulate import tabulate
from sbomnix.sbomdb import SbomDb

import repology.repology_cli
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
exec_cmd,
df_from_csv_file,
df_log,
df_to_csv_file,
nix_to_repology_pkg_name,
exit_unless_nix_artifact,
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

###############################################################################

Expand Down
21 changes: 8 additions & 13 deletions src/repology/repology_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@

""" Command-line interface to repology.org """

import json
import os
import pathlib
import json
import re
import urllib.parse
from argparse import ArgumentParser, ArgumentTypeError, SUPPRESS
from bs4 import BeautifulSoup
from argparse import SUPPRESS, ArgumentParser, ArgumentTypeError

import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from tabulate import tabulate

import repology.exceptions
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
df_to_csv_file,
df_regex_filter,
nix_to_repology_pkg_name,
parse_version,
CachedLimiterSession,
)
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)

###############################################################################

Expand Down
16 changes: 6 additions & 10 deletions src/repology/repology_cve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,19 @@
""" Command-line interface to query CVE info from repology.org """

import os
import sys
import re
import sys
import urllib.parse
from argparse import ArgumentParser, ArgumentTypeError
from bs4 import BeautifulSoup

import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from tabulate import tabulate

import repology.exceptions
from common.utils import (
LOG,
LOG_SPAM,
set_log_verbosity,
df_to_csv_file,
parse_version,
CachedLimiterSession,
)
from common.utils import (LOG, LOG_SPAM, CachedLimiterSession, df_to_csv_file,
parse_version, set_log_verbosity)

###############################################################################

Expand Down
1 change: 1 addition & 0 deletions src/sbomnix/cdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re

from reuse._licenses import LICENSE_MAP as SPDX_LICENSES

from common.utils import LOG, LOG_SPAM
from vulnxscan.utils import _vuln_source, _vuln_url

Expand Down
10 changes: 3 additions & 7 deletions src/sbomnix/cpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@

"""Generate CPE (Common Platform Enumeration) identifiers"""

import sys
import string
import sys

from common.utils import LOG, LOG_SPAM, df_from_csv_file, df_log
from sbomnix.dfcache import LockedDfCache
from common.utils import (
LOG,
LOG_SPAM,
df_from_csv_file,
df_log,
)

###############################################################################

Expand Down
4 changes: 2 additions & 2 deletions src/sbomnix/derivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

""" Nix derivation, originally from https://github.com/flyingcircusio/vulnix """

import json
import bisect
import json

from packageurl import PackageURL

from common.utils import LOG, LOG_SPAM


###############################################################################


Expand Down
2 changes: 1 addition & 1 deletion src/sbomnix/dfcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import tempfile
from getpass import getuser

from filelock import FileLock
from dfdiskcache import DataFrameDiskCache
from filelock import FileLock

###############################################################################

Expand Down
11 changes: 4 additions & 7 deletions src/sbomnix/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@

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 sbomnix.sbomdb import SbomDb
from common.utils import (
set_log_verbosity,
check_positive,
get_py_pkg_version,
exit_unless_nix_artifact,
try_resolve_flakeref,
)

###############################################################################

Expand Down
9 changes: 5 additions & 4 deletions src/sbomnix/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@

"""Cache nixpkgs meta information"""

import os
import re
import logging
import os
import pathlib
import re
import tempfile
from getpass import getuser

import pandas as pd
from filelock import FileLock
from sbomnix.dfcache import LockedDfCache
from nixmeta.scanner import NixMetaScanner, nixref_to_nixpkgs_path

from common.utils import LOG, df_from_csv_file, df_to_csv_file
from nixmeta.scanner import NixMetaScanner, nixref_to_nixpkgs_path
from sbomnix.dfcache import LockedDfCache

###############################################################################

Expand Down
5 changes: 3 additions & 2 deletions src/sbomnix/nix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

""" Nix store, originally from https://github.com/flyingcircusio/vulnix """

import os
import json
import os

import pandas as pd

from common.utils import LOG, LOG_SPAM, exec_cmd
from sbomnix.derivation import load
from sbomnix.cpe import CPE
from sbomnix.derivation import load

###############################################################################

Expand Down
19 changes: 11 additions & 8 deletions src/sbomnix/sbomdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@

""" Module for generating SBOMs in various formats """

from tempfile import NamedTemporaryFile
import uuid
import logging
import argparse
import json
import logging
import re
import argparse
import uuid
from datetime import datetime, timezone
import pandas as pd
from tempfile import NamedTemporaryFile

import numpy as np
import pandas as pd
from reuse._licenses import LICENSE_MAP as SPDX_LICENSES

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.nix import Store, find_deriver
from sbomnix.cdx import (_drv_to_cdx_component, _drv_to_cdx_dependency,
_vuln_to_cdx_vuln)
from sbomnix.meta import Meta
from common.utils import LOG, df_to_csv_file, get_py_pkg_version
from sbomnix.nix import Store, find_deriver
from vulnxscan.vulnscan import VulnScan

###############################################################################
Expand Down
8 changes: 5 additions & 3 deletions src/vulnxscan/osv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
""" Demonstrate querying OSV db for vulnerabilities based on cdx SBOM """

import argparse
import json
import os
import sys
import pathlib
import json
import requests
import sys

import pandas as pd
import requests

from common.utils import LOG, LOG_SPAM, df_to_csv_file, set_log_verbosity

###############################################################################
Expand Down
Loading

0 comments on commit 4f20a5f

Please sign in to comment.