• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python names.get_first_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中names.get_first_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_first_name函数的具体用法?Python get_first_name怎么用?Python get_first_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_first_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_personal_shopper_assignment

    def test_personal_shopper_assignment(self):
        #Create some personal shoppers
        personal_shopper1 = PersonalShopper.objects.create(
            first_name=names.get_first_name(gender="female"),
            last_name=names.get_last_name(),
        )
        personal_shopper2 = PersonalShopper.objects.create(
            first_name=names.get_first_name(gender="female"),
            last_name=names.get_last_name(),
        )

        personal_shopper1.save()
        personal_shopper2.save()

        personal_shopper1.regions.add(self.region)
        personal_shopper2.regions.add(self.region)

        #Create some users without recent orders and assign them to personal shopper 1
        for _ in xrange(5):
            member = Member.objects.create(
                first_name=names.get_first_name(gender='male'),
                last_name=names.get_last_name(),
                phone_number=random.randint(1, 9999999999),
                region=random_region(),
                personal_shopper=personal_shopper1,
            )

            member.save()

        #Check if a new member would be assigned to personal shopper 2
        self.assertEqual(assign_personal_shopper(self.region), personal_shopper2)
开发者ID:jghyllebert,项目名称:member-distribution,代码行数:31,代码来源:tests.py


示例2: __init__

    def __init__(self):
        id_length = random.randint(config.min_id_length, config.max_id_length)
        self.id = utils.random_string(id_length)

        sex = random.choice(['male', 'female'])
        if sex == 'male':
            self.sex = 'M'
        else:
            self.sex = 'F'

        self.first_name = names.get_first_name(sex)
        self.last_name = names.get_last_name()
        self.middle_name = ''
        if config.gen_mid_name:
            if random.random() < config.gen_mid_name_chance:
                if random.randint(0, 1):
                    self.middle_name = names.get_first_name(sex)
                else:
                    self.middle_name = names.get_first_name(sex)[0]

        start = datetime.datetime(1900, 1, 1)
        end = datetime.datetime.now()
        self.birth_date = utils.random_date_between(start, end)

        self.aliases = []
        if config.gen_alias:
            for i in xrange(config.gen_alias_max):
                if random.random() < config.gen_alias_chance:
                    self.aliases.append(self.generate_alias())

        self.studies = self.generate_studies(self.birth_date)
开发者ID:IMAGE-ET,项目名称:dcmenvgen,代码行数:31,代码来源:hierarchy.py


示例3: test_random_gender

 def test_random_gender(self):
     counts = defaultdict(int)
     rounds = 5000.0
     with patch_file(test_files):
         for i in range(int(rounds)):
             names.get_first_name()
             counts[names.get_first_name()] += 1
     self.assertAlmostEqual(counts['Male'] / rounds, 0.500, delta=0.05)
     self.assertAlmostEqual(counts['Female'] / rounds, 0.500, delta=0.05)
开发者ID:djibson,项目名称:names,代码行数:9,代码来源:test_names.py


示例4: test_empty_file

 def test_empty_file(self):
     empty_files = {
         'first:male': full_path('test/empty.txt'),
         'first:female': full_path('test/empty.txt'),
         'last': full_path('test/empty.txt'),
     }
     with patch_file(empty_files):
         self.assertEqual(names.get_first_name(gender='male'), "")
         self.assertEqual(names.get_first_name(gender='female'), "")
         self.assertEqual(names.get_last_name(), "")
开发者ID:djibson,项目名称:names,代码行数:10,代码来源:test_names.py


示例5: test_competitor_creation

def test_competitor_creation(sh):

  prefix = Preferences.TestingPrefix

  sh = SetupHelper.SetupHelper()
  sh.setManualDbCursor(DatabaseConnection.DatabaseConnection().getDatabaseCursor())
  if random() < 0.5:
      print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='male'), "U18M", prefix)
  else:
      print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='female'), "U18F", prefix)
