mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-09 21:04:17 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
769c0bd938
commit
846d3cc2d6
1 changed files with 5 additions and 2 deletions
|
|
@ -3,7 +3,8 @@ from __future__ import annotations
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from typing import Any, Sequence
|
from typing import Any
|
||||||
|
from typing import Sequence
|
||||||
|
|
||||||
|
|
||||||
def raise_duplicate_keys(
|
def raise_duplicate_keys(
|
||||||
|
|
@ -17,6 +18,7 @@ def raise_duplicate_keys(
|
||||||
d[key] = val
|
d[key] = val
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
def check_mixed_indentation(content: str, filename: str) -> bool:
|
def check_mixed_indentation(content: str, filename: str) -> bool:
|
||||||
"""
|
"""
|
||||||
Checks a string content for mixed indentation (tabs and spaces) in leading whitespace.
|
Checks a string content for mixed indentation (tabs and spaces) in leading whitespace.
|
||||||
|
|
@ -41,6 +43,7 @@ def check_mixed_indentation(content: str, filename: str) -> bool:
|
||||||
|
|
||||||
return not found_mixed
|
return not found_mixed
|
||||||
|
|
||||||
|
|
||||||
def main(argv: Sequence[str] | None = None) -> int:
|
def main(argv: Sequence[str] | None = None) -> int:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('filenames', nargs='*', help='Filenames to check.')
|
parser.add_argument('filenames', nargs='*', help='Filenames to check.')
|
||||||
|
|
@ -48,7 +51,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
|
|
||||||
retval = 0
|
retval = 0
|
||||||
for filename in args.filenames:
|
for filename in args.filenames:
|
||||||
with open(filename, 'r') as f:
|
with open(filename) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
# Check for mixed indentation first
|
# Check for mixed indentation first
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue