Commit 2b5b0fe9 authored by Iustin Pop's avatar Iustin Pop
Browse files

Replace dict() with {}



The network patches and an existing test added function-call based
dict construction as opposed to literal sintax.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 7a476bb5
......@@ -1339,7 +1339,7 @@ def _BuildNetworkHookEnv(name, subnet, gateway, network6, gateway6,
@param tags: the tags of the network
 
"""
env = dict()
env = {}
if name:
env["NETWORK_NAME"] = name
if subnet:
......@@ -12841,7 +12841,7 @@ class LUInstanceSetParams(LogicalUnit):
This runs on the master, primary and secondaries.
 
"""
args = dict()
args = {}
if constants.BE_MINMEM in self.be_new:
args["minmem"] = self.be_new[constants.BE_MINMEM]
if constants.BE_MAXMEM in self.be_new:
......@@ -16062,7 +16062,7 @@ class LUNetworkConnect(LogicalUnit):
self.cfg.GetNodeGroupInstances(self.group_uuid)
 
def BuildHooksEnv(self):
ret = dict()
ret = {}
ret["GROUP_NAME"] = self.group_name
ret["GROUP_NETWORK_MODE"] = self.network_mode
ret["GROUP_NETWORK_LINK"] = self.network_link
......@@ -16077,7 +16077,7 @@ class LUNetworkConnect(LogicalUnit):
l = lambda value: ", ".join("%s: %s/%s" % (i[0], i[1], i[2])
for i in value)
 
self.netparams = dict()
self.netparams = {}
self.netparams[constants.NIC_MODE] = self.network_mode
self.netparams[constants.NIC_LINK] = self.network_link
objects.NIC.CheckParameterSyntax(self.netparams)
......@@ -16158,7 +16158,7 @@ class LUNetworkDisconnect(LogicalUnit):
self.cfg.GetNodeGroupInstances(self.group_uuid)
 
def BuildHooksEnv(self):
ret = dict()
ret = {}
ret["GROUP_NAME"] = self.group_name
ret.update(_BuildNetworkHookEnvByObject(self.network))
return ret
......
#!/usr/bin/python
#
# Copyright (C) 2011 Google Inc.
# Copyright (C) 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -286,7 +286,7 @@ class TestRunningTimeout(unittest.TestCase):
class TestJoinDisjointDicts(unittest.TestCase):
def setUp(self):
self.non_empty_dict = {"a": 1, "b": 2}
self.empty_dict = dict()
self.empty_dict = {}
def testWithEmptyDicts(self):
self.assertEqual(self.empty_dict, algo.JoinDisjointDicts(self.empty_dict,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment