From 07306747c5b338e5a7046d2eb9c790a880dba8dd Mon Sep 17 00:00:00 2001 From: Jonathan Lestrelin Date: Tue, 2 Mar 2021 08:10:55 +0100 Subject: [PATCH] Use pre-commit instead of Coala. Linting. --- .coafile | 4 ---- .pre-commit-config.yaml | 23 +++++++++++++++++++++++ gnome-pass-search-provider.py | 17 ++++++++--------- 3 files changed, 31 insertions(+), 13 deletions(-) delete mode 100644 .coafile create mode 100644 .pre-commit-config.yaml diff --git a/.coafile b/.coafile deleted file mode 100644 index f4b2a1a..0000000 --- a/.coafile +++ /dev/null @@ -1,4 +0,0 @@ -[python] -bears = PyUnusedCodeBear,PySafetyBear,PyFlakesBear,PEP8Bear,BanditBear,PyCommentedCodeBear,VultureBear,InvalidLinkBear,PyImportSortBear -files = *.py -use_spaces = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ae39912 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 + args: ['--ignore=E501,E203'] + - repo: https://github.com/asottile/reorder_python_imports + rev: v2.3.6 + hooks: + - id: reorder-python-imports diff --git a/gnome-pass-search-provider.py b/gnome-pass-search-provider.py index 5accd55..8524d9c 100755 --- a/gnome-pass-search-provider.py +++ b/gnome-pass-search-provider.py @@ -14,27 +14,26 @@ # You should have received a copy of the GNU General Public License # along with gnome-pass-search-provider. If not, see # . - # Copyright (C) 2017 Jonathan Lestrelin # Author: Jonathan Lestrelin - # This project was based on gnome-shell-search-github-repositories # Copyright (C) 2012 Red Hat, Inc. # Author: Ralph Bean # which itself was based on fedmsg-notify # Copyright (C) 2012 Red Hat, Inc. # Author: Luke Macken - -import dbus -import dbus.service import re import subprocess +from os import getenv +from os import walk +from os.path import expanduser +from os.path import join as path_join +import dbus.service from dbus.mainloop.glib import DBusGMainLoop -from fuzzywuzzy import process, fuzz +from fuzzywuzzy import fuzz +from fuzzywuzzy import process from gi.repository import GLib -from os import getenv, walk -from os.path import expanduser, join as path_join # Convenience shorthand for declaring dbus interface methods. # s.b.n. -> search_bus_name @@ -165,7 +164,7 @@ class SearchPassService(dbus.service.Object): def send_password_to_native_clipboard(self, base_args, name, field=None): if field is not None: self.notify( - f"Cannot copy field values.", + "Cannot copy field values.", body="This feature requires GPaste.", error=True, )