Package org.python.indexer.types

Examples of org.python.indexer.types.NClassType


    }

    @Override
    protected void bindNames(Scope s) throws Exception {
        Scope container = s.getScopeSymtab();
        setType(new NClassType(name.id, container));

        // If we already defined this class in this scope, don't redefine it.
        NType existing = container.lookupType(name.id);
        if (existing != null && existing.isClassType()) {
            return;
View Full Code Here


        NameBinder.make(NBinding.Kind.CLASS).bind(container, name, getType());
    }

    @Override
    public NType resolve(Scope s) throws Exception {
        NClassType thisType = getType().asClassType();
        List<NType> baseTypes = new ArrayList<NType>();
        for (NNode base : bases) {
            NType baseType = resolveExpr(base, s);
            if (baseType.isClassType()) {
                thisType.addSuper(baseType);
            }
            baseTypes.add(baseType);
        }

        Builtins builtins = Indexer.idx.builtins;
View Full Code Here

        }
        @Override
        public void initBindings() {
            addNumAttrs("blocksize", "digest_size");

            NClassType sha = newClass("sha", table, Object);
            sha.getTable().update("update", liburl(), newFunc(), METHOD);
            sha.getTable().update("digest", liburl(), newFunc(BaseStr), METHOD);
            sha.getTable().update("hexdigest", liburl(), newFunc(BaseStr), METHOD);
            sha.getTable().update("copy", liburl(), newFunc(sha), METHOD);
            addClass("sha", liburl(), sha);

            update("new", liburl(), newFunc(sha), CONSTRUCTOR);
        }
View Full Code Here

        public SpwdModule() {
            super("spwd");
        }
        @Override
        public void initBindings() {
            NClassType struct_spwd = newClass("struct_spwd", table, Object);
            for (String s : list("sp_nam", "sp_pwd", "sp_lstchg", "sp_min",
                                 "sp_max", "sp_warn", "sp_inact", "sp_expire",
                                 "sp_flag")) {
                struct_spwd.getTable().update(s, liburl(), BaseNum, ATTRIBUTE);
            }
            addAttr("struct_spwd", liburl(), struct_spwd);

            addFunction("getspnam", liburl(), struct_spwd);
            addFunction("getspall", liburl(), newList(struct_spwd));
View Full Code Here

        }
        @Override
        public void initBindings() {
            addClass("error", liburl(), newException("error", table));

            NClassType lock = newClass("lock", table, Object);
            lock.getTable().update("acquire", liburl(), BaseNum, METHOD);
            lock.getTable().update("locked", liburl(), BaseNum, METHOD);
            lock.getTable().update("release", liburl(), None, METHOD);
            addAttr("LockType", liburl(), Type);

            addNoneFuncs("interrupt_main", "exit", "exit_thread");
            addNumFuncs("start_new", "start_new_thread", "get_ident", "stack_size");
View Full Code Here

        public TimeModule() {
            super("time");
        }
        @Override
        public void initBindings() {
            NClassType struct_time = Time_struct_time = newClass("datetime", table, Object);
            addAttr("struct_time", liburl(), struct_time);

            String[] struct_time_attrs = {
                "n_fields", "n_sequence_fields", "n_unnamed_fields",
                "tm_hour", "tm_isdst", "tm_mday", "tm_min",
                "tm_mon", "tm_wday", "tm_yday", "tm_year",
            };
            for (String s : struct_time_attrs) {
                struct_time.getTable().update(s, liburl("struct_time"), BaseNum, ATTRIBUTE);
            }

            addNumAttrs("accept2dyear", "altzone", "daylight", "timezone");

            addAttr("tzname", liburl(), newTuple(BaseStr, BaseStr));
View Full Code Here

        }
        @Override
        public void initBindings() {
            addClass("ZipImportError", liburl(), newException("ZipImportError", table));

            NClassType zipimporter = newClass("zipimporter", table, Object);
            Scope t = zipimporter.getTable();
            t.update("find_module", liburl(), zipimporter, METHOD);
            t.update("get_code", liburl(), unknown(), METHOD)// XXX:  code object
            t.update("get_data", liburl(), unknown(), METHOD);
            t.update("get_source", liburl(), BaseStr, METHOD);
            t.update("is_package", liburl(), BaseNum, METHOD);
View Full Code Here

        public ZlibModule() {
            super("zlib");
        }
        @Override
        public void initBindings() {
            NClassType Compress = newClass("Compress", table, Object);
            for (String s : list("compress", "flush")) {
                Compress.getTable().update(s, newLibUrl("zlib"), BaseStr, METHOD);
            }
            Compress.getTable().update("copy", newLibUrl("zlib"), Compress, METHOD);
            addClass("Compress", liburl(), Compress);

            NClassType Decompress = newClass("Decompress", table, Object);
            for (String s : list("unused_data", "unconsumed_tail")) {
                Decompress.getTable().update(s, newLibUrl("zlib"), BaseStr, ATTRIBUTE);
            }
            for (String s : list("decompress", "flush")) {
                Decompress.getTable().update(s, newLibUrl("zlib"), BaseStr, METHOD);
            }
            Decompress.getTable().update("copy", newLibUrl("zlib"), Decompress, METHOD);
            addClass("Decompress", liburl(), Decompress);

            addFunction("adler32", liburl(), BaseNum);
            addFunction("compress", liburl(), BaseStr);
            addFunction("compressobj", liburl(), Compress);
View Full Code Here

            super("grp");
        }
        @Override
        public void initBindings() {
            Builtins.this.get("struct");
            NClassType struct_group = newClass("struct_group", table, BaseStruct);
            struct_group.getTable().update("gr_name", liburl(), BaseStr, ATTRIBUTE);
            struct_group.getTable().update("gr_passwd", liburl(), BaseStr, ATTRIBUTE);
            struct_group.getTable().update("gr_gid", liburl(), BaseNum, ATTRIBUTE);
            struct_group.getTable().update("gr_mem", liburl(), newList(BaseStr), ATTRIBUTE);

            addClass("struct_group", liburl(), struct_group);

            for (String s : list("getgrgid", "getgrnam")) {
                addFunction(s, liburl(), struct_group);
View Full Code Here

            addNumAttrs("PY_SOURCE", "PY_COMPILED", "C_EXTENSION",
                        "PKG_DIRECTORY", "C_BUILTIN", "PY_FROZEN", "SEARCH_ERROR");

            addNumFuncs("lock_held", "is_builtin", "is_frozen");

            NClassType impNullImporter = newClass("NullImporter", table, Object);
            impNullImporter.getTable().update("find_module", liburl(), newFunc(None), FUNCTION);
            addClass("NullImporter", liburl(), impNullImporter);
        }
View Full Code Here

TOP

Related Classes of org.python.indexer.types.NClassType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.