diff --git a/pyproject.toml b/pyproject.toml index 0df0840..f9a947f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,4 +43,7 @@ homepage = "https://github.com/boschresearch/ros_license_toolkit" repository = "https://github.com/boschresearch/ros_license_toolkit" [project.scripts] -ros_license_toolkit = "ros_license_toolkit.main:main" \ No newline at end of file +ros_license_toolkit = "ros_license_toolkit.main:main" + +[isort] +profile = "google" diff --git a/setup.cfg b/setup.cfg index 491e6fd..255a574 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,4 +18,4 @@ push = False pyproject.toml = version = "{version}" src/ros_license_toolkit/__init__.py = - __version__ = "{version}" \ No newline at end of file + __version__ = "{version}" diff --git a/src/ros_license_toolkit/checks.py b/src/ros_license_toolkit/checks.py index 72e94b6..5f13781 100644 --- a/src/ros_license_toolkit/checks.py +++ b/src/ros_license_toolkit/checks.py @@ -20,15 +20,12 @@ from pprint import pformat from typing import Dict, List, Optional -from ros_license_toolkit.license_tag import is_license_name_in_spdx_list -from ros_license_toolkit.license_tag import LicenseTag -from ros_license_toolkit.package import get_spdx_license_name -from ros_license_toolkit.package import is_license_text_file -from ros_license_toolkit.package import Package -from ros_license_toolkit.package import PackageException -from ros_license_toolkit.ui_elements import green -from ros_license_toolkit.ui_elements import NO_REASON_STR -from ros_license_toolkit.ui_elements import red +from ros_license_toolkit.license_tag import (LicenseTag, + is_license_name_in_spdx_list) +from ros_license_toolkit.package import (Package, PackageException, + get_spdx_license_name, + is_license_text_file) +from ros_license_toolkit.ui_elements import NO_REASON_STR, green, red class Check: diff --git a/src/ros_license_toolkit/license_tag.py b/src/ros_license_toolkit/license_tag.py index 8378d30..9e9b8a4 100644 --- a/src/ros_license_toolkit/license_tag.py +++ b/src/ros_license_toolkit/license_tag.py @@ -19,10 +19,10 @@ license tags in package.xml files. """ -from glob import glob import os -from typing import List, Optional, Set import xml.etree.ElementTree as ET +from glob import glob +from typing import List, Optional, Set from spdx.config import LICENSE_MAP diff --git a/src/ros_license_toolkit/main.py b/src/ros_license_toolkit/main.py index 93cba67..8c6565b 100644 --- a/src/ros_license_toolkit/main.py +++ b/src/ros_license_toolkit/main.py @@ -24,19 +24,14 @@ import timeit from typing import Optional, Sequence -from ros_license_toolkit.checks import LicensesInCodeCheck -from ros_license_toolkit.checks import LicenseTagExistsCheck -from ros_license_toolkit.checks import LicenseTagIsInSpdxListCheck -from ros_license_toolkit.checks import LicenseTextExistsCheck +from ros_license_toolkit.checks import (LicensesInCodeCheck, + LicenseTagExistsCheck, + LicenseTagIsInSpdxListCheck, + LicenseTextExistsCheck) from ros_license_toolkit.package import get_packages_in_path -from ros_license_toolkit.ui_elements import FAILURE_STR -from ros_license_toolkit.ui_elements import green -from ros_license_toolkit.ui_elements import major_sep -from ros_license_toolkit.ui_elements import minor_sep -from ros_license_toolkit.ui_elements import red -from ros_license_toolkit.ui_elements import rll_print_factory -from ros_license_toolkit.ui_elements import SUCCESS_STR -from ros_license_toolkit.ui_elements import Verbosity +from ros_license_toolkit.ui_elements import (FAILURE_STR, SUCCESS_STR, + Verbosity, green, major_sep, + minor_sep, red, rll_print_factory) def main(args: Optional[Sequence[str]] = None) -> int: diff --git a/src/ros_license_toolkit/package.py b/src/ros_license_toolkit/package.py index 755c883..6995999 100644 --- a/src/ros_license_toolkit/package.py +++ b/src/ros_license_toolkit/package.py @@ -18,18 +18,16 @@ """ import os -from typing import Any, Dict, List, Optional import xml.etree.ElementTree as ET +from typing import Any, Dict, List, Optional -from rospkg import list_by_path -from rospkg import RosPack +from rospkg import RosPack, list_by_path from rospkg.common import PACKAGE_FILE from scancode.api import get_licenses from ros_license_toolkit.common import is_license_text_file from ros_license_toolkit.license_tag import LicenseTag -from ros_license_toolkit.repo import NotARepoError -from ros_license_toolkit.repo import Repo +from ros_license_toolkit.repo import NotARepoError, Repo # files we ignore in scan results IGNORED_FILES = [ diff --git a/src/ros_license_toolkit/ui_elements.py b/src/ros_license_toolkit/ui_elements.py index a5db477..40249bd 100644 --- a/src/ros_license_toolkit/ui_elements.py +++ b/src/ros_license_toolkit/ui_elements.py @@ -18,8 +18,7 @@ This module contains UI elements for the CLI. """ -from enum import auto -from enum import Enum +from enum import Enum, auto # colors diff --git a/test/systemtest/test_license_per_repo.py b/test/systemtest/test_license_per_repo.py index c4fcad0..a94d29d 100644 --- a/test/systemtest/test_license_per_repo.py +++ b/test/systemtest/test_license_per_repo.py @@ -20,9 +20,8 @@ import os import subprocess -from test.systemtest._test_helpers import make_repo -from test.systemtest._test_helpers import remove_repo import unittest +from test.systemtest._test_helpers import make_repo, remove_repo class TestLicensePerRepoBsd3(unittest.TestCase): diff --git a/test/systemtest/test_separate_pkgs.py b/test/systemtest/test_separate_pkgs.py index 3579034..a3867af 100644 --- a/test/systemtest/test_separate_pkgs.py +++ b/test/systemtest/test_separate_pkgs.py @@ -18,9 +18,8 @@ import os import subprocess -from test.systemtest._test_helpers import make_repo -from test.systemtest._test_helpers import remove_repo import unittest +from test.systemtest._test_helpers import make_repo, remove_repo from ros_license_toolkit.main import main diff --git a/test/unittest/test_license_tag.py b/test/unittest/test_license_tag.py index a36588a..2fb88b4 100644 --- a/test/unittest/test_license_tag.py +++ b/test/unittest/test_license_tag.py @@ -19,8 +19,8 @@ import unittest from xml.etree import ElementTree as ET -from ros_license_toolkit.license_tag import is_license_name_in_spdx_list -from ros_license_toolkit.license_tag import LicenseTag +from ros_license_toolkit.license_tag import (LicenseTag, + is_license_name_in_spdx_list) class TestChecks(unittest.TestCase): diff --git a/test/unittest/test_repo.py b/test/unittest/test_repo.py index 226c4c9..6f5f82c 100644 --- a/test/unittest/test_repo.py +++ b/test/unittest/test_repo.py @@ -21,8 +21,7 @@ import git -from ros_license_toolkit.repo import NotARepoError -from ros_license_toolkit.repo import Repo +from ros_license_toolkit.repo import NotARepoError, Repo class TestRepo(unittest.TestCase):