Skip to content

Commit

Permalink
Upgrade black 23.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hnformentin committed Feb 3, 2023
1 parent 268110b commit 718937d
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 47 deletions.
2 changes: 0 additions & 2 deletions komodo/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -239,7 +238,6 @@ def make(
virtualenv=None,
fakeroot=".",
):

xs = flatten(dfs(pkg, ver, pkgs, repo) for pkg, ver in pkgs.items())

seen = set()
Expand Down
1 change: 0 additions & 1 deletion komodo/check_up_to_date_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion komodo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion komodo/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 0 additions & 18 deletions komodo/lint_maturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@


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)


def msg_packages_invalid(
release_basename, release_version, count_tag_invalid, dict_tag_maturity
):

exit_msg = ""
exit_msg += (
release_basename
Expand All @@ -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"
Expand All @@ -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:
Expand All @@ -62,15 +57,13 @@ 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)

return invalid_tags_count


def get_release_type(version_string):

try:
version = Version(version_string)
release_type = "stable" if version.pre is None else version.pre[0]
Expand All @@ -81,7 +74,6 @@ def get_release_type(version_string):


def get_packages_info(packages_dict, tag_exceptions_package):

dict_tag_maturity = {
"a": [],
"b": [],
Expand All @@ -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:
Expand All @@ -105,15 +96,13 @@ 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)

return loaded_yaml_file


def msg_release_exception(release_basename, release_version):

msg_exception = ""

if release_version == "exception":
Expand All @@ -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:
Expand All @@ -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"]
Expand Down Expand Up @@ -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:
Expand All @@ -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] == "":
Expand All @@ -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,
Expand Down Expand Up @@ -244,7 +227,6 @@ def get_parser():


def main():

parser = get_parser()
args = parser.parse_args()

Expand Down
3 changes: 0 additions & 3 deletions komodo/release_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


def load_all_releases(files):

used_versions = {}

for filename in files:
Expand Down Expand Up @@ -63,7 +62,6 @@ def _get_yml_files(path_name):


def _valid_path_or_files(path):

yml_files = []

full_path = os.path.realpath(path)
Expand Down Expand Up @@ -112,7 +110,6 @@ def add_cleanup_parser(subparsers):


def add_prettier_parser(subparsers):

prettier_parser = subparsers.add_parser(
"prettier",
description=(
Expand Down
1 change: 0 additions & 1 deletion komodo/symlink/create_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion komodo/symlink/suggester/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_link_io_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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():
Expand Down
14 changes: 0 additions & 14 deletions tests/test_lint_maturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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")],
Expand All @@ -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",
Expand All @@ -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']
Expand All @@ -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",
Expand Down Expand Up @@ -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"],
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_non_deployed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion tests/test_release_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 0 additions & 1 deletion tests/test_snyk_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def _create_result_mock(issue_ids):

result_mock = Mock()
result_mock.issues.vulnerabilities = [
Vulnerability(
Expand Down

0 comments on commit 718937d

Please sign in to comment.