本文整理汇总了Python中names.get_last_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_last_name函数的具体用法?Python get_last_name怎么用?Python get_last_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_last_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: 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
示例3: 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
示例4: 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
示例5: crea_sede
def crea_sede(presidente=None, estensione=LOCALE, genitore=None,
locazione=None):
ESTENSIONE_DICT = dict(ESTENSIONE)
locazione = locazione or crea_locazione()
s = Sede(
nome="Com. " + ESTENSIONE_DICT[estensione] + " " + names.get_last_name(),
tipo=Sede.COMITATO,
estensione=estensione,
genitore=genitore,
telefono='+3902020202',
email='[email protected]',
codice_fiscale='01234567891',
partita_iva='01234567891',
locazione=locazione
)
s.save()
if presidente is not None:
d = Delega(
inizio="1980-12-10",
persona=presidente,
tipo=PRESIDENTE,
oggetto=s
)
d.save()
return s
开发者ID:AlfioEmanueleFresta,项目名称:jorvik,代码行数:25,代码来源:utils_tests.py
示例6: 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
示例7: 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
示例8: __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
示例9: __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
示例10: 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
示例11: 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(), "")
# Test with cached responses
self.assertEqual(names.get_first_name(gender='male',
cached=True), "")
self.assertEqual(names.get_first_name(gender='female',
cached=True), "")
self.assertEqual(names.get_last_name(True), "")
开发者ID:juiceinc,项目名称:names,代码行数:16,代码来源:test_names.py
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: fill_persons
def fill_persons(cur):
# 100 random persons...
for i in range(0,100):
# Creates Person with random first and last name. Also other random functions are inserted.
person = ( names.get_first_name(), names.get_last_name(),' ',random.randint(60000 , 999999), "functie", 0)
# Inserts record in the table.
cur.execute('''INSERT INTO Persons
VALUES(NULL,?,?,?,?,?,?);''', person)
开发者ID:MartenButter,项目名称:Miniproject,代码行数:9,代码来源:filldatabase.py
示例17: crea_persona
def crea_persona():
p = Persona(
nome=names.get_first_name(),
cognome=names.get_last_name(),
codice_fiscale=codice_fiscale(),
data_nascita="1994-2-5"
)
p.save()
return p
开发者ID:ico88,项目名称:jorvik,代码行数:9,代码来源:utils_tests.py
示例18: randomPlayer
def randomPlayer():
p = Player(None, names.get_first_name(gender='male'), names.get_last_name())
p.rate1B = random.gauss(0.154, 0.051)
p.rate2B = random.gauss(0.044, 0.015)
p.rate3B = random.gauss(0.004, 0.001)
p.rateHR = random.gauss(0.025, 0.008)
p.rateBB = random.gauss(0.079, 0.026)
p.rateHBP = random.gauss(0.008, 0.003)
return p
开发者ID:mrketchup,项目名称:playball,代码行数:9,代码来源:main.py
示例19: crea_persona
def crea_persona():
p = Persona.objects.create(
nome=names.get_first_name(),
cognome=names.get_last_name(),
codice_fiscale=codice_fiscale(),
data_nascita="{}-{}-{}".format(random.randint(1960, 1990), random.randint(1, 12), random.randint(1, 28))
)
p.refresh_from_db()
return p
开发者ID:valentino831,项目名称:jorvik,代码行数:9,代码来源:utils_tests.py
示例20: _create_customers
def _create_customers(self):
print "Adding {0} customers ".format(self.num_customers),
for _ in xrange(self.num_customers):
name = gen_names.get_first_name()
surname = gen_names.get_last_name()
user = Customer(first_name=name, last_name=surname, email=name+"@"+surname+".com")
user.save()
sys.stdout.write('.')
print "OK"
开发者ID:Akrog,项目名称:yoyo_test,代码行数:10,代码来源:populate_db.py
注:本文中的names.get_last_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论