Make sure that non-gpg files are not shown in the search results.
Fix some typos and PEP8 stuff.
This commit is contained in:
parent
26f2fb0190
commit
26d46a725a
@ -6,13 +6,13 @@
|
|||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# gnome-pass-search-providers is distributed in the hope that it will be useful,
|
# gnome-pass-search-provider is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with search-pass. If not, see
|
# along with gnome-pass-search-provider. If not, see
|
||||||
# <http://www.gnu.org/licenses/>.
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Copyright (C) 2017 Jonathan Lestrelin
|
# Copyright (C) 2017 Jonathan Lestrelin
|
||||||
@ -94,12 +94,14 @@ class SearchPassService(dbus.service.Object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
for filename in files:
|
for filename in files:
|
||||||
|
if filename[-4:] != '.gpg':
|
||||||
|
continue
|
||||||
path = path_join(dir_path, filename)[:-4]
|
path = path_join(dir_path, filename)[:-4]
|
||||||
for name in path.split('/'):
|
for name in path.split('/'):
|
||||||
matcher.set_seq1(name)
|
matcher.set_seq1(name)
|
||||||
score = matcher.ratio()
|
score = matcher.ratio()
|
||||||
|
if score >= 0.5 and \
|
||||||
if score >= 0.5 and (path not in matches or score > matches[path]):
|
(path not in matches or score > matches[path]):
|
||||||
matches[path] = score
|
matches[path] = score
|
||||||
|
|
||||||
return sorted(matches, key=matches.__getitem__, reverse=True)
|
return sorted(matches, key=matches.__getitem__, reverse=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user