]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/StringUtils.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / Common / StringUtils.py
index f667c4c91640f8fc0f0365ec099410ae5d1d4aae..0febbc0034a4d5690ffae959614489570dce9a95 100644 (file)
@@ -2,18 +2,13 @@
 # This file is used to define common string related functions used in parsing process\r
 #\r
 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this 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
 ##\r
 # Import Modules\r
 #\r
+from __future__ import absolute_import\r
 import re\r
 from . import DataType\r
 import Common.LongFilePathOs as os\r
@@ -31,7 +26,7 @@ gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
 \r
 ## GetSplitValueList\r
 #\r
-# Get a value list from a string with multiple values splited with SplitTag\r
+# Get a value list from a string with multiple values split with SplitTag\r
 # The default SplitTag is DataType.TAB_VALUE_SPLIT\r
 # 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']\r
 #\r
@@ -87,7 +82,7 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
 \r
 ## GetSplitList\r
 #\r
-# Get a value list from a string with multiple values splited with SplitString\r
+# Get a value list from a string with multiple values split with SplitString\r
 # The default SplitTag is DataType.TAB_VALUE_SPLIT\r
 # 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']\r
 #\r
@@ -98,7 +93,7 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
 # @retval list() A list for splitted string\r
 #\r
 def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):\r
-    return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))\r
+    return list(map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)))\r
 \r
 ## MergeArches\r
 #\r
@@ -122,7 +117,7 @@ def MergeArches(Dict, Key, Arch):
 # Return False if invalid format\r
 #\r
 # @param String:   String with DEFINE statement\r
-# @param Arch:     Supportted Arch\r
+# @param Arch:     Supported Arch\r
 # @param Defines:  DEFINE statement to be parsed\r
 #\r
 # @retval 0   DEFINE statement found, and valid\r
@@ -148,7 +143,7 @@ def GenDefines(String, Arch, Defines):
 #\r
 # @param String:        String with INCLUDE statement\r
 # @param IncludeFiles:  INCLUDE statement to be parsed\r
-# @param Arch:          Supportted Arch\r
+# @param Arch:          Supported Arch\r
 #\r
 # @retval True\r
 # @retval False\r
@@ -296,7 +291,7 @@ def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=
 ## NormPath\r
 #\r
 # Create a normal path\r
-# And replace DFEINE in the path\r
+# And replace DEFINE in the path\r
 #\r
 # @param Path:     The input value for Path to be converted\r
 # @param Defines:  A set for DEFINE statement\r
@@ -544,7 +539,7 @@ def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCh
                 #\r
                 LineList[1] = CleanString(LineList[1], CommentCharacter)\r
                 if ValueSplitFlag:\r
-                    Value = map(string.strip, LineList[1].split(ValueSplitCharacter))\r
+                    Value = list(map(string.strip, LineList[1].split(ValueSplitCharacter)))\r
                 else:\r
                     Value = CleanString(LineList[1], CommentCharacter).splitlines()\r
 \r
@@ -729,9 +724,9 @@ def WorkspaceFile(WorkspaceDir, Filename):
 \r
 ## Split string\r
 #\r
-# Revmove '"' which startswith and endswith string\r
+# Remove '"' which startswith and endswith string\r
 #\r
-# @param String:  The string need to be splited\r
+# @param String:  The string need to be split\r
 #\r
 # @retval String: The string after removed '""'\r
 #\r
@@ -750,7 +745,7 @@ def SplitString(String):
 # @param StringList:  A list for strings to be converted\r
 #\r
 def ConvertToSqlString(StringList):\r
-    return map(lambda s: s.replace("'", "''"), StringList)\r
+    return list(map(lambda s: s.replace("'", "''"), StringList))\r
 \r
 ## Convert To Sql String\r
 #\r