本文整理汇总了Python中names.get_full_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_full_name函数的具体用法?Python get_full_name怎么用?Python get_full_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_full_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
def execute(self, *args, **options):
with transaction.atomic():
for ii in range(10):
for jj in ['Projektowanie Webaplikacji', 'Analiza Matematyczna', 'Programowanie Obiektowe']:
models.Course.objects.create(
name = "{} {}".format(jj, ii)
)
for ii in range(100):
models.Room.objects.create(
room_name="Sala {}".format(ii),
number_of_places=random.randint(5, 15)
)
for ii in range(100):
models.Lecturer.objects.create(
name = names.get_full_name()
)
rooms = models.Room.objects.all()
lecturers = models.Lecturer.objects.all()
for year in [2013, 2014, 2015]:
for course in models.Course.objects.all():
for ii in range(3):
date_from = datetime.time(random.randint(8, 18))
models.CourseInstance.objects.create(
course = course,
room = random.choice(rooms),
lecturer = random.choice(lecturers),
time_from=date_from,
time_to = datetime.time(date_from.hour+2),
year=year,
weekday = random.randint(0, 7)
)
for ii in range(1000):
student = models.Student.objects.create(
name = names.get_full_name()
)
for jj in range(3):
student.courses.add(random.choice(models.Course.objects.all()))
student.save()
for s in models.Student.objects.all():
if random.randint(0, 10) != 5:
for c in s.courses.all():
for ii in range(10):
models.Mark.objects.create(
student = s, course=c,
mark = random.randint(2, 5)
)
示例2: stations
def stations(request):
if request.method == 'PUT':
# add a new station
jreq = json.loads(request.raw_post_data)
station = Station(name=jreq['name'])
# set default alert level
station.alertlevel = AlertLevel.objects.order_by("-threshold")[:1].get()
# build the default map
station.wide = 3
station.high = 3
airlock = Module.objects.filter(is_entry=True)[:1].get()
station.save()
cell = StationCell(station=station, x=1, y=1, module=airlock)
cell.save()
# create starting crew
name = names.get_full_name()
person = Person(station=station, stationcell=cell, name=name)
person.save()
# set up the planet
planet = Planet(station=station, cargo=600, credits=10000)
planet.name = "%s %i" % (names.get_last_name(), random.randint(1, 12))
planet.save()
for pa in PlanetAttribute.objects.all():
s = pa.planetattributesetting_set.all().order_by('?')[0]
planet.settings.add(s)
"""
for tg in TradeGood.objects.all():
stg = MarketTradeGood(station=station, tradegood=tg)
stg.quantity = 0
stg.bid = tg.price * 0.99
stg.ask = tg.price * 1.01
stg.save()
ptg = MarketTradeGood(planet=planet, tradegood=tg)
ptg.quantity = 50
ptg.bid = tg.price * 0.99
ptg.ask = tg.price * 1.01
ptg.save()
"""
# set up recruits
for ii in xrange(10):
person = Person(station=station, name=names.get_full_name())
person.save()
# now save
station.save()
# and return
return { "station": station.get_json() }
else:
# return all
objs = {}
for obj in Station.objects.all():
objs[obj.pk] = obj.name
return {"stations": objs}
示例3: testTournamentMultiPlayers
def testTournamentMultiPlayers():
id_round=1
start_time = time.time()
final_players= list()
print "Number of participants [",swiss_trnmnt._participants,"]"
for i in range(swiss_trnmnt._participants):
# register players' name randomly using third-package names
try:
swiss_trnmnt.registerPlayer(names.get_full_name())
except Exception as ex:
swiss_trnmnt.rollback()
if ex.pgcode == '23505': # avoit duplicated player in same tournamnt
swiss_trnmnt.registerPlayer(names.get_full_name())
else:
raise Exception('Unexpected error registering players',str(ex))
swiss_trnmnt.rankingInit()
while id_round <=swiss_trnmnt._total_rounds:
print "Round=[",id_round,"]"
# result of pairings for next match [(id1,name1,id2,name2),...]
swiss= swiss_trnmnt.swissPairings()
print '\n'
print "Next match=",swiss,'\n'
testMatchesRandomly(swiss,id_round) # establish winner of match randomly
id_round +=1
print '--- SWISS TOURNAMENT FINISHED ---\n'
print ' Final Standings'
print ('ID\tNAME\t\tWINS')
print ('---------------------------')
final_stands=swiss_trnmnt.playerStandings()
for i in final_stands:
print i[0],'\t',i[1][:13],'\t',i[2] # it prints ID | NAME | WINS
final_players=swiss_trnmnt.topEightPlayers()
print (''' \nThe final TOP players using opponents-points for tie-break''')
print ('ID\tNAME\t POSITION')
print ('---------------------------')
x=1
for top8 in final_players:
for rows in top8:
print rows[0],'\t',rows[1][:10],'\t',x
x+=1
print '\n---Starting single-elimination tournament---'
while id_round <=swiss_trnmnt._total_rounds+swiss_trnmnt._rounds_single: # round's number for single is 3
print "Round final=[",id_round,"]"
single= swiss_trnmnt.siglePairingElimination()
print "Next match=",single, '\n'
testMatchesRandomly(single,id_round) # establish winner of match randomly
id_round +=1
swiss_trnmnt.setWinnerTournament()
swiss_trnmnt.closeTournament()
print("Total execution --- %s seconds ---" % (time.time() - start_time))
示例4: Person
def Person(self):
#creating random data
person = copy.deepcopy(self.person_data)
#person data
name = names.get_full_name()
person_id = name.replace(" ","")
website = "https://"+person_id+".com"
email = person_id+"@yahoo.com"
person_desc = names.get_full_name()\
+" "+names.get_full_name()
phone = ("("+"".join([str(random.randint(0, 9)) for i in range(3)])\
+")"+"".join([str(random.randint(0, 9)) for i in range(7)])).decode()
person[0]['pedigree']['true_as_of_secs'] \
= int(math.floor(time.time()))
person[0]['dataunit']['person_property']['id']['person_id'] \
= person_id
person[0]['dataunit']['person_property']['property']['website']\
= website
person[1]['pedigree']['true_as_of_secs'] \
= int(math.floor(time.time()))
person[1]['dataunit']['person_property']['id']['person_id'] \
= person_id
person[1]['dataunit']['person_property']['property']['email']\
= email
person[2]['pedigree']['true_as_of_secs'] \
= int(math.floor(time.time()))
person[2]['dataunit']['person_property']['id']['person_id'] \
= person_id
person[2]['dataunit']['person_property']['property']['desc'] \
= person_desc
person[3]['pedigree']['true_as_of_secs'] \
= int(math.floor(time.time()))
person[3]['dataunit']['person_property']['id']['person_id'] \
= person_id
person[3]['dataunit']['person_property']['property']['name'] \
= name
person[4]['pedigree']['true_as_of_secs'] \
= int(math.floor(time.time()))
person[4]['dataunit']['person_property']['id']['person_id'] \
= person_id
person[4]['dataunit']['person_property']['property']['phone'] \
= phone
return person
示例5: __init__
def __init__(self):
''' Initialize a user object '''
self._name = names.get_full_name()
self._state = ""
self._lat = ""
self._long = ""
self._active = False
示例6: __init__
def __init__(self):
self.name = names.get_full_name()
self.rules = []
self.gameScore = 0
self.lastScore = 0
self.scores = []
self.sequence = ''
示例7: sessione_utente
def sessione_utente(server_url, persona=None, utente=None, password=None):
if not (persona or utente):
raise ValueError("sessione_utente deve ricevere almeno una persona "
"o un utente.")
if persona:
try:
utenza = persona.utenza
except:
utenza = crea_utenza(persona=persona, email=email_fittizzia(),
password=names.get_full_name())
elif utente:
utenza = utente
try:
password_da_usare = password or utenza.password_testing
except AttributeError:
raise AttributeError("L'utenza è già esistente, non ne conosco la password.")
sessione = crea_sessione()
sessione.visit("%s/login/" % server_url)
sessione.fill("auth-username", utenza.email)
sessione.fill("auth-password", password_da_usare)
sessione.find_by_xpath('//button[@type="submit"]').first.click()
# Assicurati che il login sia riuscito.
assert sessione.is_text_present(utenza.persona.nome)
return sessione
示例8: log_analytics
def log_analytics(request, event, properties):
try:
import analytics
from ipware.ip import get_ip as get_ip
if settings.DEBUG: return
if not hasattr(settings, "SEGMENT_IO_KEY"):
logger.warning("Cannot send analytics. No Segment IO Key has been set")
return
if "pingdom" in request.META.get("HTTP_USER_AGENT", ""):
logger.warning("Not recording analytics. Ignored pingdom bot")
return
api_key = settings.SEGMENT_IO_KEY
ip = get_ip(request)
name = names.get_full_name()
uid = request.session.get("uid", name)
request.session["uid"] = uid
analytics.init(api_key)
analytics.identify(uid,
{
"$name" : uid,
},
{ "$ip" : ip}
)
analytics.track(uid, event=event, properties=properties)
except Exception, e:
logger.exception("Error handling analytics")
示例9: main
def main():
authors = []
author_set = set()
i = 1
while i <= AUTHOR_COUNT:
author_name = names.get_full_name()
if author_name not in author_set:
authors.append({
'id': i,
'name': author_name
})
author_set.add(author_name)
i += 1
books = []
book_set = set()
i = 1
while i <= BOOK_COUNT:
book_title = generate_book_title()
if book_title not in book_set:
books.append({
'id': i,
'title': book_title,
'authors': get_authors(),
})
book_set.add(book_title)
i += 1
data = {'authors': authors, 'books': books}
print json.dumps(data, indent=1)
示例10: test_create_conflict
def test_create_conflict(self):
name = names.get_full_name()
_, friend = yield from self._create_friend(name=name)
_.close()
_, friend = yield from self._create_friend(name=name)
assert _.status == 409
_.close()
示例11: make_users
def make_users(numb):
"""Generate a list of unique account names and returns the list. """
user_list = []
start = 0
# Keep running the loop until the number of unique names has been
# generated and appended to the list
while start != numb:
user = names.get_full_name()
if user not in user_list:
user_list.append(user)
start = start + 1
account_list = []
xnumb = 0
# Create unique account names and append to the list
for user in user_list:
account = '{0}{1}'.format(user.split(' ')[0].lower()[0:2], user.split(' ')[1].lower())
if account not in account_list:
account_list.append(account)
elif account in account_list:
account_list.append('{0}{1}'.format(account, xnumb))
xnumb = xnumb + 1
return account_list
示例12: __init__
def __init__(self):
self.name = names.get_full_name(gender='male')
self.primary_position = "f"
self.shot_rating = random.randint(6,14)
three_point_shot = random.randint(2,5)
self.three_point_rating = self.shot_rating + three_point_shot
self.shots_per_game = random.randint(7,14)
self.defensive_rebound_rating = random.randint(9,20)
self.offensive_rebound_rating = random.randint(3,13)
self.assist_rating = random.randint(5,20)
self.offense_results.three_point_shot = (1, 38+random.randint(0,17))
self.offense_results.free_throw_shot = (1, random.randint(68,78))
self.defense_results.three_point_shot = (1, random.randint(28,35))
fgf_o_tweak = random.randint(0,8)
fg_o_range = random.randint(6,14)
fg_o_end = 11 + fgf_o_tweak + fg_o_range
assist_range = random.randint(5,10)
assist_end = fg_o_end + 1 + assist_range
to_range = random.randint(0,13)
o_foul_range = random.randint(1,10)
steal_range = random.randint(2,11)
steal_start = 99 - steal_range
to_start = steal_start - 1 - to_range
o_foul_start = to_start - 1 - o_foul_range
miss_range = random.randint(14,26)
miss_start = o_foul_start - 1 - miss_range
if (miss_start-1) < (assist_end+1):
miss_start = assist_end+2
self.offense_results.plays = {"fg_foul_range": (1, 10+fgf_o_tweak), "fg_range": (11+fgf_o_tweak, fg_o_end),
"assist_range": (fg_o_end+1, assist_end), "foul_range": (assist_end+1, miss_start-1),
"miss_range": (miss_start, o_foul_start-1), "block_range": None,
"offensive_foul_range": (o_foul_start, to_start-1), "turnover_range": (to_start, steal_start-1),
"steal_range": (steal_start, 99)}
fg_d_tweak = random.randint(0,8)
foul_d_tweak = random.randint(5,21)
miss_d_range = random.randint(4,36)
miss_d_start = fg_d_tweak + foul_d_tweak + 28
miss_d_end = miss_d_start + miss_d_range
block_range = random.randint(30,36) - miss_d_range
if block_range < 0:
block_range = 0
block_end = miss_d_end + 1 + block_range
to_d_range = random.randint(8,21)
to_d_end = block_end + 1 + to_d_range
#this deals with guys that block a ton of shots
if block_end > 98:
block_end = 98
to_d_end = 99
steal_d_start = 99
elif to_d_end > 98:
to_d_end = 99
steal_d_start = 99
else:
steal_d_start = to_d_end+1
self.defense_results.plays = {"fg_foul_range": None, "fg_range": (1, 23+fg_d_tweak), "assist_range": None,
"foul_range": (28+fg_d_tweak, 28+fg_d_tweak+foul_d_tweak), "miss_range": (miss_d_start, miss_d_end),
"block_range": (miss_d_end+1, block_end), "offensive_foul_range": None,
"turnover_range": (block_end+1, to_d_end), "steal_range": (steal_d_start, 99)}
self.game_stats = GameStats()
示例13: fixture_random
def fixture_random():
code = count(24400)
# patients
p = models.Patient(id=str(code.next()))
# name with accent
p.name = u'John Heyder Oliveira de Medeiros Galv\xe3o'
p.blood_type = random.choice(models.blood_types)
p.type_ = random.choice(models.patient_types)
p.put()
keys = [p.key]
for _ in range(5):
p = models.Patient(id=str(code.next()))
p.name = names.get_full_name()
p.blood_type = random.choice(models.blood_types)
p.type_ = random.choice(models.patient_types)
p.put()
keys.append(p.key)
# transfusions
for _ in range(40):
tr = models.Transfusion(id=str(code.next()))
tr.patient = random.choice(keys)
tr.date = random_date()
tr.local = random.choice(models.valid_locals)
tr.text = random_text()
tr.bags = []
for _ in range(2):
bag = models.BloodBag()
bag.type_ = random.choice(models.blood_types)
bag.content = random.choice(models.blood_contents)
tr.bags.append(bag)
if random.choice((True, False)):
tr.tags = ['naovisitado']
else:
if random.choice((True, False)):
tr.tags.append('rt')
else:
tr.tags.append('semrt')
tr.put()
# users
# admin user
u = models.UserPrefs(id=ADMIN_USERID, name='admin',
email="[email protected]", admin=True, authorized=True)
u.put()
# ordinary user1
u = models.UserPrefs(id=ORDINARY_USERID, name="user",
email="[email protected]", admin=False, authorized=True)
u.put()
# ordinary user1
u = models.UserPrefs(id=ORDINARY_USERID * 2, name="user2",
email="[email protected]", admin=False, authorized=True)
u.put()
示例14: random
def random(cls, parent):
obj = cls()
obj.set_container_key(parent.identity_key())
obj.name = names.get_full_name()
if parent.employees:
obj.id = max([e.id for e in parent.employees]) + 1
else:
obj.id = 0
return obj
示例15: create_new
def create_new():
gender = choice(['male', 'female'])
name = names.get_full_name(gender)
skill = 1
salary = find_salary(skill)
job = choice(['artist', 'writer'])
employer = None
employee_list.append(Employee(name, gender, skill, salary, job, employer, False))
return Employee(name, gender, salary, job, employer, False)