fix some pylint detected errors
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 14 Oct 2010 10:15:56 +0200
changeset 6492 47a284c0d012
parent 6491 ee9a10b6620e
child 6493 019ab5eb37ea
fix some pylint detected errors
dataimport.py
utils.py
--- a/dataimport.py	Thu Oct 14 10:15:38 2010 +0200
+++ b/dataimport.py	Thu Oct 14 10:15:56 2010 +0200
@@ -85,7 +85,7 @@
 
 def count_lines(stream_or_filename):
     if isinstance(stream_or_filename, basestring):
-        f = open(filename)
+        f = open(stream_or_filename)
     else:
         f = stream_or_filename
         f.seek(0)
@@ -98,8 +98,8 @@
                   skipfirst=False, withpb=True):
     """same as ucsvreader but a progress bar is displayed as we iter on rows"""
     if isinstance(stream_or_path, basestring):
-        if not osp.exists(filepath):
-            raise Exception("file doesn't exists: %s" % filepath)
+        if not osp.exists(stream_or_path):
+            raise Exception("file doesn't exists: %s" % stream_or_path)
         stream = open(stream_or_path)
     else:
         stream = stream_or_path
@@ -421,7 +421,6 @@
         ObjectStore.__init__(self)
         if session is None:
             sys.exit('please provide a session of run this script with cubicweb-ctl shell and pass cnx as session')
-            session = cnx
         if not hasattr(session, 'set_pool'):
             # connection
             cnx = session
--- a/utils.py	Thu Oct 14 10:15:38 2010 +0200
+++ b/utils.py	Thu Oct 14 10:15:56 2010 +0200
@@ -186,7 +186,7 @@
         return other[:] + ([self._item] * self._size)
     def __eq__(self, other):
         if isinstance(other, RepeatList):
-            return other._size == self.size and other._item == self.item
+            return other._size == self._size and other._item == self._item
         return self[:] == other
     def pop(self, i):
         self._size -= 1