Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lambda: zipcodes.is_real("06905"),
lambda: zipcodes._contains_nondigits("1234a"),
lambda: zipcodes.is_real("91239"),
# digits and "-" are acceptable
def _get_zipcode(cls, zipcode: str) -> int:
try:
if is_real(zipcode):
return int(zipcode)
except TypeError:
pass
return cls._random_zip()
def _random_zip() -> int:
"""
Because what doesn't matter is close food but good food
:return: zip_code
:rtype: str
"""
random_zip = 0
while not is_real(str(random_zip)):
range_start = 10 ** 4
range_end = (10 ** 5) - 1
random_zip = randint(range_start, range_end)
return random_zip