Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making timeout and other arguments that are passed to the dbus-python method keyword only arguments #22

Open
mulkieran opened this issue Jul 23, 2018 · 1 comment
Assignees

Comments

@mulkieran
Copy link
Member

mulkieran commented Jul 23, 2018

See current source for dbus_function:

            dbus_method = proxy_object.get_dbus_method(
                name, dbus_interface=interface_name)

            try:
                return dbus_method(*xformed_args, timeout=timeout)
            except dbus.DBusException as err:
                arg_str = ", ".join(str(arg) for arg in xformed_args)
                err_msg = ("Error while invoking method \"%s\" belonging to "
                           "interface \"%s\" with arguments (%s)") % (
                               name, interface_name, arg_str)
                raise DPClientInvocationError(err_msg, interface_name,
                                              DPClientMethodCallContext(
                                                  name, xformed_args)) from err

Here it is obvious that the arguments are used to locate the appropriate D-Bus method to call, while timeout is an argument to that method.

Note that it is not so obvious in the Get and Set property methods, but probably should be:

            try:
                return proxy_object.Get(
                    interface_name,
                    name,
                    dbus_interface=dbus.PROPERTIES_IFACE,
                    timeout=timeout)
            except dbus.DBusException as err:
                err_msg = ("Error while getting value for property \"%s\" "
                           "belonging to interface \"%s\"") % (name,
                                                               interface_name)
                raise DPClientInvocationError(
                    err_msg, interface_name,
                    DPClientGetPropertyContext(name)) from err
@mulkieran
Copy link
Member Author

Also, consider making dbus_func func_args a keyword argument so that it has a default value, so it doesn't have to be explicitly specified by callers.

@mulkieran mulkieran self-assigned this Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant