mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Merge ff66c20c6e into 9a559cd764
This commit is contained in:
commit
0649105566
2 changed files with 24 additions and 3 deletions
|
|
@ -48,12 +48,17 @@ def _filter_by_include_exclude(filenames, include, exclude):
|
|||
}
|
||||
|
||||
|
||||
def _filter_by_types(filenames, types, exclude_types):
|
||||
def _filter_by_types(filenames,
|
||||
types,
|
||||
exclude_types,
|
||||
get_tags=tags_from_path):
|
||||
types, exclude_types = frozenset(types), frozenset(exclude_types)
|
||||
valid_types = types - exclude_types
|
||||
|
||||
ret = []
|
||||
for filename in filenames:
|
||||
tags = tags_from_path(filename)
|
||||
if tags >= types and not tags & exclude_types:
|
||||
tags = frozenset(get_tags(filename))
|
||||
if len(valid_types.intersection(tags)) > 0:
|
||||
ret.append(filename)
|
||||
return tuple(ret)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue