From 2b5b0fe9e97dcdc824d559c6853f914517748094 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 21 Nov 2012 17:14:36 +0100
Subject: [PATCH] Replace dict() with {}

The network patches and an existing test added function-call based
dict construction as opposed to literal sintax.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>
---
 lib/cmdlib.py                      | 10 +++++-----
 test/ganeti.utils.algo_unittest.py |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 2f3aab7ee..df275c389 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -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
diff --git a/test/ganeti.utils.algo_unittest.py b/test/ganeti.utils.algo_unittest.py
index 5d08e2ea8..73475ec38 100755
--- a/test/ganeti.utils.algo_unittest.py
+++ b/test/ganeti.utils.algo_unittest.py
@@ -1,7 +1,7 @@
 #!/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,
-- 
GitLab