Example #1
0
 def __init__(self, frame, anchor, value):
     from pyntch.basic_types import BoolType
     self.value = value
     ExpressionNode.__init__(self, frame, anchor)
     BoolType.get_object().connect(self.recv)
     self.value.connect(self.recv)
     return
Example #2
0
 def __init__(self, frame, anchor, value):
   from pyntch.basic_types import BoolType
   self.value = value
   ExpressionNode.__init__(self, frame, anchor)
   BoolType.get_object().connect(self.recv)
   self.value.connect(self.recv)
   return
Example #3
0
 def __init__(self, frame, anchor, op, nodes):
   from pyntch.basic_types import BoolType
   self.op = op
   self.nodes = nodes
   ExpressionNode.__init__(self, frame, anchor)
   if op == 'Or' and not [ 1 for node in nodes if isinstance(node, SimpleTypeNode) ]:
     BoolType.get_object().connect(self.recv)
   for node in self.nodes:
     node.connect(self.recv)
   return
Example #4
0
 def __init__(self, frame, anchor, op, left, right):
     from pyntch.basic_types import BoolType
     self.op = op
     self.left = left
     self.right = right
     self.received = set()
     ExpressionNode.__init__(self, frame, anchor)
     BoolType.get_object().connect(self.recv)
     if op not in ('is', 'is not'):
         self.left.connect(self.recv_left)
     return
Example #5
0
 def __init__(self, frame, anchor, op, left, right):
   from pyntch.basic_types import BoolType
   self.op = op
   self.left = left
   self.right = right
   self.received = set()
   ExpressionNode.__init__(self, frame, anchor)
   BoolType.get_object().connect(self.recv)
   if op not in ('is', 'is not'):
     self.left.connect(self.recv_left)
   return
Example #6
0
 def __init__(self, frame, anchor, op, nodes):
     from pyntch.basic_types import BoolType
     self.op = op
     self.nodes = nodes
     ExpressionNode.__init__(self, frame, anchor)
     if op == 'Or' and not [
             1 for node in nodes if isinstance(node, SimpleTypeNode)
     ]:
         BoolType.get_object().connect(self.recv)
     for node in self.nodes:
         node.connect(self.recv)
     return
Example #7
0
 def create_attr(self, frame, anchor, name):
   if name == 'copy':
     setobj = self.get_type().create_copy(frame, anchor, self)
     return BuiltinConstMethod('set.copy', setobj)
   elif name == 'difference':
     setobj = self.get_type().create_copy(frame, anchor, self)
     return BuiltinConstMethod('set.difference', setobj, [[ANY]])
   elif name == 'intersection':
     return SetObject.Intersection('set.intersection', self)
   elif name == 'issubset':
     return BuiltinConstMethod('set.issubset', BoolType.get_object(), [[ANY]])
   elif name == 'issuperset':
     return BuiltinConstMethod('set.issuperset', BoolType.get_object(), [[ANY]])
   elif name == 'symmetric_difference':
     setobj = self.get_type().create_copy(frame, anchor, self)
     return self.SequenceExtender('set.symmetric_difference', setobj, setobj, [ANY])
   elif name == 'union':
     setobj = self.get_type().create_copy(frame, anchor, self)
     return self.SequenceExtender('set.union', setobj, setobj, [ANY])
   raise NodeAttrError(name)
 def create_attr(self, frame, anchor, name):
     if name == 'copy':
         setobj = self.get_type().create_copy(frame, anchor, self)
         return BuiltinConstMethod('set.copy', setobj)
     elif name == 'difference':
         setobj = self.get_type().create_copy(frame, anchor, self)
         return BuiltinConstMethod('set.difference', setobj, [[ANY]])
     elif name == 'intersection':
         return SetObject.Intersection('set.intersection', self)
     elif name == 'issubset':
         return BuiltinConstMethod('set.issubset', BoolType.get_object(),
                                   [[ANY]])
     elif name == 'issuperset':
         return BuiltinConstMethod('set.issuperset', BoolType.get_object(),
                                   [[ANY]])
     elif name == 'symmetric_difference':
         setobj = self.get_type().create_copy(frame, anchor, self)
         return self.SequenceExtender('set.symmetric_difference', setobj,
                                      setobj, [ANY])
     elif name == 'union':
         setobj = self.get_type().create_copy(frame, anchor, self)
         return self.SequenceExtender('set.union', setobj, setobj, [ANY])
     raise NodeAttrError(name)
 def create_attr(self, frame, anchor, name):
     if name == 'clear':
         return BuiltinConstMethod('dict.clear', NoneType.get_object())
     elif name == 'copy':
         dictobj = self.get_type().create_copy(frame, anchor, self)
         return BuiltinConstMethod('dict.copy', dictobj)
     elif name == 'fromkeys':
         return DictType.FromKeys('dict.fromkeys')
     elif name == 'get':
         return DictObject.Get(self, 'dict.get')
     elif name == 'has_key':
         return BuiltinConstMethod('dict.has_key', BoolType.get_object(),
                                   [ANY])
     elif name == 'keys':
         return BuiltinConstMethod('dict.keys',
                                   ListType.create_list(self.key))
     elif name == 'values':
         return BuiltinConstMethod('dict.values',
                                   ListType.create_list(self.value))
     elif name == 'items':
         return BuiltinConstMethod(
             'dict.items',
             ListType.create_list(
                 TupleType.create_tuple([self.key, self.value])))
     elif name == 'iterkeys':
         return BuiltinConstMethod('dict.iterkeys',
                                   IterType.create_iter(self.key))
     elif name == 'itervalues':
         return BuiltinConstMethod('dict.itervalues',
                                   IterType.create_iter(self.value))
     elif name == 'iteritems':
         return BuiltinConstMethod(
             'dict.iteritems',
             IterType.create_iter(
                 TupleType.create_tuple([self.key, self.value])))
     elif name == 'pop':
         return DictObject.Pop(self, 'dict.pop')
     elif name == 'popitem':
         return BuiltinConstMethod(
             'dict.popitem',
             TupleType.create_tuple([self.key, self.value]),
             expts=[ErrorConfig.MaybeElementNotFound()])
     elif name == 'setdefault':
         return DictObject.SetDefault(self, 'dict.setdefault')
     elif name == 'update':
         return DictObject.Update(self, 'dict.update')
     raise NodeAttrError(name)
