Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_country_code():
""" Get a country code.
:return str:
::
print get_country_code() # -> ru
"""
return g.get_choice(COUNTRY_CODES)
def get_city(**kwargs):
""" Get a city.
:return str:
::
print get_city() # -> North Carter
"""
prf, sfx, city = g.get_choice(CITY_PREFIXIES), g.get_choice(CITY_SUFFIXIES), g.get_choice(CITIES) #noqa
return g.get_choice((
city,
"{0} {1}".format(prf, city),
"{0} {1}".format(prf, get_firstname()),
"{0} {1}".format(get_lastname(), sfx),
))
def get_street(**kwargs):
""" Generate street name. """
params = dict(
first_name=get_firstname(),
last_name=get_lastname(),
suffix=g.get_choice(STREET_SUFFIXES),
)
return g.get_choice((
'{first_name} {suffix}'.format(**params),
'{last_name} {suffix}'.format(**params)
))
def get_street(**kwargs):
""" Generate street name. """
params = dict(
first_name=get_firstname(),
last_name=get_lastname(),
suffix=g.get_choice(STREET_SUFFIXES),
)
return g.get_choice((
'{first_name} {suffix}'.format(**params),
'{last_name} {suffix}'.format(**params)
))
def get_short_lorem(length=64, **kwargs):
""" Get a small text (based on lorem ipsum.
:return str:
::
print get_short_lorem() # -> atque rerum et aut reiciendis
"""
lorem = g.get_choice(LOREM_CHOICES)
while True:
choice = g.get_choice(LOREM_CHOICES)
if len(lorem + choice) > length - 1:
return lorem
lorem += ' ' + choice