diff --git a/komodo/build.py b/komodo/build.py index a9a3be006..9fed01c39 100644 --- a/komodo/build.py +++ b/komodo/build.py @@ -22,7 +22,6 @@ def dfs(pkg, version, pkgs, repo): - # package has no more dependencies - add the package itself if "depends" not in repo[pkg][version]: return [pkg] @@ -239,7 +238,6 @@ def make( virtualenv=None, fakeroot=".", ): - xs = flatten(dfs(pkg, ver, pkgs, repo) for pkg, ver in pkgs.items()) seen = set() diff --git a/komodo/check_up_to_date_pypi.py b/komodo/check_up_to_date_pypi.py index 845fe1d41..03288957a 100644 --- a/komodo/check_up_to_date_pypi.py +++ b/komodo/check_up_to_date_pypi.py @@ -86,7 +86,6 @@ def get_pypi_packages(release: dict, repository: dict) -> list: def get_upgrade_proposal(releases: dict, repository: dict, python_version: str) -> dict: - pypi_packages = get_pypi_packages(releases, repository) pypi_response = get_pypi_info(pypi_packages) diff --git a/komodo/cli.py b/komodo/cli.py index e749c3bb4..8307c5392 100755 --- a/komodo/cli.py +++ b/komodo/cli.py @@ -39,7 +39,6 @@ def create_enable_scripts(komodo_prefix: str, komodo_release: str) -> None: ("enable.jinja2", "enable"), ("enable.csh.jinja2", "enable.csh"), ]: - (Path(komodo_release) / target).write_text( jinja_env.get_template(tmpl).render( komodo_prefix=komodo_prefix, diff --git a/komodo/fetch.py b/komodo/fetch.py index 045b12e33..3c8453ab5 100644 --- a/komodo/fetch.py +++ b/komodo/fetch.py @@ -81,7 +81,6 @@ def fetch(pkgs, repo, outdir, pip="pip") -> dict: git_hashes = {} with pushd(outdir): for pkg, ver in pkgs.items(): - current = repo[pkg][ver] if "pypi_package_name" in current and current["make"] != "pip": raise ValueError( diff --git a/komodo/lint_maturity.py b/komodo/lint_maturity.py index 73866a220..fd3d98ae0 100644 --- a/komodo/lint_maturity.py +++ b/komodo/lint_maturity.py @@ -17,13 +17,11 @@ def print_system_exit_message(system_exit_msg): - if system_exit_msg != "": raise SystemExit(system_exit_msg) def print_warning_message(system_warning_msg): - if system_warning_msg != "": warnings.warn(system_warning_msg, UserWarning) @@ -31,7 +29,6 @@ def print_warning_message(system_warning_msg): def msg_packages_invalid( release_basename, release_version, count_tag_invalid, dict_tag_maturity ): - exit_msg = "" exit_msg += ( release_basename @@ -41,7 +38,6 @@ def msg_packages_invalid( ) for tag in _INVALID_TAGS[release_version]: - if len(dict_tag_maturity[tag]) > 0: exit_msg += ( "\tTag " + tag + " packages: " + str(dict_tag_maturity[tag]) + "\n" @@ -51,7 +47,6 @@ def msg_packages_invalid( def msg_packages_exception(release_basename, dict_tag_maturity): - msg_exception = "" if len(dict_tag_maturity["exception"]) > 0: @@ -62,7 +57,6 @@ def msg_packages_exception(release_basename, dict_tag_maturity): def count_invalid_tags(dict_tag_maturity, invalid_tags): - count_tag_maturity = {tag: len(dict_tag_maturity[tag]) for tag in dict_tag_maturity} invalid_tags_count = sum(count_tag_maturity[tag] for tag in invalid_tags) @@ -70,7 +64,6 @@ def count_invalid_tags(dict_tag_maturity, invalid_tags): def get_release_type(version_string): - try: version = Version(version_string) release_type = "stable" if version.pre is None else version.pre[0] @@ -81,7 +74,6 @@ def get_release_type(version_string): def get_packages_info(packages_dict, tag_exceptions_package): - dict_tag_maturity = { "a": [], "b": [], @@ -92,7 +84,6 @@ def get_packages_info(packages_dict, tag_exceptions_package): } for package_name, package_version in packages_dict.items(): - if package_name not in tag_exceptions_package: release_version_package = get_release_type(package_version) else: @@ -105,7 +96,6 @@ def get_packages_info(packages_dict, tag_exceptions_package): def read_yaml_file(file_path): - with open(file_path) as yml_file: loaded_yaml_file = yaml.safe_load(yml_file) @@ -113,7 +103,6 @@ def read_yaml_file(file_path): def msg_release_exception(release_basename, release_version): - msg_exception = "" if release_version == "exception": @@ -125,7 +114,6 @@ def msg_release_exception(release_basename, release_version): def get_release_version(release_basename, tag_exceptions_release): - release_cleanname = release_basename.split("-")[0] if release_cleanname not in tag_exceptions_release: @@ -137,12 +125,10 @@ def get_release_version(release_basename, tag_exceptions_release): def run(files_to_lint, tag_exceptions): - system_exit_msg = "" system_warning_msg = "" for file_to_lint in files_to_lint: - release_basename = os.path.basename(file_to_lint) release_version = get_release_version( release_basename, tag_exceptions["release"] @@ -184,7 +170,6 @@ def run(files_to_lint, tag_exceptions): def get_files_to_lint(release_folder, release_file): - if release_folder is None: files_to_lint = [release_file] else: @@ -199,7 +184,6 @@ def get_files_to_lint(release_folder, release_file): def define_tag_exceptions(tag_exception_arg): - if os.path.isfile(tag_exception_arg[0]): tag_exceptions = read_yaml_file(file_path=tag_exception_arg[0]) elif tag_exception_arg[0] == "": @@ -212,7 +196,6 @@ def define_tag_exceptions(tag_exception_arg): def get_parser(): - parser = argparse.ArgumentParser( description="Lint the maturity of packages.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, @@ -244,7 +227,6 @@ def get_parser(): def main(): - parser = get_parser() args = parser.parse_args() diff --git a/komodo/release_cleanup.py b/komodo/release_cleanup.py index 5a147f0f2..423a921d4 100644 --- a/komodo/release_cleanup.py +++ b/komodo/release_cleanup.py @@ -6,7 +6,6 @@ def load_all_releases(files): - used_versions = {} for filename in files: @@ -63,7 +62,6 @@ def _get_yml_files(path_name): def _valid_path_or_files(path): - yml_files = [] full_path = os.path.realpath(path) @@ -112,7 +110,6 @@ def add_cleanup_parser(subparsers): def add_prettier_parser(subparsers): - prettier_parser = subparsers.add_parser( "prettier", description=( diff --git a/komodo/symlink/create_links.py b/komodo/symlink/create_links.py index 2834429e7..3d4822182 100644 --- a/komodo/symlink/create_links.py +++ b/komodo/symlink/create_links.py @@ -46,7 +46,6 @@ def create_symlinks(links_dict): def symlink_main(): - parser = argparse.ArgumentParser(description="Create symlinks for komodo versions.") parser.add_argument( "config", type=str, help="a json file describing symlink structure" diff --git a/komodo/symlink/suggester/configuration.py b/komodo/symlink/suggester/configuration.py index fc2299453..f335e8468 100644 --- a/komodo/symlink/suggester/configuration.py +++ b/komodo/symlink/suggester/configuration.py @@ -42,7 +42,6 @@ def update(self, release, mode): handle_ripe = stable.monthly_diff(release) <= -1 if stable else True handle_ours = link_exists and linked_release.monthly_diff(release) == 0 if handle_ripe or handle_ours: - # i.e. if the linked release is a month alias if linked and not Release(linked).is_concrete(): self.links[release.month_alias()] = repr(release) diff --git a/tests/test_link_io_structure.py b/tests/test_link_io_structure.py index 28fe7850d..2cd63f763 100644 --- a/tests/test_link_io_structure.py +++ b/tests/test_link_io_structure.py @@ -69,7 +69,6 @@ def test_create_symlinks(tmpdir): def test_integration(tmpdir): - test_folder = _get_test_root() shutil.copy(os.path.join(test_folder, "data/links.json"), tmpdir) with tmpdir.as_cwd(): @@ -89,7 +88,6 @@ def test_integration(tmpdir): def test_root_links(tmpdir): - test_folder = _get_test_root() shutil.copy(os.path.join(test_folder, "data/links.json"), tmpdir) with tmpdir.as_cwd(): diff --git a/tests/test_lint_maturity.py b/tests/test_lint_maturity.py index c63fe3894..17118539c 100644 --- a/tests/test_lint_maturity.py +++ b/tests/test_lint_maturity.py @@ -8,7 +8,6 @@ def _create_tmp_test_files(release_sample, file_names_sample): - folder_name = os.path.join(os.getcwd(), "test_lint_maturity/") os.mkdir(folder_name) list_files = [] @@ -32,7 +31,6 @@ def _create_tmp_test_files(release_sample, file_names_sample): ], ) def test_msg_packages_invalid(release_basename, release_version, count_tag_invalid): - exit_msg = lint_maturity.msg_packages_invalid( release_basename, release_version, @@ -71,7 +69,6 @@ def test_msg_packages_invalid(release_basename, release_version, count_tag_inval def test_msg_packages_exception(): - RELEASE_FILE_NAMES = [ "2020.02.01-py27.yml", "2020.02.a1-py27.yml", @@ -111,7 +108,6 @@ def test_msg_packages_exception(): ], ) def test_count_invalid_tags(invalid_tags, expected_n_invalid_tags_release): - n_invalid_tags = lint_maturity.count_invalid_tags( dict_tag_maturity={ "a": [("package_a1", "v3.1.a1")], @@ -138,14 +134,12 @@ def test_count_invalid_tags(invalid_tags, expected_n_invalid_tags_release): ], ) def test_get_release_type(version_string, expected_release_type): - release_type = lint_maturity.get_release_type(version_string) assert release_type == expected_release_type def test_get_packages_info(): - dict_tag_maturity = lint_maturity.get_packages_info( packages_dict={ "package_a1": "v3.1.a1", @@ -172,7 +166,6 @@ def test_get_packages_info(): def test_read_yaml_file(tmpdir): - with tmpdir.as_cwd(): list_files = _create_tmp_test_files( release_sample="""release: ['bleeding', 'rpath'] @@ -187,7 +180,6 @@ def test_read_yaml_file(tmpdir): def test_msg_release_exception(): - EXPECTED_RELEASE_VERSION = ["stable", "a", "b", "rc", "exception"] RELEASE_FILE_NAMES = [ "2020.02.01-py27.yml", @@ -225,7 +217,6 @@ def test_msg_release_exception(): ], ) def test_get_release_version(release_basename, expected_release_version): - release_version = lint_maturity.get_release_version( release_basename=release_basename, tag_exceptions_release=["bleeding", "rpath"], @@ -235,7 +226,6 @@ def test_get_release_version(release_basename, expected_release_version): def test_lint_maturity_run(tmpdir): - with tmpdir.as_cwd(): list_files = _create_tmp_test_files( release_sample="""package_a1: v3.1.a1 @@ -291,7 +281,6 @@ def test_lint_maturity_run(tmpdir): """ # noqa for list_file in list_files: - with pytest.raises(SystemExit) as exit_info, warnings.catch_warnings( record=True ) as warning_info: @@ -335,7 +324,6 @@ def test_get_files_to_lint(tmpdir): def test_define_tag_exceptions(tmpdir): - with tmpdir.as_cwd(): tag_exception_file_name = _create_tmp_test_files( release_sample="""release: ['bleeding', 'rpath'] @@ -365,7 +353,6 @@ def test_define_tag_exceptions(tmpdir): def test_main(monkeypatch, tmpdir): - with tmpdir.as_cwd(): list_files_expected = _create_tmp_test_files( release_sample="None", @@ -409,7 +396,6 @@ def test_main(monkeypatch, tmpdir): def test_integration_main(monkeypatch, tmpdir): - with tmpdir.as_cwd(): list_files_expected = _create_tmp_test_files( release_sample="""package_a1: v3.1.a1 diff --git a/tests/test_non_deployed.py b/tests/test_non_deployed.py index c52fad237..b77cc4433 100644 --- a/tests/test_non_deployed.py +++ b/tests/test_non_deployed.py @@ -7,7 +7,7 @@ def _create_links(links, root=""): root = os.path.realpath(root) - for (src, target) in links: + for src, target in links: os.symlink( os.path.join(root, src), os.path.join(root, target), diff --git a/tests/test_release_cleanup.py b/tests/test_release_cleanup.py index ae24521c3..a829ba624 100644 --- a/tests/test_release_cleanup.py +++ b/tests/test_release_cleanup.py @@ -43,7 +43,6 @@ def test_load_all_releases(): - files = [ os.path.join(_get_test_root(), "data/test_releases/2020.01.a1-py27.yml"), os.path.join(_get_test_root(), "data/test_releases/2020.01.a1-py36.yml"), diff --git a/tests/test_snyk_reporting.py b/tests/test_snyk_reporting.py index 5dd41b77f..f49f54a71 100644 --- a/tests/test_snyk_reporting.py +++ b/tests/test_snyk_reporting.py @@ -7,7 +7,6 @@ def _create_result_mock(issue_ids): - result_mock = Mock() result_mock.issues.vulnerabilities = [ Vulnerability(