On Fri, 2013-09-20 at 17:07 +0200, Radek Vykydal wrote:
..as I promised
pyanaconda/nm.py | 307 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 216 insertions(+), 91 deletions(-)
diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py index 880c9df..3c587dc 100644 --- a/pyanaconda/nm.py +++ b/pyanaconda/nm.py @@ -104,7 +104,11 @@ def _get_property(object_path, prop, interface_name_suffix=""): return prop.unpack()[0]
def nm_state():
- """Return state of NetworkManager"""
- """Return state of NetworkManager
- :return: state of NetworkManager
- :rtype: integer
- """ return _get_property("/org/freedesktop/NetworkManager", "State")
# FIXME - use just GLOBAL? There is some connectivity checking @@ -112,17 +116,29 @@ def nm_state(): # and how it is implemented. # Also see Gio g_network_monitor_can_reach. def nm_is_connected():
- """Is NetworkManager connected?"""
- """Is NetworkManager connected?
- :return: True if NM is connected, False otherwise.
- :rtype: bool
- """ return nm_state() in (NetworkManager.State.CONNECTED_GLOBAL, NetworkManager.State.CONNECTED_SITE, NetworkManager.State.CONNECTED_LOCAL)
def nm_is_connecting():
- """Is NetworkManager connecting?"""
- """Is NetworkManager connecting?
- :return: True if NM is in CONNECTING state, False otherwise.
- :rtype: bool
- """ return nm_state() == NetworkManager.State.CONNECTING
def nm_devices():
- """Return list of network device names supported in installer"""
"""Return names of network devices supported in installer.
:return: names of network devices supported in installer
:rtype: list of strings
"""
interfaces = []
@@ -145,7 +161,11 @@ def nm_devices(): return interfaces
def nm_activated_devices():
- """Return list of names of activated network devices"""
"""Return names of activated network devices.
:return: names of activated network devices
:rtype: list of strings
"""
interfaces = []
@@ -185,9 +205,14 @@ def _device_type_specific_interface(device): def nm_device_property(name, prop): """Return value of device NM property
Exceptions:UnknownDeviceError if device is not foundPropertyNotFoundError if property is not found
:param name: name of device:type name: str:param prop: property:type name: str:return: value of device's property:rtype: unpacked GDBus value:raise UnknownDeviceError if device is not found """:raise PropertyNotFoundError if property is not found
I think the above should be :raise PropertyNotFoundError: if property is not found
with the colon after the exception type which applies to a bunch of other places from the patch. Otherwise this looks good to me, nice!