<s> """<STR_LIT>""" <EOL> from copy import deepcopy <EOL> class BigInteger : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class EmailString : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class HostnameString : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class IP4String : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class IP6String : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class IPString : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class NullOrBoolean : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class PositiveDecimal : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class PositiveInteger : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class PositiveSmallInteger : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class SmallInteger : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Text : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class URL : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class UUID : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Mix ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , value = None , parent = None ) : <EOL> self . __value = value <EOL> self . __parent = parent <EOL> self . __func = None <EOL> def __getattr__ ( self , value ) : <EOL> return Mix ( value , self if self . __value else None ) <EOL> def __call__ ( self , func ) : <EOL> self . __func = func <EOL> return self <EOL> def __and__ ( self , values ) : <EOL> if self . __parent : <EOL> values = self . __parent & values <EOL> if isinstance ( values , dict ) : <EOL> value = values [ self . __value ] <EOL> elif isinstance ( values , _Deffered ) : <EOL> value = getattr ( values . value , self . __value ) <EOL> else : <EOL> value = getattr ( values , self . __value ) <EOL> if self . __func : <EOL> return self . __func ( value ) <EOL> return value <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % ( self . __value , str ( self . __parent or '<STR_LIT>' ) ) <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % str ( self ) <EOL> class ServiceValue ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , scheme = None , * choices , ** params ) : <EOL> self . scheme = scheme <EOL> self . choices = choices <EOL> self . params = params <EOL> @ classmethod <EOL> def __call__ ( cls , * args , ** kwargs ) : <EOL> return cls ( * args , ** kwargs ) <EOL> def gen_value ( self , type_mixer , name , field ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> class Field ( ServiceValue ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , scheme , name , ** params ) : <EOL> self . name = name <EOL> super ( Field , self ) . __init__ ( scheme , ** params ) <EOL> def __deepcopy__ ( self , memo ) : <EOL> return Field ( self . scheme , self . name , ** deepcopy ( self . params ) ) <EOL> def gen_value ( self , type_mixer , name , field ) : <EOL> """<STR_LIT>""" <EOL> return type_mixer . gen_field ( field ) <EOL> class Fake ( ServiceValue ) : <EOL> """<STR_LIT>""" <EOL> def gen_value ( self , type_mixer , name , fake ) : <EOL> """<STR_LIT>""" <EOL> return type_mixer . gen_fake ( name , fake ) <EOL> class Random ( ServiceValue ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , scheme = None , * choices , ** params ) : <EOL> super ( Random , self ) . __init__ ( scheme , * choices , ** params ) <EOL> if scheme is not None : <EOL> self . choices += scheme , <EOL> def gen_value ( self , type_mixer , name , random ) : <EOL> """<STR_LIT>""" <EOL> return type_mixer . gen_random ( name , random ) <EOL> class Select ( Random ) : <EOL> """<STR_LIT>""" <EOL> def gen_value ( self , type_mixer , name , field ) : <EOL> """<STR_LIT>""" <EOL> return type_mixer . gen_select ( name , field ) <EOL> class _Deffered ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , value , scheme = None ) : <EOL> self . value = value <EOL> self . scheme = scheme </s>
