builtup4/bu4/indexing/targets/ailambda.py

18 lines
498 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from typing import Callable
from bu4.indexing.constructs.indexed import Indexed
from bu4.indexing.states.indexingstate import IndexingState
from bu4.indexing.targets.aitargett import AITarget
__all__ = ('AILambda',)
class AILambda(AITarget):
def __init__(self, lambda_: Callable[[Indexed], IndexingState]):
self.lambda_ = lambda_
def given(self, indexed: Indexed) -> IndexingState:
return self.lambda_(indexed)