Skip to content

Commit

Permalink
Renamed basic methods of dbus objects to use dbus_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
igo95862 committed Jan 29, 2021
1 parent 9d79fa9 commit 9eaeaa5
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 21 deletions.
7 changes: 4 additions & 3 deletions docs/asyncio_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ Classes
for interfaces that sd-bus already provides such as
``org.freedesktop.DBus.Peer``.

.. py:method:: ping()
.. py:method:: dbus_ping()
:async:

Pings the remote object using dbus.
Usefull to test if remote object is alive.

.. py:method:: get_machine_id()
.. py:method:: dbus_machine_id()
:async:

Returns the machine UUID of the remote object.

:return: machine UUID
:rtype: str

.. py:method:: introspect()
.. py:method:: dbus_introspect()
:async:

Get dbus introspection XML.

It is users responsibility to parse that data.

:return: string with introspection XML
Expand Down
10 changes: 6 additions & 4 deletions docs/sync_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ Classes
Optional dbus connection object.
If not passed the default dbus will be used.

.. py:method:: ping()
.. py:method:: dbus_ping()
Pings the remote object using dbus.

Usefull to test if remote object is alive.

.. py:method:: get_machine_id()
.. py:method:: dbus_machine_id()
Returns the machine UUID of the remote object.

:return: machine UUID
:rtype: str

.. py:method:: introspect()
.. py:method:: dbus_introspect()
Get dbus introspection XML.

It is users responsibility to parse that data.

:return: string with introspection XML
Expand Down
12 changes: 6 additions & 6 deletions sdbus/dbus_proxy_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,12 +707,12 @@ class DbusPeerInterfaceAsync(
serving_enabled=False,
):

@dbus_method_async()
async def ping(self) -> None:
@dbus_method_async(method_name='Ping')
async def dbus_ping(self) -> None:
raise NotImplementedError

@dbus_method_async()
async def get_machine_id(self) -> str:
@dbus_method_async(method_name='GetMachineId')
async def dbus_machine_id(self) -> str:
raise NotImplementedError


Expand All @@ -722,8 +722,8 @@ class DbusIntrospectableAsync(
serving_enabled=False,
):

@dbus_method_async()
async def introspect(self) -> str:
@dbus_method_async(method_name='Introspect')
async def dbus_introspect(self) -> str:
raise NotImplementedError


Expand Down
12 changes: 6 additions & 6 deletions sdbus/dbus_proxy_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ class DbusPeerInterface(
serving_enabled=False,
):

@dbus_method()
def ping(self) -> None:
@dbus_method(method_name='Ping')
def dbus_ping(self) -> None:
raise NotImplementedError

@dbus_method()
def get_machine_id(self) -> str:
@dbus_method(method_name='GetMachineId')
def dbus_machine_id(self) -> str:
raise NotImplementedError


Expand All @@ -307,8 +307,8 @@ class DbusIntrospectable(
serving_enabled=False,
):

@dbus_method()
def introspect(self) -> str:
@dbus_method(method_name='Introspect')
def dbus_introspect(self) -> str:
raise NotImplementedError


Expand Down
4 changes: 3 additions & 1 deletion test/test_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class TestFreedesktopDbus(TempDbusTest):
async def test_connection(self) -> None:
dbus_object = FreedesktopDbus(self.bus)

await dbus_object.ping()
await dbus_object.dbus_ping()
await dbus_object.dbus_introspect()
await dbus_object.dbus_machine_id()
self.assertIsInstance(await dbus_object.get_id(), str)
self.assertIsInstance(await dbus_object.features, list)

Expand Down
2 changes: 1 addition & 1 deletion test/test_sd_bus_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def asyncSetUp(self) -> None:
self.test_object_connection = TestInterface.new_connect(
"org.example.test", '/', self.bus)

await self.test_object_connection.ping()
await self.test_object_connection.dbus_ping()

async def test_method_kwargs(self) -> None:

Expand Down
3 changes: 3 additions & 0 deletions test/test_sd_bus_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class TestSync(TestCase):

def test_sync(self) -> None:
s = FreedesktopDbus()
s.dbus_ping()
s.dbus_introspect()
s.dbus_machine_id()

self.assertIsInstance(s.get_id(), str)
self.assertIsInstance(s.features, list)
Expand Down

0 comments on commit 9eaeaa5

Please sign in to comment.