lint fixes

This commit is contained in:
Devaev Maxim 2021-07-08 16:52:51 +03:00
parent 43aa435b81
commit 7c68b6b406
4 changed files with 5 additions and 4 deletions

View File

@ -539,7 +539,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
def __set_image_complete(self, name: str, flag: bool) -> None: def __set_image_complete(self, name: str, flag: bool) -> None:
path = os.path.join(self.__meta_path, name + ".complete") path = os.path.join(self.__meta_path, name + ".complete")
if flag: if flag:
open(path, "w").close() open(path, "w").close() # pylint: disable=consider-using-with
else: else:
if os.path.exists(path): if os.path.exists(path):
os.remove(path) os.remove(path)

View File

@ -35,6 +35,7 @@ disable =
raise-missing-from, raise-missing-from,
consider-using-in, consider-using-in,
unsubscriptable-object, unsubscriptable-object,
unused-private-member,
# https://github.com/PyCQA/pylint/issues/3882 # https://github.com/PyCQA/pylint/issues/3882
[CLASSES] [CLASSES]

View File

@ -37,9 +37,9 @@ def test_ok(tmpdir) -> None: # type: ignore
queue: "multiprocessing.Queue[Literal[True]]" = multiprocessing.Queue() queue: "multiprocessing.Queue[Literal[True]]" = multiprocessing.Queue()
ustreamer_sock_path = os.path.abspath(str(tmpdir.join("ustreamer-fake.sock"))) ustreamer_sock_path = os.path.abspath(str(tmpdir.join("ustreamer-fake.sock")))
open(ustreamer_sock_path, "w").close() open(ustreamer_sock_path, "w").close() # pylint: disable=consider-using-with
kvmd_sock_path = os.path.abspath(str(tmpdir.join("kvmd-fake.sock"))) kvmd_sock_path = os.path.abspath(str(tmpdir.join("kvmd-fake.sock")))
open(kvmd_sock_path, "w").close() open(kvmd_sock_path, "w").close() # pylint: disable=consider-using-with
def ustreamer_fake() -> None: def ustreamer_fake() -> None:
setproctitle.setproctitle("kvmd/streamer: /usr/bin/ustreamer") setproctitle.setproctitle("kvmd/streamer: /usr/bin/ustreamer")

View File

@ -164,7 +164,7 @@ def test_fail__unknown_plugin() -> None:
def test_fail__invalid_passwd(mocker, tmpdir) -> None: # type: ignore def test_fail__invalid_passwd(mocker, tmpdir) -> None: # type: ignore
path = os.path.abspath(str(tmpdir.join("htpasswd"))) path = os.path.abspath(str(tmpdir.join("htpasswd")))
open(path, "w").close() open(path, "w").close() # pylint: disable=consider-using-with
mocker.patch.object(builtins, "input", (lambda: "\n")) mocker.patch.object(builtins, "input", (lambda: "\n"))
with pytest.raises(SystemExit, match="The argument is not a valid passwd characters"): with pytest.raises(SystemExit, match="The argument is not a valid passwd characters"):
_run_htpasswd(["set", "admin", "--read-stdin"], path) _run_htpasswd(["set", "admin", "--read-stdin"], path)