(self, condition_conv, cast=BaseConversion._none)
Args:
          condition_conv (object): to be wrapped with
            :py:obj:`ensure_conversion` and used on each item of a collection
            to filter it
          cast (callable): to wrap the generator of filtered items
        Returns:
          BaseConversion: the generator of filtered items, wrapped with `cast`
          if provided
Args:
          condition_conv (object): to be wrapped with
            :py:obj:`ensure_conversion` and used on each item of a collection
            to filter it
          cast (callable): to wrap the generator of filtered items
        Returns:
          BaseConversion: the generator of filtered items, wrapped with `cast`
          if provided
Args : condition_conv ( object ) : to be wrapped with : py : obj : ensure_conversion and used on each item of a collection to filter it cast ( callable ) : to wrap the generator of filtered items Returns : BaseConversion : the generator of filtered items wrapped with cast if provided
def __init__(self, condition_conv, cast=BaseConversion._none):
        """
        Args:
          condition_conv (object): to be wrapped with
            :py:obj:`ensure_conversion` and used on each item of a collection
            to filter it
          cast (callable): to wrap the generator of filtered items
        Returns:
          BaseConversion: the generator of filtered items, wrapped with `cast`
          if provided
        """
        super().__init__()
        if cast is None or cast is self._none:
            result = GeneratorComp(GetItem(), where=condition_conv)
        elif cast is list:
            result = ListComp(GetItem(), where=condition_conv)
        elif cast is tuple:
            result = TupleComp(GetItem(), where=condition_conv)
        elif cast is set:
            result = SetComp(GetItem(), where=condition_conv)
        elif callable(cast):
            gen = GeneratorComp(GetItem(), where=condition_conv)
            result = NaiveConversion(cast).call(gen)
        else:
            raise AssertionError(
                "cannot cast generator to cast={}".format(cast)
            )
        self.conversion = self.ensure_conversion(result)
def __init__ ( self , condition_conv , cast = BaseConversion . _none ) : super ( ) . __init__ ( ) if cast is None or cast is self . _none : result = GeneratorComp ( GetItem ( ) , where = condition_conv ) elif cast is list : result = ListComp ( GetItem ( ) , where = condition_conv ) elif cast is tuple : result = TupleComp ( GetItem ( ) , where = condition_conv ) elif cast is set : result = SetComp ( GetItem ( ) , where = condition_conv ) elif callable ( cast ) : gen = GeneratorComp ( GetItem ( ) , where = condition_conv ) result = NaiveConversion ( cast ) . call ( gen ) else : raise AssertionError ( "cannot cast generator to cast={}" . format ( cast ) ) self . conversion = self . ensure_conversion ( result )