diff --git a/README.md b/README.md index 29fe72b..28ea13a 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ For more information, see the [overview for the high-level client](https://dbus- This example connects to a media player and controls it with the [MPRIS](https://specifications.freedesktop.org/mpris-spec/latest/) DBus interface. ```python -from dbus_next.aio import MessageBus +from dbus_fast.aio import MessageBus import asyncio @@ -118,8 +118,8 @@ To define a service on the bus, use the `ServiceInterface` class and decorate cl For more information, see the [overview for the high-level service](https://python-dbus-fast.readthedocs.io/en/latest/high-level-service/index.html). ```python -from dbus_next.service import ServiceInterface, method, dbus_property, signal, Variant -from dbus_next.aio MessageBus +from dbus_fast.service import ServiceInterface, method, dbus_property, signal, Variant +from dbus_fast.aio MessageBus import asyncio @@ -171,8 +171,8 @@ The low-level interface works with DBus messages directly. For more information, see the [overview for the low-level interface](https://python-dbus-fast.readthedocs.io/en/latest/low-level-interface/index.html). ```python -from dbus_next.message import Message, MessageType -from dbus_next.aio import MessageBus +from dbus_fast.message import Message, MessageType +from dbus_fast.aio import MessageBus import asyncio import json diff --git a/docs/source/authentication.rst b/docs/source/authentication.rst index 6749c67..39f667e 100644 --- a/docs/source/authentication.rst +++ b/docs/source/authentication.rst @@ -1,9 +1,9 @@ Authentication ============== -Classes for the DBus `authentication protocol `_ for us with :class:`MessageBus ` implementations. +Classes for the DBus `authentication protocol `_ for us with :class:`MessageBus ` implementations. -.. autoclass:: dbus_next.auth.Authenticator +.. autoclass:: dbus_fast.auth.Authenticator -.. autoclass:: dbus_next.auth.AuthExternal -.. autoclass:: dbus_next.auth.AuthAnnonymous +.. autoclass:: dbus_fast.auth.AuthExternal +.. autoclass:: dbus_fast.auth.AuthAnnonymous diff --git a/docs/source/conf.py b/docs/source/conf.py index 72aac25..029e125 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,7 +16,7 @@ import sys sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "/..")) -from dbus_next.__version__ import __author__, __copyright__, __title__, __version__ +from dbus_fast.__version__ import __author__, __copyright__, __title__, __version__ _project_slug = __title__.replace("_", "-") diff --git a/docs/source/constants.rst b/docs/source/constants.rst index 843924c..e17a08d 100644 --- a/docs/source/constants.rst +++ b/docs/source/constants.rst @@ -2,38 +2,38 @@ Constants ========= -.. autoclass:: dbus_next.BusType +.. autoclass:: dbus_fast.BusType :members: :undoc-members: -.. autoclass:: dbus_next.MessageType +.. autoclass:: dbus_fast.MessageType :members: :undoc-members: -.. autoclass:: dbus_next.MessageFlag +.. autoclass:: dbus_fast.MessageFlag :members: :undoc-members: -.. autoclass:: dbus_next.NameFlag +.. autoclass:: dbus_fast.NameFlag :members: :undoc-members: -.. autoclass:: dbus_next.RequestNameReply +.. autoclass:: dbus_fast.RequestNameReply :members: :undoc-members: -.. autoclass:: dbus_next.ReleaseNameReply +.. autoclass:: dbus_fast.ReleaseNameReply :members: :undoc-members: -.. autoclass:: dbus_next.PropertyAccess +.. autoclass:: dbus_fast.PropertyAccess :members: :undoc-members: -.. autoclass:: dbus_next.ArgDirection +.. autoclass:: dbus_fast.ArgDirection :members: :undoc-members: -.. autoclass:: dbus_next.ErrorType +.. autoclass:: dbus_fast.ErrorType :members: :undoc-members: diff --git a/docs/source/errors.rst b/docs/source/errors.rst index 28012fa..a9d69cb 100644 --- a/docs/source/errors.rst +++ b/docs/source/errors.rst @@ -1,19 +1,19 @@ Errors ====== -.. autoclass:: dbus_next.DBusError +.. autoclass:: dbus_fast.DBusError :members: :undoc-members: -.. autoclass:: dbus_next.SignatureBodyMismatchError -.. autoclass:: dbus_next.InvalidSignatureError -.. autoclass:: dbus_next.InvalidAddressError -.. autoclass:: dbus_next.AuthError -.. autoclass:: dbus_next.InvalidMessageError -.. autoclass:: dbus_next.InvalidIntrospectionError -.. autoclass:: dbus_next.InterfaceNotFoundError -.. autoclass:: dbus_next.SignalDisabledError -.. autoclass:: dbus_next.InvalidBusNameError -.. autoclass:: dbus_next.InvalidObjectPathError -.. autoclass:: dbus_next.InvalidInterfaceNameError -.. autoclass:: dbus_next.InvalidMemberNameError +.. autoclass:: dbus_fast.SignatureBodyMismatchError +.. autoclass:: dbus_fast.InvalidSignatureError +.. autoclass:: dbus_fast.InvalidAddressError +.. autoclass:: dbus_fast.AuthError +.. autoclass:: dbus_fast.InvalidMessageError +.. autoclass:: dbus_fast.InvalidIntrospectionError +.. autoclass:: dbus_fast.InterfaceNotFoundError +.. autoclass:: dbus_fast.SignalDisabledError +.. autoclass:: dbus_fast.InvalidBusNameError +.. autoclass:: dbus_fast.InvalidObjectPathError +.. autoclass:: dbus_fast.InvalidInterfaceNameError +.. autoclass:: dbus_fast.InvalidMemberNameError diff --git a/docs/source/high-level-client/aio-proxy-interface.rst b/docs/source/high-level-client/aio-proxy-interface.rst index f1e260b..a3864be 100644 --- a/docs/source/high-level-client/aio-proxy-interface.rst +++ b/docs/source/high-level-client/aio-proxy-interface.rst @@ -1,7 +1,7 @@ aio.ProxyInterface ================== -.. autoclass:: dbus_next.aio.ProxyInterface +.. autoclass:: dbus_fast.aio.ProxyInterface :members: :undoc-members: :show-inheritance: diff --git a/docs/source/high-level-client/aio-proxy-object.rst b/docs/source/high-level-client/aio-proxy-object.rst index 9a9cadf..703b1d4 100644 --- a/docs/source/high-level-client/aio-proxy-object.rst +++ b/docs/source/high-level-client/aio-proxy-object.rst @@ -1,7 +1,7 @@ aio.ProxyObject =============== -.. autoclass:: dbus_next.aio.ProxyObject +.. autoclass:: dbus_fast.aio.ProxyObject :members: :undoc-members: :show-inheritance: diff --git a/docs/source/high-level-client/base-proxy-interface.rst b/docs/source/high-level-client/base-proxy-interface.rst index b3fd2aa..3ce4c4f 100644 --- a/docs/source/high-level-client/base-proxy-interface.rst +++ b/docs/source/high-level-client/base-proxy-interface.rst @@ -1,6 +1,6 @@ BaseProxyInterface ================== -.. autoclass:: dbus_next.proxy_object.BaseProxyInterface +.. autoclass:: dbus_fast.proxy_object.BaseProxyInterface :members: :undoc-members: diff --git a/docs/source/high-level-client/base-proxy-object.rst b/docs/source/high-level-client/base-proxy-object.rst index 15fb47d..0b3fe82 100644 --- a/docs/source/high-level-client/base-proxy-object.rst +++ b/docs/source/high-level-client/base-proxy-object.rst @@ -1,6 +1,6 @@ BaseProxyObject =============== -.. autoclass:: dbus_next.proxy_object.BaseProxyObject +.. autoclass:: dbus_fast.proxy_object.BaseProxyObject :members: :undoc-members: diff --git a/docs/source/high-level-client/glib-proxy-interface.rst b/docs/source/high-level-client/glib-proxy-interface.rst index e072133..2b3a0f2 100644 --- a/docs/source/high-level-client/glib-proxy-interface.rst +++ b/docs/source/high-level-client/glib-proxy-interface.rst @@ -1,7 +1,7 @@ glib.ProxyInterface =================== -.. autoclass:: dbus_next.glib.ProxyInterface +.. autoclass:: dbus_fast.glib.ProxyInterface :members: :undoc-members: :show-inheritance: diff --git a/docs/source/high-level-client/glib-proxy-object.rst b/docs/source/high-level-client/glib-proxy-object.rst index 24486e9..1368052 100644 --- a/docs/source/high-level-client/glib-proxy-object.rst +++ b/docs/source/high-level-client/glib-proxy-object.rst @@ -1,7 +1,7 @@ glib.ProxyObject ================ -.. autoclass:: dbus_next.glib.ProxyObject +.. autoclass:: dbus_fast.glib.ProxyObject :members: :undoc-members: :show-inheritance: diff --git a/docs/source/high-level-client/index.rst b/docs/source/high-level-client/index.rst index 0ebe474..da1b0ff 100644 --- a/docs/source/high-level-client/index.rst +++ b/docs/source/high-level-client/index.rst @@ -40,11 +40,11 @@ DBus interfaces are defined with an XML-based `introspection data format -The object at this path (a ``node``) may contain interfaces and child nodes. Nodes like this are represented in the library by a :class:`ProxyObject `. The interfaces contained in the nodes are represented by a :class:`ProxyInterface `. The proxy interface exposes the methods, signals, and properties specified by the interface definition. +The object at this path (a ``node``) may contain interfaces and child nodes. Nodes like this are represented in the library by a :class:`ProxyObject `. The interfaces contained in the nodes are represented by a :class:`ProxyInterface `. The proxy interface exposes the methods, signals, and properties specified by the interface definition. -The proxy object is obtained by the :class:`MessageBus ` through the :func:`get_proxy_object() ` method. This method takes the name of the client to send messages to, the path exported by that client that is expected to export the node, and the XML introspection data. If you can, it is recommended to include the XML in your project and pass it to that method as a string. But you may also use the :func:`introspect() ` method of the message bus to get this data dynamically at runtime. +The proxy object is obtained by the :class:`MessageBus ` through the :func:`get_proxy_object() ` method. This method takes the name of the client to send messages to, the path exported by that client that is expected to export the node, and the XML introspection data. If you can, it is recommended to include the XML in your project and pass it to that method as a string. But you may also use the :func:`introspect() ` method of the message bus to get this data dynamically at runtime. -Once you have a proxy object, use the :func:`get_proxy_interface() ` method to create an interface passing the name of the interface to get. Each message bus has its own implementation of the proxy interface which behaves slightly differently. This is an example of how to use a proxy interface for the asyncio :class:`MessageBus `. +Once you have a proxy object, use the :func:`get_proxy_interface() ` method to create an interface passing the name of the interface to get. Each message bus has its own implementation of the proxy interface which behaves slightly differently. This is an example of how to use a proxy interface for the asyncio :class:`MessageBus `. If any file descriptors are sent or received (DBus type ``h``), the variable refers to the file descriptor itself. You are responsible for closing any file descriptors sent or received by the bus. You must set the ``negotiate_unix_fd`` flag to ``True`` in the ``MessageBus`` constructor to use unix file descriptors. @@ -52,8 +52,8 @@ If any file descriptors are sent or received (DBus type ``h``), the variable ref .. code-block:: python3 - from dbus_next.aio import MessageBus - from dbus_next import Variant + from dbus_fast.aio import MessageBus + from dbus_fast import Variant bus = await MessageBus().connect() diff --git a/docs/source/high-level-service/index.rst b/docs/source/high-level-service/index.rst index d420ac4..4adf1aa 100644 --- a/docs/source/high-level-service/index.rst +++ b/docs/source/high-level-service/index.rst @@ -6,11 +6,11 @@ The High Level Service service-interface -The high level service interface provides everything you need to export interfaces on the bus. When you export an interface on your :class:`MessageBus `, clients can send you messages to call methods, get and set properties, and listen to your signals. +The high level service interface provides everything you need to export interfaces on the bus. When you export an interface on your :class:`MessageBus `, clients can send you messages to call methods, get and set properties, and listen to your signals. -If you're exposing a service for general use, you can request a well-known name for your connection with :func:`MessageBus.request_name() ` so users have a predictable name to use to send messages your client. +If you're exposing a service for general use, you can request a well-known name for your connection with :func:`MessageBus.request_name() ` so users have a predictable name to use to send messages your client. -Services are defined by subclassing :class:`ServiceInterface ` and definining members as methods on the class with the decorator methods :func:`@method() `, :func:`@dbus_property() `, and :func:`@signal() `. The parameters of the decorated class methods must be annotated with DBus type strings to indicate the types of values they expect. See the documentation on `the type system `_ for more information on how DBus types are mapped to Python values with signature strings. The decorator methods themselves take arguments that affect how the member is exported on the bus, such as the name of the member or the access permissions of a property. +Services are defined by subclassing :class:`ServiceInterface ` and definining members as methods on the class with the decorator methods :func:`@method() `, :func:`@dbus_property() `, and :func:`@signal() `. The parameters of the decorated class methods must be annotated with DBus type strings to indicate the types of values they expect. See the documentation on `the type system `_ for more information on how DBus types are mapped to Python values with signature strings. The decorator methods themselves take arguments that affect how the member is exported on the bus, such as the name of the member or the access permissions of a property. A class method decorated with ``@method()`` will be called when a client calls the method over DBus. The parameters given to the class method will be provided by the calling client and will conform to the parameter type annotations. The value returned by the class method will be returned to the client and must conform to the return type annotation specified by the user. If the return annotation specifies more than one type, the values must be returned in a ``list``. When :class:`aio.MessageBus` is used, methods can be coroutines. @@ -18,9 +18,9 @@ A class method decorated with ``@dbus_property()`` will be exposed as a DBus pro A class method decorated with ``@signal()`` will be exposed as a DBus signal. The value returned by the class method will be emitted as a signal and broadcast to clients who are listening to the signal. The returned value must conform to the return annotation of the class method as a DBus signature string. If the signal has more than one argument, they must be returned within a ``list``. -A class method decorated with ``@method()`` or ``@dbus_property()`` may throw a :class:`DBusError ` to return a detailed error to the client if something goes wrong. +A class method decorated with ``@method()`` or ``@dbus_property()`` may throw a :class:`DBusError ` to return a detailed error to the client if something goes wrong. -After the service interface is defined, call :func:`MessageBus.export() ` on a connected message bus and the service will be made available on the given object path. +After the service interface is defined, call :func:`MessageBus.export() ` on a connected message bus and the service will be made available on the given object path. If any file descriptors are sent or received (DBus type ``h``), the variable refers to the file descriptor itself. You are responsible for closing any file descriptors sent or received by the bus. You must set the ``negotiate_unix_fd`` flag to ``True`` in the ``MessageBus`` constructor to use unix file descriptors. @@ -28,10 +28,10 @@ If any file descriptors are sent or received (DBus type ``h``), the variable ref .. code-block:: python3 - from dbus_next.aio import MessageBus - from dbus_next.service import (ServiceInterface, + from dbus_fast.aio import MessageBus + from dbus_fast.service import (ServiceInterface, method, dbus_property, signal) - from dbus_next import Variant, DBusError + from dbus_fast import Variant, DBusError import asyncio diff --git a/docs/source/high-level-service/service-interface.rst b/docs/source/high-level-service/service-interface.rst index 01fc449..f0cc89f 100644 --- a/docs/source/high-level-service/service-interface.rst +++ b/docs/source/high-level-service/service-interface.rst @@ -1,12 +1,12 @@ ServiceInterface ================ -.. autoclass:: dbus_next.service.ServiceInterface +.. autoclass:: dbus_fast.service.ServiceInterface :members: :undoc-members: -.. autodecorator:: dbus_next.service.dbus_property +.. autodecorator:: dbus_fast.service.dbus_property -.. autodecorator:: dbus_next.service.method +.. autodecorator:: dbus_fast.service.method -.. autodecorator:: dbus_next.service.signal +.. autodecorator:: dbus_fast.service.signal diff --git a/docs/source/index.rst b/docs/source/index.rst index 79cb88d..da66e81 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,7 +1,7 @@ Python DBus-Next Documentation ============================== -.. module:: dbus_next +.. module:: dbus_fast .. toctree:: :maxdepth: 3 diff --git a/docs/source/introspection.rst b/docs/source/introspection.rst index b155206..7c95c7f 100644 --- a/docs/source/introspection.rst +++ b/docs/source/introspection.rst @@ -1,26 +1,26 @@ Introspection ============= -.. autoclass:: dbus_next.introspection.Node +.. autoclass:: dbus_fast.introspection.Node :members: :undoc-members: -.. autoclass:: dbus_next.introspection.Interface +.. autoclass:: dbus_fast.introspection.Interface :members: :undoc-members: -.. autoclass:: dbus_next.introspection.Property +.. autoclass:: dbus_fast.introspection.Property :members: :undoc-members: -.. autoclass:: dbus_next.introspection.Method +.. autoclass:: dbus_fast.introspection.Method :members: :undoc-members: -.. autoclass:: dbus_next.introspection.Signal +.. autoclass:: dbus_fast.introspection.Signal :members: :undoc-members: -.. autoclass:: dbus_next.introspection.Arg +.. autoclass:: dbus_fast.introspection.Arg :members: :undoc-members: diff --git a/docs/source/low-level-interface/index.rst b/docs/source/low-level-interface/index.rst index ee56ebd..1d1f371 100644 --- a/docs/source/low-level-interface/index.rst +++ b/docs/source/low-level-interface/index.rst @@ -6,22 +6,22 @@ The Low Level Interface message -The low-level interface allows you to work with messages directly through the :class:`MessageBus ` with the :class:`Message ` class. This might be useful in the following cases: +The low-level interface allows you to work with messages directly through the :class:`MessageBus ` with the :class:`Message ` class. This might be useful in the following cases: - Implementing an application that works with DBus directly like ``dbus-send(1)`` or ``dbus-monitor(1)``. -- Creating a new implementation of the :class:`BaseMessageBus `. +- Creating a new implementation of the :class:`BaseMessageBus `. - Creating clients or services that use an alternative to the standard DBus interfaces. The primary methods and classes of the low-level interface are: -- :class:`Message ` -- :func:`MessageBus.send() ` -- :func:`MessageBus.add_message_handler() ` -- :func:`MessageBus.remove_message_handler() ` -- :func:`MessageBus.next_serial() ` -- :func:`aio.MessageBus.call() ` -- :func:`glib.MessageBus.call() ` -- :func:`glib.MessageBus.call_sync() ` +- :class:`Message ` +- :func:`MessageBus.send() ` +- :func:`MessageBus.add_message_handler() ` +- :func:`MessageBus.remove_message_handler() ` +- :func:`MessageBus.next_serial() ` +- :func:`aio.MessageBus.call() ` +- :func:`glib.MessageBus.call() ` +- :func:`glib.MessageBus.call_sync() ` Mixed use of the low and high level interfaces on the same bus connection is not recommended. diff --git a/docs/source/low-level-interface/message.rst b/docs/source/low-level-interface/message.rst index e9c9151..5070750 100644 --- a/docs/source/low-level-interface/message.rst +++ b/docs/source/low-level-interface/message.rst @@ -1,6 +1,6 @@ Message ======= -.. autoclass:: dbus_next.Message +.. autoclass:: dbus_fast.Message :members: :undoc-members: diff --git a/docs/source/message-bus/aio-message-bus.rst b/docs/source/message-bus/aio-message-bus.rst index 542a50d..5733450 100644 --- a/docs/source/message-bus/aio-message-bus.rst +++ b/docs/source/message-bus/aio-message-bus.rst @@ -1,7 +1,7 @@ aio.MessageBus ============== -.. autoclass:: dbus_next.aio.MessageBus +.. autoclass:: dbus_fast.aio.MessageBus :members: :inherited-members: :show-inheritance: diff --git a/docs/source/message-bus/base-message-bus.rst b/docs/source/message-bus/base-message-bus.rst index 3ea36d1..932a75d 100644 --- a/docs/source/message-bus/base-message-bus.rst +++ b/docs/source/message-bus/base-message-bus.rst @@ -1,5 +1,5 @@ BaseMessageBus ============== -.. autoclass:: dbus_next.message_bus.BaseMessageBus +.. autoclass:: dbus_fast.message_bus.BaseMessageBus :members: diff --git a/docs/source/message-bus/glib-message-bus.rst b/docs/source/message-bus/glib-message-bus.rst index d006e86..29472fe 100644 --- a/docs/source/message-bus/glib-message-bus.rst +++ b/docs/source/message-bus/glib-message-bus.rst @@ -1,7 +1,7 @@ glib.MessageBus =============== -.. autoclass:: dbus_next.glib.MessageBus +.. autoclass:: dbus_fast.glib.MessageBus :members: :inherited-members: :show-inheritance: diff --git a/docs/source/message-bus/index.rst b/docs/source/message-bus/index.rst index 1de821e..c742f65 100644 --- a/docs/source/message-bus/index.rst +++ b/docs/source/message-bus/index.rst @@ -10,7 +10,7 @@ The Message Bus The message bus manages a connection to the DBus daemon. It's capable of sending and receiving messages and wiring up the classes of the high level interfaces. -There are currently two implementations of the message bus depending on what main loop implementation you want to use. Use :class:`aio.MessageBus ` if you are using an asyncio main loop. Use :class:`glib.MessageBus ` if you are using a GLib main loop. +There are currently two implementations of the message bus depending on what main loop implementation you want to use. Use :class:`aio.MessageBus ` if you are using an asyncio main loop. Use :class:`glib.MessageBus ` if you are using a GLib main loop. For standalone applications, the asyncio message bus is preferable because it has a nice async/await api in place of the callback/synchronous interface of the GLib message bus. If your application is using other libraries that use the GLib main loop, such as a GTK application, the GLib implementation will be needed. However neither library is a requirement. diff --git a/docs/source/type-system/index.rst b/docs/source/type-system/index.rst index 1866526..7cc7018 100644 --- a/docs/source/type-system/index.rst +++ b/docs/source/type-system/index.rst @@ -51,14 +51,14 @@ below. | SIGNATURE | g | str | Must be a valid signature. | +-------------+-------+--------------------------------------+-------------------------------------------------------------------------+ | UNIX_FD | h | int | In the low-level interface, an index pointing to a file descriptor | -| | | | in the ``unix_fds`` member of the :class:`Message `. | +| | | | in the ``unix_fds`` member of the :class:`Message `. | | | | | In the high-level interface, it is the file descriptor itself. | +-------------+-------+--------------------------------------+-------------------------------------------------------------------------+ | ARRAY | a | list | Must be followed by a complete type which specifies the child type. | +-------------+-------+--------------------------------------+-------------------------------------------------------------------------+ | STRUCT | ( | list | Types in the Python ``list`` must match the types between the parens. | +-------------+-------+--------------------------------------+-------------------------------------------------------------------------+ -| VARIANT | v | :class:`Variant ` | This class is provided by the library. | +| VARIANT | v | :class:`Variant ` | This class is provided by the library. | | | | | | +-------------+-------+--------------------------------------+-------------------------------------------------------------------------+ | DICT_ENTRY | { | dict | Must be included in an array to be a ``dict``. | diff --git a/docs/source/type-system/signature-tree.rst b/docs/source/type-system/signature-tree.rst index 6560fdd..107e832 100644 --- a/docs/source/type-system/signature-tree.rst +++ b/docs/source/type-system/signature-tree.rst @@ -1,6 +1,6 @@ SignatureTree ============= -.. autoclass:: dbus_next.SignatureTree +.. autoclass:: dbus_fast.SignatureTree :members: :undoc-members: diff --git a/docs/source/type-system/signature-type.rst b/docs/source/type-system/signature-type.rst index d052cbb..1e250a1 100644 --- a/docs/source/type-system/signature-type.rst +++ b/docs/source/type-system/signature-type.rst @@ -1,7 +1,7 @@ SignatureType ============== -.. autoclass:: dbus_next.SignatureType +.. autoclass:: dbus_fast.SignatureType :members: :undoc-members: :exclude-members: signature diff --git a/docs/source/type-system/variant.rst b/docs/source/type-system/variant.rst index f09f550..ffb5f00 100644 --- a/docs/source/type-system/variant.rst +++ b/docs/source/type-system/variant.rst @@ -1,6 +1,6 @@ Variant ======= -.. autoclass:: dbus_next.Variant +.. autoclass:: dbus_fast.Variant :members: :undoc-members: diff --git a/docs/source/validators.rst b/docs/source/validators.rst index 337a406..07169c5 100644 --- a/docs/source/validators.rst +++ b/docs/source/validators.rst @@ -1,11 +1,11 @@ Validators ========== -.. autofunction:: dbus_next.is_bus_name_valid -.. autofunction:: dbus_next.is_member_name_valid -.. autofunction:: dbus_next.is_object_path_valid -.. autofunction:: dbus_next.is_interface_name_valid -.. autofunction:: dbus_next.assert_bus_name_valid -.. autofunction:: dbus_next.assert_member_name_valid -.. autofunction:: dbus_next.assert_object_path_valid -.. autofunction:: dbus_next.assert_interface_name_valid +.. autofunction:: dbus_fast.is_bus_name_valid +.. autofunction:: dbus_fast.is_member_name_valid +.. autofunction:: dbus_fast.is_object_path_valid +.. autofunction:: dbus_fast.is_interface_name_valid +.. autofunction:: dbus_fast.assert_bus_name_valid +.. autofunction:: dbus_fast.assert_member_name_valid +.. autofunction:: dbus_fast.assert_object_path_valid +.. autofunction:: dbus_fast.assert_interface_name_valid diff --git a/examples/aio-list-names.py b/examples/aio-list-names.py index 38706c3..cfb1bb2 100755 --- a/examples/aio-list-names.py +++ b/examples/aio-list-names.py @@ -7,8 +7,8 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/..")) import asyncio import json -from dbus_next import Message, MessageType -from dbus_next.aio import MessageBus +from dbus_fast import Message, MessageType +from dbus_fast.aio import MessageBus loop = asyncio.get_event_loop() diff --git a/examples/aio-tcp-notification.py b/examples/aio-tcp-notification.py index 73036fd..b9d69db 100755 --- a/examples/aio-tcp-notification.py +++ b/examples/aio-tcp-notification.py @@ -15,7 +15,7 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/..")) import asyncio -from dbus_next.aio import MessageBus +from dbus_fast.aio import MessageBus loop = asyncio.get_event_loop() diff --git a/examples/dbus-next-send.py b/examples/dbus-next-send.py index cf70587..f4bb7ea 100755 --- a/examples/dbus-next-send.py +++ b/examples/dbus-next-send.py @@ -8,9 +8,9 @@ import asyncio import json from argparse import OPTIONAL, ArgumentParser -from dbus_next import BusType, Message, MessageType, Variant -from dbus_next.aio import MessageBus -from dbus_next.validators import ( +from dbus_fast import BusType, Message, MessageType, Variant +from dbus_fast.aio import MessageBus +from dbus_fast.validators import ( is_bus_name_valid, is_interface_name_valid, is_member_name_valid, diff --git a/examples/example-service.py b/examples/example-service.py index 6a6932e..8ceb9a9 100755 --- a/examples/example-service.py +++ b/examples/example-service.py @@ -6,9 +6,9 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/..")) import asyncio -from dbus_next import Variant -from dbus_next.aio.message_bus import MessageBus -from dbus_next.service import ServiceInterface, dbus_property, method, signal +from dbus_fast import Variant +from dbus_fast.aio.message_bus import MessageBus +from dbus_fast.service import ServiceInterface, dbus_property, method, signal class ExampleInterface(ServiceInterface): diff --git a/examples/glib-list-names.py b/examples/glib-list-names.py index 20b79a1..649926c 100755 --- a/examples/glib-list-names.py +++ b/examples/glib-list-names.py @@ -7,10 +7,11 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/..")) import json import signal -from dbus_next import Message -from dbus_next.glib import MessageBus from gi.repository import GLib +from dbus_fast import Message +from dbus_fast.glib import MessageBus + main = GLib.MainLoop() bus = MessageBus().connect_sync() diff --git a/examples/mpris.py b/examples/mpris.py index bcd9417..79cd85d 100755 --- a/examples/mpris.py +++ b/examples/mpris.py @@ -6,7 +6,7 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/..")) import asyncio -from dbus_next.aio import MessageBus +from dbus_fast.aio import MessageBus loop = asyncio.get_event_loop() diff --git a/src/dbus_fast/__version__.py b/src/dbus_fast/__version__.py index 8e5494d..fe54c85 100644 --- a/src/dbus_fast/__version__.py +++ b/src/dbus_fast/__version__.py @@ -1,4 +1,4 @@ -__title__ = "dbus_next" +__title__ = "dbus_fast" __description__ = "A zero-dependency DBus library for Python with asyncio support" __url__ = "https://github.com/altdesktop/python-dbus-fast" __version__ = "0.2.3" diff --git a/src/dbus_fast/aio/message_bus.py b/src/dbus_fast/aio/message_bus.py index e5b7e4b..4416acb 100644 --- a/src/dbus_fast/aio/message_bus.py +++ b/src/dbus_fast/aio/message_bus.py @@ -109,17 +109,17 @@ class MessageBus(BaseMessageBus): library. It sets up a connection to the DBus daemon and exposes an interface to send and receive messages and expose services. - You must call :func:`connect() ` before + You must call :func:`connect() ` before using this message bus. :param bus_type: The type of bus to connect to. Affects the search path for the bus address. - :type bus_type: :class:`BusType ` + :type bus_type: :class:`BusType ` :param bus_address: A specific bus address to connect to. Should not be used under normal circumstances. :param auth: The authenticator to use, defaults to an instance of - :class:`AuthExternal `. - :type auth: :class:`Authenticator ` + :class:`AuthExternal `. + :type auth: :class:`Authenticator ` :param negotiate_unix_fd: Allow the bus to send and receive Unix file descriptors (DBus type 'h'). This must be supported by the transport. :type negotiate_unix_fd: bool @@ -159,10 +159,10 @@ class MessageBus(BaseMessageBus): This method must be called before the message bus can be used. :returns: This message bus for convenience. - :rtype: :class:`MessageBus ` + :rtype: :class:`MessageBus ` :raises: - - :class:`AuthError ` - If authorization to \ + - :class:`AuthError ` - If authorization to \ the DBus daemon failed. - :class:`Exception` - If there was a connection error. """ @@ -215,14 +215,14 @@ class MessageBus(BaseMessageBus): :type timeout: float :returns: The introspection data for the name at the path. - :rtype: :class:`Node ` + :rtype: :class:`Node ` :raises: - - :class:`InvalidObjectPathError ` \ + - :class:`InvalidObjectPathError ` \ - If the given object path is not valid. - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. - :class:`asyncio.TimeoutError` - Waited for future but time run out. @@ -247,15 +247,15 @@ class MessageBus(BaseMessageBus): :param name: The name to request. :type name: str :param flags: Name flags that affect the behavior of the name request. - :type flags: :class:`NameFlag ` + :type flags: :class:`NameFlag ` :returns: The reply to the name request. - :rtype: :class:`RequestNameReply ` + :rtype: :class:`RequestNameReply ` :raises: - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ @@ -278,12 +278,12 @@ class MessageBus(BaseMessageBus): :type name: str :returns: The reply to the release request. - :rtype: :class:`ReleaseNameReply ` + :rtype: :class:`ReleaseNameReply ` :raises: - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ @@ -303,12 +303,12 @@ class MessageBus(BaseMessageBus): """Send a method call and wait for a reply from the DBus daemon. :param msg: The method call message to send. - :type msg: :class:`Message ` + :type msg: :class:`Message ` :returns: A message in reply to the message sent. If the message does not expect a reply based on the message flags or type, returns ``None`` after the message is sent. - :rtype: :class:`Message ` or :class:`None` if no reply is expected. + :rtype: :class:`Message ` or :class:`None` if no reply is expected. :raises: - :class:`Exception` - If a connection error occurred. @@ -342,7 +342,7 @@ class MessageBus(BaseMessageBus): release of the library. :param msg: The message to send. - :type msg: :class:`Message ` + :type msg: :class:`Message ` :returns: A future that resolves when the message is sent or a connection error occurs. diff --git a/src/dbus_fast/aio/proxy_object.py b/src/dbus_fast/aio/proxy_object.py index 2fd4fd1..43f1e83 100644 --- a/src/dbus_fast/aio/proxy_object.py +++ b/src/dbus_fast/aio/proxy_object.py @@ -14,11 +14,11 @@ from ..signature import Variant class ProxyInterface(BaseProxyInterface): """A class representing a proxy to an interface exported on the bus by another client for the asyncio :class:`MessageBus - ` implementation. + ` implementation. This class is not meant to be constructed directly by the user. Use :func:`ProxyObject.get_interface() - ` on a asyncio proxy object to get + ` on a asyncio proxy object to get a proxy interface. This class exposes methods to call DBus methods, listen to signals, and get @@ -70,7 +70,7 @@ class ProxyInterface(BaseProxyInterface): must correspond to the type of the property in the interface definition. If the service returns an error for a DBus call, a :class:`DBusError - ` will be raised with information about the error. + ` will be raised with information about the error. """ def _add_method(self, intr_method): @@ -162,9 +162,9 @@ class ProxyInterface(BaseProxyInterface): class ProxyObject(BaseProxyObject): - """The proxy object implementation for the GLib :class:`MessageBus `. + """The proxy object implementation for the GLib :class:`MessageBus `. - For more information, see the :class:`BaseProxyObject `. + For more information, see the :class:`BaseProxyObject `. """ def __init__( diff --git a/src/dbus_fast/auth.py b/src/dbus_fast/auth.py index d83a6db..c491980 100644 --- a/src/dbus_fast/auth.py +++ b/src/dbus_fast/auth.py @@ -30,7 +30,7 @@ class _AuthResponse(enum.Enum): # UNSTABLE class Authenticator: - """The base class for authenticators for :class:`MessageBus ` authentication. + """The base class for authenticators for :class:`MessageBus ` authentication. In the future, the library may allow extending this class for custom authentication protocols. @@ -54,7 +54,7 @@ class Authenticator: class AuthExternal(Authenticator): """An authenticator class for the external auth protocol for use with the - :class:`MessageBus `. + :class:`MessageBus `. :sealso: https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol """ @@ -86,7 +86,7 @@ class AuthExternal(Authenticator): class AuthAnnonymous(Authenticator): """An authenticator class for the annonymous auth protocol for use with the - :class:`MessageBus `. + :class:`MessageBus `. :sealso: https://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol """ diff --git a/src/dbus_fast/glib/message_bus.py b/src/dbus_fast/glib/message_bus.py index 5b5b01d..fd62dcb 100644 --- a/src/dbus_fast/glib/message_bus.py +++ b/src/dbus_fast/glib/message_bus.py @@ -133,18 +133,18 @@ class MessageBus(BaseMessageBus): library. It sets up a connection to the DBus daemon and exposes an interface to send and receive messages and expose services. - You must call :func:`connect() ` or - :func:`connect_sync() ` before + You must call :func:`connect() ` or + :func:`connect_sync() ` before using this message bus. :param bus_type: The type of bus to connect to. Affects the search path for the bus address. - :type bus_type: :class:`BusType ` + :type bus_type: :class:`BusType ` :param bus_address: A specific bus address to connect to. Should not be used under normal circumstances. :param auth: The authenticator to use, defaults to an instance of - :class:`AuthExternal `. - :type auth: :class:`Authenticator ` + :class:`AuthExternal `. + :type auth: :class:`Authenticator ` :ivar connected: True if this message bus is expected to be able to send and receive messages. @@ -183,7 +183,7 @@ class MessageBus(BaseMessageBus): :param connect_notify: A callback that will be called with this message bus. May return an :class:`Exception` on connection errors or - :class:`AuthError ` on authorization errors. + :class:`AuthError ` on authorization errors. :type callback: :class:`Callable` """ @@ -235,10 +235,10 @@ class MessageBus(BaseMessageBus): message bus can be used. :returns: This message bus for convenience. - :rtype: :class:`MessageBus ` + :rtype: :class:`MessageBus ` :raises: - - :class:`AuthError ` - If authorization to \ + - :class:`AuthError ` - If authorization to \ the DBus daemon failed. - :class:`Exception` - If there was a connection error. """ @@ -267,7 +267,7 @@ class MessageBus(BaseMessageBus): daemon. :param msg: The method call message to send. - :type msg: :class:`Message ` + :type msg: :class:`Message ` :param reply_notify: A callback that will be called with the reply to this message. May return an :class:`Exception` on connection errors. :type reply_notify: Callable @@ -279,15 +279,15 @@ class MessageBus(BaseMessageBus): daemon. :param msg: The method call message to send. - :type msg: :class:`Message ` + :type msg: :class:`Message ` :returns: A message in reply to the message sent. If the message does not expect a reply based on the message flags or type, returns ``None`` immediately. - :rtype: :class:`Message ` + :rtype: :class:`Message ` :raises: - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ @@ -336,14 +336,14 @@ class MessageBus(BaseMessageBus): :type path: str :returns: The introspection data for the name at the path. - :rtype: :class:`Node ` + :rtype: :class:`Node ` :raises: - - :class:`InvalidObjectPathError ` \ + - :class:`InvalidObjectPathError ` \ - If the given object path is not valid. - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ @@ -376,15 +376,15 @@ class MessageBus(BaseMessageBus): :param name: The name to request. :type name: str :param flags: Name flags that affect the behavior of the name request. - :type flags: :class:`NameFlag ` + :type flags: :class:`NameFlag ` :returns: The reply to the name request. - :rtype: :class:`RequestNameReply ` + :rtype: :class:`RequestNameReply ` :raises: - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ @@ -416,12 +416,12 @@ class MessageBus(BaseMessageBus): :type name: str :returns: The reply to the release request. - :rtype: :class:`ReleaseNameReply ` + :rtype: :class:`ReleaseNameReply ` :raises: - - :class:`InvalidBusNameError ` - If \ + - :class:`InvalidBusNameError ` - If \ the given bus name is not valid. - - :class:`DBusError ` - If the service threw \ + - :class:`DBusError ` - If the service threw \ an error for the method call or returned an invalid result. - :class:`Exception` - If a connection error occurred. """ diff --git a/src/dbus_fast/glib/proxy_object.py b/src/dbus_fast/glib/proxy_object.py index da35c9e..f794664 100644 --- a/src/dbus_fast/glib/proxy_object.py +++ b/src/dbus_fast/glib/proxy_object.py @@ -18,12 +18,12 @@ except ImportError: class ProxyInterface(BaseProxyInterface): """A class representing a proxy to an interface exported on the bus by - another client for the GLib :class:`MessageBus ` + another client for the GLib :class:`MessageBus ` implementation. This class is not meant to be constructed directly by the user. Use :func:`ProxyObject.get_interface() - ` on a GLib proxy + ` on a GLib proxy object to get a proxy interface. This class exposes methods to call DBus methods, listen to signals, and get @@ -49,7 +49,7 @@ class ProxyInterface(BaseProxyInterface): To *asynchronously* call a method, provide a callback that takes an error as the first argument and a list as the second argument. If the call completed successfully, ``error`` will be :class:`None`. If the service - returns an error, it will be a :class:`DBusError ` + returns an error, it will be a :class:`DBusError ` with information about the error returned from the bus. The result will be a list of values that correspond to the *out args* of the introspection method definition. @@ -101,11 +101,11 @@ class ProxyInterface(BaseProxyInterface): To asynchronously get or set a property, provide a callback that takes an :class:`Exception` as the first argument. If the call completed successfully, ``error`` will be :class:`None`. If the service returns an - error, it will be a :class:`DBusError ` with + error, it will be a :class:`DBusError ` with information about the error returned from the bus. If the service returns an error for a synchronous DBus call, a - :class:`DBusError ` will be raised with information + :class:`DBusError ` will be raised with information about the error. """ @@ -288,9 +288,9 @@ class ProxyInterface(BaseProxyInterface): class ProxyObject(BaseProxyObject): - """The proxy object implementation for the asyncio :class:`MessageBus `. + """The proxy object implementation for the asyncio :class:`MessageBus `. - For more information, see the :class:`BaseProxyObject `. + For more information, see the :class:`BaseProxyObject `. """ def __init__( diff --git a/src/dbus_fast/introspection.py b/src/dbus_fast/introspection.py index 72bb871..a1558bc 100644 --- a/src/dbus_fast/introspection.py +++ b/src/dbus_fast/introspection.py @@ -16,16 +16,16 @@ class Arg: :ivar name: The name of this arg. :vartype name: str :ivar direction: Whether this is an input or an output argument. - :vartype direction: :class:`ArgDirection ` + :vartype direction: :class:`ArgDirection ` :ivar type: The parsed signature type of this argument. - :vartype type: :class:`SignatureType ` + :vartype type: :class:`SignatureType ` :ivar signature: The signature string of this argument. :vartype signature: str :raises: - - :class:`InvalidMemberNameError ` - If the name of the arg is not valid. - - :class:`InvalidSignatureError ` - If the signature is not valid. - - :class:`InvalidIntrospectionError ` - If the signature is not a single complete type. + - :class:`InvalidMemberNameError ` - If the name of the arg is not valid. + - :class:`InvalidSignatureError ` - If the signature is not valid. + - :class:`InvalidIntrospectionError ` - If the signature is not a single complete type. """ def __init__( @@ -63,10 +63,10 @@ class Arg: :param element: The parsed XML element. :type element: :class:`xml.etree.ElementTree.Element` :param direction: The direction of this arg. Must be specified because it can default to different values depending on if it's in a method or signal. - :type direction: :class:`ArgDirection ` + :type direction: :class:`ArgDirection ` :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ name = element.attrib.get("name") signature = element.attrib.get("type") @@ -102,7 +102,7 @@ class Signal: :vartype signature: str :raises: - - :class:`InvalidMemberNameError ` - If the name of the signal is not a valid member name. + - :class:`InvalidMemberNameError ` - If the name of the signal is not a valid member name. """ def __init__(self, name: str, args: List[Arg] = None): @@ -124,7 +124,7 @@ class Signal: :type is_root: bool :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ name = element.attrib.get("name") if not name: @@ -165,7 +165,7 @@ class Method: :vartype out_signature: str :raises: - - :class:`InvalidMemberNameError ` - If the name of this method is not valid. + - :class:`InvalidMemberNameError ` - If the name of this method is not valid. """ def __init__(self, name: str, in_args: List[Arg] = [], out_args: List[Arg] = []): @@ -188,7 +188,7 @@ class Method: :type is_root: bool :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ name = element.attrib.get("name") if not name: @@ -230,14 +230,14 @@ class Property: :ivar signature: The signature string for this property. Must be a single complete type. :vartype signature: str :ivar access: Whether this property is readable and writable. - :vartype access: :class:`PropertyAccess ` + :vartype access: :class:`PropertyAccess ` :ivar type: The parsed type of this property. - :vartype type: :class:`SignatureType ` + :vartype type: :class:`SignatureType ` :raises: - - :class:`InvalidIntrospectionError ` - If the property is not a single complete type. - - :class `InvalidSignatureError ` - If the given signature is not valid. - - :class: `InvalidMemberNameError ` - If the member name is not valid. + - :class:`InvalidIntrospectionError ` - If the property is not a single complete type. + - :class `InvalidSignatureError ` - If the given signature is not valid. + - :class: `InvalidMemberNameError ` - If the member name is not valid. """ def __init__( @@ -268,7 +268,7 @@ class Property: :type element: :class:`xml.etree.ElementTree.Element` :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ name = element.attrib.get("name") signature = element.attrib.get("type") @@ -306,7 +306,7 @@ class Interface: :vartype properties: list(:class:`Property`) :raises: - - :class:`InvalidInterfaceNameError ` - If the name is not a valid interface name. + - :class:`InvalidInterfaceNameError ` - If the name is not a valid interface name. """ def __init__( @@ -334,7 +334,7 @@ class Interface: :type element: :class:`xml.etree.ElementTree.Element` :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ name = element.attrib.get("name") if not name: @@ -377,12 +377,12 @@ class Node: This class is an essential building block for a high-level DBus interface. This is the underlying data structure for the :class:`ProxyObject - `. A :class:`ServiceInterface - ` definition is converted to this class + `. A :class:`ServiceInterface + ` definition is converted to this class to expose XML on the introspectable interface. :ivar interfaces: A list of interfaces exposed on this node. - :vartype interfaces: list(:class:`Interface `) + :vartype interfaces: list(:class:`Interface `) :ivar nodes: A list of child nodes. :vartype nodes: list(:class:`Node`) :ivar name: The object path of this node. @@ -391,7 +391,7 @@ class Node: :vartype is_root: bool :raises: - - :class:`InvalidIntrospectionError ` - If the name is not a valid node name. + - :class:`InvalidIntrospectionError ` - If the name is not a valid node name. """ def __init__( @@ -417,7 +417,7 @@ class Node: :type is_root: bool :raises: - - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the XML tree is not valid introspection data. """ node = Node(element.attrib.get("name"), is_root=is_root) @@ -439,7 +439,7 @@ class Node: :type data: str :raises: - - :class:`InvalidIntrospectionError ` - If the string is not valid introspection data. + - :class:`InvalidIntrospectionError ` - If the string is not valid introspection data. """ element = ET.fromstring(data) if element.tag != "node": diff --git a/src/dbus_fast/message.py b/src/dbus_fast/message.py index 78befe5..6413d7e 100644 --- a/src/dbus_fast/message.py +++ b/src/dbus_fast/message.py @@ -15,7 +15,7 @@ from .validators import ( class Message: """A class for sending and receiving messages through the - :class:`MessageBus ` with the + :class:`MessageBus ` with the low-level api. A ``Message`` can be constructed by the user to send over the message bus. diff --git a/src/dbus_fast/message_bus.py b/src/dbus_fast/message_bus.py index 331f6a1..9beb313 100644 --- a/src/dbus_fast/message_bus.py +++ b/src/dbus_fast/message_bus.py @@ -38,14 +38,14 @@ class BaseMessageBus: :param bus_type: The type of bus to connect to. Affects the search path for the bus address. - :type bus_type: :class:`BusType ` + :type bus_type: :class:`BusType ` :param bus_address: A specific bus address to connect to. Should not be used under normal circumstances. :type bus_address: str :param ProxyObject: The proxy object implementation for this message bus. Must be passed in by an implementation that supports the high-level client. :type ProxyObject: Type[:class:`BaseProxyObject - `] + `] :ivar unique_name: The unique name of the message bus connection. It will be :class:`None` until the message bus connects. @@ -111,10 +111,10 @@ class BaseMessageBus: :type path: str :param interface: The service interface to export. :type interface: :class:`ServiceInterface - ` + ` :raises: - - :class:`InvalidObjectPathError ` - If the given object path is not valid. + - :class:`InvalidObjectPathError ` - If the given object path is not valid. - :class:`ValueError` - If an interface with this name is already exported on the message bus at this path """ assert_object_path_valid(path) @@ -145,10 +145,10 @@ class BaseMessageBus: :param interface: The interface instance or the name of the interface to unexport. If ``None``, unexport every interface on the path. :type interface: :class:`ServiceInterface - ` or str or None + ` or str or None :raises: - - :class:`InvalidObjectPathError ` - If the given object path is not valid. + - :class:`InvalidObjectPathError ` - If the given object path is not valid. """ assert_object_path_valid(path) if type(interface) not in [str, type(None)] and not isinstance( @@ -202,12 +202,12 @@ class BaseMessageBus: :param path: The path to introspect. :type path: str :param callback: A callback that will be called with the introspection - data as a :class:`Node `. + data as a :class:`Node `. :type callback: :class:`Callable` :raises: - - :class:`InvalidObjectPathError ` - If the given object path is not valid. - - :class:`InvalidBusNameError ` - If the given bus name is not valid. + - :class:`InvalidObjectPathError ` - If the given object path is not valid. + - :class:`InvalidBusNameError ` - If the given bus name is not valid. """ BaseMessageBus._check_callback_type(callback) @@ -241,7 +241,7 @@ class BaseMessageBus: :type path: str :param interface: Exported service interface. :type interface: :class:`ServiceInterface - ` + ` """ if self._disconnected: return @@ -309,13 +309,13 @@ class BaseMessageBus: :param name: The name to request. :type name: str :param flags: Name flags that affect the behavior of the name request. - :type flags: :class:`NameFlag ` + :type flags: :class:`NameFlag ` :param callback: A callback that will be called with the reply of the - request as a :class:`RequestNameReply `. + request as a :class:`RequestNameReply `. :type callback: :class:`Callable` :raises: - - :class:`InvalidBusNameError ` - If the given bus name is not valid. + - :class:`InvalidBusNameError ` - If the given bus name is not valid. """ assert_bus_name_valid(name) @@ -360,11 +360,11 @@ class BaseMessageBus: :type name: str :param callback: A callback that will be called with the reply of the release request as a :class:`ReleaseNameReply - `. + `. :type callback: :class:`Callable` :raises: - - :class:`InvalidBusNameError ` - If the given bus name is not valid. + - :class:`InvalidBusNameError ` - If the given bus name is not valid. """ assert_bus_name_valid(name) @@ -408,15 +408,15 @@ class BaseMessageBus: :type path: str :param introspection: XML introspection data used to build the interfaces on the proxy object. - :type introspection: :class:`Node ` or str or :class:`ElementTree` + :type introspection: :class:`Node ` or str or :class:`ElementTree` :returns: A proxy object for the given path on the given name. - :rtype: :class:`BaseProxyObject ` + :rtype: :class:`BaseProxyObject ` :raises: - - :class:`InvalidBusNameError ` - If the given bus name is not valid. - - :class:`InvalidObjectPathError ` - If the given object path is not valid. - - :class:`InvalidIntrospectionError ` - If the introspection data for the node is not valid. + - :class:`InvalidBusNameError ` - If the given bus name is not valid. + - :class:`InvalidObjectPathError ` - If the given object path is not valid. + - :class:`InvalidIntrospectionError ` - If the introspection data for the node is not valid. """ if self._ProxyObject is None: raise Exception( @@ -440,7 +440,7 @@ class BaseMessageBus: def next_serial(self) -> int: """Get the next serial for this bus. This can be used as the ``serial`` - attribute of a :class:`Message ` to manually handle + attribute of a :class:`Message ` to manually handle the serial of messages. :returns: The next serial for the bus. @@ -455,7 +455,7 @@ class BaseMessageBus: """Add a custom message handler for incoming messages. The handler should be a callable that takes a :class:`Message - `. If the message is a method call, you may return + `. If the message is a method call, you may return another Message as a reply and it will be marked as handled. You may also return ``True`` to mark the message as handled without sending a reply. @@ -479,7 +479,7 @@ class BaseMessageBus: ): """Remove a message handler that was previously added by :func:`add_message_handler() - `. + `. :param handler: A message handler. :type handler: :class:`Callable` @@ -493,7 +493,7 @@ class BaseMessageBus: """Asynchronously send a message on the message bus. :param msg: The message to send. - :type msg: :class:`Message ` + :type msg: :class:`Message ` """ raise NotImplementedError( 'the "send" method must be implemented in the inheriting class' diff --git a/src/dbus_fast/proxy_object.py b/src/dbus_fast/proxy_object.py index 7a8d2c1..8ab4cee 100644 --- a/src/dbus_fast/proxy_object.py +++ b/src/dbus_fast/proxy_object.py @@ -35,9 +35,9 @@ class BaseProxyInterface: :ivar path: The object path exported on the client that owns the bus name. :vartype path: str :ivar introspection: Parsed introspection data for the proxy interface. - :vartype introspection: :class:`Node ` + :vartype introspection: :class:`Node ` :ivar bus: The message bus this proxy interface is connected to. - :vartype bus: :class:`BaseMessageBus ` + :vartype bus: :class:`BaseMessageBus ` """ def __init__(self, bus_name, path, introspection, bus): @@ -157,7 +157,7 @@ class BaseProxyObject: Implementations of this class are not meant to be constructed directly. Use :func:`BaseMessageBus.get_proxy_object() - ` to get a proxy + ` to get a proxy object. Each message bus implementation provides its own proxy object implementation that will be returned by that method. @@ -173,18 +173,18 @@ class BaseProxyObject: :ivar path: The object path exported on the client that owns the bus name. :vartype path: str :ivar introspection: Parsed introspection data for the proxy object. - :vartype introspection: :class:`Node ` + :vartype introspection: :class:`Node ` :ivar bus: The message bus this proxy object is connected to. - :vartype bus: :class:`BaseMessageBus ` + :vartype bus: :class:`BaseMessageBus ` :ivar ~.ProxyInterface: The proxy interface class this proxy object uses. - :vartype ~.ProxyInterface: Type[:class:`BaseProxyInterface `] + :vartype ~.ProxyInterface: Type[:class:`BaseProxyInterface `] :ivar child_paths: A list of absolute object paths of the children of this object. :vartype child_paths: list(str) :raises: - - :class:`InvalidBusNameError ` - If the given bus name is not valid. - - :class:`InvalidObjectPathError ` - If the given object path is not valid. - - :class:`InvalidIntrospectionError ` - If the introspection data for the node is not valid. + - :class:`InvalidBusNameError ` - If the given bus name is not valid. + - :class:`InvalidObjectPathError ` - If the given object path is not valid. + - :class:`InvalidIntrospectionError ` - If the introspection data for the node is not valid. """ def __init__( @@ -232,7 +232,7 @@ class BaseProxyObject: :type name: str :raises: - - :class:`InterfaceNotFoundError ` - If there is no interface by this name exported on the bus. + - :class:`InterfaceNotFoundError ` - If there is no interface by this name exported on the bus. """ if name in self._interfaces: return self._interfaces[name] diff --git a/src/dbus_fast/service.py b/src/dbus_fast/service.py index 20fb2b9..b24bb54 100644 --- a/src/dbus_fast/service.py +++ b/src/dbus_fast/service.py @@ -65,7 +65,7 @@ def method(name: str = None, disabled: bool = False): dbus-fast type system. If multiple parameters are returned, they must be contained within a :class:`list`. - The decorated method may raise a :class:`DBusError ` + The decorated method may raise a :class:`DBusError ` to return an error to the client. :param name: The member name that DBus clients will use to call this method. Defaults to the name of the class method. @@ -271,7 +271,7 @@ def dbus_property( The parameters of the getter and the setter must conform to the dbus-fast type system. The getter or the setter may raise a :class:`DBusError - ` to return an error to the client. + ` to return an error to the client. :param name: The name that DBus clients will use to interact with this property on the bus. @@ -311,12 +311,12 @@ class ServiceInterface: """An abstract class that can be extended by the user to define DBus services. Instances of :class:`ServiceInterface` can be exported on a path of the bus - with the :class:`export ` - method of a :class:`MessageBus `. + with the :class:`export ` + method of a :class:`MessageBus `. - Use the :func:`@method `, :func:`@dbus_property - `, and :func:`@signal - ` decorators to mark class methods as DBus + Use the :func:`@method `, :func:`@dbus_property + `, and :func:`@signal + ` decorators to mark class methods as DBus methods, properties, and signals respectively. :ivar name: The name of this interface as it appears to clients. Must be a @@ -402,7 +402,7 @@ class ServiceInterface: This might be useful for creating clients for the interface or examining the introspection output of an interface. :returns: The introspection data for the interface. - :rtype: :class:`dbus_next.introspection.Interface` + :rtype: :class:`dbus_fast.introspection.Interface` """ # TODO cannot be overridden by a dbus member return intr.Interface( diff --git a/src/dbus_fast/signature.py b/src/dbus_fast/signature.py index 6ad41bd..aea38ea 100644 --- a/src/dbus_fast/signature.py +++ b/src/dbus_fast/signature.py @@ -449,6 +449,6 @@ class Variant: return super().__eq__(other) def __repr__(self): - return "".format( + return "".format( self.type.signature, self.value ) diff --git a/tests/client/test_methods.py b/tests/client/test_methods.py index fd87359..fcdd281 100644 --- a/tests/client/test_methods.py +++ b/tests/client/test_methods.py @@ -1,10 +1,11 @@ from test.util import check_gi_repository, skip_reason_no_gi -import dbus_next.introspection as intr import pytest -from dbus_next import DBusError, aio, glib -from dbus_next.message import MessageFlag -from dbus_next.service import ServiceInterface, method + +import dbus_fast.introspection as intr +from dbus_fast import DBusError, aio, glib +from dbus_fast.message import MessageFlag +from dbus_fast.service import ServiceInterface, method has_gi = check_gi_repository() diff --git a/tests/client/test_properties.py b/tests/client/test_properties.py index 23800a7..e77b545 100644 --- a/tests/client/test_properties.py +++ b/tests/client/test_properties.py @@ -1,8 +1,9 @@ from test.util import check_gi_repository, skip_reason_no_gi import pytest -from dbus_next import DBusError, Message, aio, glib -from dbus_next.service import PropertyAccess, ServiceInterface, dbus_property + +from dbus_fast import DBusError, Message, aio, glib +from dbus_fast.service import PropertyAccess, ServiceInterface, dbus_property has_gi = check_gi_repository() diff --git a/tests/client/test_signals.py b/tests/client/test_signals.py index 4eeb083..0973616 100644 --- a/tests/client/test_signals.py +++ b/tests/client/test_signals.py @@ -1,9 +1,10 @@ import pytest -from dbus_next import Message -from dbus_next.aio import MessageBus -from dbus_next.constants import RequestNameReply -from dbus_next.introspection import Node -from dbus_next.service import ServiceInterface, signal + +from dbus_fast import Message +from dbus_fast.aio import MessageBus +from dbus_fast.constants import RequestNameReply +from dbus_fast.introspection import Node +from dbus_fast.service import ServiceInterface, signal class ExampleInterface(ServiceInterface): diff --git a/tests/service/test_decorators.py b/tests/service/test_decorators.py index 9655ae5..b1769ef 100644 --- a/tests/service/test_decorators.py +++ b/tests/service/test_decorators.py @@ -1,6 +1,6 @@ -from dbus_next import PropertyAccess -from dbus_next import introspection as intr -from dbus_next.service import ServiceInterface, dbus_property, method, signal +from dbus_fast import PropertyAccess +from dbus_fast import introspection as intr +from dbus_fast.service import ServiceInterface, dbus_property, method, signal class ExampleInterface(ServiceInterface): diff --git a/tests/service/test_export.py b/tests/service/test_export.py index 9cace6a..a3a0259 100644 --- a/tests/service/test_export.py +++ b/tests/service/test_export.py @@ -1,8 +1,9 @@ import pytest -from dbus_next import Message, MessageType -from dbus_next import introspection as intr -from dbus_next.aio import MessageBus -from dbus_next.service import ServiceInterface, method + +from dbus_fast import Message, MessageType +from dbus_fast import introspection as intr +from dbus_fast.aio import MessageBus +from dbus_fast.service import ServiceInterface, method standard_interfaces_count = len(intr.Node.default().interfaces) diff --git a/tests/service/test_methods.py b/tests/service/test_methods.py index 55930ec..6d4a93d 100644 --- a/tests/service/test_methods.py +++ b/tests/service/test_methods.py @@ -1,5 +1,6 @@ import pytest -from dbus_next import ( + +from dbus_fast import ( DBusError, ErrorType, Message, @@ -8,8 +9,8 @@ from dbus_next import ( SignatureTree, Variant, ) -from dbus_next.aio import MessageBus -from dbus_next.service import ServiceInterface, method +from dbus_fast.aio import MessageBus +from dbus_fast.service import ServiceInterface, method class ExampleInterface(ServiceInterface): diff --git a/tests/service/test_properties.py b/tests/service/test_properties.py index 491a93f..54a4f80 100644 --- a/tests/service/test_properties.py +++ b/tests/service/test_properties.py @@ -1,7 +1,8 @@ import asyncio import pytest -from dbus_next import ( + +from dbus_fast import ( DBusError, ErrorType, Message, @@ -9,8 +10,8 @@ from dbus_next import ( PropertyAccess, Variant, ) -from dbus_next.aio import MessageBus -from dbus_next.service import ServiceInterface, dbus_property, method +from dbus_fast.aio import MessageBus +from dbus_fast.service import ServiceInterface, dbus_property, method class ExampleInterface(ServiceInterface): diff --git a/tests/service/test_signals.py b/tests/service/test_signals.py index 0a83f48..6e1ab12 100644 --- a/tests/service/test_signals.py +++ b/tests/service/test_signals.py @@ -1,16 +1,17 @@ import asyncio import pytest -from dbus_next import Message, MessageType -from dbus_next.aio import MessageBus -from dbus_next.constants import PropertyAccess -from dbus_next.service import ( + +from dbus_fast import Message, MessageType +from dbus_fast.aio import MessageBus +from dbus_fast.constants import PropertyAccess +from dbus_fast.service import ( ServiceInterface, SignalDisabledError, dbus_property, signal, ) -from dbus_next.signature import Variant +from dbus_fast.signature import Variant class ExampleInterface(ServiceInterface): diff --git a/tests/service/test_standard_interfaces.py b/tests/service/test_standard_interfaces.py index 3471004..1537a0d 100644 --- a/tests/service/test_standard_interfaces.py +++ b/tests/service/test_standard_interfaces.py @@ -1,10 +1,11 @@ import pytest -from dbus_next import Message, MessageType -from dbus_next import introspection as intr -from dbus_next.aio import MessageBus -from dbus_next.constants import ErrorType -from dbus_next.service import PropertyAccess, ServiceInterface, dbus_property -from dbus_next.signature import Variant + +from dbus_fast import Message, MessageType +from dbus_fast import introspection as intr +from dbus_fast.aio import MessageBus +from dbus_fast.constants import ErrorType +from dbus_fast.service import PropertyAccess, ServiceInterface, dbus_property +from dbus_fast.signature import Variant standard_interfaces_count = len(intr.Node.default().interfaces) diff --git a/tests/test_address_parser.py b/tests/test_address_parser.py index b116abe..c65d856 100644 --- a/tests/test_address_parser.py +++ b/tests/test_address_parser.py @@ -1,4 +1,4 @@ -from dbus_next._private.address import parse_address +from dbus_fast._private.address import parse_address def test_valid_addresses(): diff --git a/tests/test_aio_low_level.py b/tests/test_aio_low_level.py index 930beb7..92e0c3a 100644 --- a/tests/test_aio_low_level.py +++ b/tests/test_aio_low_level.py @@ -1,6 +1,7 @@ import pytest -from dbus_next import Message, MessageFlag, MessageType -from dbus_next.aio import MessageBus + +from dbus_fast import Message, MessageFlag, MessageType +from dbus_fast.aio import MessageBus @pytest.mark.asyncio diff --git a/tests/test_big_message.py b/tests/test_big_message.py index dd5ac97..55dcaba 100644 --- a/tests/test_big_message.py +++ b/tests/test_big_message.py @@ -1,8 +1,9 @@ from test.util import check_gi_repository, skip_reason_no_gi import pytest -from dbus_next import Message, MessageType, aio, glib -from dbus_next.service import ServiceInterface, method + +from dbus_fast import Message, MessageType, aio, glib +from dbus_fast.service import ServiceInterface, method has_gi = check_gi_repository() diff --git a/tests/test_disconnect.py b/tests/test_disconnect.py index 83909a8..80f92a0 100644 --- a/tests/test_disconnect.py +++ b/tests/test_disconnect.py @@ -2,8 +2,9 @@ import functools import os import pytest -from dbus_next import Message -from dbus_next.aio import MessageBus + +from dbus_fast import Message +from dbus_fast.aio import MessageBus @pytest.mark.asyncio diff --git a/tests/test_fd_passing.py b/tests/test_fd_passing.py index e50a4c0..21d3033 100644 --- a/tests/test_fd_passing.py +++ b/tests/test_fd_passing.py @@ -2,10 +2,11 @@ import os import pytest -from dbus_next import Message, MessageType -from dbus_next.aio import MessageBus -from dbus_next.service import ServiceInterface, dbus_property, method, signal -from dbus_next.signature import SignatureTree, Variant + +from dbus_fast import Message, MessageType +from dbus_fast.aio import MessageBus +from dbus_fast.service import ServiceInterface, dbus_property, method, signal +from dbus_fast.signature import SignatureTree, Variant def open_file(): diff --git a/tests/test_glib_low_level.py b/tests/test_glib_low_level.py index fa971fc..fcc3105 100644 --- a/tests/test_glib_low_level.py +++ b/tests/test_glib_low_level.py @@ -1,8 +1,9 @@ from test.util import check_gi_repository, skip_reason_no_gi import pytest -from dbus_next import Message, MessageFlag, MessageType -from dbus_next.glib import MessageBus + +from dbus_fast import Message, MessageFlag, MessageType +from dbus_fast.glib import MessageBus has_gi = check_gi_repository() diff --git a/tests/test_introspection.py b/tests/test_introspection.py index 0ff0ed5..ba8794d 100644 --- a/tests/test_introspection.py +++ b/tests/test_introspection.py @@ -1,7 +1,7 @@ import os -from dbus_next import ArgDirection, PropertyAccess, SignatureType -from dbus_next import introspection as intr +from dbus_fast import ArgDirection, PropertyAccess, SignatureType +from dbus_fast import introspection as intr example_data = open(f"{os.path.dirname(__file__)}/data/introspection.xml").read() diff --git a/tests/test_marshaller.py b/tests/test_marshaller.py index 1ea4bf7..14e3bef 100644 --- a/tests/test_marshaller.py +++ b/tests/test_marshaller.py @@ -2,8 +2,8 @@ import io import json import os -from dbus_next import Message, SignatureTree, Variant -from dbus_next._private.unmarshaller import Unmarshaller +from dbus_fast import Message, SignatureTree, Variant +from dbus_fast._private.unmarshaller import Unmarshaller def print_buf(buf): diff --git a/tests/test_request_name.py b/tests/test_request_name.py index 557c5bb..1ddce9e 100644 --- a/tests/test_request_name.py +++ b/tests/test_request_name.py @@ -1,7 +1,8 @@ from test.util import check_gi_repository, skip_reason_no_gi import pytest -from dbus_next import ( + +from dbus_fast import ( Message, MessageType, NameFlag, diff --git a/tests/test_signature.py b/tests/test_signature.py index 9ccc963..6eab88e 100644 --- a/tests/test_signature.py +++ b/tests/test_signature.py @@ -1,6 +1,7 @@ import pytest -from dbus_next import SignatureBodyMismatchError, SignatureTree, Variant -from dbus_next._private.util import signature_contains_type + +from dbus_fast import SignatureBodyMismatchError, SignatureTree, Variant +from dbus_fast._private.util import signature_contains_type def assert_simple_type(signature, type_): diff --git a/tests/test_tcp_address.py b/tests/test_tcp_address.py index e59e224..b6f4c78 100644 --- a/tests/test_tcp_address.py +++ b/tests/test_tcp_address.py @@ -2,9 +2,10 @@ import asyncio import os import pytest -from dbus_next import Message -from dbus_next._private.address import parse_address -from dbus_next.aio import MessageBus + +from dbus_fast import Message +from dbus_fast._private.address import parse_address +from dbus_fast.aio import MessageBus @pytest.mark.asyncio diff --git a/tests/test_validators.py b/tests/test_validators.py index 391d8dd..e184c09 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -1,4 +1,4 @@ -from dbus_next import ( +from dbus_fast import ( is_bus_name_valid, is_interface_name_valid, is_member_name_valid,