#\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
\r
-from message import *\r
+from __future__ import absolute_import\r
+from .message import *\r
import re\r
import os\r
\r
@return: instance of this class\r
\r
"""\r
- if len(args) == 0: return object.__new__(cls, *args, **kwargs)\r
+ if len(args) == 0: return object.__new__(cls)\r
filename = args[0]\r
parent = None\r
if len(args) > 1:\r
\r
key = os.path.normpath(filename)\r
if key not in cls._objs.keys():\r
- cls._objs[key] = object.__new__(cls, *args, **kwargs)\r
+ cls._objs[key] = object.__new__(cls)\r
\r
- if parent != None:\r
+ if parent is not None:\r
cls._objs[key].AddParent(parent)\r
\r
return cls._objs[key]\r
self._isModify = True\r
\r
def AddParent(self, parent):\r
- if parent == None: return\r
+ if parent is None: return\r
if not hasattr(self, "_parents"):\r
self._parents = []\r
\r
continue\r
\r
m = section_re.match(templine)\r
- if m!= None: # found a section\r
+ if m is not None: # found a section\r
inGlobal = False\r
# Finish the latest section first\r
if len(sObjs) != 0:\r
sObj = self.GetSectionInstance(self, name, (len(sname_arr) > 1))\r
sObj._start = index\r
sObjs.append(sObj)\r
- if not self._sections.has_key(name.lower()):\r
+ if name.lower() not in self._sections:\r
self._sections[name.lower()] = [sObj]\r
else:\r
self._sections[name.lower()].append(sObj)\r
def Destroy(self, parent):\r
\r
# check referenced parent\r
- if parent != None:\r
+ if parent is not None:\r
assert parent in self._parents, "when destory ini object, can not found parent reference!"\r
self._parents.remove(parent)\r
\r
visit += 1\r
continue\r
line = line.split('#')[0].strip()\r
- if iniObj != None:\r
+ if iniObj is not None:\r
if line.endswith('}'):\r
iniObj._end = visit - self._start\r
if not iniObj.Parse():\r