예제 #1
0
    def handle(self, *args, **options):
        for i in range(100):
            user_name = re.sub('[^A-Za-z0-9]+', '', silly.name())
            email = silly.email()
            password = "******".format(re.sub('[^A-Za-z0-9]+', '', silly.name()),
                                     silly.number())
            gender = Gender.MALE if i == randint(0, 100) else Gender.FEMALE
            status = Status.SINGLE if i == randint(0, 100) else Status.DIVORCEE
            dob = models.DateField()
            is_cohen = True if i == randint(0, 100) else False
            is_single = True if i == randint(0, 100) else False
            user = User.objects.create_user("{}".format(user_name), email,
                                            password)
            user.authenticate()
            # user = authenticate(**form.cleaned_data)
            # user.full_clean()
            # user.save()

            # Add new user to Profile
            p = models.Profile(user=user,
                               gender=gender,
                               status=status,
                               dob=dob,
                               is_cohen=is_cohen,
                               is_single=is_single)

            # pis_single = True
            pfull_clean()
            psave()
    def handle(self, n, *args, **options):
        o1, c1 = Coach.objects.get_or_create(user_id=2,
                                             first_name='Nuni',
                                             last_name='Shasha',
                                             gender='Male')
        o1.save()
        o2, c2 = Coach.objects.get_or_create(user_id=3,
                                             first_name='Avi',
                                             last_name='Yitzhaki',
                                             gender='Male')
        o2.save()
        o3, c3 = Coach.objects.get_or_create(user_id=4,
                                             first_name='Shira',
                                             last_name='Lulu',
                                             gender='Female')
        o3.save()

        coaches = Coach.objects.all()

        groups_names = [
            'fishies', 'goldfish', 'jellyfish', 'octopus', 'squid', 'dolphin',
            'pre_masters', 'masters', 'provision', 'team'
        ]
        levels = [1, 1, 1, 2, 2, 3, 3, 4, 4, 4]
        age_groups = [1, 1, 2, 2, 3, 2, 4, 4, 2, 3]

        for i in range(10):
            o, c = Group.objects.get_or_create(
                name=groups_names[i],
                level=levels[i],
                age_group=age_groups[i],
                coach=random.choice(coaches),
                defaults={'capacity': random.uniform(8, 20)})

        groups = Group.objects.all()

        for i in range(n):
            o = Trainee.objects.create(first_name=silly.name().split(' ')[0],
                                       last_name=silly.name().split(' ')[0],
                                       gender=silly.gender(),
                                       birth_date=silly.datetime().date(),
                                       group=random.choice(groups))
            o.save()
예제 #3
0
 def setUp(self):
     self.community = Community.objects.create(
         name="Kibbutz Broken Dream",
     )
     self.users_details = dict()
     for i in range(NUM_OF_USERS):
         name = silly.name(slugify=True)
         email = silly.email()
         self.users_details[name] = OCUser.objects.create_superuser(email, name, DEFAULT_PASS)
     self.committee = Committee.objects.create(name="Culture", slug="culture", community=self.community)
     self.selenium = WebDriver()
예제 #4
0
    def handle(self, n, **options):
        map = os.path.join(settings.BASE_DIR, f'artifact_images/map.jpg')
        for i in range(n):
            user = User.objects.first()

            # Create random artifact
            o = Artifact()
            o.uploaded_by = user
            o.uploaded_at = silly.datetime().date()
            o.status = random.randint(1, 4)
            o.is_private = random.choice([True, False])
            o.is_featured = random.choice([True, False])
            o.name_he = silly.name()
            o.name_en = silly.name()
            o.slug = silly.name(slugify=True)
            o.year_from = random.randint(1700, 2000)
            o.year_to = random.randint(1700, 2000)
            o.origin_country = list(COUNTRIES)[random.randint(0, 200)]
            o.origin_city_he = silly.city()
            o.origin_city_en = silly.city()
            o.donor_name_he = silly.name()
            o.donor_name_en = silly.name()
            o.technical_data_he = silly.thing()
            o.technical_data_en = silly.thing()
            o.description_he = silly.thing()
            o.description_en = silly.thing()
            o.route_he = silly.thing()
            o.route_en = silly.thing()
            o.route_map = UploadedFile(open(map, "br"))
            o.save()

            # Add 4 random images to artifact
            for i in range(4):
                image = ArtifactImage()
                image.artifact = o
                filename = os.path.join(
                    settings.BASE_DIR,
                    f'artifact_images/{random.randint(1, 16)}.jpg')
                image.image = UploadedFile(open(filename, "br"))
                image.is_cover = random.choice([True, False])
                image.year_era_he = silly.name()
                image.year_era_en = silly.name()
                image.location_he = silly.name()
                image.location_en = silly.name()
                image.full_clean()
                image.save()
예제 #5
0
파일: user.py 프로젝트: J0kerMh/webgame
 def random_item(name):
     item_name = silly.name()
     if (random.randint(0, 9) % 2):
         category = 'tool'
     else:
         category = 'decoration'
     luck = User.query.filter_by(name=name).first().luck
     from app_sql.utils import weight
     weight = [j + (2**luck) for j in weight]
     quality = weighted_random(tuple(zip(reversed(range(1, 6)), weight)))
     # quality = weighted_random(weighted_item)
     return Item(name, item_name, category, quality, False, False)
예제 #6
0
    def handle(self, *args, **options):
        for i in range(100):
            user_name = re.sub('[^A-Za-z0-9]+', '', silly.name())
            email = silly.email()
            password = "******".format(re.sub('[^A-Za-z0-9]+', '', silly.name()), silly.number())
            gender = Gender.MALE if i == randint(0, 100) else Gender.FEMALE
            status = Status.SINGLE if i == randint(0, 100) else Status.DIVORCEE
            dob = models.DateField()
            is_cohen = True if i == randint(0, 100) else False
            is_single = True if i == randint(0, 100) else False
            user = User.objects.create_user("{}".format(user_name), email, password)
            user.authenticate()
            # user = authenticate(**form.cleaned_data)
            # user.full_clean()
            # user.save()

            # Add new user to Profile
            p = models.Profile(
                user=user, gender=gender, status=status, dob=dob, is_cohen=is_cohen, is_single=is_single)

            # pis_single = True
            pfull_clean()
            psave()
예제 #7
0
 def random_item():
     item_name = silly.name()
     if (random.randint(0, 9) % 2):
         category = 'tool'
     else:
         category = 'decoration'
     luck = mongo.db.user.find_one({'name': name})['luck']
     from application.utils import weight
     weight = [j + (2**luck) for j in weight]
     quality = weighted_random(tuple(zip(reversed(range(1, 6)), weight)))
     # quality = weighted_random(weighted_item)
     return {
         'item_name': item_name,
         'category': category,
         'quality': quality,
         'on_sale': False
     }
예제 #8
0
 def __init__(self,
              personal_id,
              job=None,
              full_name=None,
              last_seen_station_id=LAST_LOCATION_DEFAULT,
              signal_strength=-1,
              last_seen_time=-1):
     if not full_name:
         full_name = silly.name()
     if not job:
         job = silly.title()
     self.personal_id = personal_id  # can start with 0 - so not int
     self.job = job
     self.full_name = full_name
     self.last_seen_station_id = int(last_seen_station_id)
     self.signal_strength = signal_strength
     if last_seen_time < 0 and last_seen_station_id != LAST_LOCATION_DEFAULT:
         last_seen_time = time.time()
     self.last_seen_time = int(last_seen_time)
     self.signal_strength1 = 100
     self.signal_strength2 = 100
예제 #9
0
def user_info(user: str = None, id: str = None):
    if id == None:
        set_id = uuid.uuid1()
    else:
        set_id = id
    if user is None:
        username: str = silly.name(capitalize=True)
    else:
        username = user

    title: str = silly.title(capitalize=True)
    company: str = silly.company(capitalize=True)
    address: str = silly.address(capitalize=True)
    city: str = silly.city(capitalize=True)
    country: str = silly.country(capitalize=True)
    postal_code: str = silly.postal_code()
    email = silly.email()
    phone = silly.phone_number()
    description: str = silly.paragraph(length=3)
    website = f'http://www.{silly.domain()}'
    create_date = f'{silly.datetime().year}/{silly.datetime().month}/{silly.datetime().day}'

    result = {
        'useId': str(set_id),
        'username': username,
        'title': title,
        'company': company,
        'address': address,
        'city': city,
        'country': country,
        'postal': postal_code,
        'email': email,
        'phone': phone,
        'website': website,
        'description': description,
        'dateCreate': create_date
    }
    return result
