mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-14 17:31:28 +08:00
pre-commit-hooks: python3.6+
This commit is contained in:
@ -1,14 +1,11 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
|
||||
import toml
|
||||
|
||||
|
||||
def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
||||
def main(argv: Optional[Sequence[str]] = None) -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filenames', nargs='*', help='Filenames to check.')
|
||||
args = parser.parse_args(argv)
|
||||
@ -19,10 +16,10 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
|
||||
with open(filename) as f:
|
||||
toml.load(f)
|
||||
except toml.TomlDecodeError as exc:
|
||||
print('{}: {}'.format(filename, exc))
|
||||
print(f'{filename}: {exc}')
|
||||
retval = 1
|
||||
return retval
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
exit(main())
|
||||
|
Reference in New Issue
Block a user