From de7611208a1f0e813634f048c5df963e65e56a93 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Sat, 16 Oct 2010 20:11:32 +0000 Subject: ignore incorrect pylint error E1101 pylint isn't smart enough to figure out the contents of ParseResult and gtk.Invisible, so squelch the warning. --- 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 1b06d74..b505829 100644 --- a/src/jarabe/frame/eventarea.py +++ b/src/jarabe/frame/eventarea.py @@ -95,9 +95,9 @@ 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) + gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) invisible.window.move_resize(x, y, width, height) return invisible -- cgit v0.9.1