diff --git a/pyproject.toml b/pyproject.toml index 75d90c1..7db6fb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ target-version = "py312" line-length = 88 [tool.ruff.lint] -select = ["PL"] +select = ["B", "F", "PL"] [tool.ruff.lint.isort] known-first-party = ["into-dbus-python"] diff --git a/src/dbus_python_client_gen/__init__.py b/src/dbus_python_client_gen/__init__.py index acfd826..0f4f35e 100644 --- a/src/dbus_python_client_gen/__init__.py +++ b/src/dbus_python_client_gen/__init__.py @@ -5,18 +5,16 @@ Top-level classes and methods. """ -from ._errors import ( - DPClientError, - DPClientGenerationError, - DPClientGetPropertyContext, - DPClientInvalidArgError, - DPClientInvocationContext, - DPClientInvocationError, - DPClientKeywordError, - DPClientMarshallingError, - DPClientMethodCallContext, - DPClientRuntimeError, - DPClientSetPropertyContext, -) -from ._invokers import make_class -from ._version import __version__ +from ._errors import DPClientError as DPClientError +from ._errors import DPClientGenerationError as DPClientGenerationError +from ._errors import DPClientGetPropertyContext as DPClientGetPropertyContext +from ._errors import DPClientInvalidArgError as DPClientInvalidArgError +from ._errors import DPClientInvocationContext as DPClientInvocationContext +from ._errors import DPClientInvocationError as DPClientInvocationError +from ._errors import DPClientKeywordError as DPClientKeywordError +from ._errors import DPClientMarshallingError as DPClientMarshallingError +from ._errors import DPClientMethodCallContext as DPClientMethodCallContext +from ._errors import DPClientRuntimeError as DPClientRuntimeError +from ._errors import DPClientSetPropertyContext as DPClientSetPropertyContext +from ._invokers import make_class as make_class +from ._version import __version__ as __version__ diff --git a/src/dbus_python_client_gen/_errors.py b/src/dbus_python_client_gen/_errors.py index 8b4ee3e..19aaa77 100644 --- a/src/dbus_python_client_gen/_errors.py +++ b/src/dbus_python_client_gen/_errors.py @@ -5,10 +5,8 @@ Exception hierarchy for this package. """ -from abc import ABC - -class DPClientInvocationContext(ABC): +class DPClientInvocationContext: """ Identifies the context in which an invocation error occurred. diff --git a/tests/test_generated.py b/tests/test_generated.py index 0cb16d0..7ca4887 100644 --- a/tests/test_generated.py +++ b/tests/test_generated.py @@ -51,7 +51,7 @@ def _test_property(self, klass, prop): self.assertTrue(hasattr(prop_klass, "Get")) with self.assertRaises(AttributeError): - getattr(prop_klass, "Get")(None) + prop_klass.Get(None) if "write" in access: self.assertTrue(hasattr(prop_klass, "Set")) @@ -63,14 +63,14 @@ def _test_property(self, klass, prop): pass else: with self.assertRaises(DPClientMarshallingError): - getattr(prop_klass, "Set")(None, None) + prop_klass.Set(None, None) if "readwrite" in access: self.assertTrue(hasattr(prop_klass, "Get")) self.assertTrue(hasattr(prop_klass, "Set")) with self.assertRaises(AttributeError): - getattr(prop_klass, "Get")(None) + prop_klass.Get(None) def _test_method(self, klass, method): """ @@ -95,8 +95,8 @@ def _test_klasses(self): self.assertTrue(hasattr(klass, "Properties")) self.assertTrue(hasattr(klass, "Methods")) - properties = getattr(klass, "Properties") - methods = getattr(klass, "Methods") + properties = klass.Properties + methods = klass.Methods for method in spec.findall("./method"): self._test_method(methods, method)