1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2024-10-26 16:25:10 +03:00
libvirt-python/libvirt-override-virNetwork.py
Philipp Hahn 5777008197 override: Convert to list comprehension
:%s/retlist = list()\n\s*\(for \w\+ in ret\):\n\s*retlist.append(\(.*\))\n\n\s*return retlist/return [\2 \1]/

Signed-off-by: Philipp Hahn <hahn@univention.de>
2020-08-18 09:48:25 +00:00

8 lines
381 B
Python

def listAllPorts(self, flags: int = 0) -> List['virNetworkPort']:
"""List all ports on the network and returns a list of network port objects"""
ret = libvirtmod.virNetworkListAllPorts(self._o, flags)
if ret is None:
raise libvirtError("virNetworkListAllPorts() failed")
return [virNetworkPort(self, _obj=domptr) for domptr in ret]