Skip to content

Commit

Permalink
BaseTools: remove the super() function argument
Browse files Browse the repository at this point in the history
Cc: Liming Gao <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
  • Loading branch information
yunhuafx authored and Yonghong Zhu committed Oct 13, 2018
1 parent 5135cc4 commit 4ce4f75
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions BaseTools/Source/Python/AutoGen/AutoGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
# if it exists, just return it directly
return cls.__ObjectCache[Key]
# it didnt exist. create it, cache it, then return it
RetVal = cls.__ObjectCache[Key] = super(AutoGen, cls).__new__(cls)
RetVal = cls.__ObjectCache[Key] = super().__new__(cls)
return RetVal

def __init__ (self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
super(AutoGen, self).__init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
super().__init__()

## hash() operator
#
Expand Down Expand Up @@ -235,7 +235,7 @@ class WorkspaceAutoGen(AutoGen):
# call super().__init__ then call the worker function with different parameter count
def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
if not hasattr(self, "_Init"):
super(WorkspaceAutoGen, self).__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
super().__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
self._Init = True

Expand Down Expand Up @@ -973,7 +973,7 @@ class PlatformAutoGen(AutoGen):
# call super().__init__ then call the worker function with different parameter count
def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
if not hasattr(self, "_Init"):
super(PlatformAutoGen, self).__init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
super().__init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch)
self._Init = True
#
Expand Down Expand Up @@ -2425,7 +2425,7 @@ class ModuleAutoGen(AutoGen):
# call super().__init__ then call the worker function with different parameter count
def __init__(self, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
if not hasattr(self, "_Init"):
super(ModuleAutoGen, self).__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
super().__init__(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args)
self._Init = True

Expand All @@ -2439,7 +2439,7 @@ def __new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs):
EdkLogger.verbose("Module [%s] for [%s] is not employed by active platform\n" \
% (MetaFile, Arch))
return None
return super(ModuleAutoGen, cls).__new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
return super().__new__(cls, Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)

## Initialize ModuleAutoGen
#
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/Python/AutoGen/ValidCheckingInfoObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __eq__(self, validObj):

class VAR_CHECK_PCD_VALID_LIST(VAR_CHECK_PCD_VALID_OBJ):
def __init__(self, VarOffset, validlist, PcdDataType):
super(VAR_CHECK_PCD_VALID_LIST, self).__init__(VarOffset, validlist, PcdDataType)
super().__init__(VarOffset, validlist, PcdDataType)
self.Type = 1
valid_num_list = []
for item in self.rawdata:
Expand All @@ -261,7 +261,7 @@ def __init__(self, VarOffset, validlist, PcdDataType):

class VAR_CHECK_PCD_VALID_RANGE(VAR_CHECK_PCD_VALID_OBJ):
def __init__(self, VarOffset, validrange, PcdDataType):
super(VAR_CHECK_PCD_VALID_RANGE, self).__init__(VarOffset, validrange, PcdDataType)
super().__init__(VarOffset, validrange, PcdDataType)
self.Type = 2
RangeExpr = ""
i = 0
Expand Down
4 changes: 2 additions & 2 deletions BaseTools/Source/Python/Common/Expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def IntToStr(Value):

class BaseExpression(object):
def __init__(self, *args, **kwargs):
super(BaseExpression, self).__init__()
super().__init__()

# Check if current token matches the operators given from parameter
def _IsOperator(self, OpSet):
Expand Down Expand Up @@ -324,7 +324,7 @@ def Eval(Operator, Oprand1, Oprand2 = None):
return Val

def __init__(self, Expression, SymbolTable={}):
super(ValueExpression, self).__init__(self, Expression, SymbolTable)
super().__init__(self, Expression, SymbolTable)
self._NoProcess = False
if not isinstance(Expression, type('')):
self._Expr = Expression
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/Python/Common/RangeExpression.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def Eval(self, Operator, Oprand1, Oprand2 = None):


def __init__(self, Expression, PcdDataType, SymbolTable = {}):
super(RangeExpression, self).__init__(self, Expression, PcdDataType, SymbolTable)
super().__init__(self, Expression, PcdDataType, SymbolTable)
self._NoProcess = False
if not isinstance(Expression, type('')):
self._Expr = Expression
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/Python/Workspace/BuildClassObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __init__(self, StructuredPcdIncludeFile=None, Packages=None, Name=None, Guid
expressions = []
if Packages is None:
Packages = []
super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
super().__init__(Name, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, validlists, expressions)
self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None else StructuredPcdIncludeFile
self.PackageDecs = Packages
self.DefaultStoreName = [default_store]
Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/Python/Workspace/MetaFileParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __new__(Class, FilePath, *args, **kwargs):
if FilePath in Class.MetaFiles:
return Class.MetaFiles[FilePath]
else:
ParserObject = super(MetaFileParser, Class).__new__(Class)
ParserObject = super().__new__(Class)
Class.MetaFiles[FilePath] = ParserObject
return ParserObject

Expand Down
2 changes: 1 addition & 1 deletion BaseTools/Source/Python/Workspace/WorkspaceCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class OrderedListDict(OrderedDict):
def __init__(self, *args, **kwargs):
super(OrderedListDict, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.default_factory = list

def __missing__(self, key):
Expand Down

0 comments on commit 4ce4f75

Please sign in to comment.