开发者ID:balugege,项目名称:PCompetition,代码行数:10,代码来源:SetupHelperTest.py


示例6: test_correct_files

 def test_correct_files(self):
     with patch_file(test_files):
         self.assertEqual(names.get_first_name(gender='male'), "Male")
         self.assertEqual(names.get_first_name(gender='female'), "Female")
         self.assertEqual(names.get_last_name(), "Last")
         # Test with cached responses
         self.assertEqual(names.get_first_name(gender='male',
                                               cached=True), "Male")
         self.assertEqual(names.get_first_name(gender='female',
                                               cached=True), "Female")
         self.assertEqual(names.get_last_name(True), "Last")
开发者ID:juiceinc,项目名称:names,代码行数:11,代码来源:test_names.py


示例7: generate_user

def generate_user(organization, session, **kwargs):
    first_name = names.get_first_name()
    user = create_user(
        organization_id=organization.id,
        first_name=names.get_first_name(),
        last_name=names.get_last_name(),
        email='{}+{}@company.com'.format(first_name, uuid.uuid4()),
        session=session,
        **kwargs
    )
    return user
开发者ID:barakalon,项目名称:marco-polo,代码行数:11,代码来源:models.py


示例8: insert_random_seller

    def insert_random_seller(self, repeat=qsellers):
        ''' Inserir registros com valores randomicos '''

        seller_list = []
        for _ in range(repeat):
            d = gen_timestamp(2014, 2015) + '+00'
            fname = names.get_first_name()
            lname = names.get_last_name()
            email = fname[0].lower() + '.' + lname.lower() + '@example.com'
            birthday = gen_timestamp() + '+00'
            active = rstr.rstr('01', 1)
            internal = rstr.rstr('01', 1)
            commissioned = rstr.rstr('01', 1)
            commission = 0.01
            seller_list.append(
                (gen_cpf(), fname, lname, email, gen_phone(), birthday, active, internal, commissioned, commission, d, d))
        try:
            self.db.cursor.executemany("""
            INSERT INTO vendas_seller (cpf, firstname, lastname, email, phone, birthday, active, internal, commissioned, commission, created, modified)
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
            """, seller_list)
            self.db.commit_db()
            print("Inserindo %s registros na tabela vendas_seller." % repeat)
            print("Registros criados com sucesso.")
        except sqlite3.IntegrityError:
            print("Aviso: O email deve ser único.")
            return False
开发者ID:leandroguedesdasilva,项目名称:vendas,代码行数:27,代码来源:manager_db.py


示例9: inserir_randomico

 def inserir_randomico(self, repeat=10):
     ''' Inserir registros com valores randomicos names '''
     lista = []
     for _ in range(repeat):
         date = datetime.datetime.now().isoformat(" ")
         fname = names.get_first_name()
         lname = names.get_last_name()
         name = fname + ' ' + lname
         email = fname[0].lower() + '.' + lname.lower() + '@email.com'
         c = gen_city()
         city = c[0]
         uf = c[1]
         lista.append((name, gen_age(), gen_cpf(),
                       email, gen_phone(),
                       city, uf, date))
     try:
         self.db.cursor.executemany("""
         INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
         VALUES (?,?,?,?,?,?,?,?)
         """, lista)
         self.db.commit_db()
         print("Inserindo %s registros na tabela..." % repeat)
         print("Registros criados com sucesso.")
     except sqlite3.IntegrityError:
         print("Aviso: O email deve ser único.")
         return False
开发者ID:RaphaDinelli,项目名称:python-sqlite,代码行数:26,代码来源:manager_db_.py


示例10: gen_admin

 def gen_admin(self):
     b, admin = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Administrator, email=self.random_email(),
                      first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
     admin = admin.get_typed_user()
     admin.hospital = self.random_hospital().first()
     admin.is_pending = False
     admin.save()
开发者ID:sseveiN,项目名称:HealthNet,代码行数:7,代码来源:generate_random.py


