server/rqlannotation.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1132 96752791c2b6
child 1977 606923dff11b
--- a/server/rqlannotation.py	Thu May 14 10:24:56 2009 +0200
+++ b/server/rqlannotation.py	Thu May 14 11:38:40 2009 +0200
@@ -69,7 +69,7 @@
             # "Any X", "Any X, Y WHERE X attr Y"
             stinfo['invariant'] = False
             continue
-        joins = set()            
+        joins = set()
         invariant = False
         for ref in var.references():
             rel = ref.relation()
@@ -78,7 +78,7 @@
             lhs, rhs = rel.get_parts()
             onlhs = ref is lhs
             if rel.r_type == 'eid':
-                if not (onlhs and len(stinfo['relations']) > 1): 
+                if not (onlhs and len(stinfo['relations']) > 1):
                     break
                 if not stinfo['constnode']:
                     joins.add(rel)
@@ -110,9 +110,9 @@
                 continue
             if not stinfo['constnode']:
                 if rschema.inlined and rel.neged(strict=True):
-                    # if relation is inlined, can't be invariant if that 
+                    # if relation is inlined, can't be invariant if that
                     # variable is used anywhere else.
-                    # see 'Any P WHERE NOT N ecrit_par P, N eid 512':                    
+                    # see 'Any P WHERE NOT N ecrit_par P, N eid 512':
                     # sql for 'NOT N ecrit_par P' is 'N.ecrit_par is NULL' so P
                     # can use N.ecrit_par as principal
                     if (stinfo['selected'] or len(stinfo['relations']) > 1):
@@ -184,7 +184,7 @@
         return iter(_sort(diffscope_rels)).next()
     # XXX  could use a relation for a different scope if it can't generate
     # duplicates, so we would have to check cardinality
-    raise CantSelectPrincipal()    
+    raise CantSelectPrincipal()
 
 def _select_main_var(relations):
     """given a list of rqlst relations, select one which will be used as main
@@ -265,12 +265,12 @@
             return False
         try:
             data = var.stmt._deamb_data
-        except AttributeError: 
+        except AttributeError:
             data = var.stmt._deamb_data = IsAmbData(self.schema, self.nfdomain)
             data.compute(var.stmt)
         return data.is_ambiguous(var)
 
-        
+
 class IsAmbData(object):
     def __init__(self, schema, nfdomain):
         self.schema = schema
@@ -288,7 +288,7 @@
         self.deambification_map = {}
         # not invariant variables (access to final.inlined relation)
         self.not_invariants = set()
-        
+
     def is_ambiguous(self, var):
         return var in self.ambiguousvars
 
@@ -296,7 +296,7 @@
         self.varsols[var] &= restricted_domain
         if var in self.ambiguousvars and self.varsols[var] == var.stinfo['possibletypes']:
             self.ambiguousvars.remove(var)
-    
+
     def compute(self, rqlst):
         # set domains for each variable
         for varname, var in rqlst.defined_vars.iteritems():
@@ -334,7 +334,7 @@
                 except KeyError:
                     # no relation to deambiguify
                     continue
-        
+
     def _debug_print(self):
         print 'varsols', dict((x, sorted(str(v) for v in values))
                                for x, values in self.varsols.iteritems())
@@ -350,7 +350,7 @@
                     self.maydeambrels[var].add(rel)
                 except KeyError:
                     self.maydeambrels[var] = set((rel,))
-        
+
     def deambiguifying_relation(self, var, rel):
         lhs, rhs = rel.get_variable_parts()
         onlhs = var is getattr(lhs, 'variable', None)