fix: upgrade to ruff 0.1.0 and fix violations (#422)
This commit is contained in:
parent
fc28bd4079
commit
7e4cab6778
@ -38,7 +38,7 @@ repos:
|
|||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py39-plus]
|
args: [--py39-plus]
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.9.10
|
rev: v0.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class BuildExt(build_ext):
|
|||||||
|
|
||||||
|
|
||||||
def build(setup_kwargs):
|
def build(setup_kwargs):
|
||||||
if os.environ.get("SKIP_CYTHON", False):
|
if os.environ.get("SKIP_CYTHON"):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
from Cython.Build import cythonize
|
from Cython.Build import cythonize
|
||||||
|
|||||||
@ -7,10 +7,9 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/.."))
|
|||||||
import json
|
import json
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
from gi.repository import GLib
|
|
||||||
|
|
||||||
from dbus_fast import Message
|
from dbus_fast import Message
|
||||||
from dbus_fast.glib import MessageBus
|
from dbus_fast.glib import MessageBus
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
main = GLib.MainLoop()
|
main = GLib.MainLoop()
|
||||||
bus = MessageBus().connect_sync()
|
bus = MessageBus().connect_sync()
|
||||||
|
|||||||
@ -120,7 +120,6 @@ ignore = [
|
|||||||
"SIM109", # intended for cython
|
"SIM109", # intended for cython
|
||||||
"SIM102", # intended for cython
|
"SIM102", # intended for cython
|
||||||
"E501", # too many to fix,
|
"E501", # too many to fix,
|
||||||
"TC001", # too many to fix right now
|
|
||||||
"TID252", # intended
|
"TID252", # intended
|
||||||
"PLC0414", # intended
|
"PLC0414", # intended
|
||||||
"TRY003", # too many to fix
|
"TRY003", # too many to fix
|
||||||
@ -128,7 +127,7 @@ ignore = [
|
|||||||
"PLR0911", # api is public
|
"PLR0911", # api is public
|
||||||
"PYI036", # too many to fix
|
"PYI036", # too many to fix
|
||||||
"PYI034", # too many to fix
|
"PYI034", # too many to fix
|
||||||
"TC003", # too many to fix
|
"E721", # many are as intended
|
||||||
## should fix these sooner
|
## should fix these sooner
|
||||||
"B007", # too many to fix -- should fix sooner
|
"B007", # too many to fix -- should fix sooner
|
||||||
"SIM103", # too many to fix -- should fix sooner
|
"SIM103", # too many to fix -- should fix sooner
|
||||||
@ -138,7 +137,6 @@ ignore = [
|
|||||||
"B904", # too many to fix -- should fix sooner
|
"B904", # too many to fix -- should fix sooner
|
||||||
"PERF401", # too many to fix -- should fix sooner
|
"PERF401", # too many to fix -- should fix sooner
|
||||||
"B904", # too many to fix -- should fix sooner
|
"B904", # too many to fix -- should fix sooner
|
||||||
"PLR1704", # too many to fix -- should fix sooner
|
|
||||||
"B006", # too many to fix -- should fix sooner
|
"B006", # too many to fix -- should fix sooner
|
||||||
"G004", # too many to fix -- should fix sooner
|
"G004", # too many to fix -- should fix sooner
|
||||||
"PT015", # too many to fix -- should fix sooner
|
"PT015", # too many to fix -- should fix sooner
|
||||||
@ -189,7 +187,6 @@ select = [
|
|||||||
"SLOT", # flake8-slots
|
"SLOT", # flake8-slots
|
||||||
"T100", # Trace found: {name} used
|
"T100", # Trace found: {name} used
|
||||||
"T20", # flake8-print
|
"T20", # flake8-print
|
||||||
"TC", # flake8-type-checking
|
|
||||||
"TID", # Tidy imports
|
"TID", # Tidy imports
|
||||||
"TRY", # tryceratops
|
"TRY", # tryceratops
|
||||||
]
|
]
|
||||||
@ -227,8 +224,6 @@ select = [
|
|||||||
"PLR0913", # skip this one
|
"PLR0913", # skip this one
|
||||||
"SIM102" , # too many to fix right now
|
"SIM102" , # too many to fix right now
|
||||||
"SIM108", # too many to fix right now
|
"SIM108", # too many to fix right now
|
||||||
"TC003", # too many to fix right now
|
|
||||||
"TC002", # too many to fix right now
|
|
||||||
"T201", # too many to fix right now
|
"T201", # too many to fix right now
|
||||||
]
|
]
|
||||||
"bench/**/*" = [
|
"bench/**/*" = [
|
||||||
@ -238,4 +233,8 @@ select = [
|
|||||||
"T201", # intended
|
"T201", # intended
|
||||||
"RSE102", # too many to fix
|
"RSE102", # too many to fix
|
||||||
"C408", # too many to fix
|
"C408", # too many to fix
|
||||||
|
"E402", # as intended
|
||||||
|
]
|
||||||
|
"docs/**/*" = [
|
||||||
|
"E402", # as intended
|
||||||
]
|
]
|
||||||
|
|||||||
@ -73,10 +73,10 @@ def get_session_bus_address() -> str:
|
|||||||
display = os.environ["DISPLAY"]
|
display = os.environ["DISPLAY"]
|
||||||
try:
|
try:
|
||||||
display = display_re.search(display).group(1)
|
display = display_re.search(display).group(1)
|
||||||
except Exception:
|
except Exception as ex:
|
||||||
raise InvalidAddressError(
|
raise InvalidAddressError(
|
||||||
f"DBUS_SESSION_BUS_ADDRESS not set and could not parse DISPLAY environment variable to get bus address: {display}"
|
f"DBUS_SESSION_BUS_ADDRESS not set and could not parse DISPLAY environment variable to get bus address: {display}"
|
||||||
)
|
) from ex
|
||||||
|
|
||||||
# XXX: this will block but they're very small files and fs operations
|
# XXX: this will block but they're very small files and fs operations
|
||||||
# should be fairly reliable. fix this by passing in an async func to read
|
# should be fairly reliable. fix this by passing in an async func to read
|
||||||
@ -90,10 +90,10 @@ def get_session_bus_address() -> str:
|
|||||||
try:
|
try:
|
||||||
with open(dbus_info_file_name) as f:
|
with open(dbus_info_file_name) as f:
|
||||||
dbus_info = f.read().rstrip()
|
dbus_info = f.read().rstrip()
|
||||||
except Exception:
|
except Exception as ex:
|
||||||
raise InvalidAddressError(
|
raise InvalidAddressError(
|
||||||
f"could not open dbus info file: {dbus_info_file_name}"
|
f"could not open dbus info file: {dbus_info_file_name}"
|
||||||
)
|
) from ex
|
||||||
|
|
||||||
for line in dbus_info.split("\n"):
|
for line in dbus_info.split("\n"):
|
||||||
if line.strip().startswith("DBUS_SESSION_BUS_ADDRESS="):
|
if line.strip().startswith("DBUS_SESSION_BUS_ADDRESS="):
|
||||||
|
|||||||
@ -186,7 +186,9 @@ class Marshaller:
|
|||||||
try:
|
try:
|
||||||
return self._construct_buffer()
|
return self._construct_buffer()
|
||||||
except KeyError as ex:
|
except KeyError as ex:
|
||||||
raise NotImplementedError(f'type is not implemented yet: "{ex.args}"')
|
raise NotImplementedError(
|
||||||
|
f'type is not implemented yet: "{ex.args}"'
|
||||||
|
) from ex
|
||||||
except error:
|
except error:
|
||||||
self.signature_tree.verify(self.body)
|
self.signature_tree.verify(self.body)
|
||||||
raise RuntimeError("should not reach here")
|
raise RuntimeError("should not reach here")
|
||||||
|
|||||||
@ -738,9 +738,11 @@ class Unmarshaller:
|
|||||||
self._serial = _ustr_uint32(self._buf_ustr, 8, endian)
|
self._serial = _ustr_uint32(self._buf_ustr, 8, endian)
|
||||||
self._header_len = _ustr_uint32(self._buf_ustr, 12, endian)
|
self._header_len = _ustr_uint32(self._buf_ustr, 12, endian)
|
||||||
elif endian == LITTLE_ENDIAN:
|
elif endian == LITTLE_ENDIAN:
|
||||||
self._body_len, self._serial, self._header_len = (
|
(
|
||||||
UNPACK_HEADER_LITTLE_ENDIAN(self._buf, 4)
|
self._body_len,
|
||||||
)
|
self._serial,
|
||||||
|
self._header_len,
|
||||||
|
) = UNPACK_HEADER_LITTLE_ENDIAN(self._buf, 4)
|
||||||
self._uint32_unpack = UINT32_UNPACK_LITTLE_ENDIAN
|
self._uint32_unpack = UINT32_UNPACK_LITTLE_ENDIAN
|
||||||
self._int16_unpack = INT16_UNPACK_LITTLE_ENDIAN
|
self._int16_unpack = INT16_UNPACK_LITTLE_ENDIAN
|
||||||
self._uint16_unpack = UINT16_UNPACK_LITTLE_ENDIAN
|
self._uint16_unpack = UINT16_UNPACK_LITTLE_ENDIAN
|
||||||
|
|||||||
@ -108,9 +108,15 @@ class ErrorType(str, Enum):
|
|||||||
:seealso: http://man7.org/linux/man-pages/man3/sd-bus-errors.3.html
|
:seealso: http://man7.org/linux/man-pages/man3/sd-bus-errors.3.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
SERVICE_ERROR = "com.dubstepdish.dbus.next.ServiceError" #: A custom error to indicate an exported service threw an exception.
|
SERVICE_ERROR = (
|
||||||
INTERNAL_ERROR = "com.dubstepdish.dbus.next.InternalError" #: A custom error to indicate something went wrong with the library.
|
"com.dubstepdish.dbus.next.ServiceError"
|
||||||
CLIENT_ERROR = "com.dubstepdish.dbus.next.ClientError" #: A custom error to indicate something went wrong with the client.
|
) #: A custom error to indicate an exported service threw an exception.
|
||||||
|
INTERNAL_ERROR = (
|
||||||
|
"com.dubstepdish.dbus.next.InternalError"
|
||||||
|
) #: A custom error to indicate something went wrong with the library.
|
||||||
|
CLIENT_ERROR = (
|
||||||
|
"com.dubstepdish.dbus.next.ClientError"
|
||||||
|
) #: A custom error to indicate something went wrong with the client.
|
||||||
|
|
||||||
FAILED = "org.freedesktop.DBus.Error.Failed"
|
FAILED = "org.freedesktop.DBus.Error.Failed"
|
||||||
NO_MEMORY = "org.freedesktop.DBus.Error.NoMemory"
|
NO_MEMORY = "org.freedesktop.DBus.Error.NoMemory"
|
||||||
|
|||||||
@ -1033,8 +1033,7 @@ class BaseMessageBus:
|
|||||||
|
|
||||||
# first build up the result object to know when it's complete
|
# first build up the result object to know when it's complete
|
||||||
result: dict[str, dict[str, Any]] = {
|
result: dict[str, dict[str, Any]] = {
|
||||||
node: {interface: None for interface in self._path_exports[node]}
|
node: dict.fromkeys(self._path_exports[node]) for node in nodes
|
||||||
for node in nodes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_result_complete():
|
if is_result_complete():
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class BaseProxyInterface:
|
|||||||
return
|
return
|
||||||
|
|
||||||
match = [s for s in self.introspection.signals if s.name == msg.member]
|
match = [s for s in self.introspection.signals if s.name == msg.member]
|
||||||
if not len(match):
|
if not match:
|
||||||
return
|
return
|
||||||
intr_signal = match[0]
|
intr_signal = match[0]
|
||||||
if intr_signal.signature != msg.signature:
|
if intr_signal.signature != msg.signature:
|
||||||
@ -302,8 +302,10 @@ class BaseProxyObject:
|
|||||||
intr_interface = next(
|
intr_interface = next(
|
||||||
i for i in self.introspection.interfaces if i.name == name
|
i for i in self.introspection.interfaces if i.name == name
|
||||||
)
|
)
|
||||||
except StopIteration:
|
except StopIteration as ex:
|
||||||
raise InterfaceNotFoundError(f"interface not found on this object: {name}")
|
raise InterfaceNotFoundError(
|
||||||
|
f"interface not found on this object: {name}"
|
||||||
|
) from ex
|
||||||
|
|
||||||
interface = self.ProxyInterface(
|
interface = self.ProxyInterface(
|
||||||
self.bus_name, self.path, intr_interface, self.bus
|
self.bus_name, self.path, intr_interface, self.bus
|
||||||
|
|||||||
@ -33,7 +33,8 @@ HandlerType = Callable[[Message, SendReply], None]
|
|||||||
|
|
||||||
|
|
||||||
class _MethodCallbackProtocol(Protocol):
|
class _MethodCallbackProtocol(Protocol):
|
||||||
def __call__(self, interface: ServiceInterface, *args: Any) -> Any: ...
|
def __call__(self, interface: ServiceInterface, *args: Any) -> Any:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
class _Method:
|
class _Method:
|
||||||
@ -206,7 +207,7 @@ def signal(name: str | None = None, disabled: bool = False) -> Callable:
|
|||||||
|
|
||||||
|
|
||||||
class _Property(property):
|
class _Property(property):
|
||||||
def set_options(self, options):
|
def set_options(self, options: dict[str, Any]) -> None:
|
||||||
self.options = getattr(self, "options", {})
|
self.options = getattr(self, "options", {})
|
||||||
for k, v in options.items():
|
for k, v in options.items():
|
||||||
self.options[k] = v
|
self.options[k] = v
|
||||||
@ -221,11 +222,7 @@ class _Property(property):
|
|||||||
else:
|
else:
|
||||||
self.access = PropertyAccess.READWRITE
|
self.access = PropertyAccess.READWRITE
|
||||||
|
|
||||||
if "disabled" in options:
|
self.disabled = options.get("disabled", False)
|
||||||
self.disabled = options["disabled"]
|
|
||||||
else:
|
|
||||||
self.disabled = False
|
|
||||||
|
|
||||||
self.introspection = intr.Property(self.name, self.signature, self.access)
|
self.introspection = intr.Property(self.name, self.signature, self.access)
|
||||||
|
|
||||||
self.__dict__["__DBUS_PROPERTY"] = True
|
self.__dict__["__DBUS_PROPERTY"] = True
|
||||||
|
|||||||
@ -205,10 +205,10 @@ class SignatureType:
|
|||||||
def _verify_unix_fd(self, body: Any) -> None:
|
def _verify_unix_fd(self, body: Any) -> None:
|
||||||
try:
|
try:
|
||||||
self._verify_uint32(body)
|
self._verify_uint32(body)
|
||||||
except SignatureBodyMismatchError:
|
except SignatureBodyMismatchError as ex:
|
||||||
raise SignatureBodyMismatchError(
|
raise SignatureBodyMismatchError(
|
||||||
'DBus UNIX_FD type "h" must be a valid UINT32'
|
'DBus UNIX_FD type "h" must be a valid UINT32'
|
||||||
)
|
) from ex
|
||||||
|
|
||||||
def _verify_object_path(self, body: Any) -> None:
|
def _verify_object_path(self, body: Any) -> None:
|
||||||
if not is_object_path_valid(body):
|
if not is_object_path_valid(body):
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
from pytest_codspeed import BenchmarkFixture
|
|
||||||
|
|
||||||
from dbus_fast import Message
|
from dbus_fast import Message
|
||||||
|
from pytest_codspeed import BenchmarkFixture
|
||||||
|
|
||||||
message = Message(
|
message = Message(
|
||||||
destination="org.bluez",
|
destination="org.bluez",
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import io
|
import io
|
||||||
|
|
||||||
from pytest_codspeed import BenchmarkFixture
|
|
||||||
|
|
||||||
from dbus_fast._private.unmarshaller import Unmarshaller
|
from dbus_fast._private.unmarshaller import Unmarshaller
|
||||||
|
from pytest_codspeed import BenchmarkFixture
|
||||||
|
|
||||||
|
|
||||||
def test_unmarshall_bluez_rssi_message(benchmark: BenchmarkFixture) -> None:
|
def test_unmarshall_bluez_rssi_message(benchmark: BenchmarkFixture) -> None:
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import aio
|
from dbus_fast import aio
|
||||||
from dbus_fast.service import ServiceInterface
|
from dbus_fast.service import ServiceInterface
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,13 @@ import sys
|
|||||||
from logging.handlers import QueueHandler
|
from logging.handlers import QueueHandler
|
||||||
from queue import SimpleQueue
|
from queue import SimpleQueue
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
import dbus_fast.introspection as intr
|
import dbus_fast.introspection as intr
|
||||||
|
import pytest
|
||||||
from dbus_fast import DBusError, aio, glib
|
from dbus_fast import DBusError, aio, glib
|
||||||
from dbus_fast.message import MessageFlag
|
from dbus_fast.message import MessageFlag
|
||||||
from dbus_fast.service import ServiceInterface, method
|
from dbus_fast.service import ServiceInterface, method
|
||||||
from dbus_fast.signature import Variant
|
from dbus_fast.signature import Variant
|
||||||
|
|
||||||
from tests.util import check_gi_repository, skip_reason_no_gi
|
from tests.util import check_gi_repository, skip_reason_no_gi
|
||||||
|
|
||||||
has_gi = check_gi_repository()
|
has_gi = check_gi_repository()
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import DBusError, Message, aio, glib
|
from dbus_fast import DBusError, Message, aio, glib
|
||||||
from dbus_fast.service import PropertyAccess, ServiceInterface, dbus_property
|
from dbus_fast.service import PropertyAccess, ServiceInterface, dbus_property
|
||||||
from dbus_fast.signature import Variant
|
from dbus_fast.signature import Variant
|
||||||
|
|
||||||
from tests.util import check_gi_repository, skip_reason_no_gi
|
from tests.util import check_gi_repository, skip_reason_no_gi
|
||||||
|
|
||||||
has_gi = check_gi_repository()
|
has_gi = check_gi_repository()
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message
|
from dbus_fast import Message
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
from dbus_fast.constants import RequestNameReply
|
from dbus_fast.constants import RequestNameReply
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageType
|
from dbus_fast import Message, MessageType
|
||||||
from dbus_fast import introspection as intr
|
from dbus_fast import introspection as intr
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import (
|
from dbus_fast import (
|
||||||
DBusError,
|
DBusError,
|
||||||
ErrorType,
|
ErrorType,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import (
|
from dbus_fast import (
|
||||||
DBusError,
|
DBusError,
|
||||||
ErrorType,
|
ErrorType,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageType
|
from dbus_fast import Message, MessageType
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
from dbus_fast.constants import PropertyAccess
|
from dbus_fast.constants import PropertyAccess
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageType
|
from dbus_fast import Message, MessageType
|
||||||
from dbus_fast import introspection as intr
|
from dbus_fast import introspection as intr
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import os
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast._private.address import (
|
from dbus_fast._private.address import (
|
||||||
get_bus_address,
|
get_bus_address,
|
||||||
get_session_bus_address,
|
get_session_bus_address,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageFlag, MessageType
|
from dbus_fast import Message, MessageFlag, MessageType
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
from dbus_fast.service import ServiceInterface, method
|
from dbus_fast.service import ServiceInterface, method
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
"""This tests setting a hardcoded UID in AuthExternal"""
|
"""This tests setting a hardcoded UID in AuthExternal"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast.auth import (
|
from dbus_fast.auth import (
|
||||||
UID_NOT_SPECIFIED,
|
UID_NOT_SPECIFIED,
|
||||||
AuthAnnonymous,
|
AuthAnnonymous,
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageType, aio, glib
|
from dbus_fast import Message, MessageType, aio, glib
|
||||||
from dbus_fast.service import ServiceInterface, method
|
from dbus_fast.service import ServiceInterface, method
|
||||||
|
|
||||||
from tests.util import check_gi_repository, skip_reason_no_gi
|
from tests.util import check_gi_repository, skip_reason_no_gi
|
||||||
|
|
||||||
has_gi = check_gi_repository()
|
has_gi = check_gi_repository()
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import asyncio
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message
|
from dbus_fast import Message
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageType
|
from dbus_fast import Message, MessageType
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
from dbus_fast.service import ServiceInterface, dbus_property, method, signal
|
from dbus_fast.service import ServiceInterface, dbus_property, method, signal
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageFlag, MessageType
|
from dbus_fast import Message, MessageFlag, MessageType
|
||||||
from dbus_fast.glib import MessageBus
|
from dbus_fast.glib import MessageBus
|
||||||
|
|
||||||
from tests.util import check_gi_repository, skip_reason_no_gi
|
from tests.util import check_gi_repository, skip_reason_no_gi
|
||||||
|
|
||||||
has_gi = check_gi_repository()
|
has_gi = check_gi_repository()
|
||||||
|
|||||||
@ -5,7 +5,6 @@ from enum import Enum
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message, MessageFlag, MessageType, SignatureTree, Variant
|
from dbus_fast import Message, MessageFlag, MessageType, SignatureTree, Variant
|
||||||
from dbus_fast._private._cython_compat import FakeCython
|
from dbus_fast._private._cython_compat import FakeCython
|
||||||
from dbus_fast._private.constants import BIG_ENDIAN, LITTLE_ENDIAN
|
from dbus_fast._private.constants import BIG_ENDIAN, LITTLE_ENDIAN
|
||||||
@ -234,9 +233,9 @@ def test_unmarshalling_with_table(unmarshall_table):
|
|||||||
"flags",
|
"flags",
|
||||||
"serial",
|
"serial",
|
||||||
]:
|
]:
|
||||||
assert getattr(unmarshaller.message, attr) == getattr(message, attr), (
|
assert getattr(unmarshaller.message, attr) == getattr(
|
||||||
f"attr doesnt match: {attr}"
|
message, attr
|
||||||
)
|
), f"attr doesnt match: {attr}"
|
||||||
|
|
||||||
|
|
||||||
def test_unmarshall_can_resume():
|
def test_unmarshall_can_resume():
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import (
|
from dbus_fast import (
|
||||||
Message,
|
Message,
|
||||||
MessageType,
|
MessageType,
|
||||||
@ -11,6 +10,7 @@ from dbus_fast import (
|
|||||||
aio,
|
aio,
|
||||||
glib,
|
glib,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.util import check_gi_repository, skip_reason_no_gi
|
from tests.util import check_gi_repository, skip_reason_no_gi
|
||||||
|
|
||||||
has_gi = check_gi_repository()
|
has_gi = check_gi_repository()
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import os
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast.constants import ErrorType, MessageType
|
from dbus_fast.constants import ErrorType, MessageType
|
||||||
from dbus_fast.errors import DBusError
|
from dbus_fast.errors import DBusError
|
||||||
from dbus_fast.message import Message
|
from dbus_fast.message import Message
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import SignatureBodyMismatchError, SignatureTree, Variant
|
from dbus_fast import SignatureBodyMismatchError, SignatureTree, Variant
|
||||||
from dbus_fast._private.util import signature_contains_type
|
from dbus_fast._private.util import signature_contains_type
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import os
|
|||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast import Message
|
from dbus_fast import Message
|
||||||
from dbus_fast._private.address import parse_address
|
from dbus_fast._private.address import parse_address
|
||||||
from dbus_fast.aio import MessageBus
|
from dbus_fast.aio import MessageBus
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
"""Test unpack variants."""
|
"""Test unpack variants."""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from dbus_fast.signature import Variant
|
from dbus_fast.signature import Variant
|
||||||
from dbus_fast.unpack import unpack_variants
|
from dbus_fast.unpack import unpack_variants
|
||||||
|
|
||||||
|
|||||||
@ -66,13 +66,13 @@ def test_interface_name_validator():
|
|||||||
]
|
]
|
||||||
|
|
||||||
for name in valid_names:
|
for name in valid_names:
|
||||||
assert is_interface_name_valid(name), (
|
assert is_interface_name_valid(
|
||||||
f'interface name should be valid: "{name}"'
|
name
|
||||||
)
|
), f'interface name should be valid: "{name}"'
|
||||||
for name in invalid_names:
|
for name in invalid_names:
|
||||||
assert not is_interface_name_valid(name), (
|
assert not is_interface_name_valid(
|
||||||
f'interface name should be invalid: "{name}"'
|
name
|
||||||
)
|
), f'interface name should be invalid: "{name}"'
|
||||||
|
|
||||||
|
|
||||||
def test_member_name_validator():
|
def test_member_name_validator():
|
||||||
@ -82,6 +82,6 @@ def test_member_name_validator():
|
|||||||
for member in valid_members:
|
for member in valid_members:
|
||||||
assert is_member_name_valid(member), f'member name should be valid: "{member}"'
|
assert is_member_name_valid(member), f'member name should be valid: "{member}"'
|
||||||
for member in invalid_members:
|
for member in invalid_members:
|
||||||
assert not is_member_name_valid(member), (
|
assert not is_member_name_valid(
|
||||||
f'member name should be invalid: "{member}"'
|
member
|
||||||
)
|
), f'member name should be invalid: "{member}"'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user