2018-11-12 23:21:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import os
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import random
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import string
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 17:09:42 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 16:05:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def random_choices(population, k):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Emulate random.choices for Python < 3.6"""
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return [random.choice(population) for _ in range(k)]
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 14:48:21 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Config:
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 17:09:42 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    SECRET_KEY = os.environ.get('SECRET_KEY') or \
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-29 16:05:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ''.join(random_choices(string.ascii_letters, k=20))
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-12 19:38:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    DATA_DIR   = os.environ.get('DATA_DIR') or '/var/tmp/prolefeeder-test-data'
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-06 20:19:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    OUT_DIR    = os.environ.get('OUT_DIR') or '/var/tmp/prolefeeder-test-out'
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 14:48:21 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 19:55:57 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    KBITS      = os.environ.get('KBITS') or 128
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-30 18:25:56 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    DEBUG      = False
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-06 20:19:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if not os.path.exists(DATA_DIR):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        raise "DATA_DIR does not exist"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if not os.path.exists(OUT_DIR):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        raise "OUT_DIR does not exist"
							 |