Emulate random.choices for Python < 3.6
This commit is contained in:
parent
fb3bec50f5
commit
faa2b431c6
1 changed files with 4 additions and 1 deletions
|
@ -2,10 +2,13 @@ import os
|
|||
import random
|
||||
import string
|
||||
|
||||
def random_choices(population, k):
|
||||
"""Emulate random.choices for Python < 3.6"""
|
||||
return [random.choice(population) for _ in range(k)]
|
||||
|
||||
class Config:
|
||||
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'
|
||||
TMP_DIR = os.environ.get('TMP_DIR') or '/var/tmp'
|
||||
MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue