Exemple #1
0
    def __init__(self, min=1, max=1, value=None):

        if value:
            self.generator = repeat(value)
        else:
            min, max = safe_range(min, max)
            self.generator = map(randrange, repeat(min), repeat(max))
Exemple #2
0
    def __init__(self, value=None):

        if type(value) is bool:
            self.choices = [value]
        else:
            self.choices = [True, False]

        self.range = map(randrange, repeat(0), repeat(len(self.choices)))
Exemple #3
0
    def __init__(self, cls, min=0, max=1, count=None):

        self.cls = cls.__name__

        if count:
            self.count = repeat(count)
        else:
            min, max = safe_range(min, max)
            self.count = map(randrange, repeat(min), repeat(max))
Exemple #4
0
    def __init__(self,
                 min_month=1,
                 max_month=12,
                 min_year=2000,
                 max_year=None,
                 format="%m/%d/%Y"):

        max_month = 13 if max_month == 12 else max_month

        min_month = min(13, abs(min_month))
        max_month = min(13, abs(max_month))

        max_year = max_year = datetime.now().year if max_year is None else abs(max_year)
        min_year = max(1500, abs(min_year))
        max_year = max(min_year, max_year)

        self.format = format
        self.months = map(randrange, repeat(min_month), repeat(max_month))
        self.years = map(randrange, repeat(min_year), repeat(max_year))
        self.days = map(randrange, repeat(1), repeat(32))
Exemple #5
0
    def __init__(self, min=1, max=1, value=None, count=None):

        if value:
            self.value = value
            self.words = self.exact_words
        elif count:
            self.count = repeat(count)
            self.words = self.ipsum_words
        else:
            min, max = safe_range(min, max)
            self.count = map(randrange, repeat(min), repeat(max))
            self.words = self.ipsum_words
Exemple #6
0
 def action(self, context):
     number = "%i" % randrange(2, 10)
     numbers = map(randrange, repeat(0), repeat(10))
     number = number + "%i%i-%i%i%i-%i%i%i%i"
     return number % tuple(islice(numbers, 0, 9))
Exemple #7
0
 def action(self, context):
     pool = map(getattr, repeat(context), repeat(self.cls))
     results = islice(pool, 0, next(self.count))
     return list(map(lambda x: x(), results))
Exemple #8
0
 def __init__(self, choices):
     self.range = map(randrange, repeat(0), repeat(len(choices)))
     self.choices = choices