Exemplo n.º 1
0
class Deity(ListGenerated):
    template = "{title} {name}, {long_title}"
    providers = {
        'title': ListProvider(deity.titles),
        'name': ListProvider(deity.names),
        'long': ListProvider(deity.long),
    }

    def __init__(self, name, title="", long=""):
        super().__init__(name)
        self.name = name
        self.title = title
        self.long = long

    def __str__(self):
        return "{deity.title} {deity.name}, {deity.long}".format(deity=self)

    def pray(self, prayer_type=RANDOM_PRAYER):
        if prayer_type == RANDOM_PRAYER:
            return Prayer.generate(self)
        if prayer_type == FORGIVE_PRAYER:
            return ForgivePrayer.generate(self)
        return AidPrayer.generate(self)

    @classmethod
    def generate(cls):
        next_data = {key: next(d) for key, d in cls.providers.items()}
        return cls(**next_data)
Exemplo n.º 2
0
 class HaikuString1(HaikuString):
     providers = [
         ProvidersList(*[ListProvider(part) for part in haiku[0]]),
         ProvidersList(*[ListProvider(part) for part in haiku[1]]),
         ProvidersList(*[ListProvider(part) for part in haiku[2]]),
         ProvidersList(*[ListProvider(part) for part in haiku[3]]),
         ProvidersList(*[ListProvider(part) for part in haiku[4]]),
     ]
Exemplo n.º 3
0
class ForgivePrayer(BasePrayer):
    providers = {
        'sin': ListProvider(forgive.sins),

        'forgive': ListProvider(forgive.forgives),
        'description': ListProvider(forgive.descriptions),

        'ask1': ListProvider(forgive.asks[0]),
        'promise1': ListProvider(forgive.promises[0]),

        'ask2': ListProvider(forgive.asks[1]),
        'promise2': ListProvider(forgive.promises[1]),
    }

    def __init__(self, deity, sin="", forgive="", description="", ask1="", promise1="", ask2="", promise2=""):
        super().__init__(sin)
        self.deity = deity
        self.sin = sin
        self.forgive = forgive
        self.sin_description = description
        self.ask1 = ask1
        self.promise1 = promise1
        self.ask2 = ask2
        self.promise2 = promise2

    def __str__(self):
        return ("{deity}, {prayer.sin}. {prayer.forgive}, {prayer.sin_description}. "
                "{prayer.ask1}, {prayer.promise1}. {prayer.ask2} so I {prayer.promise2}.").format(
            deity=str(self.deity),
            prayer=self
        )
Exemplo n.º 4
0
class AidPrayer(BasePrayer):
    providers = {
        'ask1': ListProvider(aid.asks[0]),

        'ask2': ListProvider(aid.asks[1]),
        'may': ListProvider(aid.mays),
        'subject': ListProvider(aid.subjects),

        'ask3': ListProvider(aid.asks[2]),
        'asker': ListProvider(aid.askers),
        'title': ListProvider(aid.titles),

        'bless': ListProvider(aid.blesses),
        'bless_description': ListProvider(aid.descriptions),
        'bless_subject': ListProvider(aid.bless_subjects),
    }

    def __init__(self, deity, ask1="", ask2="", ask3="", may="", subject="", asker="", title="", bless="", bless_description="", bless_subject=""):
        super().__init__(subject)
        self.deity = deity
        self.ask1 = ask1
        self.ask2 = ask2
        self.ask3 = ask3
        self.may = may
        self.subject = subject
        self.asker = asker
        self.title = title
        self.bless = bless
        self.bless_description = bless_description
        self.bless_subject = bless_subject

    def __str__(self):
        return ("{prayer.deity}, {prayer.ask1}. {prayer.ask2} so I {prayer.may} {prayer.subject}. "
                "I {prayer.ask3} this of you {prayer.asker}, o {prayer.title}. "
                "{prayer.bless} me with your {prayer.bless_description} {prayer.bless_subject}.").format(
            deity=str(self.deity),
            prayer=self,
        )
