From 3be58c150c7709b5f007b149a59fbf4fd493c514 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 11:10:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pre_commit_hooks/enforce_branch_name.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pre_commit_hooks/enforce_branch_name.py b/pre_commit_hooks/enforce_branch_name.py index 170e1c2..6d442d9 100644 --- a/pre_commit_hooks/enforce_branch_name.py +++ b/pre_commit_hooks/enforce_branch_name.py @@ -14,25 +14,25 @@ ERROR = 1 def branch_follows_pattern(patterns: AbstractSet[str]) -> bool: try: - ref_name = cmd_output("git", "symbolic-ref", "HEAD") + ref_name = cmd_output('git', 'symbolic-ref', 'HEAD') except CalledProcessError: return False - chunks = ref_name.strip().split("/") - branch_name = "/".join(chunks[2:]) + chunks = ref_name.strip().split('/') + branch_name = '/'.join(chunks[2:]) return any(re.match(p, branch_name) for p in patterns) def main(argv: Sequence[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( - "-p", - "--pattern", - action="append", - help=("regex pattern that the name of the branch must comply with"), + '-p', + '--pattern', + action='append', + help=('regex pattern that the name of the branch must comply with'), ) args = parser.parse_args(argv) return OK if branch_follows_pattern(frozenset(args.pattern)) else ERROR -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(main())