]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / PackageDocumentTools / plugins / EdkPlugins / edk2 / model / baseobject.py
index 7c120d85c255995e9b2d8adc1ae9fd55036b9d40..ee00529f464bc51e1bfed35fa7e08e5b97aca079 100644 (file)
@@ -2,18 +2,12 @@
 #\r
 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
-# This program and the accompanying materials are licensed and made available\r
-# under the terms and conditions of the BSD License which accompanies this\r
-# distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
-import plugins.EdkPlugins.basemodel.ini as ini\r
-import plugins.EdkPlugins.edk2.model.dsc as dsc\r
-import plugins.EdkPlugins.edk2.model.inf as inf\r
-import plugins.EdkPlugins.edk2.model.dec as dec\r
+from plugins.EdkPlugins.basemodel import ini\r
+from plugins.EdkPlugins.edk2.model import dsc\r
+from plugins.EdkPlugins.edk2.model import inf\r
+from plugins.EdkPlugins.edk2.model import dec\r
 import os\r
 from plugins.EdkPlugins.basemodel.message import *\r
 \r
@@ -25,8 +19,8 @@ class SurfaceObject(object):
         @return: instance of this class\r
 \r
         """\r
-        obj = object.__new__(cls, *args, **kwargs)\r
-        if not cls._objs.has_key("None"):\r
+        obj = object.__new__(cls)\r
+        if "None" not in cls._objs:\r
             cls._objs["None"] = []\r
         cls._objs["None"].append(obj)\r
 \r
@@ -47,7 +41,7 @@ class SurfaceObject(object):
         self.GetFileObj().Destroy(self)\r
         del self._fileObj\r
         # dereference self from _objs arrary\r
-        assert self._objs.has_key(key), "when destory, object is not in obj list"\r
+        assert key in self._objs, "when destory, object is not in obj list"\r
         assert self in self._objs[key], "when destory, object is not in obj list"\r
         self._objs[key].remove(self)\r
         if len(self._objs[key]) == 0:\r
@@ -95,7 +89,7 @@ class SurfaceObject(object):
         if self not in cls._objs["None"]:\r
             ErrorMsg("Sufrace object does not be create into None list")\r
         cls._objs["None"].remove(self)\r
-        if not cls._objs.has_key(relativePath):\r
+        if relativePath not in cls._objs:\r
             cls._objs[relativePath] = []\r
         cls._objs[relativePath].append(self)\r
 \r
@@ -655,13 +649,13 @@ class Package(SurfaceObject):
         return self._pcds\r
 \r
     def GetPpis(self):\r
-        return self._ppis.values()\r
+        return list(self._ppis.values())\r
 \r
     def GetProtocols(self):\r
-        return self._protocols.values()\r
+        return list(self._protocols.values())\r
 \r
     def GetGuids(self):\r
-        return self._guids.values()\r
+        return list(self._guids.values())\r
 \r
     def Destroy(self):\r
         for pcd in self._pcds.values():\r
@@ -846,7 +840,7 @@ class SurfaceItem(object):
                 ErrorMsg("%s item is duplicated defined in packages: %s and %s" %\r
                          (name, parent.GetFilename(), cls._objs[name].GetParent().GetFilename()))\r
                 return None\r
-            obj = object.__new__(cls, *args, **kwargs)\r
+            obj = object.__new__(cls)\r
             cls._objs[name] = obj\r
             return obj\r
         elif issubclass(parent.__class__, Module):\r