mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-15 01:54:44 +08:00
Apply typing to all of pre-commit-hooks
This commit is contained in:
@ -1,12 +1,15 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
from typing import Set
|
||||
|
||||
from pre_commit_hooks.util import CalledProcessError
|
||||
from pre_commit_hooks.util import cmd_output
|
||||
|
||||
|
||||
def is_on_branch(protected):
|
||||
def is_on_branch(protected): # type: (Set[str]) -> bool
|
||||
try:
|
||||
branch = cmd_output('git', 'symbolic-ref', 'HEAD')
|
||||
except CalledProcessError:
|
||||
@ -15,7 +18,7 @@ def is_on_branch(protected):
|
||||
return '/'.join(chunks[2:]) in protected
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'-b', '--branch', action='append',
|
||||
|
Reference in New Issue
Block a user