<s> import random <EOL> __version__ = '<STR_LIT>' <EOL> class Seed ( object ) : <EOL> instance = None <EOL> seeders = { } <EOL> fakers = { } <EOL> @ classmethod <EOL> def __new__ ( cls , * args , ** kwargs ) : <EOL> if cls . instance is None : <EOL> cls . instance = super ( Seed , cls ) . __new__ ( * args , ** kwargs ) <EOL> return cls . instance <EOL> def __init__ ( self ) : <EOL> pass <EOL> @ staticmethod <EOL> def codename ( locale = None ) : <EOL> from django . conf import settings <EOL> locale = locale or getattr ( settings , '<STR_LIT>' , None ) <EOL> codename = locale or '<STR_LIT:default>' <EOL> return codename <EOL> @ classmethod <EOL> def faker ( cls , locale = None , codename = None ) : <EOL> code = codename or cls . codename ( locale ) <EOL> if code not in cls . fakers : <EOL> from faker import Faker <EOL> cls . fakers [ code ] = Faker ( locale ) <EOL> cls . fakers [ code ] . seed ( random . randint ( <NUM_LIT:1> , <NUM_LIT> ) ) <EOL> return cls . fakers [ code ] <EOL> @ classmethod <EOL> def seeder ( cls , locale = None ) : <EOL> code = cls . codename ( locale ) <EOL> if code not in cls . seeders : <EOL> faker = cls . fakers . get ( code , None ) or cls . faker ( codename = code ) <EOL> from django_seed import seeder <EOL> cls . seeders [ code ] = seeder . Seeder ( faker ) <EOL> return cls . seeders [ code ] </s>
