def constraint_range_dict ( self , * args , * * kwargs ) : bins = self . bins ( * args , * * kwargs ) return [ { self . name + '__gte' : a , self . name + '__lt' : b } for a , b in zip ( bins [ : - 1 ] , bins [ 1 : ] ) ] space = self . space ( * args , * * kwargs ) resolution = space [ 1 ] - space [ 0 ] return [ { self . name + '__gte' : s , self . name + '__lt' : s + resolution } for s in space ]
using a factors of a range as a dictionary index in python
Creates a list of dictionaries which each give a constraint for a certain section of the dimension .
def constraint_range_dict(self,*args,**kwargs):
        """ 
            Creates a list of dictionaries which each give a constraint for a certain
            section of the dimension.

            bins arguments overwrites resolution
        """
        bins = self.bins(*args,**kwargs)
        return [{self.name+'__gte': a,self.name+'__lt': b} for a,b in zip(bins[:-1],bins[1:])]
        space = self.space(*args,**kwargs)
        resolution = space[1] - space[0]
        return [{self.name+'__gte': s,self.name+'__lt': s+resolution} for s in space]