Module FunctionDef arguments args NameParam NameParam defaults body Expr Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Call NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Str For NameStore NameLoad body AugAssignAdd NameStore NameLoad Expr Call NameLoad Str If UnaryOpNot Call NameLoad NameLoad body If Call NameLoad Str body Expr Call NameLoad orelse Assign NameStore NameLoad TryExcept body Expr Call NameLoad Str handlers ExceptHandler body Pass If UnaryOpNot NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call NameLoad Str AugAssignAdd NameStore Str Assign NameStore SubscriptLoad NameLoad Index Num Expr Call NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Str Expr Call NameLoad Str decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad Str decorator_list NameLoad FunctionDef arguments args defaults body Expr Call NameLoad Str decorator_list
N/A printFunc N/A N/A objs newline N/A N/A N/A N/A JS 
        var s = "";
        for(var i=0; i < @{{objs}}.length; i++) {
            if(s != "") s += " ";
                s += @{{objs}}[i];
        }

        @{{pyv8_print_fn}}(s);
     N/A import_module N/A N/A syspath parent_name module_name dynamic_load async init N/A N/A N/A N/A JS 
    @{{module}} = $pyjs.modules_hash[@{{module_name}}];
    if (typeof @{{module}} == 'function' && @{{module}}.__was_initialized__ == true) {
        return null;
    }
    if (@{{module_name}} == 'sys' || @{{module_name}} == 'pyjslib') {
        @{{module}}();
        return null;
    }
     N/A names N/A N/A module_name split . N/A importName N/A name names N/A N/A importName name N/A N/A JS @{{module}} = $pyjs.modules_hash[@{{importName}}]; N/A N/A N/A isUndefined module N/A N/A N/A JS @{{module}}.__was_initialized__ != true N/A N/A N/A module N/A N/A initialized False N/A N/A N/A N/A JS @{{initialized}} = (@{{module}}.__was_initialized__ != true) N/A N/A N/A N/A N/A N/A initialized N/A N/A module N/A pyv8_import_module parent_name module_name N/A N/A module __was_initialized__ True N/A N/A JS $pyjs.modules_hash[@{{importName}}] = @{{module}} N/A importName . N/A name N/A names N/A 0 N/A N/A JS $pyjs.modules[@{{name}}] = $pyjs.modules_hash[@{{name}}]; N/A None N/A load_module N/A N/A path parent_module module_name dynamic async N/A 1 False N/A N/A N/A N/A JS 
        var cache_file;
        var module = $pyjs.modules_hash[@{{module_name}}];
        if (typeof module == 'function') {
            return true;
        }

        if (!@{{dynamic}}) {
            // There's no way we can load a none dynamic module
            return false;
        }

        if (@{{path}} == null)
        {
            @{{path}} = './';
        }

        var override_name = @{{sys}}.platform + "." + @{{module_name}};
        if (((@{{sys}}.overrides != null) &&
             (@{{sys}}.overrides.has_key(override_name))))
        {
            cache_file =  @{{sys}}.overrides.__getitem__(override_name) ;
        }
        else
        {
            cache_file =  @{{module_name}} ;
        }

        cache_file = (@{{path}} + cache_file + '.cache.js' ) ;

        //alert("cache " + cache_file + " " + module_nameXXX + " " + parent_moduleXXX);

        var onload_fn = '';

        // this one tacks the script onto the end of the DOM
        @{{pyjs_load_script}}(cache_file, onload_fn, @{{async}});

        try {
            var loaded = (typeof $pyjs.modules_hash[@{{module_name}}] == 'function')
        } catch ( e ) {
        }
        if (loaded) {
            return true;
        }
        return false;
     N/A noSourceTracking load_module_wait N/A N/A proceed_fn parent_mod module_list dynamic N/A N/A N/A module_list N/A N/A module_list getArray N/A N/A JS 

    var wait_count = 0;
    //var data = '';
    //var element = $doc.createElement("div");
    //element.innerHTML = '';
    //$doc.body.appendChild(element);
    //function write_dom(txt) {
    //    element.innerHTML += txt;
    //}

    var timeoutperiod = 1;
    if (@{{dynamic}})
        var timeoutperiod = 1;

    var wait = function() {
        wait_count++;
        //write_dom(".");
        var loaded = true;
        for (var i in @{{module_list}}) {
            if (typeof $pyjs.modules_hash[@{{module_list}}[i]] != 'function') {
                loaded = false;
                break;
            }
        }
        if (!loaded) {
            setTimeout(wait, timeoutperiod);
        } else {
            if (@{{proceed_fn}}.importDone)
                @{{proceed_fn}}.importDone(@{{proceed_fn}});
            else
                @{{proceed_fn}}();
            //$doc.body.removeChild(element);
        }
    }
    //write_dom("Loading modules ");
    wait();
 N/A noSourceTracking init N/A N/A N/A N/A N/A N/A JS 
@{{_errorMapping}} = function(err) {
    if (err instanceof(ReferenceError) || err instanceof(TypeError)) {
        var message = ''
        try {
            message = err.message;
        } catch ( e) {
        }
        return @{{AttributeError}}(message);
    }
    return err
}

