<s> """<STR_LIT>""" <EOL> import inspect <EOL> import collections <EOL> class MetaListConstructor ( type ) : <EOL> """<STR_LIT>""" <EOL> def __getitem__ ( cls , n ) : <EOL> """<STR_LIT>""" <EOL> return lambda * args , ** kwargs : [ cls ( * args , ** kwargs ) for x in range ( n ) ] <EOL> def list ( cls , n ) : <EOL> """<STR_LIT>""" <EOL> return lambda * args , ** kwargs : [ cls ( * args , ** kwargs ) for x in range ( n ) ] <EOL> class MetaCollectArgs ( MetaListConstructor ) : <EOL> """<STR_LIT>""" <EOL> def __call__ ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> argspec = inspect . getargspec ( self . __init__ ) <EOL> argdict = collections . OrderedDict ( ) <EOL> for i , arg_value in enumerate ( args ) : <EOL> key , value = argspec . args [ i + <NUM_LIT:1> ] , arg_value <EOL> argdict [ key ] = value <EOL> for key , value in kwargs . items ( ) : <EOL> argdict [ key ] = value <EOL> if argspec . defaults : <EOL> for i , default_value in enumerate ( reversed ( argspec . defaults ) ) : <EOL> arg_name = argspec . args [ len ( argspec . args ) - i - <NUM_LIT:1> ] <EOL> if arg_name not in argdict : <EOL> argdict [ arg_name ] = default_value <EOL> inst = super ( MetaCollectArgs , self ) . __call__ ( * args , ** kwargs ) <EOL> inst . _args = argdict <EOL> return inst </s>
