1-
2-
3-
4-
5-
1+ // PythonScript Runtime - regenerated on: Sun Oct 20 18:46:57 2013
62var jsrange = function ( num ) {
73"Emulates Python's range function" ;
84var i , r ;
@@ -306,6 +302,19 @@ return attr;
306302base = backup ;
307303}
308304
305+ var iter = bases ;
306+ for ( var base = 0 ; base < iter . length ; base ++ ) {
307+ var backup = base ;
308+ base = iter [ base ] ;
309+ var getter ;
310+ getter = _get_upstream_property ( base , attribute ) ;
311+ if ( getter ) {
312+ return getter ( [ object ] ) ;
313+ }
314+
315+ base = backup ;
316+ }
317+
309318if ( "__getattr__" in __dict__ ) {
310319return __dict__ [ "__getattr__" ] ( [ object , attribute ] ) ;
311320}
@@ -390,6 +399,22 @@ parent = backup;
390399}
391400window [ "_get_upstream_attribute" ] = _get_upstream_attribute
392401
402+ var _get_upstream_property = function ( base , attr ) {
403+ if ( attr in base . __properties__ ) {
404+ return base . __properties__ [ attr ] ;
405+ }
406+
407+ var iter = base . bases ;
408+ for ( var parent = 0 ; parent < iter . length ; parent ++ ) {
409+ var backup = parent ;
410+ parent = iter [ parent ] ;
411+ return _get_upstream_property ( parent , attr ) ;
412+ parent = backup ;
413+ }
414+
415+ }
416+ window [ "_get_upstream_property" ] = _get_upstream_property
417+
393418var set_attribute = function ( object , attribute , value ) {
394419"Set an attribute on an object by updating its __dict__ property" ;
395420var __dict__ , __class__ ;
@@ -635,32 +660,14 @@ key = backup;
635660
636661return output ;
637662}
638- window [ "json_to_pythonscript" ] = json_to_pythonscript
639-
663+ window [ "json_to_pythonscript" ] = json_to_pythonscript
640664_PythonJS_UID = 0 ;
641665var _JSNew = function ( T ) {
642- console . log ( "_JSNew->" , T ) ;
643666return new T ;
644667}
645668window [ "_JSNew" ] = _JSNew
646669
647670_JSNew . pythonscript_function = true ;
648- var _create_empty_object = function ( arr ) {
649- var o ;
650- o = Object . create ( null ) ;
651- var iter = arr ;
652- for ( var i = 0 ; i < iter . length ; i ++ ) {
653- var backup = i ;
654- i = iter [ i ] ;
655- o [ i ] = true ;
656- i = backup ;
657- }
658-
659- return o ;
660- }
661- window [ "_create_empty_object" ] = _create_empty_object
662-
663- _create_empty_object . pythonscript_function = true ;
664671var int = function ( args , kwargs ) {
665672var signature , arguments ;
666673signature = { "kwargs" : Object ( ) , "args" : create_array ( "a" ) } ;
@@ -785,12 +792,12 @@ return this.indexOf( a );
785792String . prototype . index = func ;
786793var func = function ( ) {
787794var digits ;
788- digits = _create_empty_object ( [ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" ] ) ;
795+ digits = [ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" ] ;
789796var iter = this ;
790797for ( var char = 0 ; char < iter . length ; char ++ ) {
791798var backup = char ;
792799char = iter [ char ] ;
793- if ( char in digits || digits [ "__contains__" ] ( char ) ) {
800+ if ( char in digits || Object . hasOwnProperty ( digits , "__contains__" ) && digits [ "__contains__" ] ( char ) ) {
794801/*pass*/
795802}
796803else {
@@ -811,15 +818,16 @@ _setup_str_prototype.pythonscript_function = true;
811818_setup_str_prototype ( create_array ( ) , Object ( ) ) ;
812819var _setup_array_prototype = function ( args , kwargs ) {
813820var func = function ( a ) {
814- var e ;
815- e = _create_empty_object ( this ) ;
816- if ( a in e ) {
821+ var i ;
822+ i = 0 ;
823+ while ( i < this . length ) {
824+ if ( this [ i ] == a ) {
817825return true ;
818826}
819- else {
820- return false ;
821- }
822827
828+ i += 1 ;
829+ }
830+ return false ;
823831}
824832
825833Array . prototype . __contains__ = func ;
@@ -2160,4 +2168,4 @@ window["__array_to_ascii"] = __array_to_ascii
21602168
21612169__array_to_ascii . pythonscript_function = true ;
21622170window [ "__array_attrs" ] [ "to_ascii" ] = __array_to_ascii ;
2163- array = create_class ( "array" , window [ "__array_parents" ] , window [ "__array_attrs" ] , window [ "__array_properties" ] ) ;
2171+ array = create_class ( "array" , window [ "__array_parents" ] , window [ "__array_attrs" ] , window [ "__array_properties" ] ) ;
0 commit comments