def getTypeInfo(self): types = {} self.pushAllReferences() for obj in self._id2obj.itervalues(): if '_constructAs' in dir(obj): ctor = obj._constructAs else: cls = obj.__class__ ctor = cls.__module__ + "." + cls.__name__ if ctor not in types: props = { p.name : { 'type' : self._dumpPropertyConstraint(p.type), 'hidden' : p.hidden or p.name[0] == '_', 'collapsed': p.collapsed, } for p in rtti.properties(obj)} castsTo = map(self._dumpPropertyConstraint, rtti.types(obj)) types[ctor] = { "castsTo" : castsTo, "properties" : props, "description" : utils.rst2html(trim(obj.__doc__)) } return types
def getTypeInfo(self): self.pushAllReferences() types = {} usedTypes, constraints = self.getUsedTypes() with utils.rst.Cache(): for obj in self._id2obj.itervalues(): ctor = getCtor(obj) if ctor not in types: props = dict([ (p.name, union({'type': self._dumpPropertyConstraint(p.type)}, ({ 'hidden': True } if p.isHidden else {}), ({ 'collapsed': True } if p.collapsed else {}))) for p in rtti.properties(obj) ]) castsTo = filter(lambda t: t in usedTypes, rtti.types(obj)) for t in castsTo: constraints[t].add(ctor) castsTo = map(self._dumpPropertyConstraint, castsTo) types[ctor] = { "castsTo": sorted(castsTo), "properties": props, "description": utils.rst2html(trim(obj.__doc__)) } for constraint, matching_types in constraints.iteritems(): if self.objectConstraint(constraint): if len(matching_types) == 0: print "No types matching to constraint ", constraint return types, constraints
def getTypeInfo(self): self.pushAllReferences() types = {} usedTypes, constraints = self.getUsedTypes() with utils.rst.Cache(): for obj in self._id2obj.itervalues(): ctor = getCtor(obj) if ctor not in types: props = dict([( p.name, union({'type' : self._dumpPropertyConstraint(p.type) }, ({'hidden' : True} if p.isHidden else {}), ({'collapsed' : True} if p.collapsed else {}))) for p in rtti.properties(obj)]) castsTo = filter(lambda t: t in usedTypes, rtti.types(obj)) for t in castsTo: constraints[t].add(ctor) castsTo = map(self._dumpPropertyConstraint, castsTo) types[ctor] = { "castsTo" : sorted(castsTo), "properties" : props, "description" : utils.rst2html(trim(obj.__doc__)) } for constraint, matching_types in constraints.iteritems(): if self.objectConstraint(constraint): if len(matching_types) == 0: print "No types matching to constraint ", constraint return types, constraints