Esempio n. 1
0
    def handle(self, *args, **options):
        # Product.objects.all().delete()
        cats = [
            Category.objects.create(
                title="{} {}".format(silly.adjective(),
                                     silly.noun().title()),
                description=silly.paragraph(length=2) + "\n" +
                silly.paragraph(length=2),
                image_url=silly.image(),
            ) for i in range(8)
        ]

        for i in range(100):
            title = "{} {}".format(silly.adjective(), silly.noun())
            desc = silly.paragraph(length=2) + "\n" + silly.paragraph(length=2)
            price = silly.number() + silly.number() / 10

            Product.objects.create(
                category=random.choice(cats),
                title=title,
                description=desc,
                price=price,
                image_url=silly.image(),
            )

        print("OK")
Esempio n. 2
0
    def handle(self, *args, **options):
        n = options['n']

        users = []
        for i in range(1, 6):
            user, created = User.objects.get_or_create(
                username='******'.format(i), )
            cats = list(user.categories.all())
            if not cats:
                cats = [
                    user.categories.create(name=silly.noun()) for i in range(5)
                ]

            user.set_password("secret1234")
            user.save()
            users.append(user)

        for i in range(n):
            with transaction.atomic():
                o = models.Expense(
                    user=random.choice(users),
                    date=get_random_date(),
                    amount="{:.2f}".format(random.uniform(1, 100)),
                    title="{} {}".format(silly.adjective(),
                                         silly.noun()).title(),
                    description=get_paragraph(1, 3),
                )
                o.full_clean()
                o.save()
                sample = set(random.sample(cats, random.randint(1, 3)))
                for cat in sample:
                    o.categories.add(cat)

                for i in range(random.randint(0, 5)):
                    o.comments.create(content=get_paragraph(1, 4), )
    def handle(self, *args, **options):
        # Product.objects.all().delete()
        cats = [
            Category.objects.create(
                title="{} {}".format(silly.adjective(), silly.noun().title()),
                description=silly.paragraph(length=2) + "\n" + silly.paragraph(
                    length=2),
                image_url=silly.image(),
            ) for i in range(8)]

        for i in range(100):
            title = "{} {}".format(silly.adjective(), silly.noun())
            desc = silly.paragraph(length=2) + "\n" + silly.paragraph(length=2)
            price = silly.number() + silly.number() / 10

            Product.objects.create(
                category=random.choice(cats),
                title=title,
                description=desc,
                price=price,
                image_url=silly.image(),
            )

        print("OK")
Esempio n. 4
0
    def handle(self, *args, **options):
        # Product.objects.all().delete()

        for i in range(5):
            parent_title = "{} {}".format(silly.adjective(), silly.noun())
            parent_desc = silly.paragraph(length=2) + "\n" + silly.paragraph(
                length=2)

            parent = Category.objects.create(
                title=parent_title,
                description=parent_desc,
            )

            for j in range(5):
                title = "{} {}".format(silly.adjective(), silly.noun())
                desc = silly.paragraph(length=2) + "\n" + silly.paragraph(
                    length=2)
                price = silly.number() + silly.number() / 10
                image_url = silly.image()
                Category.objects.create(title=title,
                                        description=desc,
                                        price=price,
                                        image_url=image_url,
                                        parent=parent)
Esempio n. 5
0
 def handle(self, *args, **options):
     n = options['n']
     for i in range(n):
         o = models.Expense(
             date="201{}-{:02}-{}".format(
                 random.randint(0, 9),
                 random.randint(1, 12),
                 random.randint(1, 30)
             ),
             amount="{:.2f}".format(random.uniform(1, 100)),
             title="{} {}".format(silly.adjective(), silly.noun()).title(),
             description=silly.paragraph(length=random.randint(1, 3)),
         )
         o.full_clean()
         o.save()
Esempio n. 6
0
 def handle(self, *args, **options):
     while User.objects.count() < 10:
         User.objects.create_user(
             username=silly.firstname().lower(),
             password="******",
         )
     users = list(User.objects.all())
     n = 10
     for i in range(n):
         o = Expense(
             user=random.choice(users),
             created_at=silly.datetime(),
             title="{} {}".format(silly.adjective(), silly.noun()),
             amount=str(silly.number() + silly.number() / 10)[:5],
             description=silly.sentence() + "\n" + silly.sentence()
         )
         o.full_clean()
         o.save()
         o.created_at = silly.datetime()
         o.save()
