mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04: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
d8295a246b
commit
ddc682ee83
1 changed files with 8 additions and 5 deletions
|
|
@ -9,8 +9,9 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from typing import Any, List
|
from typing import Any
|
||||||
from typing import Collection
|
from typing import Collection
|
||||||
|
from typing import List
|
||||||
from typing import MutableMapping
|
from typing import MutableMapping
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
|
|
@ -337,13 +338,14 @@ def _dive_into_file_hierarchy(dir_path: str):
|
||||||
""" Iterator for crawling recursively a path.
|
""" Iterator for crawling recursively a path.
|
||||||
:note!: Not tested on windows (hardcoded '/' for path separator).
|
:note!: Not tested on windows (hardcoded '/' for path separator).
|
||||||
"""
|
"""
|
||||||
accumulated = "" # start from empty string
|
accumulated = '' # start from empty string
|
||||||
_split = dir_path.split('/')
|
_split = dir_path.split('/')
|
||||||
while len(_split) > 0:
|
while len(_split) > 0:
|
||||||
accumulated = os.path.join(accumulated, _split.pop(0))
|
accumulated = os.path.join(accumulated, _split.pop(0))
|
||||||
yield accumulated
|
yield accumulated
|
||||||
|
|
||||||
def _find_all_config_files(modified_files: List[str], config_file_name: str) -> List[str]:
|
|
||||||
|
def _find_all_config_files(modified_files: list[str], config_file_name: str) -> list[str]:
|
||||||
""" Finds all the config files relative to modified files.
|
""" Finds all the config files relative to modified files.
|
||||||
Every modified file can have a :config_file_name: in its parent directory. If found, get it.
|
Every modified file can have a :config_file_name: in its parent directory. If found, get it.
|
||||||
"""
|
"""
|
||||||
|
|
@ -363,6 +365,7 @@ def _find_all_config_files(modified_files: List[str], config_file_name: str) ->
|
||||||
ret = sorted(list(ret_set))
|
ret = sorted(list(ret_set))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def run(
|
def run(
|
||||||
config_file: str,
|
config_file: str,
|
||||||
store: Store,
|
store: Store,
|
||||||
|
|
@ -452,8 +455,8 @@ def run(
|
||||||
all_config_files = _find_all_config_files(_all_filenames(args), config_file)
|
all_config_files = _find_all_config_files(_all_filenames(args), config_file)
|
||||||
for _config_file in all_config_files:
|
for _config_file in all_config_files:
|
||||||
config = load_config(_config_file)
|
config = load_config(_config_file)
|
||||||
if len(all_config_files) > 0 :
|
if len(all_config_files) > 0:
|
||||||
print(f"Hooks from {_config_file}:")
|
print(f'Hooks from {_config_file}:')
|
||||||
hooks = [
|
hooks = [
|
||||||
hook
|
hook
|
||||||
for hook in all_hooks(config, store)
|
for hook in all_hooks(config, store)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue