[dataimport] remove dead code
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 09 Jul 2014 15:40:50 +0200
changeset 9905 1fa35cc06c69
parent 9904 2205c5e1edc2
child 9906 b2919eca7514
[dataimport] remove dead code The only caller of ObjectStore._put is ObjectStore.create_entity, which RQLObjectStore overrides (and doesn't call up).
dataimport.py
--- a/dataimport.py	Tue Jun 03 12:41:06 2014 +0200
+++ b/dataimport.py	Wed Jul 09 15:40:50 2014 +0200
@@ -556,13 +556,10 @@
         self._rql = None
         self._commit = None
 
-    def _put(self, type, item):
-        self.items.append(item)
-        return len(self.items) - 1
-
     def create_entity(self, etype, **data):
         data = attrdict(data)
-        data['eid'] = eid = self._put(etype, data)
+        data['eid'] = eid = len(self.items)
+        self.items.append(data)
         self.eids[eid] = data
         self.types.setdefault(etype, []).append(eid)
         return data
@@ -654,13 +651,6 @@
         self.types.setdefault(args[0], []).append(entity.eid)
         return entity
 
-    def _put(self, type, item):
-        query = 'INSERT %s X' % type
-        if item:
-            query += ': ' + ', '.join('X %s %%(%s)s' % (k, k)
-                                      for k in item)
-        return self.rql(query, item)[0][0]
-
     def relate(self, eid_from, rtype, eid_to, **kwargs):
         eid_from, rtype, eid_to = super(RQLObjectStore, self).relate(
             eid_from, rtype, eid_to, **kwargs)
@@ -866,9 +856,6 @@
     def nb_inserted_relations(self):
         return self._nb_inserted_relations
 
-    def _put(self, type, item):
-        raise RuntimeError('use create entity')
-
 
 class MetaGenerator(object):
     META_RELATIONS = (META_RTYPES