Examples of NClassType


Examples of org.python.indexer.types.NClassType

        protected NUrl liburl(String anchor) {
            return newLibUrl("stringio", anchor);
        }
        @Override
        public void initBindings() {
            NClassType StringIO = newClass("StringIO", table, BaseFile);
            addFunction("StringIO", liburl(), StringIO);
            addAttr("InputType", liburl(), Type);
            addAttr("OutputType", liburl(), Type);
            addAttr("cStringIO_CAPI", liburl(), unknown());
        }
View Full Code Here

Examples of org.python.indexer.types.NClassType

        private NUrl dequeUrl() {
            return liburl("deque-objects");
        }
        @Override
        public void initBindings() {
            NClassType Callable = newClass("Callable", table, Object);
            Callable.getTable().update("__call__", abcUrl(), newFunc(), METHOD);
            addClass("Callable", abcUrl(), Callable);

            NClassType Iterable = newClass("Iterable", table, Object);
            Iterable.getTable().update("__next__", abcUrl(), newFunc(), METHOD);
            Iterable.getTable().update("__iter__", abcUrl(), newFunc(), METHOD);
            addClass("Iterable", abcUrl(), Iterable);

            NClassType Hashable = newClass("Hashable", table, Object);
            Hashable.getTable().update("__hash__", abcUrl(), newFunc(BaseNum), METHOD);
            addClass("Hashable", abcUrl(), Hashable);

            NClassType Sized = newClass("Sized", table, Object);
            Sized.getTable().update("__len__", abcUrl(), newFunc(BaseNum), METHOD);
            addClass("Sized", abcUrl(), Sized);

            NClassType Container = newClass("Container", table, Object);
            Container.getTable().update("__contains__", abcUrl(), newFunc(BaseNum), METHOD);
            addClass("Container", abcUrl(), Container);

            NClassType Iterator = newClass("Iterator", table, Iterable);
            addClass("Iterator", abcUrl(), Iterator);

            NClassType Sequence = newClass("Sequence", table, Sized, Iterable, Container);
            Sequence.getTable().update("__getitem__", abcUrl(), newFunc(), METHOD);
            Sequence.getTable().update("reversed", abcUrl(), newFunc(Sequence), METHOD);
            Sequence.getTable().update("index", abcUrl(), newFunc(BaseNum), METHOD);
            Sequence.getTable().update("count", abcUrl(), newFunc(BaseNum), METHOD);
            addClass("Sequence", abcUrl(), Sequence);

            NClassType MutableSequence = newClass("MutableSequence", table, Sequence);
            MutableSequence.getTable().update("__setitem__", abcUrl(), newFunc(), METHOD);
            MutableSequence.getTable().update("__delitem__", abcUrl(), newFunc(), METHOD);
            addClass("MutableSequence", abcUrl(), MutableSequence);

            NClassType Set = newClass("Set", table, Sized, Iterable, Container);
            Set.getTable().update("__getitem__", abcUrl(), newFunc(), METHOD);
            addClass("Set", abcUrl(), Set);

            NClassType MutableSet = newClass("MutableSet", table, Set);
            MutableSet.getTable().update("add", abcUrl(), newFunc(), METHOD);
            MutableSet.getTable().update("discard", abcUrl(), newFunc(), METHOD);
            addClass("MutableSet", abcUrl(), MutableSet);

            NClassType Mapping = newClass("Mapping", table, Sized, Iterable, Container);
            Mapping.getTable().update("__getitem__", abcUrl(), newFunc(), METHOD);
            addClass("Mapping", abcUrl(), Mapping);

            NClassType MutableMapping = newClass("MutableMapping", table, Mapping);
            MutableMapping.getTable().update("__setitem__", abcUrl(), newFunc(), METHOD);
            MutableMapping.getTable().update("__delitem__", abcUrl(), newFunc(), METHOD);
            addClass("MutableMapping", abcUrl(), MutableMapping);

            NClassType MappingView = newClass("MappingView", table, Sized);
            addClass("MappingView", abcUrl(), MappingView);

            NClassType KeysView = newClass("KeysView", table, Sized);
            addClass("KeysView", abcUrl(), KeysView);

            NClassType ItemsView = newClass("ItemsView", table, Sized);
            addClass("ItemsView", abcUrl(), ItemsView);

            NClassType ValuesView = newClass("ValuesView", table, Sized);
            addClass("ValuesView", abcUrl(), ValuesView);

            NClassType deque = newClass("deque", table, Object);
            for (String n : list("append", "appendLeft", "clear",
                                 "extend", "extendLeft", "rotate")) {
                deque.getTable().update(n, dequeUrl(), newFunc(None), METHOD);
            }
            for (String u : list("__getitem__", "__iter__",
                                 "pop", "popleft", "remove")) {
                deque.getTable().update(u, dequeUrl(), newFunc(), METHOD);
            }
            addClass("deque", dequeUrl(), deque);

            NClassType defaultdict = newClass("defaultdict", table, Object);
            defaultdict.getTable().update("__missing__", liburl("defaultdict-objects"),
                                          newFunc(), METHOD);
            defaultdict.getTable().update("default_factory", liburl("defaultdict-objects"),
                                          newFunc(), METHOD);
            addClass("defaultdict", liburl("defaultdict-objects"), defaultdict);

            String argh = "namedtuple-factory-function-for-tuples-with-named-fields";
            NClassType namedtuple = newClass("(namedtuple)", table, BaseTuple);
            namedtuple.getTable().update("_fields", liburl(argh),
                                         new NListType(BaseStr), ATTRIBUTE);
            addFunction("namedtuple", liburl(argh), namedtuple);
        }
View Full Code Here

Examples of org.python.indexer.types.NClassType

            // XXX:  make datetime, time, date, timedelta and tzinfo Base* objects,
            // so built-in functions can return them.

            addNumAttrs("MINYEAR", "MAXYEAR");

            NClassType timedelta = Datetime_timedelta = newClass("timedelta", table, Object);
            addClass("timedelta", dtUrl("timedelta"), timedelta);
            Scope tdtable = Datetime_timedelta.getTable();
            tdtable.update("min", dtUrl("timedelta"), timedelta, ATTRIBUTE);
            tdtable.update("max", dtUrl("timedelta"), timedelta, ATTRIBUTE);
            tdtable.update("resolution", dtUrl("timedelta"), timedelta, ATTRIBUTE);

            tdtable.update("days", dtUrl("timedelta"), BaseNum, ATTRIBUTE);
            tdtable.update("seconds", dtUrl("timedelta"), BaseNum, ATTRIBUTE);
            tdtable.update("microseconds", dtUrl("timedelta"), BaseNum, ATTRIBUTE);

            NClassType tzinfo = Datetime_tzinfo = newClass("tzinfo", table, Object);
            addClass("tzinfo", dtUrl("tzinfo"), tzinfo);
            Scope tztable = Datetime_tzinfo.getTable();
            tztable.update("utcoffset", dtUrl("tzinfo"), newFunc(timedelta), METHOD);
            tztable.update("dst", dtUrl("tzinfo"), newFunc(timedelta), METHOD);
            tztable.update("tzname", dtUrl("tzinfo"), newFunc(BaseStr), METHOD);
            tztable.update("fromutc", dtUrl("tzinfo"), newFunc(tzinfo), METHOD);

            NClassType date = Datetime_date = newClass("date", table, Object);
            addClass("date", dtUrl("date"), date);
            Scope dtable = Datetime_date.getTable();
            dtable.update("min", dtUrl("date"), date, ATTRIBUTE);
            dtable.update("max", dtUrl("date"), date, ATTRIBUTE);
            dtable.update("resolution", dtUrl("date"), timedelta, ATTRIBUTE);

            dtable.update("today", dtUrl("date"), newFunc(date), METHOD);
            dtable.update("fromtimestamp", dtUrl("date"), newFunc(date), METHOD);
            dtable.update("fromordinal", dtUrl("date"), newFunc(date), METHOD);

            dtable.update("year", dtUrl("date"), BaseNum, ATTRIBUTE);
            dtable.update("month", dtUrl("date"), BaseNum, ATTRIBUTE);
            dtable.update("day", dtUrl("date"), BaseNum, ATTRIBUTE);

            dtable.update("replace", dtUrl("date"), newFunc(date), METHOD);
            dtable.update("timetuple", dtUrl("date"), newFunc(Time_struct_time), METHOD);

            for (String n : list("toordinal", "weekday", "isoweekday")) {
                dtable.update(n, dtUrl("date"), newFunc(BaseNum), METHOD);
            }
            for (String r : list("ctime", "strftime", "isoformat")) {
                dtable.update(r, dtUrl("date"), newFunc(BaseStr), METHOD);
            }
            dtable.update("isocalendar", dtUrl("date"),
                          newFunc(newTuple(BaseNum, BaseNum, BaseNum)), METHOD);

            NClassType time = Datetime_time = newClass("time", table, Object);
            addClass("time", dtUrl("time"), date);
            Scope ttable = Datetime_time.getTable();

            ttable.update("min", dtUrl("time"), time, ATTRIBUTE);
            ttable.update("max", dtUrl("time"), time, ATTRIBUTE);
            ttable.update("resolution", dtUrl("time"), timedelta, ATTRIBUTE);

            ttable.update("hour", dtUrl("time"), BaseNum, ATTRIBUTE);
            ttable.update("minute", dtUrl("time"), BaseNum, ATTRIBUTE);
            ttable.update("second", dtUrl("time"), BaseNum, ATTRIBUTE);
            ttable.update("microsecond", dtUrl("time"), BaseNum, ATTRIBUTE);
            ttable.update("tzinfo", dtUrl("time"), tzinfo, ATTRIBUTE);

            ttable.update("replace", dtUrl("time"), newFunc(time), METHOD);

            for (String l : list("isoformat", "strftime", "tzname")) {
                ttable.update(l, dtUrl("time"), newFunc(BaseStr), METHOD);
            }
            for (String f : list("utcoffset", "dst")) {
                ttable.update(f, dtUrl("time"), newFunc(timedelta), METHOD);
            }

            NClassType datetime = Datetime_datetime = newClass("datetime", table, date, time);
            addClass("datetime", dtUrl("datetime"), datetime);
            Scope dttable = Datetime_datetime.getTable();

            for (String c : list("combine", "fromordinal", "fromtimestamp", "now",
                                 "strptime", "today", "utcfromtimestamp", "utcnow")) {
View Full Code Here

Examples of org.python.indexer.types.NClassType

        public DbmModule() {
            super("dbm");
        }
        @Override
        public void initBindings() {
            NClassType dbm = new NClassType("dbm", table, BaseDict);
            addClass("dbm", liburl(), dbm);
            addClass("error", liburl(), newException("error", table));
            addStrAttrs("library");
            addFunction("open", liburl(), dbm);
        }
View Full Code Here

Examples of org.python.indexer.types.NClassType

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

            NClassType gdbm = new NClassType("gdbm", table, BaseDict);
            gdbm.getTable().update("firstkey", liburl(), newFunc(BaseStr), METHOD);
            gdbm.getTable().update("nextkey", liburl(), newFunc(BaseStr), METHOD);
            gdbm.getTable().update("reorganize", liburl(), newFunc(None), METHOD);
            gdbm.getTable().update("sync", liburl(), newFunc(None), METHOD);

            addFunction("open", liburl(), gdbm);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.