Exemplo n.º 5
0
class Riddle(ListGenerated):
    provider = ListProvider(riddle)

    def __init__(self, args):
        question, answer = args
        super().__init__(question)
        self.question = question
        self.answer = answer

    def __str__(self):
        return self.question

    def __repr__(self):
        return "Question: {}\nAnswer: {}\n".format(self.question, self.answer)
Exemplo n.º 6
0
class StoryConceptEvent(BaseConcept):
    provider = ProvidersList(*[ListProvider(provider) for provider in events])
Exemplo n.º 7
0
class StoryConceptCharacter(BaseConcept):
    provider = ProvidersList(
        *[ListProvider(provider) for provider in characters])
Exemplo n.º 8
0
class Curse(Generated):
    provider = ListProvider(swears)
Exemplo n.º 9
0
class Toponym2(BaseToponym):
    providers = single_letter_provider + ListProvider(endings[1])
Exemplo n.º 10
0
from genesys.generator import Generated, ComplexGenerated
from genesys.generator import ListProvider

from fixtures.other import vowel_sounds, consonants, double_vowel_sounds, double_consonants
from fixtures.other import endings

single_letter_provider = ListProvider(consonants) + ListProvider(
    vowel_sounds) + ListProvider(double_consonants)
double_letter_provider = ListProvider(double_consonants) + ListProvider(
    double_vowel_sounds + vowel_sounds)


class BaseToponym(Generated):
    providers = None

    def __init__(self, part1="", part2="", part3="", end=""):
        super().__init__("".join([part1, part2, part3, end]).capitalize())

    @classmethod
    def generate(cls):
        if not cls.providers:
            return cls()
        next_data = next(cls.providers.items)
        return cls(*next_data)


class Toponym1(BaseToponym):
    providers = single_letter_provider + ListProvider(endings[2])


class Toponym2(BaseToponym):
Exemplo n.º 11
0
class Motto(Generated):
    provider = ListProvider(mottos)
Exemplo n.º 12
0
class BattleCry(Generated):
    provider = ListProvider(battlecry)

    def __str__(self):
        return "{}!".format(self.value)
Exemplo n.º 13
0
class BirthdayWish(Generated):
    provider = ListProvider(birthday_wish)
Exemplo n.º 14
0
class ReligiousCommandment(Generated):
    provider = ListProvider(commandment)

    def __str__(self):
        return "You shall {}".format(self.value)
Exemplo n.º 15
0
class SchoolSubject(Generated):
    provider = ListProvider(school_subjects)
Exemplo n.º 16
0
class Slogan(Generated):
    provider = ListProvider(slogans)
Exemplo n.º 17
0
class Toponym3(BaseToponym):
    providers = double_letter_provider + ListProvider(endings[0])
Exemplo n.º 18
0
 class HaikuString2(HaikuString):
     providers = [
         ProvidersList(*[ListProvider(part) for part in haiku_middle[0]]),
         ProvidersList(*[ListProvider(part) for part in haiku_middle[1]]),
     ]
Exemplo n.º 19
0
class Toponym4(BaseToponym):
    providers = ListProvider(vowel_sounds) + ListProvider(
        double_consonants) + ListProvider(endings[1])
Exemplo n.º 20
0
class CharacterGoal(Generated):
    provider = ListProvider(motivation)
Exemplo n.º 21
0
class Toponym5(BaseToponym):
    providers = double_letter_provider + ListProvider(
        consonants) + ListProvider(endings[2])
Exemplo n.º 22
0
class ArtConceptPlace(BaseConcept):
    provider = ProvidersList(*[ListProvider(provider) for provider in places])
Exemplo n.º 23
0
class ArtConceptBeing(BaseConcept):
    provider = ProvidersList(*[ListProvider(provider) for provider in beings])
Exemplo n.º 24
0
class WisdomQuote(Generated):
    provider = ListProvider(wisdom)
Exemplo n.º 25
0
class Idiom(Generated):
    provider = ListProvider(idiom)