@{{TryElse}} = function () { };
@{{TryElse}}.prototype = new Error();
@{{TryElse}}.__name__ = 'TryElse';
@{{TryElse}}.message = 'TryElse';

@{{StopIteration}} = function () { };
@{{StopIteration}}.prototype = new Error();
@{{StopIteration}}.__name__ = 'StopIteration';
@{{StopIteration}}.message = 'StopIteration';

@{{String_find}} = function(sub, start, end) {
    var pos=this.indexOf(sub, start);
    if (@{{isUndefined}}(end)) return pos;

    if (pos + sub.length>end) return -1;
    return pos;
}

@{{String_join}} = function(data) {
    var text="";

    if (@{{isArray}}(data)) {
        return data.join(this);
    }
    else if (@{{isIteratable}}(data)) {
        var iter=data.__iter__();
        try {
            text+=iter.next();
            while (true) {
                var item=iter.next();
                text+=this + item;
            }
        }
        catch (e) {
            if (e.__name__ != 'StopIteration') throw e;
        }
    }

    return text;
}

@{{String_isdigit}} = function() {
    return (this.match(/^\d+$/g) != null);
}

@{{String_replace}} = function(old, replace, count) {
    var do_max=false;
    var start=0;
    var new_str="";
    var pos=0;

    if (!@{{isString}}(old)) return this.__replace(old, replace);
    if (!@{{isUndefined}}(count)) do_max=true;

    while (start<this.length) {
        if (do_max && !count--) break;

        pos=this.indexOf(old, start);
        if (pos<0) break;

        new_str+=this.substring(start, pos) + replace;
        start=pos+old.length;
    }
    if (start<this.length) new_str+=this.substring(start);

    return new_str;
}

@{{String_split}} = function(sep, maxsplit) {
    var items=new @{{List}}();
    var do_max=false;
    var subject=this;
    var start=0;
    var pos=0;

    if (@{{isUndefined}}(sep) || @{{isNull}}(sep)) {
        sep=" ";
        subject=subject.strip();
        subject=subject.replace(/\s+/g, sep);
    }
    else if (!@{{isUndefined}}(maxsplit)) do_max=true;

    if (subject.length == 0) {
        return items;
    }

    while (start<subject.length) {
        if (do_max && !maxsplit--) break;

        pos=subject.indexOf(sep, start);
        if (pos<0) break;

        items.append(subject.substring(start, pos));
        start=pos+sep.length;
    }
    if (start<=subject.length) items.append(subject.substring(start));

    return items;
}

@{{String___iter__}} = function() {
    var i = 0;
    var s = this;
    return {
        'next': function() {
            if (i >= s.length) {
                throw @{{StopIteration}};
            }
            return s.substring(i++, i, 1);
        },
        '__iter__': function() {
            return this;
        }
    };
}

@{{String_strip}} = function(chars) {
    return this.lstrip(chars).rstrip(chars);
}

@{{String_lstrip}} = function(chars) {
    if (@{{isUndefined}}(chars)) return this.replace(/^\s+/, "");

    return this.replace(new RegExp("^[" + chars + "]+"), "");
}

@{{String_rstrip}} = function(chars) {
    if (@{{isUndefined}}(chars)) return this.replace(/\s+$/, "");

    return this.replace(new RegExp("[" + chars + "]+$"), "");
}

@{{String_startswith}} = function(prefix, start, end) {
    // FIXME: accept tuples as suffix (since 2.5)
    if (@{{isUndefined}}(start)) start = 0;
    if (@{{isUndefined}}(end)) end = this.length;

    if ((end - start) < prefix.length) return false
    if (this.substr(start, prefix.length) == prefix) return true;
    return false;
}

@{{String_endswith}} = function(suffix, start, end) {
    // FIXME: accept tuples as suffix (since 2.5)
    if (@{{isUndefined}}(start)) start = 0;
    if (@{{isUndefined}}(end)) end = this.length;

    if ((end - start) < suffix.length) return false
    if (this.substr(end - suffix.length, suffix.length) == suffix) return true;
    return false;
}

@{{String_ljust}} = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (@{{TypeError}}("an integer is required"));
    }
    if (@{{isUndefined}}(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (@{{TypeError}}("ljust() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    return this + new Array(width+1 - this.length).join(fillchar);
}

@{{String_rjust}} = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (@{{TypeError}}("an integer is required"));
    }
    if (@{{isUndefined}}(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (@{{TypeError}}("rjust() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    return new Array(width + 1 - this.length).join(fillchar) + this;
}

@{{String_center}} = function(width, fillchar) {
    if (typeof(width) != 'number' ||
        parseInt(width) != width) {
        throw (@{{TypeError}}("an integer is required"));
    }
    if (@{{isUndefined}}(fillchar)) fillchar = ' ';
    if (typeof(fillchar) != 'string' ||
        fillchar.length != 1) {
        throw (@{{TypeError}}("center() argument 2 must be char, not " + typeof(fillchar)));
    }
    if (this.length >= width) return this;
    var padlen = width - this.length;
    var right = Math.ceil(padlen / 2);
    var left = padlen - right;
    return new Array(left+1).join(fillchar) + this + new Array(right+1).join(fillchar);
}

@{{abs}} = Math.abs;

 N/A