示例11: __init__

    def __init__(self):
        # Gender
        self.gender = self.gender()
        self.genderTitle = self.genderTitle()
        self.genderPronoun = self.genderPronoun()
        self.genderPossessive = self.genderPossessive()

        # Basics
        self.firstName = names.get_first_name(self.gender)
        self.lastName = names.get_last_name()
        self.personality = self.personality(self.gender)

        # Appearance
        self.eyecolor = data.pick('appearance.eyes.color')
        self.skincolor = data.pick('appearance.skin.color')
        self.hairtype = data.pick('appearance.hair.type')
        self.haircolor = data.pick('appearance.hair.color')
        self.hairstyle = data.pick('appearance.hair.style.'+self.gender)
        self.height = data.pick('appearance.height')
        self.build = data.pick('appearance.build.'+self.gender)
        
        # Other
        self.minimumAge = 18
        self.previousService = self.previousService()
        self.birthPlace = data.pick('places.birthplaces')
开发者ID:zleach,项目名称:tradewind,代码行数:25,代码来源:people.py


示例12: populate_candidates

def populate_candidates():
    """
    Sends requests to connect to populate our sandbox Connector with 5 random
    candidates.
    """
    for i in range(5):
        last_name = names.get_last_name()
        candidate = {
            'first_name': names.get_first_name(),
            'last_name': last_name,
            'email': '{}{}@example.com'.format(last_name,
                                               choice(range(100)))
        }
        candidate_data = {
            # A random job_id will be fine as we are in a sandbox environment
            'candidate': candidate, 'applications': [{'job_id': '101'}]
        }

        # We can choose to either include a callback header with our
        # request, or to poll until the application is complete. Here
        # we use the callback functionality.
        headers = {
            'content-type': 'application/rolepoint.v2+json',
            'x-rolepoint-callback-url': url_for(
                'application_processed_callback',
                app_id=len(CREATED_CANDIDATES), _external=True
            )
        }

        requests.post(
            CONNECT_URL + '/v1/{}/candidate'.format(CONFIG['connector_id']),
            json=candidate_data, auth=AUTH, headers=headers
        )
        candidate['status'] = 'In Progress'
        CREATED_CANDIDATES.append(candidate)
开发者ID:rolepoint,项目名称:connect-examples,代码行数:35,代码来源:app.py


示例13: Bfunc

def Bfunc():
    global Bnames
    Bnames = ""
    while Bnames == "":
        name = names.get_first_name()
        if name[0] == "B":
            Bnames = name
开发者ID:ojzcroc,项目名称:ThatOneActor,代码行数:7,代码来源:That+one+actor.py


示例14: Cfunc

def Cfunc():
    global Cnames
    Cnames = ""
    while Cnames == "":
        name = names.get_first_name()
        if name[0] == "C":
            Cnames = name
开发者ID:ojzcroc,项目名称:ThatOneActor,代码行数:7,代码来源:That+one+actor.py


示例15: generate_ledger

def generate_ledger(num_nodes, num_transactions, max_amount, min_amount):
    max_num_transactions = num_nodes * (num_nodes - 1)
    if num_transactions is None:
        num_transactions = 10
    elif num_transactions == "max":
        num_transactions = max_num_transactions
    elif int(num_transactions) > max_num_transactions:
        print("num transactions is larger than max num transactions ({})".format(max_num_transactions))
        exit(1)
    num_transactions = int(num_transactions)
    ledger = {}
    while len(ledger) < num_nodes:
        name = names.get_first_name()
        if name in ledger:
            continue
        ledger[name] = dict()
    keys = list(ledger.keys())
    for i in range(num_transactions):
        name_from = None
        name_to = None
        while name_to == name_from or name_to in ledger[name_from]:
            name_from = random.choice(keys)
            name_to = random.choice(keys)
        amount = random.randint(min_amount * 100, max_amount * 100) / 100
        # mark entry in ledger
        ledger[name_from][name_to] = amount
    return ledger
