gramfuzz/gramfuzz/fields.py
def build(self, pre=None, shortest=False):
        """Build the ``Join`` field instance.
        
        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """

        if pre is None:
            pre = []

        if self.max is not None:
            if shortest:
                vals = [self.values[0]]
            else:
                # +1 to make it inclusive
                vals = [self.values[0]] * rand.randint(1, self.max+1)
        else:
            vals = self.values

        joins = []
        for val in vals:
            try:
                v = utils.val(val, pre, shortest=shortest)
                joins.append(v)
            except errors.OptGram as e:
                continue
        return self.sep.join(joins)
def build(self, pre=None, shortest=False):
        """Build the ``Join`` field instance.
        
        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
        """

        if pre is None:
            pre = []

        if self.max is not None:
            if shortest:
                vals = [self.values[0]]
            else:
                # +1 to make it inclusive
                vals = [self.values[0]] * rand.randint(1, self.max+1)
        else:
            vals = self.values

        joins = []
        for val in vals:
            try:
                v = utils.val(val, pre, shortest=shortest)
                joins.append(v)
            except errors.OptGram as e:
                continue
        return self.sep.join(joins)
def build ( self , pre = None , shortest = False ) : if pre is None : pre = [ ] if self . max is not None : if shortest : vals = [ self . values [ 0 ] ] else : # +1 to make it inclusive vals = [ self . values [ 0 ] ] * rand . randint ( 1 , self . max + 1 ) else : vals = self . values joins = [ ] for val in vals : try : v = utils . val ( val , pre , shortest = shortest ) joins . append ( v ) except errors . OptGram as e : continue return self . sep . join ( joins )
Build the ``Join`` field instance.
        
        :param list pre: The prerequisites list
        :param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
Build the Join field instance . : param list pre : The prerequisites list : param bool shortest : Whether or not the shortest reference - chain ( most minimal ) version of the field should be generated .