Add types to pre-commit

This commit is contained in:
Anthony Sottile 2020-01-10 23:32:28 -08:00
parent fa536a8693
commit 327ed924a3
62 changed files with 911 additions and 411 deletions

View file

@ -1,6 +1,8 @@
import argparse
import collections
import logging
import os.path
from typing import Tuple
from aspy.yaml import ordered_dump
@ -17,7 +19,7 @@ from pre_commit.xargs import xargs
logger = logging.getLogger(__name__)
def _repo_ref(tmpdir, repo, ref):
def _repo_ref(tmpdir: str, repo: str, ref: str) -> Tuple[str, str]:
# if `ref` is explicitly passed, use it
if ref:
return repo, ref
@ -47,7 +49,7 @@ def _repo_ref(tmpdir, repo, ref):
return repo, ref
def try_repo(args):
def try_repo(args: argparse.Namespace) -> int:
with tmpdir() as tempdir:
repo, ref = _repo_ref(tempdir, args.repo, args.ref)