开发者ID:mvanderh,项目名称:resolve_debts,代码行数:27,代码来源:generate_ledger.py


示例16: mk_author_db

def mk_author_db(db_path="author.db", pops=500):
    """ Makes and Author DB and populates it
    :param db_path: the path where the DB is created
    :pops: The amount of entries that will be generated
    """

    conn, cur = get_conn_cur(db_path)

    cur.execute("""CREATE TABLE author (
                    aid INTEGER ,
                    firstname TEXT,
                    lastname TEXT,
                    city TEXT,
                    bid INTEGER)""")

    #Get This working....
    author_list = []
    author_list.extend ( [(0, 'Mathias', 'Jensen', 'Hadsten', 3),
                   (1, 'Mathias', 'Jensen', 'Hadsten', 4),
                   (2, 'Alexander', 'Danger', 'Skanderborg', 0),
                   (3, 'Alexander', 'Danger', 'Skanderborg', 4),
                   (6, 'Alexander', 'Danger', 'Hadsten', 4),
                   (4, 'Arash', 'Kjær', 'Kobenhavn', 1),
                   (5, 'Michael', 'Med K', None, 2)])


    for x in range(ENTRIES_AUTHOR):
        author_list.append((x+6, names.get_first_name(), names.get_last_name(),
                            random.choice(CITIES), x+6))

    cur.executemany("INSERT INTO author VALUES(?, ?, ?, ?, ?)", author_list)

    conn.commit()
    conn.close()
开发者ID:Betaboxguugi,项目名称:P6,代码行数:34,代码来源:setup_inputs_large.py


示例17: create_some_fixtures

def create_some_fixtures(sender, instance, created, **kwargs):
    import names
    import random

    if not created:
        return

    for x in range(5):
        first = names.get_first_name()
        last = names.get_last_name()
        full_name = u'{} {}'.format(first, last)
        email = u'{}@example.com'.format(first.lower().strip())
        Contact.objects.create(user=instance,
                               full_name=full_name,
                               email=email)

        adj = random.choice(['crazy', 'black', 'fancy',
                               'sneaky', 'giant', 'spicy'])
        thing = random.choice(['shoe', 'cat', 'lamp',
                               'car', 'parrot', 'burrito'])
        title = u'{} wants a {} {}'.format(first, adj, thing)
        description = 'This is not a very good description is it?'
        Deal.objects.create(user=instance,
                            title=title,
                            description=description,
                            value=random.random() * 100)
开发者ID:bennbollay,项目名称:resthookdemo,代码行数:26,代码来源:models.py


示例18: gen_nurse

 def gen_nurse(self):
     b, nurse = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Nurse, email=self.random_email(),
                  first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
     nurse = nurse.get_typed_user()
     nurse.hospital = self.random_hospital().first()
     nurse.is_pending = False
     nurse.save()
开发者ID:sseveiN,项目名称:HealthNet,代码行数:7,代码来源:generate_random.py


示例19: gen_doctor

    def gen_doctor(self):
        b, doc = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Doctor, email=self.random_email(),
                         first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)

        doc = doc.get_typed_user()
        doc.hospitals = self.random_hospital(random.randint(1, 10))
        doc.is_pending = False
        doc.save()
开发者ID:sseveiN,项目名称:HealthNet,代码行数:8,代码来源:generate_random.py


示例20: data

def data():
    """Create some fake data in a dataframe"""
    x_size = len(fasta)
    y_size = 10
    numpy.random.seed(0)
    M = numpy.random.randint(0, 1000, (x_size, y_size))
    df = pandas.DataFrame(M, index=[seq.id for seq in fasta], columns=[names.get_first_name() for j in range(y_size)])
    return df
开发者ID:IUEayhu,项目名称:seqenv,代码行数:8,代码来源:generate_abund.py



注:本文中的names.get_first_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python names.get_full_name函数代码示例发布时间:2022-05-27
下一篇:
Python nameof.nameof函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap