chore: switch to ruff (#339)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -40,7 +40,7 @@ class ExampleInterface(ServiceInterface):
|
||||
return [what1, what2, what3]
|
||||
|
||||
@method()
|
||||
def GetComplex(self) -> "a{sv}":
|
||||
def GetComplex(self) -> "a{sv}": # noqa: F722
|
||||
"""Return complex output."""
|
||||
return {"hello": Variant("s", "world")}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class ExampleInterface(ServiceInterface):
|
||||
return self._int64_property
|
||||
|
||||
@dbus_property(access=PropertyAccess.READ)
|
||||
def ComplexProperty(self) -> "a{sv}":
|
||||
def ComplexProperty(self) -> "a{sv}": # noqa: F722
|
||||
"""Return complex output."""
|
||||
return {"hello": Variant("s", "world")}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ExampleInterface(ServiceInterface):
|
||||
return ["hello", "world"]
|
||||
|
||||
@signal()
|
||||
def SignalComplex(self) -> "a{sv}":
|
||||
def SignalComplex(self) -> "a{sv}": # noqa: F722
|
||||
"""Broadcast a complex signal."""
|
||||
return {"hello": Variant("s", "world")}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ExampleInterface(ServiceInterface):
|
||||
pass
|
||||
|
||||
@signal()
|
||||
def some_signal(self) -> "as":
|
||||
def some_signal(self) -> "as": # noqa: F722
|
||||
return ["result"]
|
||||
|
||||
@signal(name="renamed_signal", disabled=True)
|
||||
|
||||
@@ -29,8 +29,12 @@ class ExampleInterface(ServiceInterface):
|
||||
|
||||
@method()
|
||||
def echo_containers(
|
||||
self, array: "as", variant: "v", dict_entries: "a{sv}", struct: "(s(s(v)))"
|
||||
) -> "asva{sv}(s(s(v)))":
|
||||
self,
|
||||
array: "as", # noqa: F722
|
||||
variant: "v",
|
||||
dict_entries: "a{sv}", # noqa: F722
|
||||
struct: "(s(s(v)))", # noqa: F722
|
||||
) -> "asva{sv}(s(s(v)))": # noqa: F722
|
||||
assert type(self) is ExampleInterface
|
||||
return [array, variant, dict_entries, struct]
|
||||
|
||||
@@ -76,8 +80,12 @@ class AsyncInterface(ServiceInterface):
|
||||
|
||||
@method()
|
||||
async def echo_containers(
|
||||
self, array: "as", variant: "v", dict_entries: "a{sv}", struct: "(s(s(v)))"
|
||||
) -> "asva{sv}(s(s(v)))":
|
||||
self,
|
||||
array: "as", # noqa: F722
|
||||
variant: "v",
|
||||
dict_entries: "a{sv}", # noqa: F722
|
||||
struct: "(s(s(v)))", # noqa: F722
|
||||
) -> "asva{sv}(s(s(v)))": # noqa: F722
|
||||
assert type(self) is AsyncInterface
|
||||
return [array, variant, dict_entries, struct]
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ def test_get_session_bus_address():
|
||||
with patch.dict(os.environ, DBUS_SESSION_BUS_ADDRESS="unix:path=/dog"):
|
||||
assert get_session_bus_address() == "unix:path=/dog"
|
||||
assert get_bus_address(BusType.SESSION) == "unix:path=/dog"
|
||||
with patch.dict(os.environ, DBUS_SESSION_BUS_ADDRESS="", DISPLAY=""), pytest.raises(
|
||||
InvalidAddressError
|
||||
with (
|
||||
patch.dict(os.environ, DBUS_SESSION_BUS_ADDRESS="", DISPLAY=""),
|
||||
pytest.raises(InvalidAddressError),
|
||||
):
|
||||
assert get_session_bus_address()
|
||||
|
||||
|
||||
@@ -52,8 +52,9 @@ async def test_unexpected_disconnect(event_loop):
|
||||
await bus.connect()
|
||||
assert bus.connected
|
||||
|
||||
with patch.object(bus._writer, "_write_without_remove_writer"), patch.object(
|
||||
bus._writer, "sock", FakeSocket()
|
||||
with (
|
||||
patch.object(bus._writer, "_write_without_remove_writer"),
|
||||
patch.object(bus._writer, "sock", FakeSocket()),
|
||||
):
|
||||
ping = bus.call(
|
||||
Message(
|
||||
|
||||
@@ -2,7 +2,7 @@ import io
|
||||
import json
|
||||
import os
|
||||
from enum import Enum
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -101,8 +101,6 @@ def test_marshalling_with_table():
|
||||
|
||||
@pytest.mark.parametrize("unmarshall_table", (table,))
|
||||
def test_unmarshalling_with_table(unmarshall_table):
|
||||
from dbus_fast._private import unmarshaller
|
||||
|
||||
for item in unmarshall_table:
|
||||
stream = io.BytesIO(bytes.fromhex(item["data"]))
|
||||
unmarshaller = Unmarshaller(stream)
|
||||
|
||||
@@ -7,7 +7,7 @@ def check_gi_repository():
|
||||
if _has_gi is not None:
|
||||
return _has_gi
|
||||
try:
|
||||
from gi.repository import GLib
|
||||
from gi.repository import GLib # noqa: F401
|
||||
|
||||
_has_gi = True
|
||||
return _has_gi
|
||||
|
||||
Reference in New Issue
Block a user