Esempio n. 7
0
    def handle(self, *args, **options):
        n = options['n']

        users = []
        for i in range(1, 6):
            user, created = User.objects.get_or_create(
                username='******'.format(i), )
            user.set_password("secret1234")
            user.save()
            users.append(user)

        for i in range(n):
            o = models.Expense(
                user=random.choice(users),
                date=get_random_date(),
                amount="{:.2f}".format(random.uniform(1, 100)),
                title="{} {}".format(silly.adjective(), silly.noun()).title(),
                description=get_paragraph(1, 3),
            )
            o.full_clean()
            o.save()
            for i in range(random.randint(0, 5)):
                o.comments.create(content=get_paragraph(1, 4), )
Esempio n. 8
0
    def populate_components(self):
        nouns = self.get_noun_list("https://3hjj9iij.api.sanity.io/v1/data/query/production?query=*[_type==\"noun\"]{noun,nounType->{nounType}}")
        descriptions = self.get_description_list("https://3hjj9iij.api.sanity.io/v1/data/query/production?query=*[_type==\"description\"]{description,nounType->{nounType}}")
        actions = self.get_action_list("https://3hjj9iij.api.sanity.io/v1/data/query/production?query=*[_type==\"action\"]{action,actionType->{actionType}}")
        articleword = self.get_article_list("https://3hjj9iij.api.sanity.io/v1/data/query/production?query=*[_type==\"articleword\"]{articleword,articleType->{articleType}}")

        # Getting lists of Nouns
        self.components['list_primary_actor'] = self.get_noun_list_for_type(nouns, 'primary actor')
        self.components['list_secondary_actor'] = self.get_noun_list_for_type(nouns, 'secondary actor')
        self.components['list_actor'] = self.components['list_primary_actor'] + self.components['list_secondary_actor']
        self.components['list_in_place'] = self.get_noun_list_for_type(nouns, 'in-place')
        self.components['list_on_place'] = self.get_noun_list_for_type(nouns, 'on-place')
        self.components['list_place'] = self.components['list_in_place'] + self.components['list_on_place']
        self.components['list_weapon'] = self.get_noun_list_for_type(nouns, 'weapon')
        self.components['list_transport'] = self.get_noun_list_for_type(nouns, 'transport')
        self.components['list_transport_damage_noun'] = self.get_noun_list_for_type(nouns, 'transport damage')
        self.components['list_regime'] = self.get_noun_list_for_type(nouns, 'politics')
        self.components['list_group'] = self.get_noun_list_for_type(nouns, 'group')
        self.components['list_secondary_actor_plural'] = self.get_noun_list_for_type(nouns, 'secondary actors plural')
        self.components['list_orbits_noun'] = self.get_noun_list_for_type(nouns, 'orbits')
        self.components['list_liquid'] = self.get_noun_list_for_type(nouns, 'liquid')
        self.components['list_tech'] = self.get_noun_list_for_type(nouns, 'tech')
        self.components['list_transport_name'] = self.get_noun_list_for_type(nouns, 'transport name')
        self.components['list_transports'] = self.get_noun_list_for_type(nouns, 'transport plural')
        self.components['list_engine'] = self.get_noun_list_for_type(nouns, 'engine')
        self.components['list_basic_noun'] = self.get_noun_list_for_type(nouns, 'basic noun')
        self.components['list_basic_nouns'] = self.get_noun_list_for_type(nouns, 'basic nouns')
        self.components['list_collection'] = self.get_noun_list_for_type(nouns, 'collection')
        self.components['list_sense_nouns'] = self.get_noun_list_for_type(nouns, 'sense nouns')


        # Getting lists of Descriptions
        self.components['list_in_place_description'] = self.get_description_list_for_type(descriptions, 'in-place')
        self.components['list_on_place_description'] = self.get_description_list_for_type(descriptions, 'on-place')
        self.components['list_place_description'] = self.components['list_in_place_description'] + self.components['list_on_place_description']
        self.components['list_primary_actor_description'] = self.get_description_list_for_type(descriptions, 'primary actor')
        self.components['list_secondary_actor_description'] = self.get_description_list_for_type(descriptions, 'secondary actor')
        self.components['list_actor_description'] = self.components['list_primary_actor_description'] + self.components['list_secondary_actor_description']
        self.components['list_weapon_description'] = self.get_description_list_for_type(descriptions, 'weapon')
        self.components['list_transport_description'] = self.get_description_list_for_type(descriptions, 'transport')
        self.components['list_transport_equipped'] = self.get_description_list_for_type(descriptions, 'transport equipped')
        self.components['list_a__society'] = self.get_description_list_for_type(descriptions, 'a__society')
        self.components['list_liquid_desc'] = self.get_description_list_for_type(descriptions, 'liquid')
        self.components['list_society_is_a__'] = self.get_description_list_for_type(descriptions, 'society_is_a__')
        self.components['list_crust'] = self.get_description_list_for_type(descriptions, 'crust')
        self.components['list_sky'] = self.get_description_list_for_type(descriptions, 'sky')
        self.components['list_transport_name_desc'] = self.get_description_list_for_type(descriptions, 'transport name')
        self.components['list_planet_with'] = self.get_description_list_for_type(descriptions, 'planet with')
        self.components['list_a__planet'] = self.get_description_list_for_type(descriptions, 'a__planet')
        self.components['list_basic_noun_desc'] = self.get_description_list_for_type(descriptions, 'basic noun')

        # Getting lists of Actions
        self.components['list_place_action'] = self.get_action_list_for_type(actions, 'place')
        self.components['list_weapon_action'] = self.get_action_list_for_type(actions, 'weapon')
        self.components['list_transport_action'] = self.get_action_list_for_type(actions, 'transport')
        self.components['list_sentient_positive_action'] = self.get_action_list_for_type(actions, 'sentient positive')
        self.components['list_sentient_negative_action'] = self.get_action_list_for_type(actions, 'sentient negative')
        self.components['list_sentient_action'] = self.components['list_sentient_positive_action'] + self.components['list_sentient_negative_action']
        self.components['list_transport_function'] = self.get_action_list_for_type(actions, 'transport function')
        self.components['list_transport_damage_action'] = self.get_action_list_for_type(actions, 'transport damage')
        self.components['list_suddenly'] = self.get_action_list_for_type(actions, 'suddenly')
        self.components['list_sentient_action_plural'] = self.get_action_list_for_type(actions, 'sentient plural')
        self.components['list_transport_about'] = self.get_action_list_for_type(actions, 'transport about')
        self.components['list_looking_for'] = self.get_action_list_for_type(actions, 'looking for')
        self.components['list_orbits_verb'] = self.get_action_list_for_type(actions, 'orbits')

        # Getting article exception lists
        self.components['list_an_article_exceptions'] = self.get_article_list_for_type(articleword, 'an_exception')
        self.components['list_a_article_exceptions'] = self.get_article_list_for_type(articleword, 'a_exception')

        # Randomly selecting a word within each list
        self.components['in_place'] = random.choice(self.components['list_in_place'])
        self.components['on_place'] = random.choice(self.components['list_on_place'])
        self.components['place'] = random.choice(self.components['list_place'])
        self.components['place_action'] = random.choice(self.components['list_place_action'])
        self.components['place_desc'] = random.choice(self.components['list_place_description'])
        self.components['secondary_actor'] = random.choice(self.components['list_secondary_actor'])
        self.components['primary_actor'] = random.choice(self.components['list_primary_actor'])
        self.components['weapon_action'] = random.choice(self.components['list_weapon_action'])
        self.components['transport_action'] = random.choice(self.components['list_transport_action'])
        self.components['sentient_positive_action'] = random.choice(self.components['list_sentient_positive_action'])
        self.components['sentient_negative_action'] = random.choice(self.components['list_sentient_negative_action'])
        self.components['sentient_action'] = random.choice(self.components['list_sentient_action'])
        self.components['primary_actor_desc'] = random.choice(self.components['list_primary_actor_description'])
        self.components['secondary_actor_desc'] = random.choice(self.components['list_secondary_actor_description'])
        self.components['weapon_desc'] = random.choice(self.components['list_weapon_description'])
        self.components['transport_desc'] = random.choice(self.components['list_transport_description'])
        self.components['weapon'] = random.choice(self.components['list_weapon'])
        self.components['transport'] = random.choice(self.components['list_transport'])
        self.components['actor'] = random.choice(self.components['list_actor'])
        self.components['actor_desc'] = random.choice(self.components['list_actor_description'])
        self.components['transport_function'] = random.choice(self.components['list_transport_function'])
        self.components['transport_damage_action'] = random.choice(self.components['list_transport_damage_action'])
        self.components['transport_equipped'] = random.choice(self.components['list_transport_equipped'])
        self.components['transport_damage_noun'] = random.choice(self.components['list_transport_damage_noun'])
        self.components['regime'] = random.choice(self.components['list_regime'])
        self.components['group'] = random.choice(self.components['list_group'])
        self.components['a__society'] = random.choice(self.components['list_a__society'])
        self.components['secondary_actors'] = random.choice(self.components['list_secondary_actor_plural'])
        self.components['orbits_verb'] = random.choice(self.components['list_orbits_verb'])
        self.components['orbits_noun'] = random.choice(self.components['list_orbits_noun'])
        self.components['suddenly'] = random.choice(self.components['list_suddenly'])
        self.components['liquid'] = random.choice(self.components['list_liquid'])
        self.components['liquid_desc'] = random.choice(self.components['list_liquid_desc'])
        self.components['sentient_action_plural'] = random.choice(self.components['list_sentient_action_plural'])
        self.components['society_is_a__'] = random.choice(self.components['list_society_is_a__'])
        self.components['tech'] = random.choice(self.components['list_tech'])
        self.components['crust'] = random.choice(self.components['list_crust'])
        self.components['sky'] = random.choice(self.components['list_sky'])
        self.components['transport_name_noun'] = random.choice(self.components['list_transport_name'])
        self.components['transport_name_desc'] = random.choice(self.components['list_transport_name_desc'])
        self.components['transport_about'] = random.choice(self.components['list_transport_about'])
        self.components['transports'] = random.choice(self.components['list_transports'])
        self.components['engine'] = random.choice(self.components['list_engine'])
        self.components['looking_for'] = random.choice(self.components['list_looking_for'])
        self.components['planet_with'] = random.choice(self.components['list_planet_with'])
        self.components['a__planet'] = random.choice(self.components['list_a__planet'])
        self.components['basic_noun'] = random.choice(self.components['list_basic_noun'])
        self.components['basic_nouns'] = random.choice(self.components['list_basic_nouns'])
        self.components['collection'] = random.choice(self.components['list_collection'])
        self.components['basic_noun_desc'] = random.choice(self.components['list_basic_noun_desc'])
        self.components['sense_noun'] = random.choice(self.components['list_sense_nouns'])
        

        # Randomising a second time for variables that are used twice in a sentence
        self.components['place2'] = random.choice(self.components['list_place'])
        self.components['place2_desc'] = random.choice(self.components['list_place_description'])
        self.components['secondary_actor2'] = random.choice(self.components['list_secondary_actor'])
        self.components['transport_equipped2'] = random.choice(self.components['list_transport_equipped'])
        self.components['transport_function2'] = random.choice(self.components['list_transport_function'])
        self.components['secondary_actor_desc2'] = random.choice(self.components['list_secondary_actor_description'])
        self.components['primary_actor2'] = random.choice(self.components['list_primary_actor'])
        self.components['planet_with2'] = random.choice(self.components['list_planet_with'])
        self.components['sense_noun2'] = random.choice(self.components['list_sense_nouns'])

        self.components['place2'] = self.randomiser_duplicator(self.components['place'], self.components['place2'], self.components['list_place'])
        self.components['place2_desc'] = self.randomiser_duplicator(self.components['place_desc'], self.components['place2_desc'], self.components['list_place_description'])
        self.components['secondary_actor2'] = self.randomiser_duplicator(self.components['secondary_actor'], self.components['secondary_actor2'], self.components['list_secondary_actor'])
        self.components['transport_function2'] = self.randomiser_duplicator(self.components['transport_function'], self.components['transport_function2'], self.components['list_transport_function'])
        self.components['secondary_actor_desc2'] = self.randomiser_duplicator(self.components['secondary_actor_desc'], self.components['secondary_actor_desc2'], self.components['list_secondary_actor_description'])
        self.components['primary_actor2'] = self.randomiser_duplicator(self.components['primary_actor'], self.components['primary_actor2'], self.components['list_primary_actor'])
        self.components['planet_with2'] = self.randomiser_duplicator(self.components['planet_with'], self.components['planet_with2'], self.components['list_planet_with'])
        self.components['sense_noun2'] = self.randomiser_duplicator(self.components['sense_noun'], self.components['sense_noun2'], self.components['list_sense_nouns'])

        self.components['primary_actor_article_on_desc'] = self.article(self.components['primary_actor_desc'])
        self.components['secondary_actor_article_on_desc'] = self.article(self.components['secondary_actor_desc'])
        self.components['place_article_on_desc'] = self.article(self.components['place_desc'])
        self.components['weapon_article_on_desc'] = self.article(self.components['weapon_desc'])
        self.components['transport_article_on_desc'] = self.article(self.components['transport_desc'])
        self.components['actor_article_on_desc'] = self.article(self.components['actor_desc'])
        self.components['primary_actor_article'] = self.article(self.components['primary_actor'])
        self.components['secondary_actor_article'] = self.article(self.components['secondary_actor'])
        self.components['place_article'] = self.article(self.components['place'])
        self.components['weapon_article'] = self.article(self.components['weapon'])
        self.components['transport_article'] = self.article(self.components['transport'])
        self.components['actor_article'] = self.article(self.components['actor'])
        self.components['a__society_article'] = self.article(self.components['a__society'])
        self.components['secondary_actor2_article'] = self.article(self.components['secondary_actor2'])
        self.components['place2_article'] = self.article(self.components['place2'])
        self.components['primary_actor2_article'] = self.article(self.components['primary_actor2'])
        self.components['place2_article_on_desc'] = self.article(self.components['place2_desc'])
        self.components['society_is_a__article'] = self.article(self.components['society_is_a__'])
        self.components['crust_article'] = self.article(self.components['crust'])
        self.components['engine_article'] = self.article(self.components['engine'])
        self.components['a__planet_article'] = self.article(self.components['a__planet'])

        # Listing prepositions
        self.components['list_weapon_preposition'] = ['with', 'using']
        self.components['weapon_preposition'] = random.choice(self.components['list_weapon_preposition'])
        self.components['list_transport_preposition'] = ['aboard', 'on']
        self.components['transport_preposition'] = random.choice(self.components['list_transport_preposition'])

        if self.components['place'] in self.components['list_in_place']:
            self.components['place_prep'] = 'in'
        if self.components['place'] in self.components['list_on_place']:
            self.components['place_prep'] = 'on'

        # dealing with pronouns
        self.components['list_pronoun'] = ['she', 'he']
        
        if self.components['primary_actor'] in ['king','prince','dad','eunuch']:
            self.components['pronoun'] = 'he'
        elif self.components['primary_actor'] in ['queen','princess','mom']:
            self.components['pronoun'] = 'she'
        else:
            self.components['pronoun'] = random.choice(self.components['list_pronoun'])          

        if self.components['pronoun'] == 'she':
            self.components['pos_pro'] = 'her'
            self.components['obj_pro'] = 'her'
        elif self.components['pronoun'] == 'he':
            self.components['pos_pro'] = 'his'
            self.components['obj_pro'] = 'him'
        
        # select constructions

        self.components['history'] = random.choice(['History will remark on this for generations.','Lifetimes will pass before this moment is forgotten.','Make a note of this day, gentleman.','Make a note of this day, ladies.','So anyway, I started blasting.'])

        self.components['list_planetsystemsector'] = ['Planet', 'System', 'Sector']
        self.components['planetsystemsector'] = random.choice(self.components['list_planetsystemsector'])

        self.components['in-range'] = random.choice(['Should hostilities erupt, we will be outgunned.','We should try to maintain diplomatic relations.'])

        self.components['taste for human flesh'] = random.choice(['The human race will come to an end tonight.','The human race faces extinction tonight.','Run.'])
                
        self.components['verb'] = self.get_random_word('verb', 10)
        self.components['noun1'] = self.get_random_word('noun', 10)
        self.components['noun2'] = self.get_random_word('noun', 10)
        self.components['name'] = self.components['verb'].title() + ' ' + self.components['noun1'].title() + ' the ' + self.components['noun2'].title()
    
        if self.components['place'] == 'civilisation':
            self.components['civ_soc'] = 'society'
        else:
            self.components['civ_soc'] = 'civilisation'

        self.components['list_alpha'] = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
        self.components['liquid_type'] = random.choice(['it rains', 'there are deep oceans of', 'there are clouds of', 'there are pools of', 'rivers run with', 'the skies are full of', 'there is an ocean of'])

        self.components['planet_end'] = random.choice(['There is something eery about this system.', 'You can see it too, right?', 'Let\'s get in and get out.', 'I have a bad feeling about this.', 'The metal spaceship creaks and groans - an ignored voice of resistance.', 'I\'ve heard some messed-up stories about this place.', 'We can hide out there until this all blows over.', 'We can make this work.'])

        self.components['sense'] = random.choice(['sense','feel','smell','hear','taste'])

        self.components['list_consonants'] = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
        self.components['list_vowels'] = ['a','e','i','o','u']

        self.components['L1'] = random.choice(self.components['list_consonants'])
        self.components['L2'] = random.choice(self.components['list_vowels'])
        self.components['L3'] = random.choice(self.components['list_consonants'])
        self.components['L4'] = random.choice(self.components['list_vowels'])
        self.components['L5'] = random.choice(self.components['list_consonants'])
        self.components['L6'] = random.choice(self.components['list_vowels'])
        self.components['L7'] = random.choice(self.components['list_vowels'])
        self.components['L8'] = random.choice(self.components['list_consonants'])

        self.components['L9'] = random.choice(self.components['list_consonants'])
        self.components['L10'] = random.choice(self.components['list_vowels'])
        self.components['L11'] = random.choice(self.components['list_consonants'])

        self.components['planetname'] = self.components['L1'].title() + self.components['L2'] + self.components['L3'] + self.components['L4'] + self.components['L5'] + self.components['L6'] + self.components['L7'] + self.components['L8'] + ' ' + self.components['L9'].title() + self.components['L10'] + self.components['L11']
        
        self.components['hired_to'] = random.choice(['complete the job.','create a distraction.'])

        self.components['stranded'] = random.choice(['Sons of bitches. It was only a little mutiny.', 'Some people are so easily offended.', 'Talk about an overreaction to a minor mishap. No one even died.', 'Jeez, there\'s just no pleasing some people.', 'Some people are so sensitive. The explosion wasn\'t even intentional.', 'When you told them to \"just let it go already\" this is not what you meant.', 'Some people just can\'t take a joke.', 'You\'re gonna get back at them by not dying. Somehow.'])

        self.components['breaking_through'] = random.choice(['the planet\'s crust', 'the ship\'s hull', 'the force field', 'the cargo bay doors'])

        self.components['silly_thing_group'] = self.components['collection'] + ' ' + self.components['basic_nouns']
        self.components['silly_thing_single'] = self.components['basic_noun_desc'] + ' ' + self.components['basic_noun']
        self.components['silly_thing_number'] = num2words(random.randint(2, 200)) + ' ' + self.components['basic_nouns']
        self.components['silly_thing'] = random.choice([self.components['silly_thing_group'], self.components['silly_thing_single'], self.components['silly_thing_number']])
 
        self.components['random_year'] = str(random.randint(3000, 8000))

        self.components['body_part'] = random.choice(['ear', 'eye', 'nose', 'lips', 'tongue', 'skin', 'arm', 'leg', 'foot', 'hand', 'brain'])

        self.components['stardate'] = str(random.randint(1000, 56947)) + '.' + str(random.randint(1,9))
        self.components['system_name'] = self.get_random_word('noun', 5) + ' ' + self.get_random_word('noun', 5)

        self.components['roman_numeral'] = random.choice(['I','II','III','IV','V','VI','VII','VIII','X'])

        self.components['physical_space'] = random.choice(['valley', 'cavern', 'cave', 'crevasse'])

        self.components['drifting_consequence'] = random.choice(['. They made a bad miscalculation.', '. They screwed the pooch on this one.', '. They f****d up.', ', much too far to be rescued. They are alone.'])

        self.components['planet_discovery'] = random.choice(['NASA has discovered an inhabited exoplanet. ', 'Your mission is to document a strange planet\'s surface. '])

        self.components['person_title'] = random.choice(['Ms', 'Mr', 'Dr'])

        self.components['silly_noun1'] = silly.noun()
        self.components['silly_noun2'] = silly.noun()
        self.components['silly_adjective1'] = silly.adjective()
        self.components['silly_adjective2'] = silly.adjective()
        self.components['silly_plural1'] = silly.plural()
        self.components['silly_name1'] = silly.name().split()
        

        self.components['list_of_rhyming_words'] = pronouncing.rhymes(silly.noun())
        try:
            self.components['rhyme_word1'] = self.components['list_of_rhyming_words'][0]
            self.components['rhyme_word2'] = self.components['list_of_rhyming_words'][1]
        except:
            self.components['rhyme_word1'] = 'AG'
            self.components['rhyme_word2'] = 'Bagg'

        self.components['planet_name'] = random.choice(self.components['list_alpha']).title() + random.choice(self.components['list_alpha']).title() + ' ' + str(random.randint(100000, 999999)) + random.choice(self.components['list_alpha'])
Esempio n. 9
0
# we depend on the `silly` package from pypi

import silly

if __name__ == "__main__":
    name = silly.name(capitalize=True)
    name2 = silly.name(capitalize=True)
    thing = silly.thing()
    noun = silly.noun()
    adj = silly.adjective()
    print("My name is {0}.  My favourite thing is {1}.  I am a {2}.  I love {3}".format(name, thing,
                                                                                        noun, name2))