Example #10
0
 def create_attr(self, frame, anchor, name):
   if name == 'clear':
     return BuiltinConstMethod('dict.clear', NoneType.get_object())
   elif name == 'copy':
     dictobj = self.get_type().create_copy(frame, anchor, self)
     return BuiltinConstMethod('dict.copy', dictobj)
   elif name == 'fromkeys':
     return DictType.FromKeys('dict.fromkeys')
   elif name == 'get':
     return DictObject.Get(self, 'dict.get')
   elif name == 'has_key':
     return BuiltinConstMethod('dict.has_key', BoolType.get_object(), [ANY])
   elif name == 'keys':
     return BuiltinConstMethod('dict.keys',
                                 ListType.create_list(self.key))
   elif name == 'values':
     return BuiltinConstMethod('dict.values',
                                 ListType.create_list(self.value))
   elif name == 'items':
     return BuiltinConstMethod('dict.items',
                                 ListType.create_list(TupleType.create_tuple([self.key, self.value])))
   elif name == 'iterkeys':
     return BuiltinConstMethod('dict.iterkeys',
                                 IterType.create_iter(self.key))
   elif name == 'itervalues':
     return BuiltinConstMethod('dict.itervalues',
                                 IterType.create_iter(self.value))
   elif name == 'iteritems':
     return BuiltinConstMethod('dict.iteritems',
                                 IterType.create_iter(TupleType.create_tuple([self.key, self.value])))
   elif name == 'pop':
     return DictObject.Pop(self, 'dict.pop')
   elif name == 'popitem':
     return BuiltinConstMethod('dict.popitem', TupleType.create_tuple([self.key, self.value]),
                               expts=[ErrorConfig.MaybeElementNotFound()])
   elif name == 'setdefault':
     return DictObject.SetDefault(self, 'dict.setdefault')
   elif name == 'update':
     return DictObject.Update(self, 'dict.update')
   raise NodeAttrError(name)
Example #11
0
 def __init__(self):
   BuiltinConstFunc.__init__(self, 'issubclass', BoolType.get_object(), [TypeType, ANY])
   return
Example #12
0
 def __init__(self):
   BuiltinConstFunc.__init__(self, 'isinstance', BoolType.get_object(), [ANY, ANY])
   return
Example #13
0
 def __init__(self):
   BuiltinConstFunc.__init__(self, 'callable', BoolType.get_object(), [ANY])
   return
Example #14
0
 def __init__(self, name='all'):
   BuiltinConstFunc.__init__(self, name, BoolType.get_object(), [ANY])
   return
Example #15
0
 def __init__(self):
     BuiltinConstFunc.__init__(self, 'issubclass', BoolType.get_object(),
                               [TypeType, ANY])
     return
Example #16
0
 def __init__(self):
     BuiltinConstFunc.__init__(self, 'isinstance', BoolType.get_object(),
                               [ANY, ANY])
     return
Example #17
0
 def __init__(self):
     BuiltinConstFunc.__init__(self, 'callable', BoolType.get_object(),
                               [ANY])
     return
Example #18
0
 def __init__(self, name='all'):
     BuiltinConstFunc.__init__(self, name, BoolType.get_object(), [ANY])
     return