mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 00:24:47 +04:00
Add support for meta hooks
This commit is contained in:
parent
39d5205e31
commit
88c676a7c1
6 changed files with 130 additions and 1 deletions
|
|
@ -101,6 +101,9 @@ def _check_conditional(self, dct):
|
|||
if isinstance(self.condition_value, Not):
|
||||
op = 'is'
|
||||
cond_val = self.condition_value.val
|
||||
elif isinstance(self.condition_value, NotIn):
|
||||
op = 'is any of'
|
||||
cond_val = self.condition_value.values
|
||||
else:
|
||||
op = 'is not'
|
||||
cond_val = self.condition_value
|
||||
|
|
@ -206,6 +209,14 @@ class Not(object):
|
|||
return other is not MISSING and other != self.val
|
||||
|
||||
|
||||
class NotIn(object):
|
||||
def __init__(self, values):
|
||||
self.values = values
|
||||
|
||||
def __eq__(self, other):
|
||||
return other is not MISSING and other not in self.values
|
||||
|
||||
|
||||
def check_any(_):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue