当前位置: 首页>>代码示例>>Python>>正文


Python L.is_tuple_of_names方法代码示例

本文整理汇总了Python中incoq.compiler.incast.L.is_tuple_of_names方法的典型用法代码示例。如果您正苦于以下问题:Python L.is_tuple_of_names方法的具体用法?Python L.is_tuple_of_names怎么用?Python L.is_tuple_of_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在incoq.compiler.incast.L的用法示例。


在下文中一共展示了L.is_tuple_of_names方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: visit_DictLookup

# 需要导入模块: from incoq.compiler.incast import L [as 别名]
# 或者: from incoq.compiler.incast.L import is_tuple_of_names [as 别名]
 def visit_DictLookup(self, node):
     node = self.generic_visit(node)
     
     # Only simple map lookups are allowed.
     assert isinstance(node.value, L.Name)
     assert L.is_tuple_of_names(node.key)
     assert node.default is None
     map = node.value.id
     keyvars = L.detuplify(node.key)
     
     var = self.repls.get(node, None)
     if var is None:
         mask = L.mapmask_from_len(len(keyvars))
         rel = N.SA_name(map, mask)
         
         # Create a fresh variable.
         self.repls[node] = var = next(self.fresh_names)
         
         # Construct a clause to bind it.
         vars = list(keyvars) + [var]
         new_clause = L.SetFromMapMember(vars, rel, map, mask)
         self.new_clauses.append(new_clause)
         
         # Construct a corresponding SetFromMap invariant.
         sfm = SetFromMapInvariant(rel, map, mask)
         self.sfm_invs.add(sfm)
     
     return L.Name(var)
开发者ID:jieaozhu,项目名称:dist_lang_reviews,代码行数:30,代码来源:comp.py

示例2: visit_Member

# 需要导入模块: from incoq.compiler.incast import L [as 别名]
# 或者: from incoq.compiler.incast.L import is_tuple_of_names [as 别名]
 def visit_Member(self, node):
     # For clauses that wrap around another clause, like
     # WithoutMember, reorient the target and iter before recursing.
     handled = False
     
     # <target> in <expr> - {<elem>}
     if (isinstance(node.iter, L.BinOp) and
         isinstance(node.iter.op, L.Sub) and
         isinstance(node.iter.right, L.Set) and
         len(node.iter.right.elts) == 1):
         inner_clause = L.Member(node.target, node.iter.left)
         node = L.WithoutMember(inner_clause, node.iter.right.elts[0])
         handled = True
     
     node = self.generic_visit(node)
     if handled:
         return node
     
     # <vars> in {<elem>}
     if (L.is_tuple_of_names(node.target) and
         isinstance(node.iter, L.Set) and
         len(node.iter.elts) == 1):
         return L.SingMember(L.detuplify(node.target),
                             node.iter.elts[0])
     
     return node
开发者ID:jieaozhu,项目名称:dist_lang_reviews,代码行数:28,代码来源:incast_rewritings.py

示例3: visit_Member

# 需要导入模块: from incoq.compiler.incast import L [as 别名]
# 或者: from incoq.compiler.incast.L import is_tuple_of_names [as 别名]
 def visit_Member(self, node):
     node = self.generic_visit(node)
     
     if (L.is_tuple_of_names(node.target) and
         isinstance(node.iter, L.Query)):
         node = L.VarsMember(L.detuplify(node.target), node.iter)
     
     return node
开发者ID:jieaozhu,项目名称:dist_lang_reviews,代码行数:10,代码来源:misc_rewritings.py

示例4: Tuple_helper

# 需要导入模块: from incoq.compiler.incast import L [as 别名]
# 或者: from incoq.compiler.incast.L import is_tuple_of_names [as 别名]
 def Tuple_helper(self, node):
     if not L.is_tuple_of_names(node):
         raise L.ProgramError('Non-simple tuple expression: {}'
                              .format(node))
     elts = L.detuplify(node)
     
     name = self.tuple_namer(elts)
     clause = L.TUPMember(name, elts)
     self.objrels.TUPs.append(len(elts))
     self.after_clauses.insert(0, clause)
     return name
开发者ID:jieaozhu,项目名称:dist_lang_reviews,代码行数:13,代码来源:comp.py


注:本文中的incoq.compiler.incast.L.is_tuple_of_names方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。