<s> __NULL_OBJECT__ = Object . create ( null ) <EOL> __WEBWORKER__ = False <EOL> __NODEJS__ = False <EOL> __BROWSER__ = False <EOL> if typeof ( process ) != '<STR_LIT>' : <EOL> __NODEJS__ = True <EOL> if typeof ( window ) != '<STR_LIT>' : <EOL> __BROWSER__ = True <EOL> if typeof ( importScripts ) == '<STR_LIT>' : <EOL> __WEBWORKER__ = True <EOL> def __create_array__ ( ) : <EOL> """<STR_LIT>""" <EOL> var ( i , array ) <EOL> array = [ ] <EOL> i = <NUM_LIT:0> <EOL> while i < arguments . length : <EOL> array . push ( arguments [ i ] ) <EOL> i += <NUM_LIT:1> <EOL> return array <EOL> def __get__ ( object , attribute , error_message ) : <EOL> """<STR_LIT>""" <EOL> if object is None : <EOL> if error_message : <EOL> raise AttributeError ( '<STR_LIT>' + error_message ) <EOL> else : <EOL> raise AttributeError ( '<STR_LIT>' + attribute ) <EOL> elif object is undefined : <EOL> if error_message : <EOL> raise AttributeError ( '<STR_LIT>' + error_message ) <EOL> else : <EOL> raise AttributeError ( '<STR_LIT>' + attribute ) <EOL> if attribute == '<STR_LIT>' : <EOL> if object . pythonscript_function or object . is_wrapper : <EOL> return object <EOL> elif object . cached_wrapper : <EOL> return object . cached_wrapper <EOL> elif JS ( "<STR_LIT>" ) : <EOL> def wrapper ( args , kwargs ) : <EOL> var ( i , arg , keys ) <EOL> if args != None : <EOL> i = <NUM_LIT:0> <EOL> while i < args . length : <EOL> arg = args [ i ] <EOL> if arg and typeof ( arg ) == '<STR_LIT:object>' : <EOL> if arg . jsify : <EOL> args [ i ] = arg . jsify ( ) <EOL> i += <NUM_LIT:1> <EOL> if kwargs != None : <EOL> keys = __object_keys__ ( kwargs ) <EOL> if keys . length != <NUM_LIT:0> : <EOL> args . push ( kwargs ) <EOL> i = <NUM_LIT:0> <EOL> while i < keys . length : <EOL> arg = kwargs [ keys [ i ] ] <EOL> if arg and typeof ( arg ) == '<STR_LIT:object>' : <EOL> if arg . jsify : <EOL> kwargs [ keys [ i ] ] = arg . jsify ( ) <EOL> i += <NUM_LIT:1> <EOL> return object . apply ( None , args ) <EOL> wrapper . is_wrapper = True <EOL> object . cached_wrapper = wrapper <EOL> return wrapper <EOL> if Object . hasOwnProperty . call ( object , '<STR_LIT>' ) : <EOL> return object . __getattribute__ ( attribute ) <EOL> var ( attr ) <EOL> attr = object [ attribute ] <EOL> if __NODEJS__ is False and __WEBWORKER__ is False : <EOL> if JS ( "<STR_LIT>" ) : <EOL> if JS ( "<STR_LIT>" ) : <EOL> def wrapper ( args , kwargs ) : return attr . apply ( object , args ) <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> else : <EOL> return attr <EOL> elif JS ( "<STR_LIT>" ) : <EOL> if JS ( "<STR_LIT>" ) : <EOL> def wrapper ( args , kwargs ) : return attr . apply ( object , args ) <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> else : <EOL> return attr <EOL> if attr is not undefined : <EOL> if typeof ( attr ) == '<STR_LIT>' : <EOL> if JS ( "<STR_LIT>" ) : <EOL> if instanceof ( attr . prototype , Object ) and Object . keys ( attr . prototype ) . length > <NUM_LIT:0> : <EOL> return attr <EOL> def wrapper ( args , kwargs ) : <EOL> var ( i , arg , keys ) <EOL> if args != None : <EOL> i = <NUM_LIT:0> <EOL> while i < args . length : <EOL> arg = args [ i ] <EOL> if arg and typeof ( arg ) == '<STR_LIT:object>' : <EOL> if arg . jsify : <EOL> args [ i ] = arg . jsify ( ) <EOL> i += <NUM_LIT:1> <EOL> if kwargs != None : <EOL> keys = __object_keys__ ( kwargs ) <EOL> if keys . length != <NUM_LIT:0> : <EOL> args . push ( kwargs ) <EOL> i = <NUM_LIT:0> <EOL> while i < keys . length : <EOL> arg = kwargs [ keys [ i ] ] <EOL> if arg and typeof ( arg ) == '<STR_LIT:object>' : <EOL> if arg . jsify : <EOL> kwargs [ keys [ i ] ] = arg . jsify ( ) <EOL> i += <NUM_LIT:1> <EOL> return attr . apply ( object , args ) <EOL> wrapper . is_wrapper = True <EOL> wrapper . wrapped = attr <EOL> return wrapper <EOL> elif attr . is_classmethod : <EOL> def method ( ) : <EOL> var ( args ) <EOL> args = Array . prototype . slice . call ( arguments ) <EOL> if ( JS ( '<STR_LIT>' ) and JS ( "<STR_LIT>" ) and args . length == <NUM_LIT:2> ) : <EOL> pass <EOL> else : <EOL> args = [ args , JSObject ( ) ] <EOL> if object . __class__ : <EOL> args [ <NUM_LIT:0> ] . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object . __class__ ) <EOL> else : <EOL> args [ <NUM_LIT:0> ] . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> return attr . apply ( this , args ) <EOL> method . is_wrapper = True <EOL> object [ attribute ] = method <EOL> return method <EOL> else : <EOL> return attr <EOL> else : <EOL> return attr <EOL> var ( __class__ , bases ) <EOL> __class__ = object . __class__ <EOL> if __class__ : <EOL> if attribute in __class__ . __properties__ : <EOL> return __class__ . __properties__ [ attribute ] [ '<STR_LIT>' ] ( [ object ] , JSObject ( ) ) <EOL> if attribute in __class__ . __unbound_methods__ : <EOL> attr = __class__ . __unbound_methods__ [ attribute ] <EOL> if attr . fastdef : <EOL> def method ( args , kwargs ) : <EOL> if arguments and arguments [ <NUM_LIT:0> ] : <EOL> arguments [ <NUM_LIT:0> ] . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> return attr . apply ( this , arguments ) <EOL> else : <EOL> return attr ( [ object ] , { } ) <EOL> else : <EOL> def method ( args , kwargs ) : <EOL> if arguments . length == <NUM_LIT:0> : <EOL> return attr ( [ object ] , __NULL_OBJECT__ ) <EOL> elif instanceof ( args , Array ) and typeof ( kwargs ) is "<STR_LIT:object>" and arguments . length == <NUM_LIT:2> : <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> if kwargs is undefined : <EOL> return attr ( args , __NULL_OBJECT__ ) <EOL> else : <EOL> return attr ( args , kwargs ) <EOL> else : <EOL> args = Array . prototype . slice . call ( arguments ) <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> args = [ args , __NULL_OBJECT__ ] <EOL> return attr . apply ( this , args ) <EOL> method . is_wrapper = True <EOL> object [ attribute ] = method <EOL> return method <EOL> attr = __class__ [ attribute ] <EOL> if attribute in __class__ : <EOL> if JS ( "<STR_LIT>" ) : <EOL> if attr . is_wrapper : <EOL> return attr <EOL> elif attr . fastdef : <EOL> def method ( args , kwargs ) : <EOL> if arguments and arguments [ <NUM_LIT:0> ] : <EOL> arguments [ <NUM_LIT:0> ] . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> return attr . apply ( this , arguments ) <EOL> else : <EOL> return attr ( [ object ] , { } ) <EOL> else : <EOL> def method ( args , kwargs ) : <EOL> if arguments . length == <NUM_LIT:0> : <EOL> return attr ( [ object ] , __NULL_OBJECT__ ) <EOL> elif instanceof ( args , Array ) and typeof ( kwargs ) is "<STR_LIT:object>" and arguments . length == <NUM_LIT:2> : <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> if kwargs is undefined : <EOL> return attr ( args , __NULL_OBJECT__ ) <EOL> else : <EOL> return attr ( args , kwargs ) <EOL> else : <EOL> args = Array . prototype . slice . call ( arguments ) <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> args = [ args , __NULL_OBJECT__ ] <EOL> return attr . apply ( this , args ) <EOL> method . is_wrapper = True <EOL> object [ attribute ] = method <EOL> return method <EOL> else : <EOL> return attr <EOL> bases = __class__ . __bases__ <EOL> for base in bases : <EOL> attr = _get_upstream_attribute ( base , attribute ) <EOL> if attr is not undefined : <EOL> if JS ( "<STR_LIT>" ) : <EOL> if attr . fastdef : <EOL> def method ( args , kwargs ) : <EOL> if arguments and arguments [ <NUM_LIT:0> ] : <EOL> arguments [ <NUM_LIT:0> ] . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> return attr . apply ( this , arguments ) <EOL> else : <EOL> return attr ( [ object ] , { } ) <EOL> else : <EOL> def method ( args , kwargs ) : <EOL> if arguments . length == <NUM_LIT:0> : <EOL> return attr ( [ object ] , __NULL_OBJECT__ ) <EOL> elif instanceof ( args , Array ) and typeof ( kwargs ) is "<STR_LIT:object>" and arguments . length == <NUM_LIT:2> : <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> if kwargs is undefined : <EOL> return attr ( args , __NULL_OBJECT__ ) <EOL> else : <EOL> return attr ( args , kwargs ) <EOL> else : <EOL> args = Array . prototype . slice . call ( arguments ) <EOL> args . splice ( <NUM_LIT:0> , <NUM_LIT:0> , object ) <EOL> args = [ args , __NULL_OBJECT__ ] <EOL> return attr . apply ( this , args ) <EOL> method . is_wrapper = True <EOL> object [ attribute ] = method <EOL> return method <EOL> else : <EOL> return attr <EOL> for base in bases : <EOL> var ( prop ) <EOL> prop = _get_upstream_property ( base , attribute ) <EOL> if prop is not undefined : <EOL> return prop [ '<STR_LIT>' ] ( [ object ] , JSObject ( ) ) <EOL> if '<STR_LIT>' in __class__ : <EOL> return __class__ [ '<STR_LIT>' ] ( [ object , attribute ] , JSObject ( ) ) <EOL> for base in bases : <EOL> var ( f ) <EOL> f = _get_upstream_attribute ( base , '<STR_LIT>' ) <EOL> if f is not undefined : <EOL> return f ( [ object , attribute ] , JSObject ( ) ) <EOL> if attribute == '<STR_LIT>' : <EOL> def wrapper ( args , kwargs ) : <EOL> v = object [ args [ <NUM_LIT:0> ] ] <EOL> if v is undefined : <EOL> raise KeyError ( args [ <NUM_LIT:0> ] ) <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> elif attribute == '<STR_LIT>' : <EOL> def wrapper ( args , kwargs ) : object [ args [ <NUM_LIT:0> ] ] = args [ <NUM_LIT:1> ] <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> if typeof ( object , '<STR_LIT>' ) and object . is_wrapper : <EOL> return object . wrapped [ attribute ] <EOL> if attribute == '<STR_LIT>' and instanceof ( object , Object ) : <EOL> def wrapper ( args , kwargs ) : return new ( __ArrayIterator ( Object . keys ( object ) , <NUM_LIT:0> ) ) <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> if attribute == '<STR_LIT>' and instanceof ( object , Object ) : <EOL> def wrapper ( args , kwargs ) : return ( Object . keys ( object ) ) . indexOf ( args [ <NUM_LIT:0> ] ) != - <NUM_LIT:1> <EOL> wrapper . is_wrapper = True <EOL> return wrapper <EOL> if attr is undefined : <EOL> if error_message : <EOL> raise AttributeError ( error_message ) <EOL> else : <EOL> raise AttributeError ( attribute ) <EOL> else : <EOL> return attr <EOL> def _get_upstream_attribute ( base , attr ) : <EOL> if attr in base : <EOL> return base [ attr ] <EOL> for parent in base . __bases__ : <EOL> return _get_upstream_attribute ( parent , attr ) <EOL> def _get_upstream_property ( base , attr ) : <EOL> if attr in base . __properties__ : <EOL> return base . __properties__ [ attr ] <EOL> for parent in base . __bases__ : <EOL> return _get_upstream_property ( parent , attr ) <EOL> def __set__ ( object , attribute , value ) : <EOL> '''<STR_LIT>''' <EOL> if '<STR_LIT>' in object and object . __class__ . __setters__ . indexOf ( attribute ) != - <NUM_LIT:1> : <EOL> object [ attribute ] = value <EOL> elif '<STR_LIT>' in object : <EOL> object . __setattr__ ( attribute , value ) <EOL> else : <EOL> object [ attribute ] = value <EOL> def __getargs__ ( func_name , signature , args , kwargs ) : <EOL> """<STR_LIT>""" <EOL> if args is None : args = [ ] <EOL> if kwargs is None : kwargs = { } <EOL> out = { } <EOL> if args . length > signature . args . length : <EOL> if signature . vararg : <EOL> pass <EOL> else : <EOL> print '<STR_LIT>' + func_name <EOL> print '<STR_LIT>' , args , '<STR_LIT>' , kwargs , '<STR_LIT>' , signature <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> j = <NUM_LIT:0> <EOL> while j < signature . args . length : <EOL> name = signature . args [ j ] <EOL> if name in kwargs : <EOL> out [ name ] = kwargs [ name ] <EOL> elif j < args . length : <EOL> out [ name ] = args [ j ] <EOL> elif name in signature . kwargs : <EOL> out [ name ] = signature . kwargs [ name ] <EOL> j += <NUM_LIT:1> <EOL> args = args . slice ( j ) <EOL> if signature . vararg : <EOL> out [ signature . vararg ] = args <EOL> if signature . varkwarg : <EOL> out [ signature . varkwarg ] = kwargs <EOL> return out </s>
