mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 08:34:41 +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 os.path
|
||||
import tarfile
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
|
||||
from pre_commit import output
|
||||
from pre_commit.util import cmd_output_b
|
||||
|
|
@ -23,7 +25,7 @@ REPOS = (
|
|||
)
|
||||
|
||||
|
||||
def make_archive(name, repo, ref, destdir):
|
||||
def make_archive(name: str, repo: str, ref: str, destdir: str) -> str:
|
||||
"""Makes an archive of a repository in the given destdir.
|
||||
|
||||
:param text name: Name to give the archive. For instance foo. The file
|
||||
|
|
@ -49,7 +51,7 @@ def make_archive(name, repo, ref, destdir):
|
|||
return output_path
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
def main(argv: Optional[Sequence[str]] = None) -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--dest', default='pre_commit/resources')
|
||||
args = parser.parse_args(argv)
|
||||
|
|
@ -58,6 +60,7 @@ def main(argv=None):
|
|||
f'Making {archive_name}.tar.gz for {repo}@{ref}',
|
||||
)
|
||||
make_archive(archive_name, repo, ref, args.dest)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue