summaryrefslogtreecommitdiff
path: root/nautilus
diff options
context:
space:
mode:
authorjvoisin2018-11-08 21:40:33 +0100
committerjvoisin2018-11-08 21:40:33 +0100
commit1d75451b77579441eb894b43ef9b44d9c5382831 (patch)
tree57addec44b25dd4997776c517fe0e5d258cd018e /nautilus
parentdc35ef56c82d73d95f26ed4b1f687a5c007264b2 (diff)
Add some type annotations to the nautilus extension
Diffstat (limited to 'nautilus')
-rw-r--r--nautilus/mat2.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/nautilus/mat2.py b/nautilus/mat2.py
index af49323..0688ef2 100644
--- a/nautilus/mat2.py
+++ b/nautilus/mat2.py
@@ -14,7 +14,7 @@ thread, so we'll have to resort to using a `queue` to pass "messages" around.
14 14
15import queue 15import queue
16import threading 16import threading
17from typing import Tuple 17from typing import Tuple, Optional, List
18from urllib.parse import unquote 18from urllib.parse import unquote
19 19
20import gi 20import gi
@@ -25,10 +25,8 @@ from gi.repository import Nautilus, GObject, Gtk, Gio, GLib, GdkPixbuf
25 25
26from libmat2 import parser_factory 26from libmat2 import parser_factory
27 27
28# make pyflakes happy
29assert Tuple
30 28
31def _remove_metadata(fpath): 29def _remove_metadata(fpath) -> Tuple[bool, Optional[str]]:
32 """ This is a simple wrapper around libmat2, because it's 30 """ This is a simple wrapper around libmat2, because it's
33 easier and cleaner this way. 31 easier and cleaner this way.
34 """ 32 """
@@ -63,7 +61,7 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
63 self.infobar.get_content_area().pack_start(self.infobar_hbox, True, True, 0) 61 self.infobar.get_content_area().pack_start(self.infobar_hbox, True, True, 0)
64 self.infobar.show_all() 62 self.infobar.show_all()
65 63
66 def get_widget(self, uri, window): 64 def get_widget(self, uri, window) -> Gtk.Widget:
67 """ This is the method that we have to implement (because we're 65 """ This is the method that we have to implement (because we're
68 a LocationWidgetProvider) in order to show our infobar. 66 a LocationWidgetProvider) in order to show our infobar.
69 """ 67 """
@@ -228,7 +226,7 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
228 """ https://bugzilla.gnome.org/show_bug.cgi?id=784278 """ 226 """ https://bugzilla.gnome.org/show_bug.cgi?id=784278 """
229 return None 227 return None
230 228
231 def get_file_items(self, window, files): 229 def get_file_items(self, window, files) -> Optional[List[Nautilus.MenuItem]]:
232 """ This method is the one allowing us to create a menu item. 230 """ This method is the one allowing us to create a menu item.
233 """ 231 """
234 # Do not show the menu item if not a single file has a chance to be 232 # Do not show the menu item if not a single file has a chance to be