예제 #10
0
파일: startup.py 프로젝트: sweettuse/utils
import pandas as pd
import numpy as np
from functools import partial, wraps, cache
from collections import defaultdict, Counter, deque
from itertools import accumulate, chain, combinations, combinations_with_replacement, compress, count, cycle, dropwhile, filterfalse, groupby, islice, permutations, product, repeat, starmap, takewhile, tee, zip_longest
from operator import itemgetter, attrgetter


try:
    import silly
except:
    s = 'unable to import silly!'
else:
    s = '{} {} has {}'.format(silly.title(), silly.name(), silly.a_thing())

banner = len(s) * '='
try:
    from rich import print, inspect, box
    help_orig = help
    help = partial(inspect, methods=True, help=True)
    from rich.table import Table
    from rich.style import Style

except ModuleNotFoundError:
    s += '\nunable to import rich'
else:
    s += '\n:tada: [green on purple]rich[/] [red bold]installed :tada:'

print()
print(banner)
print(s)
예제 #11
0
    def handle(self, n, **options):
        # Create 5 tags
        Tag.objects.bulk_create([
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=True),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=True),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=True),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=True),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=True),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=False),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=False),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=False),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=False),
            Tag(tag_he=silly.title(), tag_en=silly.title(), featured=False),
        ])

        for i in range(n):
            # Create random mosaic site
            s = MosaicSite()
            s.site_id = silly.title()
            s.title_he = silly.name()
            s.title_en = silly.name()
            s.origin_he = silly.title()
            s.origin_en = silly.title()
            s.story_he = silly.thing()
            s.story_en = silly.thing()
            s.archeological_context = random.choice(['church', 'synagogue', 'public'])
            s.period = 'byzantine'
            s.video_id = silly.title()
            s.comments = silly.thing()
            s.featured = random.choice([True, False])
            s.latitude = silly.number()
            s.longitude = silly.number()
            s.save()
            for j in range(3):
                mi = MosaicItem()
                mi.mosaic_site = s
                mi.misp_rashut = silly.title()
                mi.length = silly.number()
                mi.width = silly.number()
                mi.area = silly.number()
                mi.rishayon = silly.title()
                mi.materials = [random.choice(Materials.CHOICES)[0]]
                mi.year = silly.datetime().year
                mi.displayed_at = silly.address()
                mi.description_he = silly.thing()
                mi.description_en = silly.thing()
                mi.bibliography_he = silly.thing()
                mi.bibliography_en = silly.thing()
                mi.save()
                mi.tags.add(Tag.objects.all().order_by('?')[0])
                for k in range(3):
                    mp = MosaicPicture()
                    mp.mosaic = mi
                    mp.is_cover = random.choice([True, False])
                    mp.order_priority = random.randint(1, 100)
                    filename = os.path.join(
                        settings.BASE_DIR, 'mosaic_images/{}.jpg'.format(random.randint(1, 12))
                    )
                    mp.picture = UploadedFile(open(filename, "br"))
                    mp.negative_id = silly.number()
                    mp.photographer_name_he = silly.name()
                    mp.photographer_name_en = silly.name()
                    mp.taken_at = silly.country()
                    mp.picture_type = random.choice(PictureType.CHOICES)[0]
                    mp.taken_date = silly.datetime().date()
                    mp.comments_he = silly.thing()
                    mp.comments_en = silly.thing()
                    mp.full_clean()
                    mp.save()
                    mp.tags.add(Tag.objects.all().order_by('?')[0])
예제 #12
0
 def get_silly_username(self):
     return "{}{}".format(re.sub('[^A-Za-z0-9]+', '', silly.name()), silly.number())
예제 #13
0
def handle(event, context):
    person = core_api.Person()
    person.id = new_id()
    person.name = silly.name()
    return MessageToJson(person)
예제 #14
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'])
예제 #15
0
 def get_silly_username(self):
     return "{}{}".format(re.sub('[^A-Za-z0-9]+', '', silly.name()),
                          silly.number())
예제 #16
0
def handle(event, context):
    return silly.name()
예제 #17
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))