def __init__(self, *args, **kwargs): self._calls = [] threading_support = kwargs.pop('threading_support', False) clear_env_var = kwargs.pop('clear_env_var', False) self.handler = hunter._prepare_predicate(*args, **kwargs) self.is_pure = hunter.Tracer.__module__ == 'hunter.tracer' self._tracer = hunter.trace(self._append, threading_support=threading_support, clear_env_var=clear_env_var)
def test_mix_predicates_with_callables(): hunter._prepare_predicate(Q(module=1) | Q(lambda: 2)) hunter._prepare_predicate(Q(lambda: 2) | Q(module=1)) hunter._prepare_predicate(Q(module=1) & Q(lambda: 2)) hunter._prepare_predicate(Q(lambda: 2) & Q(module=1)) hunter._prepare_predicate(Q(module=1) | (lambda: 2)) hunter._prepare_predicate((lambda: 2) | Q(module=1)) hunter._prepare_predicate(Q(module=1) & (lambda: 2)) hunter._prepare_predicate((lambda: 2) & Q(module=1))
def __init__(self, *args, **kwargs): self._calls = [] threading_support = kwargs.pop('threading_support', False) self.handler = hunter._prepare_predicate(*args, **kwargs) self._tracer = hunter.trace(self._append, threading_support=threading_support)