Reviewed-by: Simon Schampijer<[email protected]>

On 11/19/2010 10:13 PM, Sascha Silbe wrote:
pylint isn't smart enough to figure out the contents of ParseResult and
gtk.Invisible, so squelch the warning.

Reviewed-by: James Cameron<[email protected]>
CC: Aleksey Lim<[email protected]>
Signed-off-by: Sascha Silbe<[email protected]>

diff --git a/src/jarabe/frame/clipboard.py b/src/jarabe/frame/clipboard.py
index 65872ef..be2b902 100644
--- a/src/jarabe/frame/clipboard.py
+++ b/src/jarabe/frame/clipboard.py
@@ -130,16 +130,17 @@ class Clipboard(gobject.GObject):

      def _copy_file(self, original_uri):
          uri = urlparse.urlparse(original_uri)
-        path_, file_name = os.path.split(uri.path)
+        path = uri.path  # pylint: disable=E1101
+        directory_, file_name = os.path.split(path)

          root, ext = os.path.splitext(file_name)
          if not ext or ext == '.':
-            mime_type = mime.get_for_file(uri.path)
+            mime_type = mime.get_for_file(path)
              ext = '.' + mime.get_primary_extension(mime_type)

          f_, new_file_path = tempfile.mkstemp(ext, root)
          del f_
-        shutil.copyfile(uri.path, new_file_path)
+        shutil.copyfile(path, new_file_path)
          os.chmod(new_file_path, 0644)

          return 'file://' + new_file_path
diff --git a/src/jarabe/frame/clipboardmenu.py 
b/src/jarabe/frame/clipboardmenu.py
index 03c953b..d11538d 100644
--- a/src/jarabe/frame/clipboardmenu.py
+++ b/src/jarabe/frame/clipboardmenu.py
@@ -213,7 +213,8 @@ class ClipboardMenu(Palette):
          if most_significant_mime_type == 'text/uri-list':
              uris = mime.split_uri_list(format_.get_data())
              if len(uris) == 1 and uris[0].startswith('file://'):
-                file_path = urlparse.urlparse(uris[0]).path
+                parsed_url = urlparse.urlparse(uris[0])
+                file_path = parsed_url.path  # pylint: disable=E1101
                  transfer_ownership = False
                  mime_type = mime.get_for_file(file_path)
              else:
@@ -222,7 +223,8 @@ class ClipboardMenu(Palette):
                  mime_type = 'text/uri-list'
          else:
              if format_.is_on_disk():
-                file_path = urlparse.urlparse(format_.get_data()).path
+                parsed_url = urlparse.urlparse(format_.get_data())
+                file_path = parsed_url.path  # pylint: disable=E1101
                  transfer_ownership = False
                  mime_type = mime.get_for_file(file_path)
              else:
diff --git a/src/jarabe/frame/clipboardobject.py 
b/src/jarabe/frame/clipboardobject.py
index 90f64e7..407af2f 100644
--- a/src/jarabe/frame/clipboardobject.py
+++ b/src/jarabe/frame/clipboardobject.py
@@ -106,11 +106,13 @@ class ClipboardObject(object):
          if format_ == 'text/uri-list':
              data = self._formats['text/uri-list'].get_data()
              uri = urlparse.urlparse(mime.split_uri_list(data)[0], 'file')
-            if uri.scheme == 'file':
-                if os.path.exists(uri.path):
-                    format_ = mime.get_for_file(uri.path)
+            scheme = uri.scheme  # pylint: disable=E1101
+            if scheme == 'file':
+                path = uri.path  # pylint: disable=E1101
+                if os.path.exists(path):
+                    format_ = mime.get_for_file(path)
                  else:
-                    format_ = mime.get_from_file_name(uri.path)
+                    format_ = mime.get_from_file_name(path)
                  logging.debug('Chose %r!', format_)

          return format_
@@ -128,8 +130,9 @@ class Format(object):
      def destroy(self):
          if self._on_disk:
              uri = urlparse.urlparse(self._data)
-            if os.path.isfile(uri.path):
-                os.remove(uri.path)
+            path = uri.path  # pylint: disable=E1101
+            if os.path.isfile(path):
+                os.remove(path)

      def get_type(self):
          return self._type
diff --git a/src/jarabe/frame/eventarea.py b/src/jarabe/frame/eventarea.py
index b9bb60b..1b5bf86 100644
--- a/src/jarabe/frame/eventarea.py
+++ b/src/jarabe/frame/eventarea.py
@@ -95,6 +95,7 @@ class EventArea(gobject.GObject):
          invisible.connect('drag_leave', self._drag_leave_cb)

          invisible.realize()
+        # pylint: disable=E1101
          invisible.window.set_events(gtk.gdk.POINTER_MOTION_MASK |
                                      gtk.gdk.ENTER_NOTIFY_MASK |
                                      gtk.gdk.LEAVE_NOTIFY_MASK)

_______________________________________________
Sugar-devel mailing list
[email protected]
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to