Emulate random.choices for Python < 3.6

stable
neingeist 6 years ago
parent fb3bec50f5
commit faa2b431c6

@ -2,10 +2,13 @@ import os
import random import random
import string import string
def random_choices(population, k):
"""Emulate random.choices for Python < 3.6"""
return [random.choice(population) for _ in range(k)]
class Config: class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or \ SECRET_KEY = os.environ.get('SECRET_KEY') or \
''.join(random.choices(string.ascii_letters, k=20)) ''.join(random_choices(string.ascii_letters, k=20))
DATA_DIR = os.environ.get('DATA_DIR') or '/var/tmp/prolefeeder-test-data' DATA_DIR = os.environ.get('DATA_DIR') or '/var/tmp/prolefeeder-test-data'
TMP_DIR = os.environ.get('TMP_DIR') or '/var/tmp' TMP_DIR = os.environ.get('TMP_DIR') or '/var/tmp'
MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180 MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180

Loading…
Cancel
Save