From 49afde55b278355d20efebebca1cf78f2907a9d9 Mon Sep 17 00:00:00 2001 From: Patrik Polakovič Date: May 04 2021 12:37:43 +0000 Subject: Use black to reformat codebase --- diff --git a/rpmautospec/changelog.py b/rpmautospec/changelog.py index 69d496a..376f39a 100644 --- a/rpmautospec/changelog.py +++ b/rpmautospec/changelog.py @@ -18,7 +18,8 @@ def register_subcommand(subparsers): subcmd_name = "generate-changelog" gen_changelog_parser = subparsers.add_parser( - subcmd_name, help="Generate changelog entries from git commit logs", + subcmd_name, + help="Generate changelog entries from git commit logs", ) gen_changelog_parser.add_argument("worktree_path", help="Path to the dist-git worktree") @@ -32,7 +33,7 @@ def git_get_log( toref: typing.Optional[str] = None, target: typing.Optional[str] = None, ) -> typing.List[str]: - """ Returns the list of the commit logs for the repo in ``path`` . + """Returns the list of the commit logs for the repo in ``path`` . This method runs the system's `git log --pretty=oneline --abbrev-commit` command. @@ -78,7 +79,7 @@ def git_get_changed_files(path: str, commithash: str) -> typing.List[str]: def nevrd_to_evr(nevrd: str) -> str: - """ Converts a name:epoch-version-release.dist_tag to epoch_version_release + """Converts a name:epoch-version-release.dist_tag to epoch_version_release so it can be inserted in the changelog. If the nevrd provided does not have at least 2 "-" in it, otherwise @@ -186,23 +187,25 @@ def produce_changelog(repopath, latest_rel=None): files_changed = git_get_changed_files(repocopy, commit) ignore = True for filename in files_changed: - if filename.endswith(( - ".automount", - ".device", - ".mount", - ".patch", - ".path", - ".pc", - ".preset", - ".scope", - ".service", - ".slice", - ".socket", - ".spec", - ".swap", - ".target", - ".timer", - )): + if filename.endswith( + ( + ".automount", + ".device", + ".mount", + ".patch", + ".path", + ".pc", + ".preset", + ".scope", + ".service", + ".slice", + ".socket", + ".spec", + ".swap", + ".target", + ".timer", + ) + ): ignore = False if not ignore: diff --git a/rpmautospec/misc.py b/rpmautospec/misc.py index 4e3e8bd..4148e36 100644 --- a/rpmautospec/misc.py +++ b/rpmautospec/misc.py @@ -65,7 +65,7 @@ def parse_release_tag(tag: str) -> Tuple[Optional[int], Optional[str], Optional[ def get_rpm_current_version(path: str, name: Optional[str] = None, with_epoch: bool = False) -> str: - """ Retrieve the current version set in the spec file named ``name``.spec + """Retrieve the current version set in the spec file named ``name``.spec at the given path. """ if not name: @@ -119,7 +119,7 @@ def get_package_builds(pkgname: str) -> List[dict]: def run_command(command: list, cwd: Optional[str] = None) -> bytes: - """ Run the specified command in a specific working directory if one + """Run the specified command in a specific working directory if one is specified. """ output = None diff --git a/rpmautospec/process_distgit.py b/rpmautospec/process_distgit.py index 2de5570..6debe79 100644 --- a/rpmautospec/process_distgit.py +++ b/rpmautospec/process_distgit.py @@ -33,7 +33,8 @@ def register_subcommand(subparsers): subcmd_name = "process-distgit" process_distgit_parser = subparsers.add_parser( - subcmd_name, help="Modify the contents of the specfile according to the repo", + subcmd_name, + help="Modify the contents of the specfile according to the repo", ) process_distgit_parser.add_argument("worktree_path", help="Path to the dist-git worktree") @@ -124,7 +125,13 @@ def needs_processing(srcdir): def process_specfile( - srcdir, dist, session, has_autorelease, has_autochangelog, changelog_lineno, autochangelog_lineno + srcdir, + dist, + session, + has_autorelease, + has_autochangelog, + changelog_lineno, + autochangelog_lineno, ): specfile_name = get_specfile_name(srcdir) diff --git a/rpmautospec/release.py b/rpmautospec/release.py index d0ce9ef..a37d0a3 100644 --- a/rpmautospec/release.py +++ b/rpmautospec/release.py @@ -23,7 +23,8 @@ def register_subcommand(subparsers): subcmd_name = "calculate-release" calc_release_parser = subparsers.add_parser( - subcmd_name, help="Calculate the next release tag for a package build", + subcmd_name, + help="Calculate the next release tag for a package build", ) calc_release_parser.add_argument( diff --git a/tests/rpmautospec/test_misc.py b/tests/rpmautospec/test_misc.py index 7009d98..92a88f0 100644 --- a/tests/rpmautospec/test_misc.py +++ b/tests/rpmautospec/test_misc.py @@ -23,7 +23,10 @@ class TestMisc: assert not any(rec.levelno >= logging.WARNING for rec in caplog.records) else: check_output.side_effect = subprocess.CalledProcessError( - returncode=139, cmd=["command"], output="Some command", stderr="And it failed!", + returncode=139, + cmd=["command"], + output="Some command", + stderr="And it failed!", ) with pytest.raises(subprocess.CalledProcessError) as excinfo: misc.run_command(["command"]) diff --git a/tests/rpmautospec/test_process_distgit.py b/tests/rpmautospec/test_process_distgit.py index fa492e7..d097d52 100644 --- a/tests/rpmautospec/test_process_distgit.py +++ b/tests/rpmautospec/test_process_distgit.py @@ -100,11 +100,14 @@ class TestProcessDistgit: unpacked_repo_dir = os.path.join(workdir, "dummy-test-package-gloster") unprocessed_spec_file_path = os.path.join( - unpacked_repo_dir, "dummy-test-package-gloster.spec", + unpacked_repo_dir, + "dummy-test-package-gloster.spec", ) if autorelease_case != "unchanged" or autochangelog_case != "unchanged": - self.fuzz_spec_file(unprocessed_spec_file_path, autorelease_case, autochangelog_case) + self.fuzz_spec_file( + unprocessed_spec_file_path, autorelease_case, autochangelog_case + ) koji_session = mock.MagicMock() koji_session.getPackageID.return_value = 30489 @@ -142,7 +145,9 @@ class TestProcessDistgit: autochangelog_case = "unchanged" shutil.copy2(expected_spec_file_path, tmpspec.name) expected_spec_file_path = tmpspec.name - self.fuzz_spec_file(expected_spec_file_path, autorelease_case, autochangelog_case) + self.fuzz_spec_file( + expected_spec_file_path, autorelease_case, autochangelog_case + ) rpm_cmd = ["rpm", "--define", "dist .fc32", "--specfile"]