mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 03:26:53 +00:00
pre-commit-hooks: python3.6+
This commit is contained in:
parent
551d1a07b3
commit
f5c42a050b
60 changed files with 291 additions and 493 deletions
|
|
@ -1,5 +1,3 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import re
|
||||
from typing import AbstractSet
|
||||
|
|
@ -10,8 +8,10 @@ from pre_commit_hooks.util import CalledProcessError
|
|||
from pre_commit_hooks.util import cmd_output
|
||||
|
||||
|
||||
def is_on_branch(protected, patterns=frozenset()):
|
||||
# type: (AbstractSet[str], AbstractSet[str]) -> bool
|
||||
def is_on_branch(
|
||||
protected: AbstractSet[str],
|
||||
patterns: AbstractSet[str] = frozenset(),
|
||||
) -> bool:
|
||||
try:
|
||||
ref_name = cmd_output('git', 'symbolic-ref', 'HEAD')
|
||||
except CalledProcessError:
|
||||
|
|
@ -23,7 +23,7 @@ def is_on_branch(protected, patterns=frozenset()):
|
|||
)
|
||||
|
||||
|
||||
def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
||||
def main(argv: Optional[Sequence[str]] = None) -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'-b', '--branch', action='append',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue