def checkMember(self, context, name): if "count"==name: return IntegerType.instance elif "keys"==name: return SetType(TextType.instance) elif "values"==name: return ListType(self.itemType) else: return super(DictType, self).checkMember(context, name)
def check(self, context): listType = self.source.check(context) if not isinstance(listType, IterableType): raise SyntaxError("Expecting an iterable type as data source!") itemType = listType.itemType arrow = self.predicate.toArrowExpression() filterType = arrow.checkFilter(context, itemType) if filterType is not BooleanType.instance: raise SyntaxError("Filtering expression must return a boolean!") return ListType(itemType)
def checkMember(self, context, name): if "count" == name: return IntegerType.instance elif "keys" == name: return SetType(TextType.instance) elif "values" == name: return ListType(AnyType.instance) elif name == "text": return TextType.instance else: return AnyType.instance
def __init__(self, itemType, items=None, item=None, mutable=False): from prompto.type.ListType import ListType super(ListValue, self).__init__(ListType(itemType), items, mutable) self.storables = None if item is not None: self.items.append(item)
def checkStaticMember(self, context, name): if "symbols" == name: return ListType(self) else: return super(EnumeratedCategoryType, self).checkMember(context, name)
def check(self, context): if self.itemType is None: self.itemType = inferElementType(context, self.expressions) return ListType(self.itemType)
def check(self, context): from prompto.type.ListType import ListType return ListType(TextType.instance)
def check(self, context, isStart): return ListType(self.itemType)
def checkStaticMember(self, context, name): if name == "symbols": return ListType(self) else: return super(EnumeratedNativeType, self).checkMember(context, name)
def check(self, context): from prompto.type.ListType import ListType return ListType(self.itemType)
def check(self, context): if self.itemType is None: self.itemType = self.inferElementType(context) return ListType(self.itemType)
def check(self, context): named = context.getRegisteredDeclaration(IDeclaration, self.name) if not isinstance(named, IEnumeratedDeclaration): raise SyntaxError(self.name + " is not an enumerated type!") return ListType(named.getType(context))