Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
[(vmId, vmPort, gwPort), ...] ==> {vmId: [VmPortTranslation, ...], ...} 

            @staticmethod
    def fromTuple(tup):
        """ [(vmId, vmPort, gwPort), ...] ==> {vmId: [VmPortTranslation, ...], ...} """
        result = {}
        for vmId, vmPort, gwPort in tup:
            if not result.has_key(vmId):
                result[vmId] = VmPortTranslation(vmid=vmId)
            result[vmId].add(vmPort, gwPort)
        return result
        


src/s/t/stratuslab-client-14.03.0/stratuslab/pat/Client.py   stratuslab-client(Download)
    def getPortTranslation(self, vmId=None):
        query = self._buildQuery(vmId)
        rawPorts = self._executeQuery(query)
        return VmPortTranslation.fromTuple(rawPorts)