[refactor] refactor rtag keys generations. stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 22 Jun 2010 13:47:35 +0200
branchstable
changeset 5843 85c4d5334f2c
parent 5842 10efd227648e
child 5844 df7608ecea29
[refactor] refactor rtag keys generations.
rtags.py
--- a/rtags.py	Tue Jun 22 13:47:13 2010 +0200
+++ b/rtags.py	Tue Jun 22 13:47:35 2010 +0200
@@ -82,16 +82,14 @@
         self._tagdefs.clear()
 
     def _get_keys(self, stype, rtype, otype, tagged):
-        keys = [('*', rtype, '*', tagged),
-                ('*', rtype, otype, tagged),
-                (stype, rtype, '*', tagged),
-                (stype, rtype, otype, tagged)]
-        if stype == '*' or otype == '*':
-            keys.remove( ('*', rtype, '*', tagged) )
-            if stype == '*':
-                keys.remove( ('*', rtype, otype, tagged) )
-            if otype == '*':
-                keys.remove( (stype, rtype, '*', tagged) )
+        keys = []
+        if '*' not in (stype, otype):
+            keys.append(('*', rtype, '*', tagged))
+        if '*' != stype:
+            keys.append(('*', rtype, otype, tagged))
+        if '*' != otype:
+            keys.append((stype, rtype, '*', tagged))
+        keys.append((stype, rtype, otype, tagged))
         return keys
 
     def init(self, schema, check=True):