Created
March 4, 2020 23:40
-
-
Save sofroniewn/29878fe66fbe9d61c264d56cdd5591d3 to your computer and use it in GitHub Desktop.
holder for TransformChain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TransformChain(ListModel, Transform): | |
def __init__(self, transforms=[]): | |
super().__init__( | |
basetype=Transform, | |
iterable=transforms, | |
lookup={str: lambda q, e: q == e.name}, | |
) | |
def __call__(self, coords): | |
return tz.pipe(coords, *self) | |
def __newlike__(self, iterable): | |
return ListModel(self._basetype, iterable, self._lookup) | |
def set_slice(self, axes: Sequence[int]) -> TransformChain: | |
return TransformChain([tf.set_slice(axes) for tf in self]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment