mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Add types to pre-commit
This commit is contained in:
parent
fa536a8693
commit
327ed924a3
62 changed files with 911 additions and 411 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue