Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romain
mat2
Commits
1d75451b
Commit
1d75451b
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Add some type annotations to the nautilus extension
parent
dc35ef56
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-2
1 addition, 2 deletions
.gitlab-ci.yml
nautilus/mat2.py
+4
-6
4 additions, 6 deletions
nautilus/mat2.py
with
5 additions
and
8 deletions
.gitlab-ci.yml
+
1
−
2
View file @
1d75451b
...
...
@@ -35,8 +35,7 @@ mypy:
-
apt-get -qqy update
-
apt-get -qqy install --no-install-recommends python3-pip
-
pip3 install mypy
-
mypy mat2 libmat2/*.py --ignore-missing-imports
-
mypy --ignore-missing-imports ./nautilus/mat2.py
-
mypy --ignore-missing-imports mat2 libmat2/*.py ./nautilus/mat2.py
tests:debian
:
stage
:
test
...
...
This diff is collapsed.
Click to expand it.
nautilus/mat2.py
+
4
−
6
View file @
1d75451b
...
...
@@ -14,7 +14,7 @@ thread, so we'll have to resort to using a `queue` to pass "messages" around.
import
queue
import
threading
from
typing
import
Tuple
from
typing
import
Tuple
,
Optional
,
List
from
urllib.parse
import
unquote
import
gi
...
...
@@ -25,10 +25,8 @@ from gi.repository import Nautilus, GObject, Gtk, Gio, GLib, GdkPixbuf
from
libmat2
import
parser_factory
# make pyflakes happy
assert
Tuple
def
_remove_metadata
(
fpath
):
def
_remove_metadata
(
fpath
)
->
Tuple
[
bool
,
Optional
[
str
]]
:
"""
This is a simple wrapper around libmat2, because it
'
s
easier and cleaner this way.
"""
...
...
@@ -63,7 +61,7 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
self
.
infobar
.
get_content_area
().
pack_start
(
self
.
infobar_hbox
,
True
,
True
,
0
)
self
.
infobar
.
show_all
()
def
get_widget
(
self
,
uri
,
window
):
def
get_widget
(
self
,
uri
,
window
)
->
Gtk
.
Widget
:
"""
This is the method that we have to implement (because we
'
re
a LocationWidgetProvider) in order to show our infobar.
"""
...
...
@@ -228,7 +226,7 @@ class ColumnExtension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationW
"""
https://bugzilla.gnome.org/show_bug.cgi?id=784278
"""
return
None
def
get_file_items
(
self
,
window
,
files
):
def
get_file_items
(
self
,
window
,
files
)
->
Optional
[
List
[
Nautilus
.
MenuItem
]]
:
"""
This method is the one allowing us to create a menu item.
"""
# Do not show the menu item if not a single file has a chance to be
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment