diff --git a/src/abstract/v00/configuration.py b/src/abstract/v00/configuration.py index a46bde4..b8ac7fd 100644 --- a/src/abstract/v00/configuration.py +++ b/src/abstract/v00/configuration.py @@ -81,7 +81,7 @@ def get_Text(self) -> str: # -------------------------------------------------------------------- def Delete(self, withLineIfLast: bool): - assert type(withLineIfLast) == bool # noqa: E721 + assert type(withLineIfLast) is bool RaiseError.MethodIsNotImplemented(__class__, "Delete") @@ -162,7 +162,7 @@ def get_File(self) -> PostgresConfigurationFile: # -------------------------------------------------------------------- def Delete(self, withLine: bool): - assert type(withLine) == bool # noqa: E721 + assert type(withLine) is bool RaiseError.MethodIsNotImplemented(__class__, "Delete") @@ -182,27 +182,27 @@ def __len__(self) -> int: def AddComment( self, text: str, offset: typing.Optional[int] ) -> PostgresConfigurationComment: - assert type(text) == str # noqa: E721 - assert (offset is None) or (type(offset) == int) # noqa: E721 + assert type(text) is str + assert (offset is None) or (type(offset) is int) RaiseError.MethodIsNotImplemented(__class__, "AddComment") # -------------------------------------------------------------------- def AddOption( self, name: str, value: any, offset: typing.Optional[int] ) -> PostgresConfigurationOption: - assert type(name) == str # noqa: E721 + assert type(name) is str assert name != "" assert value is not None - assert (offset is None) or (type(offset) == int) # noqa: E721 + assert (offset is None) or (type(offset) is int) RaiseError.MethodIsNotImplemented(__class__, "AddOption") # -------------------------------------------------------------------- def AddInclude( self, path: str, offset: typing.Optional[int] ) -> PostgresConfigurationInclude: - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" - assert (offset is None) or (type(offset) == int) # noqa: E721 + assert (offset is None) or (type(offset) is int) RaiseError.MethodIsNotImplemented(__class__, "AddInclude") # -------------------------------------------------------------------- @@ -271,19 +271,19 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine: # -------------------------------------------------------------------- def AddComment(self, text: str) -> PostgresConfigurationComment: - assert type(text) == str # noqa: E721 + assert type(text) is str RaiseError.MethodIsNotImplemented(__class__, "AddComment") # -------------------------------------------------------------------- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption: - assert type(name) == str # noqa: E721 + assert type(name) is str assert name != "" assert value is not None RaiseError.MethodIsNotImplemented(__class__, "AddOption") # -------------------------------------------------------------------- def AddInclude(self, path: str) -> PostgresConfigurationInclude: - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" RaiseError.MethodIsNotImplemented(__class__, "AddInclude") @@ -301,7 +301,7 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude: def SetOptionValue( self, name: str, value: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str # noqa: E721 + assert type(name) is str assert name != "" RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue") @@ -314,14 +314,14 @@ def SetOptionValue( # - None if option is not found in this file. # def GetOptionValue(self, name: str) -> any: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") # -------------------------------------------------------------------- def SetOptionValueItem( self, name: str, value_item: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str # noqa: E721 + assert type(name) is str assert name != "" assert value_item is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem") @@ -375,13 +375,13 @@ def __init__(self): # interface ---------------------------------------------------------- def AddTopLevelFile(self, path: str) -> PostgresConfigurationFile: - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" RaiseError.MethodIsNotImplemented(__class__, "AddTopLevelFile") # -------------------------------------------------------------------- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption: - assert type(name) == str # noqa: E721 + assert type(name) is str assert name != "" assert value is not None RaiseError.MethodIsNotImplemented(__class__, "AddOption") @@ -400,7 +400,7 @@ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption: def SetOptionValue( self, name: str, value: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue") # -------------------------------------------------------------------- @@ -412,14 +412,14 @@ def SetOptionValue( # - None if option is not found. # def GetOptionValue(self, name: str) -> any: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") # -------------------------------------------------------------------- def SetOptionValueItem( self, name: str, value_item: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str # noqa: E721 + assert type(name) is str assert value_item is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem") diff --git a/src/core/bugcheck_error.py b/src/core/bugcheck_error.py index 06e3c55..76566e3 100644 --- a/src/core/bugcheck_error.py +++ b/src/core/bugcheck_error.py @@ -9,15 +9,15 @@ class BugCheckError: def UnkObjectDataType(objectType: type): assert objectType is not None - assert type(objectType) == type # noqa: E721 + assert type(objectType) is type errMsg = "[BUG CHECK] Unknown object data type [{0}].".format(objectType) raise Exception(errMsg) # -------------------------------------------------------------------- def MultipleDefOfOptionIsFound(optName: str, count: int): - assert type(optName) == str # noqa: E721 - assert type(count) == int # noqa: E721 + assert type(optName) is str + assert type(count) is int errMsg = ( "[BUG CHECK] Multiple definitition of option [{0}] is found - {1}.".format( @@ -28,8 +28,8 @@ def MultipleDefOfOptionIsFound(optName: str, count: int): # -------------------------------------------------------------------- def UnkOptObjectDataType(optName: str, optDataType: type): - assert type(optName) == str # noqa: E721 - assert type(optDataType) == type # noqa: E721 + assert type(optName) is str + assert type(optDataType) is type errMsg = ( "[BUG CHECK] Unknown type of the option object data [{0}] - {1}.".format( @@ -40,8 +40,8 @@ def UnkOptObjectDataType(optName: str, optDataType: type): # -------------------------------------------------------------------- def MultipleDefOfFileIsFound(fileName: str, count: int): - assert type(fileName) == str # noqa: E721 - assert type(count) == int # noqa: E721 + assert type(fileName) is str + assert type(count) is int errMsg = ( "[BUG CHECK] Multiple definitition of file [{0}] is found - {1}.".format( @@ -52,8 +52,8 @@ def MultipleDefOfFileIsFound(fileName: str, count: int): # -------------------------------------------------------------------- def UnkFileObjectDataType(fileName: str, fileDataType: type): - assert type(fileName) == str # noqa: E721 - assert type(fileDataType) == type # noqa: E721 + assert type(fileName) is str + assert type(fileDataType) is type errMsg = "[BUG CHECK] Unknown type of the file object data [{0}] - {1}.".format( fileName, fileDataType.__name__ @@ -62,7 +62,7 @@ def UnkFileObjectDataType(fileName: str, fileDataType: type): # -------------------------------------------------------------------- def UnkFileDataStatus(filePath: str, fileStatus: any): - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str assert fileStatus is not None errMsg = "[BUG CHECK] Unknown file data status [{0}] - {1}.".format( @@ -72,8 +72,8 @@ def UnkFileDataStatus(filePath: str, fileStatus: any): # -------------------------------------------------------------------- def FileIsNotFoundInIndex(fileKey: str, filePath: str): - assert type(fileKey) == str # noqa: E721 - assert type(filePath) == str # noqa: E721 + assert type(fileKey) is str + assert type(filePath) is str errMsg = "[BUG CHECK] File [{0}][{1}] is not found in index.".format( fileKey, filePath @@ -82,14 +82,14 @@ def FileIsNotFoundInIndex(fileKey: str, filePath: str): # -------------------------------------------------------------------- def OptionIsNotFoundInIndex(optName: str): - assert type(optName) == str # noqa: E721 + assert type(optName) is str errMsg = "[BUG CHECK] Option [{0}] is not found in index.".format(optName) raise Exception(errMsg) # -------------------------------------------------------------------- def OptionIsNotFoundInFileLine(optName: str): - assert type(optName) == str # noqa: E721 + assert type(optName) is str errMsg = "[BUG CHECK] Option [{0}] is not found in file line.".format(optName) raise Exception(errMsg) @@ -111,7 +111,7 @@ def FileLineIsNotFoundInFile(): # -------------------------------------------------------------------- def OptionHandlerToPrepareSetValueIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValue for [{0}] is not defined.".format( name @@ -120,7 +120,7 @@ def OptionHandlerToPrepareSetValueIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToPrepareGetValueIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToPrepareGetValue for [{0}] is not defined.".format( name @@ -129,7 +129,7 @@ def OptionHandlerToPrepareGetValueIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToPrepareSetValueItemIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValueItem for [{0}] is not defined.".format( name @@ -138,7 +138,7 @@ def OptionHandlerToPrepareSetValueItemIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToSetValueIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToSetValue for [{0}] is not defined.".format( name @@ -147,7 +147,7 @@ def OptionHandlerToSetValueIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToGetValueIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToGetValue for [{0}] is not defined.".format( name @@ -156,7 +156,7 @@ def OptionHandlerToGetValueIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToAddOptionIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = ( "[BUG CHECK] OptionHandlerToAddOption for [{0}] is not defined.".format( @@ -167,7 +167,7 @@ def OptionHandlerToAddOptionIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToSetValueItemIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = ( "[BUG CHECK] OptionHandlerToSetValueItem for [{0}] is not defined.".format( @@ -178,7 +178,7 @@ def OptionHandlerToSetValueItemIsNotDefined(name: str): # -------------------------------------------------------------------- def OptionHandlerToWriteIsNotDefined(name: str): - assert type(name) == str # noqa: E721 + assert type(name) is str errMsg = "[BUG CHECK] OptionHandlerToWrite for [{0}] is not defined.".format( name @@ -187,9 +187,9 @@ def OptionHandlerToWriteIsNotDefined(name: str): # -------------------------------------------------------------------- def UnexpectedSituation(bugcheckSrc: str, bugcheckPoint: str, explain: str): - assert type(bugcheckSrc) == str # noqa: E721 - assert type(bugcheckPoint) == str # noqa: E721 - assert explain is None or type(explain) == str # noqa: E721 + assert type(bugcheckSrc) is str + assert type(bugcheckPoint) is str + assert explain is None or type(explain) is str errMsg = "[BUG CHECK] Unexpected situation in [{0}][{1}].".format( bugcheckSrc, bugcheckPoint @@ -205,9 +205,9 @@ def UnexpectedSituation(bugcheckSrc: str, bugcheckPoint: str, explain: str): # -------------------------------------------------------------------- def UnknownOptionValueType(optionName: str, typeOfOptionValue: type): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionName != "" - assert type(typeOfOptionValue) == type # noqa: E721 + assert type(typeOfOptionValue) is type errMsg = "[BUG CHECK] Unknown value type [{1}] of option [{0}].".format( optionName, typeOfOptionValue.__name__ diff --git a/src/core/controller_utils.py b/src/core/controller_utils.py index dab2366..78ba8b4 100644 --- a/src/core/controller_utils.py +++ b/src/core/controller_utils.py @@ -28,15 +28,15 @@ class DataControllerUtils: def Option__set_Value(optionData: PgCfgModel__OptionData, value: any): - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert value is not None optionData.m_Value = value # -------------------------------------------------------------------- def Option__add_ValueItem(optionData: PgCfgModel__OptionData, valueItem: any): - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData + assert type(optionData.m_Value) is list assert valueItem is not None optionData.m_Value.append(valueItem) @@ -47,13 +47,13 @@ def Option__delete( optionData: PgCfgModel__OptionData, withLine: bool, ): - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 - assert type(withLine) == bool # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(optionData) is PgCfgModel__OptionData + assert type(withLine) is bool fileLineData = optionData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData __class__.Helper__DeleteOption(cfgData, optionData) @@ -70,13 +70,13 @@ def Include__delete( includeData: PgCfgModel__IncludeData, withLine: bool, ): - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 - assert type(withLine) == bool # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(includeData) is PgCfgModel__IncludeData + assert type(withLine) is bool fileLineData = includeData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData __class__.Helper__DeleteInclude(includeData) @@ -93,9 +93,9 @@ def Comment__delete( commentData: PgCfgModel__CommentData, withLineIfLast: bool, ): - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 - assert type(withLineIfLast) == bool # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(commentData) is PgCfgModel__CommentData + assert type(withLineIfLast) is bool commentData.IsAlive() @@ -103,7 +103,7 @@ def Comment__delete( fileLineData = commentData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData __class__.Helper__DeleteComment(commentData) @@ -119,10 +119,10 @@ def Comment__delete( def FileLine__add_Comment( fileLineData: PgCfgModel__FileLineData, offset: typing.Optional[int], text: str ) -> PgCfgModel__CommentData: - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert (offset is None) or (type(offset) == int) # noqa: E721 - assert type(text) == str # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert (offset is None) or (type(offset) is int) + assert type(text) is str + assert type(fileLineData.m_Items) is list assert fileLineData.IsAlive() @@ -137,8 +137,8 @@ def FileLine__add_Comment( def Helper__CheckThatWeCanAddCommentToFileLine( fileLineData: PgCfgModel__FileLineData, ): - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list assert fileLineData.IsAlive() @@ -148,7 +148,7 @@ def Helper__CheckThatWeCanAddCommentToFileLine( lastItem = fileLineData.m_Items[-1] assert lastItem is not None - assert type(lastItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(lastItem) is PgCfgModel__FileLineData.tagItem assert lastItem.m_Element is not None assert isinstance(lastItem.m_Element, PgCfgModel__FileLineElementData) @@ -160,7 +160,7 @@ def Helper__CheckThatWeCanAddCommentToFileLine( if typeOfLastElement == PgCfgModel__IncludeData: return - if typeOfLastElement == PgCfgModel__CommentData: + if typeOfLastElement is PgCfgModel__CommentData: RaiseError.FileLineAlreadyHasComment() BugCheckError.UnkObjectDataType(typeOfLastElement) @@ -172,11 +172,11 @@ def FileLine__add_Include( fileData: PgCfgModel__FileData, offset: typing.Optional[int], ) -> PgCfgModel__IncludeData: - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(filePath) == str # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(filePath) is str + assert type(fileData) is PgCfgModel__FileData assert filePath != "" - assert offset is None or type(offset) == int # noqa: E721 + assert offset is None or type(offset) is int assert fileLineData.IsAlive() assert fileData.IsAlive() @@ -199,21 +199,21 @@ def FileLine__add_Option( optValue: any, optOffset: typing.Optional[int], ) -> PgCfgModel__OptionData: - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(optName) is str assert optValue is not None assert optName != "" - assert type(fileLineData.m_Items) == list # noqa: E721 - assert optOffset is None or type(optOffset) == int # noqa: E721 + assert type(fileLineData.m_Items) is list + assert optOffset is None or type(optOffset) is int __class__.Helper__CheckThatWeCanAddWorkDataToFileLine(fileLineData) fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict optionData = PgCfgModel__OptionData(fileLineData, optOffset, optName, optValue) fileLineDataItem = PgCfgModel__FileLineData.tagItem(optionData) @@ -234,7 +234,7 @@ def FileLine__add_Option( ) raise except: # rollback - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list assert len(fileLineData.m_Items) > 0 assert fileLineData.m_Items[-1] is fileLineDataItem assert fileLineData.m_Items[-1].m_Element is optionData @@ -247,8 +247,8 @@ def FileLine__add_Option( def Helper__CheckThatWeCanAddWorkDataToFileLine( fileLineData: PgCfgModel__FileLineData, ): - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list assert fileLineData.IsAlive() @@ -258,7 +258,7 @@ def Helper__CheckThatWeCanAddWorkDataToFileLine( lastItem = fileLineData.m_Items[-1] assert lastItem is not None - assert type(lastItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(lastItem) is PgCfgModel__FileLineData.tagItem assert lastItem.m_Element is not None assert isinstance(lastItem.m_Element, PgCfgModel__FileLineElementData) @@ -270,7 +270,7 @@ def Helper__CheckThatWeCanAddWorkDataToFileLine( if typeOfLastElement == PgCfgModel__IncludeData: RaiseError.FileLineAlreadyHasIncludeDirective() - if typeOfLastElement == PgCfgModel__CommentData: + if typeOfLastElement is PgCfgModel__CommentData: RaiseError.FileLineAlreadyHasComment() BugCheckError.UnkObjectDataType(typeOfLastElement) @@ -281,8 +281,8 @@ def FileLine__delete( ): assert cfgData is not None assert fileLineData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() __class__.Helper__DeleteFileLine(cfgData, fileLineData) @@ -295,11 +295,11 @@ def FileLine__clear( ): assert cfgData is not None assert fileLineData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list return __class__.Helper__ClearFileLine(cfgData, fileLineData) @@ -310,35 +310,35 @@ def File__add_Option( optName: str, optValue: any, ) -> PgCfgModel__OptionData: - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileData) is PgCfgModel__FileData + assert type(optName) is str assert optValue is not None newLineData = DataControllerUtils.File__add_Line(fileData) # raise - assert type(newLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(newLineData) is PgCfgModel__FileLineData try: optionData = __class__.FileLine__add_Option( cfgData, newLineData, optName, optValue, None ) # raise - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.m_Name == optName except: DataControllerUtils.FileLine__delete(cfgData, newLineData) raise assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() return optionData # -------------------------------------------------------------------- def File__add_Line(fileData: PgCfgModel__FileData) -> PgCfgModel__FileLineData: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(fileData.m_Lines) is list lineData = PgCfgModel__FileLineData(fileData) fileData.m_Lines.append(lineData) @@ -348,18 +348,18 @@ def File__add_Line(fileData: PgCfgModel__FileData) -> PgCfgModel__FileLineData: def Cfg__CreateAndAddTopLevelFile__AUTO( cfgData: PgCfgModel__ConfigurationData, file_name: str ) -> PgCfgModel__FileData: - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(cfgData.m_Files) == list # noqa: E721 - assert type(cfgData.m_AllFilesByName) == dict # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(cfgData.m_Files) is list + assert type(cfgData.m_AllFilesByName) is dict assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(file_name) == str # noqa: E721 + assert type(file_name) is str assert file_name != "" assert cfgData.OsOps.Path_BaseName(file_name) == file_name newFilePath = cfgData.OsOps.Path_Join(cfgData.m_DataDir, file_name) newFilePath = cfgData.OsOps.Path_NormPath(newFilePath) - assert type(newFilePath) == str # noqa: E721 + assert type(newFilePath) is str assert newFilePath != "" return __class__.Helper__FinishCreateTopLevelFile(cfgData, newFilePath) @@ -368,22 +368,22 @@ def Cfg__CreateAndAddTopLevelFile__AUTO( def Cfg__CreateAndAddTopLevelFile__USER( cfgData: PgCfgModel__ConfigurationData, path: str ) -> PgCfgModel__FileData: - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(cfgData.m_Files) == list # noqa: E721 - assert type(cfgData.m_AllFilesByName) == dict # noqa: E721 - assert type(path) == str # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(cfgData.m_Files) is list + assert type(cfgData.m_AllFilesByName) is dict + assert type(path) is str assert isinstance(cfgData.OsOps, ConfigurationOsOps) assert path != "" newFilePath = Helpers.NormalizeFilePath(cfgData.OsOps, cfgData.m_DataDir, path) - assert type(newFilePath) == str # noqa: E721 + assert type(newFilePath) is str assert newFilePath != "" # TODO: use index for fileData in cfgData.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.IsAlive() if fileData.m_Path == newFilePath: @@ -395,23 +395,23 @@ def Cfg__CreateAndAddTopLevelFile__USER( def Cfg__GetOrCreateFile__USER( cfgData: PgCfgModel__ConfigurationData, baseFolder: str, path: str ) -> PgCfgModel__FileData: - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(cfgData.m_Files) == list # noqa: E721 - assert type(cfgData.m_AllFilesByName) == dict # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(cfgData.m_Files) is list + assert type(cfgData.m_AllFilesByName) is dict assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(baseFolder) == str # noqa: E721 - assert type(path) == str # noqa: E721 + assert type(baseFolder) is str + assert type(path) is str assert path != "" newFilePath = Helpers.NormalizeFilePath(cfgData.OsOps, baseFolder, path) - assert type(newFilePath) == str # noqa: E721 + assert type(newFilePath) is str assert newFilePath != "" # TODO: use index for fileData in cfgData.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.IsAlive() if fileData.m_Path == newFilePath: @@ -446,16 +446,16 @@ def Helper__FindIndexOfFileLine( ) -> int: assert fileData is not None assert fileLineData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(fileData.m_Lines) == list # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(fileData.m_Lines) is list + assert type(fileLineData) is PgCfgModel__FileLineData cFileLines = len(fileData.m_Lines) for iFileLine in range(cFileLines): ptr = fileData.m_Lines[iFileLine] assert ptr is not None - assert type(ptr) == PgCfgModel__FileLineData # noqa: E721 + assert type(ptr) is PgCfgModel__FileLineData assert ptr.m_Parent is fileData if ptr is fileLineData: @@ -471,8 +471,8 @@ def Helper__FindIndexOfFileLineElement( ) -> int: assert fileLineData is not None assert elementData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list assert isinstance(elementData, PgCfgModel__FileLineElementData) cItems = len(fileLineData.m_Items) @@ -480,7 +480,7 @@ def Helper__FindIndexOfFileLineElement( for iItem in range(cItems): ptr = fileLineData.m_Items[iItem] assert ptr is not None - assert type(ptr) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(ptr) is PgCfgModel__FileLineData.tagItem assert ptr.m_Element is not None if ptr.m_Element is elementData: @@ -495,16 +495,16 @@ def Helper__RegFileInCfgData( ): assert cfgData is not None assert fileData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(fileData.m_Path) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(fileData.m_Path) is str assert fileData.m_Path != "" assert fileData.IsAlive() fileName = cfgData.OsOps.Path_BaseName(fileData.m_Path) - assert type(fileName) == str # noqa: E721 + assert type(fileName) is str assert fileName != "" __class__.Helper__InsertFileIntoIndex( @@ -517,15 +517,15 @@ def Helper__UnRegFileFromCfgData( ): assert cfgData is not None assert fileData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_Path != "" assert fileData.IsAlive() fileName = cfgData.OsOps.Path_BaseName(fileData.m_Path) - assert type(fileName) == str # noqa: E721 + assert type(fileName) is str assert fileName != "" __class__.Helper__DeleteFileIntoIndex( @@ -538,9 +538,9 @@ def Helper__InsertFileIntoIndex( fileKey: str, fileData: PgCfgModel__FileData, ): - assert type(filesByStrKeyDictionary) == dict # noqa: E721 - assert type(fileKey) == str # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(filesByStrKeyDictionary) is dict + assert type(fileKey) is str + assert type(fileData) is PgCfgModel__FileData assert fileKey != "" assert fileData.IsAlive() @@ -553,11 +553,11 @@ def Helper__InsertFileIntoIndex( if indexItemData is PgCfgModel__FileData: filesByStrKeyDictionary[fileKey] = [indexItemData, fileData] # throw else: - assert type(indexItemData) == list # noqa: E721 + assert type(indexItemData) is list assert len(indexItemData) > 0 indexItemData.append(fileData) # throw - assert type(filesByStrKeyDictionary[fileKey]) == list # noqa: E721 + assert type(filesByStrKeyDictionary[fileKey]) is list assert len(filesByStrKeyDictionary[fileKey]) > 1 assert filesByStrKeyDictionary[fileKey][-1] is fileData @@ -567,9 +567,9 @@ def Helper__DeleteFileIntoIndex( fileKey: str, fileData: PgCfgModel__FileData, ): - assert type(filesByStrKeyDictionary) == dict # noqa: E721 - assert type(fileKey) == str # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(filesByStrKeyDictionary) is dict + assert type(fileKey) is str + assert type(fileData) is PgCfgModel__FileData assert fileKey != "" assert fileData.IsAlive() @@ -594,13 +594,13 @@ def Helper__DeleteFileIntoIndex( return if typeOfIndexItemData == list: - assert type(indexItemData) == list # noqa: E721 + assert type(indexItemData) is list assert len(indexItemData) > 1 for i in range(len(indexItemData)): ptr = indexItemData[i] assert ptr is not None - assert type(ptr) == PgCfgModel__FileData # noqa: E721 + assert type(ptr) is PgCfgModel__FileData if ptr is fileData: break @@ -611,7 +611,7 @@ def Helper__DeleteFileIntoIndex( if i == len(indexItemData): BugCheckError.FileIsNotFoundInIndex(fileKey, fileData.m_Path) - assert type(indexItemData) == list # noqa: E721 + assert type(indexItemData) is list assert i < len(indexItemData) indexItemData.pop(i) assert len(indexItemData) > 0 @@ -632,8 +632,8 @@ def Helper__InsertOptionIntoIndex( ): assert optionsByNameDictionary is not None assert optionData is not None - assert type(optionsByNameDictionary) == dict # noqa: E721 - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionsByNameDictionary) is dict + assert type(optionData) is PgCfgModel__OptionData if not (optionData.m_Name in optionsByNameDictionary.keys()): optionsByNameDictionary[optionData.m_Name] = optionData @@ -643,13 +643,13 @@ def Helper__InsertOptionIntoIndex( typeOfData = type(data) - if typeOfData == PgCfgModel__OptionData: # noqa: E721 + if typeOfData is PgCfgModel__OptionData: assert data is not optionData optionsByNameDictionary[optionData.m_Name] = [data, optionData] return - if typeOfData == list: - assert type(data) == list # noqa: E721 + if typeOfData is list: + assert type(data) is list assert len(data) > 1 data.append(optionData) return @@ -663,8 +663,8 @@ def Helper__DeleteOptionFromIndex( ): assert optionsByNameDictionary is not None assert optionData is not None - assert type(optionsByNameDictionary) == dict # noqa: E721 - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionsByNameDictionary) is dict + assert type(optionData) is PgCfgModel__OptionData if not (optionData.m_Name in optionsByNameDictionary.keys()): BugCheckError.OptionIsNotFoundInIndex(optionData.m_Name) @@ -686,14 +686,14 @@ def Helper__DeleteOptionFromIndex( return if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list assert len(data) > 1 for i in range(len(data)): ptr = data[i] assert ptr is not None - assert type(ptr) == PgCfgModel__OptionData # noqa: E721 - assert type(ptr.m_Name) == str # noqa: E721 + assert type(ptr) is PgCfgModel__OptionData + assert type(ptr.m_Name) is str assert ptr.m_Name == optionData.m_Name if ptr is optionData: @@ -705,7 +705,7 @@ def Helper__DeleteOptionFromIndex( if i == len(data): BugCheckError.OptionIsNotFoundInIndex(optionData.m_Name) - assert type(data) == list # noqa: E721 + assert type(data) is list data.pop(i) assert len(data) > 0 @@ -724,11 +724,11 @@ def Helper__ClearFileLine( ): assert cfgData is not None assert fileLineData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list cItems = len(fileLineData.m_Items) @@ -744,7 +744,7 @@ def Helper__ClearFileLine( __class__.Helper__DeleteElement(cfgData, lastItem.m_Element) assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list cItems__new = len(fileLineData.m_Items) @@ -754,14 +754,14 @@ def Helper__ClearFileLine( # -------------------------------------------------------------------- def Helper__FileLineHasWorkData(fileLineData: PgCfgModel__FileLineData): assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list for item in fileLineData.m_Items: assert item is not None - assert type(item) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(item) is PgCfgModel__FileLineData.tagItem assert item.m_Element is not None assert isinstance(item.m_Element, PgCfgModel__FileLineElementData) @@ -770,7 +770,7 @@ def Helper__FileLineHasWorkData(fileLineData: PgCfgModel__FileLineData): if typeOfElementData == PgCfgModel__OptionData: return True - if typeOfElementData == PgCfgModel__CommentData: + if typeOfElementData is PgCfgModel__CommentData: continue if typeOfElementData == PgCfgModel__IncludeData: @@ -786,12 +786,12 @@ def Helper__DeleteElement( ): assert cfgData is not None assert objectData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData assert isinstance(objectData, PgCfgModel__ObjectData) typeOfObjectData = type(objectData) - if typeOfObjectData == PgCfgModel__CommentData: + if typeOfObjectData is PgCfgModel__CommentData: return __class__.Helper__DeleteComment(objectData) if typeOfObjectData == PgCfgModel__OptionData: @@ -804,7 +804,7 @@ def Helper__DeleteElement( # -------------------------------------------------------------------- def Helper__DeleteComment(commentData: PgCfgModel__CommentData): - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(commentData) is PgCfgModel__CommentData assert commentData.IsAlive() # 0. @@ -814,7 +814,7 @@ def Helper__DeleteComment(commentData: PgCfgModel__CommentData): # 1.1 Set fileLineData fileLineData = commentData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() # 1.2 Set iFileLineItem @@ -842,9 +842,9 @@ def Helper__DeleteComment(commentData: PgCfgModel__CommentData): def Helper__DeleteOption( cfgData: PgCfgModel__ConfigurationData, optionData: PgCfgModel__OptionData ): - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 - assert type(optionData.m_Name) == str # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(optionData) is PgCfgModel__OptionData + assert type(optionData.m_Name) is str assert optionData.IsAlive() # 0. @@ -855,7 +855,7 @@ def Helper__DeleteOption( # 1.1 Set fileLineData fileLineData = optionData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() # 1.2 Set iFileLineItem @@ -875,15 +875,15 @@ def Helper__DeleteOption( # 1.3 Set fileData fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.IsAlive() # 1.3 - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict assert optionData.m_Name in fileData.m_OptionsByName.keys() # 1.4 - assert type(cfgData.m_AllOptionsByName) == dict # noqa: E721 + assert type(cfgData.m_AllOptionsByName) is dict assert optionData.m_Name in cfgData.m_AllOptionsByName.keys() # 2. Perform delete operations @@ -901,7 +901,7 @@ def Helper__DeleteOption( # -------------------------------------------------------------------- def Helper__DeleteInclude(includeData: PgCfgModel__IncludeData): - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(includeData) is PgCfgModel__IncludeData assert includeData.IsAlive() # 0. @@ -911,7 +911,7 @@ def Helper__DeleteInclude(includeData: PgCfgModel__IncludeData): # 1.1 Set fileLineData fileLineData = includeData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() # 1.2 Set iFileLineItem @@ -939,8 +939,8 @@ def Helper__DeleteInclude(includeData: PgCfgModel__IncludeData): def Helper__DeleteFileLine( cfgData: PgCfgModel__ConfigurationData, fileLineData: PgCfgModel__FileLineData ): - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() # 0. @@ -950,7 +950,7 @@ def Helper__DeleteFileLine( # 1.1 Set fileData fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.IsAlive() # 1.2 Set iFileLine @@ -970,7 +970,7 @@ def Helper__DeleteFileLine( assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list assert len(fileLineData.m_Items) == 0 # delete from file diff --git a/src/core/data_verificator.py b/src/core/data_verificator.py index 4100b09..a63a927 100644 --- a/src/core/data_verificator.py +++ b/src/core/data_verificator.py @@ -12,7 +12,7 @@ def CheckOptionName(name: str): if name is None: RaiseError.OptionNameIsNone() - if type(name) != str: # noqa: E721 + if type(name) is not str: RaiseError.OptionNameHasBadType(type(name)) if name == "": @@ -26,9 +26,9 @@ def CheckOptionName(name: str): # -------------------------------------------------------------------- def IsValidCommentText(text: str) -> bool: assert text is not None - assert type(text) == str # noqa: E721 + assert type(text) is str - assert type(__class__.sm_InvalidCommentSymbols) == str # noqa: E721 + assert type(__class__.sm_InvalidCommentSymbols) is str for ch in text: if ch in __class__.sm_InvalidCommentSymbols: @@ -39,9 +39,9 @@ def IsValidCommentText(text: str) -> bool: # -------------------------------------------------------------------- def CheckCommentText(text: str): assert text is not None - assert type(text) == str # noqa: E721 + assert type(text) is str - assert type(__class__.sm_InvalidCommentSymbols) == str # noqa: E721 + assert type(__class__.sm_InvalidCommentSymbols) is str if not __class__.IsValidCommentText(text): RaiseError.CommentTextContainsInvalidSymbols() @@ -51,7 +51,7 @@ def CheckCommentText(text: str): # -------------------------------------------------------------------- def CheckStringOfFilePath(text: str): assert text is not None - assert type(text) == str # noqa: E721 + assert type(text) is str if text == "": RaiseError.FilePathIsEmpty() diff --git a/src/core/handlers.py b/src/core/handlers.py index ff2e01e..cd69d84 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -27,10 +27,10 @@ def DataHandler__SetOptionValue__Simple( ) -> any: assert ( targetData is None - or type(targetData) == FileData # noqa: E721 - or type(targetData) == FileLineData # noqa: E721 + or type(targetData) is FileData + or type(targetData) is FileLineData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None RaiseError.MethodIsNotImplemented( __class__, "DataHandler__SetOptionValue__Simple" @@ -44,10 +44,10 @@ def DataHandler__GetOptionValue__Simple( ) -> any: assert ( sourceData is None - or type(sourceData) == FileData # noqa: E721 - or type(sourceData) == OptionData # noqa: E721 + or type(sourceData) is FileData + or type(sourceData) is OptionData ) - assert type(optionName) == str or type(optionName) == OptionData # noqa: E721 + assert type(optionName) is str or type(optionName) is OptionData RaiseError.MethodIsNotImplemented( __class__, "DataHandler__GetOptionValue__Simple" ) @@ -60,10 +60,10 @@ def DataHandler__GetOptionValue__UnionList( ) -> any: assert ( sourceData is None - or type(sourceData) == FileData # noqa: E721 - or type(sourceData) == OptionData # noqa: E721 + or type(sourceData) is FileData + or type(sourceData) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str RaiseError.MethodIsNotImplemented( __class__, "DataHandler__GetOptionValue__UnionList" ) @@ -76,10 +76,10 @@ def DataHandler__ResetOption( ) -> any: assert ( targetData is None - or type(targetData) == FileData # noqa: E721 - or type(targetData) == OptionData # noqa: E721 + or type(targetData) is FileData + or type(targetData) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str RaiseError.MethodIsNotImplemented(__class__, "DataHandler__ResetOption") # -------------------------------------------------------------------- @@ -91,12 +91,10 @@ def DataHandler__AddSimpleOption( optionValue: any, ) -> any: assert ( - target is None - or type(target) == FileData # noqa: E721 - or type(target) == FileLineData # noqa: E721 E501 + target is None or type(target) is FileData or type(target) is FileLineData ) - assert optionOffset is None or type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert optionOffset is None or type(optionOffset) is int + assert type(optionName) is str assert optionValue is not None RaiseError.MethodIsNotImplemented(__class__, "DataHandler__AddSimpleOption") @@ -109,10 +107,10 @@ def DataHandler__SetUniqueOptionValueItem( ) -> any: assert ( targetData is None - or type(targetData) == FileData # noqa: E721 - or type(optionName) == OptionData # noqa: E721 + or type(targetData) is FileData + or type(optionName) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValueItem is not None RaiseError.MethodIsNotImplemented( __class__, "DataHandler__SetUniqueOptionValueItem" @@ -149,10 +147,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( targetData is None - or type(targetData) == FileData # noqa: E721 - or type(targetData) == OptionData # noqa: E721 + or type(targetData) is FileData + or type(targetData) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str self.DataHandler = dataHandler self.TargetData = targetData @@ -170,7 +168,7 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValue(self, ctx: OptionHandlerCtxToSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToSetValue assert ctx.OptionName is not None assert ctx.OptionValue is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue") @@ -195,10 +193,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( sourceData is None - or type(sourceData) == FileData # noqa: E721 - or type(sourceData) == OptionData # noqa: E721 + or type(sourceData) is FileData + or type(sourceData) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str self.DataHandler = dataHandler self.SourceData = sourceData @@ -215,13 +213,13 @@ def __init__(self): # interface ---------------------------------------------------------- def GetOptionValue(self, ctx: OptionHandlerCtxToGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToGetValue assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData # noqa: E721 - or type(ctx.SourceData) == OptionData # noqa: E721 + or type(ctx.SourceData) is FileData + or type(ctx.SourceData) is OptionData ) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") @@ -247,11 +245,9 @@ def __init__( ): assert isinstance(dataHandler, ConfigurationDataHandler) assert ( - target is None - or type(target) == FileData # noqa: E721 - or type(target) == FileLineData # noqa: E721 + target is None or type(target) is FileData or type(target) is FileLineData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None self.DataHandler = dataHandler @@ -271,7 +267,7 @@ def __init__(self): # interface ---------------------------------------------------------- def AddOption(self, ctx: OptionHandlerCtxToSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToSetValue RaiseError.MethodIsNotImplemented(__class__, "AddOption") @@ -296,10 +292,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( targetData is None - or type(targetData) == FileData # noqa: E721 - or type(targetData) == OptionData # noqa: E721 + or type(targetData) is FileData + or type(targetData) is OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str self.DataHandler = dataHandler self.TargetData = targetData @@ -317,13 +313,13 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValueItem(self, ctx: OptionHandlerCtxToSetValueItem) -> any: - assert type(ctx) == OptionHandlerCtxToSetValueItem # noqa: E721 + assert type(ctx) is OptionHandlerCtxToSetValueItem assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData # noqa: E721 - or type(ctx.TargetData) == OptionData # noqa: E721 + or type(ctx.TargetData) is FileData + or type(ctx.TargetData) is OptionData ) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValueItem is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem") @@ -345,7 +341,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None self.DataHandler = dataHandler @@ -363,7 +359,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue RaiseError.MethodIsNotImplemented(__class__, "PrepareSetValue") @@ -384,7 +380,7 @@ def __init__( optionValueItem: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValueItem is not None self.DataHandler = dataHandler @@ -402,7 +398,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValueItem(self, ctx: OptionHandlerCtxToPrepareSetValueItem) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValueItem RaiseError.MethodIsNotImplemented(__class__, "PrepareSetValueItem") @@ -423,7 +419,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None self.DataHandler = dataHandler @@ -441,7 +437,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue RaiseError.MethodIsNotImplemented(__class__, "PrepareGetValue") @@ -462,7 +458,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None self.DataHandler = dataHandler @@ -480,7 +476,7 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite RaiseError.MethodIsNotImplemented(__class__, "OptionValueToString") diff --git a/src/core/helpers.py b/src/core/helpers.py index e16fa43..dce2327 100644 --- a/src/core/helpers.py +++ b/src/core/helpers.py @@ -13,14 +13,14 @@ class Helpers: def ExtractOptionDataName(option: typing.Union[str, OptionData]) -> str: - assert type(option) == str or type(option) == OptionData # noqa: E721 + assert type(option) is str or type(option) is OptionData typeOption = type(option) - if typeOption == str: # noqa: E721 + if typeOption is str: return option - if typeOption == OptionData: # noqa: E721 + if typeOption is OptionData: return option.m_Name BugCheckError.UnkObjectDataType(typeOption) @@ -29,7 +29,7 @@ def ExtractOptionDataName(option: typing.Union[str, OptionData]) -> str: def ExtractFirstOptionFromIndexItem( optionName: str, indexItem: typing.Union[OptionData, typing.List[OptionData]] ) -> OptionData: - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str typeOfIndexItem = type(indexItem) @@ -40,7 +40,7 @@ def ExtractFirstOptionFromIndexItem( if typeOfIndexItem == list: assert len(indexItem) > 1 assert indexItem[0] is not None - assert type(indexItem[0]) == OptionData # noqa: E721 + assert type(indexItem[0]) is OptionData assert indexItem[0].m_Name == optionName return indexItem[0] @@ -56,7 +56,7 @@ def DoesContainerContainsValue__NotNullAndExact( for x in container: assert x is not None - assert type(x) == type(value) # noqa: E721 + assert type(x) is type(value) if x == value: return True @@ -69,8 +69,8 @@ def NormalizeFilePath( ) -> str: assert cfgOsOps is not None assert isinstance(cfgOsOps, ConfigurationOsOps) - assert type(baseFolder) == str # noqa: E721 - assert type(filePath) == str # noqa: E721 + assert type(baseFolder) is str + assert type(filePath) is str assert filePath != "" newFilePath = None @@ -81,7 +81,7 @@ def NormalizeFilePath( newFilePath = cfgOsOps.Path_Join(baseFolder, filePath) newFilePath = cfgOsOps.Path_NormPath(newFilePath) - assert type(newFilePath) == str # noqa: E721 + assert type(newFilePath) is str assert newFilePath != "" newFilePath = cfgOsOps.Path_AbsPath(newFilePath) diff --git a/src/core/model.py b/src/core/model.py index 811b65f..cc89d74 100644 --- a/src/core/model.py +++ b/src/core/model.py @@ -37,8 +37,8 @@ class FileLineElementData(ObjectData): # -------------------------------------------------------------------- def __init__(self, parent: FileLineData, offset: typing.Optional[int]): - assert type(parent) == FileLineData # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 + assert type(parent) is FileLineData + assert offset is None or type(offset) is int super().__init__() @@ -54,7 +54,7 @@ def MarkAsDeletedFrom(self, fileLineData: FileLineData) -> None: # Object interface --------------------------------------------------- def get_Parent(self) -> FileLineData: - assert type(self.m_Parent) == FileLineData # noqa: E721 + assert type(self.m_Parent) is FileLineData return self.m_Parent # -------------------------------------------------------------------- @@ -74,9 +74,9 @@ class CommentData(FileLineElementData): # -------------------------------------------------------------------- def __init__(self, parent: FileLineData, offset: typing.Optional[int], text: str): - assert type(parent) == FileLineData # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 - assert type(text) == str # noqa: E721 + assert type(parent) is FileLineData + assert offset is None or type(offset) is int + assert type(text) is str super().__init__(parent, offset) @@ -95,9 +95,9 @@ class OptionData(FileLineElementData): def __init__( self, parent: FileLineData, offset: typing.Offset[int], name: str, value: any ): - assert type(parent) == FileLineData # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 - assert type(name) == str # noqa: E721 + assert type(parent) is FileLineData + assert offset is None or type(offset) is int + assert type(name) is str assert value is not None assert name != "" @@ -123,10 +123,10 @@ def __init__( path: str, fileData: FileData, ): - assert type(parent) == FileLineData # noqa: E721 - assert type(path) == str # noqa: E721 - assert type(fileData) == FileData # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 + assert type(parent) is FileLineData + assert type(path) is str + assert type(fileData) is FileData + assert offset is None or type(offset) is int assert parent.IsAlive() assert fileData.IsAlive() @@ -159,7 +159,7 @@ def __init__(self, element: FileLineElementData): # -------------------------------------------------------------------- def __init__(self, parent: FileData): - assert type(parent) == FileData # noqa: E721 + assert type(parent) is FileData super().__init__() @@ -175,7 +175,7 @@ def MarkAsDeletedFrom(self, fileData: FileData) -> None: # Object interface --------------------------------------------------- def get_Parent(self) -> FileData: - assert type(self.m_Parent) == FileData # noqa: E721 + assert type(self.m_Parent) is FileData return self.m_Parent # -------------------------------------------------------------------- @@ -212,8 +212,8 @@ class FileData(ObjectData): # -------------------------------------------------------------------- def __init__(self, parent: ConfigurationData, path: str): - assert type(parent) == ConfigurationData # noqa: E721 - assert type(path) == str # noqa: E721 + assert type(parent) is ConfigurationData + assert type(path) is str assert parent.OsOps.Path_IsAbs(path) assert parent.OsOps.Path_NormPath(path) == path assert parent.OsOps.Path_NormCase(path) == path @@ -229,14 +229,14 @@ def __init__(self, parent: ConfigurationData, path: str): self.m_Lines = list() self.m_OptionsByName = dict() - assert type(self.m_OptionsByName) == dict # noqa: E721 + assert type(self.m_OptionsByName) is dict - assert type(self.m_Path) == str # noqa: E721 + assert type(self.m_Path) is str assert self.m_Path != "" # Object interface --------------------------------------------------- def get_Parent(self) -> ConfigurationData: - assert type(self.m_Parent) == ConfigurationData # noqa: E721 + assert type(self.m_Parent) is ConfigurationData return self.m_Parent # -------------------------------------------------------------------- @@ -264,7 +264,7 @@ class ConfigurationData(ObjectData): # -------------------------------------------------------------------- def __init__(self, data_dir: str, osOps: ConfigurationOsOps): - assert type(data_dir) == str # noqa: E721 + assert type(data_dir) is str assert isinstance(osOps, ConfigurationOsOps) super().__init__() @@ -276,9 +276,9 @@ def __init__(self, data_dir: str, osOps: ConfigurationOsOps): self.m_AllOptionsByName = dict() self.m_AllFilesByName = dict() - assert type(self.m_Files) == list # noqa: E721 - assert type(self.m_AllOptionsByName) == dict # noqa: E721 - assert type(self.m_AllFilesByName) == dict # noqa: E721 + assert type(self.m_Files) is list + assert type(self.m_AllOptionsByName) is dict + assert type(self.m_AllFilesByName) is dict # Own interface ------------------------------------------------------ @property diff --git a/src/core/option/handlers/add/option_handler_to_add__std.py b/src/core/option/handlers/add/option_handler_to_add__std.py index 7cf5e52..17ae86e 100644 --- a/src/core/option/handlers/add/option_handler_to_add__std.py +++ b/src/core/option/handlers/add/option_handler_to_add__std.py @@ -19,15 +19,15 @@ def __init__(self): # interface ---------------------------------------------------------- def AddOption(self, ctx: OptionHandlerCtxToAddOption) -> any: - assert type(ctx) == OptionHandlerCtxToAddOption # noqa: E721 + assert type(ctx) is OptionHandlerCtxToAddOption assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.Target is None - or type(ctx.Target) == FileData # noqa: E721 - or type(ctx.Target) == FileLineData # noqa: E721 + or type(ctx.Target) is FileData + or type(ctx.Target) is FileLineData ) - assert ctx.OptionOffset is None or type(ctx.OptionOffset) == int # noqa: E721 - assert type(ctx.OptionName) == str # noqa: E721 + assert ctx.OptionOffset is None or type(ctx.OptionOffset) is int + assert type(ctx.OptionName) is str assert ctx.OptionName is not None return ctx.DataHandler.DataHandler__AddSimpleOption( diff --git a/src/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py b/src/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py index 6e9587b..25b81a4 100644 --- a/src/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py +++ b/src/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py @@ -19,14 +19,14 @@ def __init__(self): # interface ---------------------------------------------------------- def GetOptionValue(self, ctx: OptionHandlerCtxToGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData # noqa: E721 - or type(ctx.SourceData) == OptionData # noqa: E721 + or type(ctx.SourceData) is FileData + or type(ctx.SourceData) is OptionData ) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str return ctx.DataHandler.DataHandler__GetOptionValue__Simple( ctx.SourceData, ctx.OptionName diff --git a/src/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py b/src/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py index 0d0f446..93c4013 100644 --- a/src/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py +++ b/src/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py @@ -19,14 +19,14 @@ def __init__(self): # interface ---------------------------------------------------------- def GetOptionValue(self, ctx: OptionHandlerCtxToGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData # noqa: E721 - or type(ctx.SourceData) == OptionData # noqa: E721 + or type(ctx.SourceData) is FileData + or type(ctx.SourceData) is OptionData ) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str return ctx.DataHandler.DataHandler__GetOptionValue__UnionList( ctx.SourceData, ctx.OptionName diff --git a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py index bab6601..162e2c1 100644 --- a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py +++ b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py @@ -17,13 +17,13 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == bool # noqa: E721 + assert type(ctx.OptionValue) is bool return bool(ctx.OptionValue) diff --git a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py index fe72d48..f52b54f 100644 --- a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py +++ b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py @@ -19,18 +19,18 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: # noqa: E721 + if typeOfOptionValue is int: pass # OK - elif typeOfOptionValue == str: # noqa: E721 + elif typeOfOptionValue is str: pass # OK - elif typeOfOptionValue == bool: # noqa: E721 + elif typeOfOptionValue is bool: pass # OK else: BugCheckError.UnknownOptionValueType(ctx.OptionName, typeOfOptionValue) diff --git a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py index cba6a9d..0d6c02d 100644 --- a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py +++ b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py @@ -17,13 +17,13 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == int # noqa: E721 + assert type(ctx.OptionValue) is int return int(ctx.OptionValue) diff --git a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py index befd497..a1a0d50 100644 --- a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py +++ b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py @@ -17,13 +17,13 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == str # noqa: E721 + assert type(ctx.OptionValue) is str return str(ctx.OptionValue) diff --git a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py index 59897a0..ae45e92 100644 --- a/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +++ b/src/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py @@ -21,11 +21,11 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareGetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None - assert type(ctx.OptionValue) == list # noqa: E721 + assert type(ctx.OptionValue) is list result: typing.List[str] = list() index: set[str] = set() diff --git a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py index 6ee7c23..04606d5 100644 --- a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py +++ b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py @@ -40,19 +40,19 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None optionValue = ctx.OptionValue optionValueType = type(optionValue) - if optionValueType == bool: # noqa: E721 + if optionValueType is bool: return optionValue - if optionValueType == int: # noqa: E721 - assert type(optionValue) == int # noqa: E721 + if optionValueType is int: + assert type(optionValue) is int if optionValue == 0: return False @@ -62,8 +62,8 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: RaiseError.CantConvertOptionValue(ctx.OptionName, optionValueType, bool) - if optionValueType == str: # noqa: E721 - assert type(optionValue) == str # noqa: E721 + if optionValueType is str: + assert type(optionValue) is str if len(optionValue) < __class__.C_MIN_STR_VALUE_LENGTH: pass diff --git a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py index 1b465f9..6d81ca1 100644 --- a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py +++ b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py @@ -19,18 +19,18 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: # noqa: E721 + if typeOfOptionValue is int: pass # OK - elif typeOfOptionValue == str: # noqa: E721 + elif typeOfOptionValue is str: pass # OK - elif typeOfOptionValue == bool: # noqa: E721 + elif typeOfOptionValue is bool: pass # OK else: BugCheckError.UnknownOptionValueType(ctx.OptionName, typeOfOptionValue) diff --git a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py index 1e03513..aa5063f 100644 --- a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py +++ b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py @@ -19,9 +19,9 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) @@ -30,7 +30,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: return ctx.OptionValue optionName = ctx.OptionName - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str if typeOfOptionValue == str: if not str(ctx.OptionValue).isnumeric(): diff --git a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py index f8c6536..e0487c0 100644 --- a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py +++ b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py @@ -19,16 +19,16 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) if typeOfOptionValue != str: optionName = ctx.OptionName - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str RaiseError.BadOptionValueType(optionName, typeOfOptionValue, str) return ctx.OptionValue diff --git a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py index 734b1ab..009c9ac 100755 --- a/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +++ b/src/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py @@ -25,9 +25,9 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) @@ -35,7 +35,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: if typeOfOptionValue == str: result = ReadUtils.Unpack_StrList2(ctx.OptionValue) assert result is not None - assert type(result) == list # noqa: E721 + assert type(result) is list return result elif typeOfOptionValue == list: result: typing.List[str] = list() @@ -56,7 +56,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: return result optionName = ctx.OptionName - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str RaiseError.BadOptionValueType(optionName, typeOfOptionValue, list) diff --git a/src/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py b/src/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py index 492f015..a14df8a 100644 --- a/src/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py +++ b/src/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py @@ -19,16 +19,16 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValueItem(self, ctx: OptionHandlerCtxToPrepareSetValueItem) -> any: - assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem # noqa: E721 + assert type(ctx) is OptionHandlerCtxToPrepareSetValueItem assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValueItem is not None typeOfOptionValue = type(ctx.OptionValueItem) if typeOfOptionValue != str: optionName = ctx.OptionName - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str RaiseError.BadOptionValueItemType(optionName, typeOfOptionValue, str) return ctx.OptionValueItem diff --git a/src/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py b/src/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py index 743a0a2..b12eeeb 100644 --- a/src/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py +++ b/src/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py @@ -20,12 +20,12 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValue(self, ctx: OptionHandlerCtxToSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 + assert type(ctx) is OptionHandlerCtxToSetValue assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData # noqa: E721 - or type(ctx.TargetData) == OptionData # noqa: E721 + or type(ctx.TargetData) is FileData + or type(ctx.TargetData) is OptionData ) assert ctx.OptionName is not None assert ctx.OptionValue is not None diff --git a/src/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py b/src/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py index 9e49cf6..3a49193 100644 --- a/src/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py +++ b/src/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py @@ -20,14 +20,14 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValueItem(self, ctx: OptionHandlerCtxToSetValueItem) -> any: - assert type(ctx) == OptionHandlerCtxToSetValueItem # noqa: E721 + assert type(ctx) is OptionHandlerCtxToSetValueItem assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData # noqa: E721 - or type(ctx.TargetData) == OptionData # noqa: E721 + or type(ctx.TargetData) is FileData + or type(ctx.TargetData) is OptionData ) - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx.OptionName) is str assert ctx.OptionValueItem is not None return ctx.DataHandler.DataHandler__SetUniqueOptionValueItem( diff --git a/src/core/option/handlers/write/option_handler_to_write__std__bool.py b/src/core/option/handlers/write/option_handler_to_write__std__bool.py index 6601866..b495ae3 100644 --- a/src/core/option/handlers/write/option_handler_to_write__std__bool.py +++ b/src/core/option/handlers/write/option_handler_to_write__std__bool.py @@ -18,18 +18,18 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 - assert type(ctx.OptionName) == str # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite + assert type(ctx.OptionName) is str assert ctx.OptionValue is not None typeOfValue = type(ctx.OptionValue) - if typeOfValue == bool: # noqa: E721 + if typeOfValue is bool: typedValue = bool(ctx.OptionValue) else: RaiseError.BadOptionValueItemType(ctx.OptionName, typeOfValue, bool) - assert type(typedValue) == bool # noqa: E721 + assert type(typedValue) is bool if typedValue: result = "on" diff --git a/src/core/option/handlers/write/option_handler_to_write__std__generic.py b/src/core/option/handlers/write/option_handler_to_write__std__generic.py index bfed98b..9ebf053 100644 --- a/src/core/option/handlers/write/option_handler_to_write__std__generic.py +++ b/src/core/option/handlers/write/option_handler_to_write__std__generic.py @@ -31,7 +31,7 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) diff --git a/src/core/option/handlers/write/option_handler_to_write__std__int.py b/src/core/option/handlers/write/option_handler_to_write__std__int.py index 6f1836e..189422c 100644 --- a/src/core/option/handlers/write/option_handler_to_write__std__int.py +++ b/src/core/option/handlers/write/option_handler_to_write__std__int.py @@ -16,7 +16,7 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite assert ctx.OptionValue is not None typedValue = int(ctx.OptionValue) diff --git a/src/core/option/handlers/write/option_handler_to_write__std__str.py b/src/core/option/handlers/write/option_handler_to_write__std__str.py index 3ff84c8..42de5ca 100644 --- a/src/core/option/handlers/write/option_handler_to_write__std__str.py +++ b/src/core/option/handlers/write/option_handler_to_write__std__str.py @@ -18,14 +18,14 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite assert ctx.OptionValue is not None typedValue = str(ctx.OptionValue) result = WriteUtils.Pack_Str(typedValue) - assert type(result) == str # noqa: E721 + assert type(result) is str assert len(result) >= 2 assert result[0] == "'" assert result[-1] == "'" diff --git a/src/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py b/src/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py index aef23e1..c44e5f8 100644 --- a/src/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py +++ b/src/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py @@ -18,15 +18,15 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx) is OptionHandlerCtxToWrite assert ctx.OptionValue is not None - assert type(ctx.OptionValue) == list # noqa: E721 + assert type(ctx.OptionValue) is list result = WriteUtils.Pack_StrList2(ctx.OptionValue) - assert type(result) == str # noqa: E721 + assert type(result) is str result = WriteUtils.Pack_Str(result) - assert type(result) == str # noqa: E721 + assert type(result) is str assert len(result) >= 2 assert result[0] == "'" assert result[-1] == "'" diff --git a/src/core/raise_error.py b/src/core/raise_error.py index 1803858..f3a0ef6 100644 --- a/src/core/raise_error.py +++ b/src/core/raise_error.py @@ -9,8 +9,8 @@ class RaiseError: def MethodIsNotImplemented(classType: type, methodName: str): - assert type(classType) == type # noqa: E721 - assert type(methodName) == str # noqa: E721 + assert type(classType) is type + assert type(methodName) is str assert methodName != "" errMsg = "Method {0}::{1} is not implemented.".format( @@ -20,8 +20,8 @@ def MethodIsNotImplemented(classType: type, methodName: str): # -------------------------------------------------------------------- def GetPropertyIsNotImplemented(classType: type, methodName: str): - assert type(classType) == type # noqa: E721 - assert type(methodName) == str # noqa: E721 + assert type(classType) is type + assert type(methodName) is str assert methodName != "" errMsg = "Get property {0}::{1} is not implemented.".format( @@ -37,7 +37,7 @@ def OptionNameIsNone(): # -------------------------------------------------------------------- def OptionNameHasBadType(nameType: type): assert nameType is not None - assert type(nameType) == type # noqa: E721 + assert type(nameType) is type errMsg = "Option name has nad type [{0}]".format(nameType.__name__) raise Exception(errMsg) @@ -54,7 +54,7 @@ def NoneValueIsNotSupported(): # -------------------------------------------------------------------- def NoneOptionValueItemIsNotSupported(optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionName != "" errMsg = "None value item of option [{0}] is not supported.".format(optionName) @@ -87,9 +87,9 @@ def FileObjectWasDeleted(): # -------------------------------------------------------------------- def BadOptionValueType(optionName: str, optionValueType: type, expectedType: type): - assert type(optionName) == str # noqa: E721 - assert type(optionValueType) == type # noqa: E721 - assert type(expectedType) == type # noqa: E721 + assert type(optionName) is str + assert type(optionValueType) is type + assert type(expectedType) is type errMsg = "Bad option [{0}] value type [{1}]. Expected type is [{2}].".format( optionName, optionValueType.__name__, expectedType.__name__ @@ -98,9 +98,9 @@ def BadOptionValueType(optionName: str, optionValueType: type, expectedType: typ # -------------------------------------------------------------------- def CantConvertOptionValue(optionName: str, sourceType: type, targetType: type): - assert type(optionName) == str # noqa: E721 - assert type(sourceType) == type # noqa: E721 - assert type(targetType) == type # noqa: E721 + assert type(optionName) is str + assert type(sourceType) is type + assert type(targetType) is type errMsg = ( "Can't convert option [{0}] value from type [{1}] to type [{2}].".format( @@ -113,9 +113,9 @@ def CantConvertOptionValue(optionName: str, sourceType: type, targetType: type): def BadOptionValueItemType( optionName: str, optionValueItemType: type, expectedType: type ): - assert type(optionName) == str # noqa: E721 - assert type(optionValueItemType) == type # noqa: E721 - assert type(expectedType) == type # noqa: E721 + assert type(optionName) is str + assert type(optionValueItemType) is type + assert type(expectedType) is type errMsg = ( "Bad option [{0}] value item type [{1}]. Expected type is [{2}].".format( @@ -136,8 +136,8 @@ def FileIsAlreadyRegistered(file_path: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -148,8 +148,8 @@ def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -160,8 +160,8 @@ def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -172,8 +172,8 @@ def OptionIsAlreadyExistInFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionValueItemIsAlreadyDefined(filePath: str, optName: str, valueItem: any): - assert type(filePath) == str # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(filePath) is str + assert type(optName) is str errMsg = "Another definition of option [{1}] value item [{2}] is found in the file [{0}].".format( filePath, optName, valueItem @@ -184,8 +184,8 @@ def OptionValueItemIsAlreadyDefined(filePath: str, optName: str, valueItem: any) def OptionValueItemIsAlreadyDefinedInAnotherFile( filePath: str, optName: str, valueItem: any ): - assert type(filePath) == str # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(filePath) is str + assert type(optName) is str errMsg = "Definition of option [{1}] value item [{2}] is found in another file [{0}].".format( filePath, optName, valueItem @@ -194,15 +194,15 @@ def OptionValueItemIsAlreadyDefinedInAnotherFile( # -------------------------------------------------------------------- def UnknownFileName(fileName: str): - assert type(fileName) == str # noqa: E721 + assert type(fileName) is str errMsg = "Unknown file name [{0}].".format(fileName) raise Exception(errMsg) # -------------------------------------------------------------------- def MultipleDefOfFileIsFound(fileName: str, count: int): - assert type(fileName) == str # noqa: E721 - assert type(count) == int # noqa: E721 + assert type(fileName) is str + assert type(count) is int errMsg = "Multiple definitition of file [{0}] is found - {1}.".format( fileName, count @@ -220,9 +220,9 @@ def FileWasModifiedExternally( ourLastMDate: datetime.datetime, curLastMDate: datetime.datetime, ): - assert type(filePath) == str # noqa: E721 - assert type(ourLastMDate) == datetime.datetime # noqa: E721 - assert type(curLastMDate) == datetime.datetime # noqa: E721 + assert type(filePath) is str + assert type(ourLastMDate) is datetime.datetime + assert type(curLastMDate) is datetime.datetime errMsg = "File [{0}] was modified externally. Our timestamp is [{1}]. The current file timestamp is [{2}].".format( filePath, ourLastMDate, curLastMDate @@ -236,7 +236,7 @@ def FileLineAlreadyHasComment(): # -------------------------------------------------------------------- def FileLineAlreadyHasOption(optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str errMsg = "File line already has the option [{0}].".format(optionName) raise Exception(errMsg) @@ -249,9 +249,9 @@ def FileLineAlreadyHasIncludeDirective(): # -------------------------------------------------------------------- def CfgReader__UnexpectedSymbol(lineNum: int, colNum: int, ch: str): - assert type(lineNum) == int # noqa: E721 - assert type(colNum) == int # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(colNum) is int + assert type(ch) is str errMsg = "Unexpected symbol in line {0}, column {1}: [{2}]".format( lineNum, colNum, ch @@ -260,7 +260,7 @@ def CfgReader__UnexpectedSymbol(lineNum: int, colNum: int, ch: str): # -------------------------------------------------------------------- def CfgReader__IncludeWithoutPath(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Include directive in line {0} does not have a path.".format(lineNum) @@ -268,7 +268,7 @@ def CfgReader__IncludeWithoutPath(lineNum: int): # -------------------------------------------------------------------- def CfgReader__EndOfIncludePathIsNotFound(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "The end of an include path is not found. Line {0}.".format(lineNum) @@ -276,7 +276,7 @@ def CfgReader__EndOfIncludePathIsNotFound(lineNum: int): # -------------------------------------------------------------------- def CfgReader__IncompletedEscapeInInclude(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Escape in an include path is not completed. Line {0}.".format(lineNum) @@ -284,9 +284,9 @@ def CfgReader__IncompletedEscapeInInclude(lineNum: int): # -------------------------------------------------------------------- def CfgReader__UnknownEscapedSymbolInInclude(lineNum: int, colNum: int, ch: str): - assert type(lineNum) == int # noqa: E721 - assert type(colNum) == int # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(colNum) is int + assert type(ch) is str assert lineNum >= 0 assert colNum >= 0 assert ch != "" @@ -298,7 +298,7 @@ def CfgReader__UnknownEscapedSymbolInInclude(lineNum: int, colNum: int, ch: str) # -------------------------------------------------------------------- def CfgReader__IncludeHasEmptyPath(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Include in line {0} has an empty path.".format(lineNum) @@ -306,8 +306,8 @@ def CfgReader__IncludeHasEmptyPath(lineNum: int): # -------------------------------------------------------------------- def CfgReader__OptionWithoutValue(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -318,8 +318,8 @@ def CfgReader__OptionWithoutValue(optionName: str, lineNum: int): # -------------------------------------------------------------------- def CfgReader__EndQuotedOptionValueIsNotFound(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -330,8 +330,8 @@ def CfgReader__EndQuotedOptionValueIsNotFound(optionName: str, lineNum: int): # -------------------------------------------------------------------- def CfgReader__IncompletedEscapeInQuotedOptionValue(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -344,9 +344,9 @@ def CfgReader__IncompletedEscapeInQuotedOptionValue(optionName: str, lineNum: in def CfgReader__UnknownEscapedSymbolInQuotedOptionValue( optionName: str, lineNum: int, colNum: int, ch: str ): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str + assert type(ch) is str assert lineNum >= 0 assert optionName != "" assert ch != "" diff --git a/src/core/read_utils.py b/src/core/read_utils.py index d665c39..52636cf 100644 --- a/src/core/read_utils.py +++ b/src/core/read_utils.py @@ -23,7 +23,7 @@ class LineReader: # -------------------------------------------------------------------- def __init__(self, tabSize=C_DEFAULT_TAB_SIZE): - assert type(tabSize) == int # noqa: E721 + assert type(tabSize) is int assert tabSize > 0 self.m_TabSize = tabSize @@ -35,8 +35,8 @@ def __init__(self, tabSize=C_DEFAULT_TAB_SIZE): # -------------------------------------------------------------------- def SetData(self, lineData: str): - assert type(lineData) == str # noqa: E721 - assert type(self.m_LineNum) == int # noqa: E721 + assert type(lineData) is str + assert type(self.m_LineNum) is int assert self.m_LineNum >= 0 self.m_Data = lineData @@ -46,27 +46,27 @@ def SetData(self, lineData: str): # -------------------------------------------------------------------- def GetLineNum(self) -> int: - assert type(self.m_LineNum) == int # noqa: E721 + assert type(self.m_LineNum) is int assert self.m_LineNum >= 0 return self.m_LineNum # -------------------------------------------------------------------- def GetColNum(self) -> int: - assert type(self.m_ColNum) == int # noqa: E721 + assert type(self.m_ColNum) is int assert self.m_ColNum >= 0 return self.m_ColNum # -------------------------------------------------------------------- def GetColOffset(self) -> int: - assert type(self.m_ColNum) == int # noqa: E721 + assert type(self.m_ColNum) is int assert self.m_ColNum > 0 return self.m_ColNum - 1 # -------------------------------------------------------------------- def StepBack(self): - assert type(self.m_Next) == int # noqa: E721 - assert type(self.m_ColNum) == int # noqa: E721 - assert type(self.m_Data) == str # noqa: E721 + assert type(self.m_Next) is int + assert type(self.m_ColNum) is int + assert type(self.m_Data) is str assert self.m_Next > 0 assert self.m_Next <= len(self.m_Data) assert self.m_ColNum > 0 @@ -85,9 +85,9 @@ def StepBack(self): # -------------------------------------------------------------------- def ReadSymbol(self) -> typing.Optional[str]: - assert type(self.m_Next) == int # noqa: E721 - assert type(self.m_ColNum) == int # noqa: E721 - assert type(self.m_Data) == str # noqa: E721 + assert type(self.m_Next) is int + assert type(self.m_ColNum) is int + assert type(self.m_Data) is str assert self.m_Next >= 0 assert self.m_Next <= len(self.m_Data) @@ -107,9 +107,9 @@ def ReadSymbol(self) -> typing.Optional[str]: # -------------------------------------------------------------------- def Helper__GetStepSize(self, ch: str) -> int: - assert type(ch) == str # noqa: E721 + assert type(ch) is str assert ch != "" - assert type(self.m_TabSize) == int # noqa: E721 + assert type(self.m_TabSize) is int assert self.m_TabSize > 0 if ch == "\t": @@ -124,7 +124,7 @@ def Helper__GetStepSize(self, ch: str) -> int: class ReadUtils: def IsSpace(ch: str) -> bool: - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ch == " ": return True @@ -136,7 +136,7 @@ def IsSpace(ch: str) -> bool: # -------------------------------------------------------------------- def IsEOL(ch: str) -> bool: - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ch == "\n": return True @@ -145,7 +145,7 @@ def IsEOL(ch: str) -> bool: # -------------------------------------------------------------------- def IsValidSeqCh1(ch: str) -> bool: - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ch.isalpha(): return True @@ -157,7 +157,7 @@ def IsValidSeqCh1(ch: str) -> bool: # -------------------------------------------------------------------- def IsValidSeqCh2(ch: str) -> bool: - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ch.isdigit(): return True @@ -167,7 +167,7 @@ def IsValidSeqCh2(ch: str) -> bool: # -------------------------------------------------------------------- def Unpack_StrList2(source: str) -> typing.List[str]: assert source is not None - assert type(source) == str # noqa: E721 + assert type(source) is str C_MODE__NONE = 0 C_MODE__QSTART = 1 @@ -192,15 +192,15 @@ class tagCtx: # ---------------------------------------------- def LOCAL__append_to_curValueItem(ctx: tagCtx, ch: str, isData: bool): - assert type(ctx) == tagCtx # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(ctx) is tagCtx + assert type(ch) is str assert len(ch) == 1 - assert type(isData) == bool # noqa: E721 + assert type(isData) is bool if ctx.curValueItem is None: ctx.curValueItem = ch else: - assert type(ctx.curValueItem) == str # noqa: E721 + assert type(ctx.curValueItem) is str ctx.curValueItem += ch if isData: @@ -210,7 +210,7 @@ def LOCAL__append_to_curValueItem(ctx: tagCtx, ch: str, isData: bool): # ---------------------------------------------- def LOCAL__append_curValueItem_to_result(ctx: tagCtx, isLast: bool): - assert type(ctx) == tagCtx # noqa: E721 + assert type(ctx) is tagCtx if ctx.mode == C_MODE__QSTART: # quoted item is not completed diff --git a/src/core/write_utils.py b/src/core/write_utils.py index fca78fb..6e14ced 100644 --- a/src/core/write_utils.py +++ b/src/core/write_utils.py @@ -10,17 +10,17 @@ class WriteUtils: def Pack_StrList2(strList: list) -> str: assert strList is not None - assert type(strList) == list # noqa: E721 + assert type(strList) is list result = "" sep = "" index: typing.Set[str] = set() - assert type(index) == set # noqa: E721 + assert type(index) is set for x in strList: assert x is not None - assert type(x) == str # noqa: E721 + assert type(x) is str v = str(x) @@ -38,7 +38,7 @@ def Pack_StrList2(strList: list) -> str: # -------------------------------------------------------------------- def Pack_Str(text: str) -> str: assert text is not None - assert type(text) == str # noqa: E721 + assert type(text) is str result = "'" @@ -69,7 +69,7 @@ def Pack_Str(text: str) -> str: # Helper Methods ----------------------------------------------------- def Helper__PackStrListItem2(itemText: str) -> str: assert itemText is not None - assert type(itemText) == str # noqa: E721 + assert type(itemText) is str needQuote = __class__.Helper__StrList__DoesItemNeedToQuote(itemText) @@ -93,7 +93,7 @@ def Helper__PackStrListItem2(itemText: str) -> str: # -------------------------------------------------------------------- def Helper__StrList__DoesItemNeedToQuote(itemText: str) -> bool: assert itemText is not None - assert type(itemText) == str # noqa: E721 + assert type(itemText) is str if itemText == "": return True diff --git a/src/implementation/v00/configuration_base.py b/src/implementation/v00/configuration_base.py index 8577d8c..cbec914 100644 --- a/src/implementation/v00/configuration_base.py +++ b/src/implementation/v00/configuration_base.py @@ -81,8 +81,8 @@ def __init__( ): assert fileLine is not None assert commentData is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(commentData) is PgCfgModel__CommentData assert commentData.m_Parent is fileLine.m_FileLineData @@ -104,29 +104,25 @@ def get_Parent(self) -> PostgresConfigurationFileLine_Base: # Comment interface -------------------------------------------------- def get_Text(self) -> str: self.Helper__CheckAlive() - assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 - assert type(self.m_CommentData.m_Text) == str # noqa: E721 + assert type(self.m_CommentData) is PgCfgModel__CommentData + assert type(self.m_CommentData.m_Text) is str return self.m_CommentData.m_Text # -------------------------------------------------------------------- def Delete(self, withLineIfLast: bool): - assert type(withLineIfLast) == bool # noqa: E721 + assert type(withLineIfLast) is bool self.Helper__CheckAlive() - assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 - assert ( # noqa: E721 - type(self.m_CommentData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 - ) - assert ( # noqa: E721 - type(self.m_CommentData.m_Parent.m_Parent) == PgCfgModel__FileData # noqa: E721 - ) - assert ( # noqa: E721 + assert type(self.m_CommentData) is PgCfgModel__CommentData + assert type(self.m_CommentData.m_Parent) is PgCfgModel__FileLineData + assert type(self.m_CommentData.m_Parent.m_Parent) is PgCfgModel__FileData + assert ( type(self.m_CommentData.m_Parent.m_Parent.m_Parent) - == PgCfgModel__ConfigurationData # noqa: E721 + is PgCfgModel__ConfigurationData ) cfgData = self.m_CommentData.m_Parent.m_Parent.m_Parent - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData PgCfgModel__DataControllerUtils.Comment__delete( cfgData, self.m_CommentData, withLineIfLast @@ -135,12 +131,12 @@ def Delete(self, withLineIfLast: bool): # Helper interface --------------------------------------------------- def Helper__CheckAlive(self): assert self.m_CommentData is not None - assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert type(self.m_CommentData) is PgCfgModel__CommentData if not self.m_CommentData.IsAlive(): RaiseError.CommentObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(self.m_FileLine) is PostgresConfigurationFileLine_Base assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -158,8 +154,8 @@ def __init__( fileLine: PostgresConfigurationFileLine_Base, optionData: PgCfgModel__OptionData, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(optionData) is PgCfgModel__OptionData super().__init__() @@ -215,7 +211,7 @@ def set_Value(self, value: any) -> PostgresConfigurationSetOptionValueResult_Bas None, # offset ) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 + assert type(r) is PostgresConfigurationSetOptionValueResult_Base assert r.m_OptData is None or r.m_OptData is self.m_OptionData assert r.m_Opt is None @@ -244,7 +240,7 @@ def set_ValueItem( value_item, ) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 + assert type(r) is PostgresConfigurationSetOptionValueResult_Base assert r.m_OptData is not None assert r.m_OptData is self.m_OptionData @@ -258,12 +254,12 @@ def set_ValueItem( # Helper methods ----------------------------------------------------- def Helper__CheckAlive(self): assert self.m_OptionData is not None - assert type(self.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(self.m_OptionData) is PgCfgModel__OptionData if not self.m_OptionData.IsAlive(): RaiseError.OptionObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(self.m_FileLine) is PostgresConfigurationFileLine_Base assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -281,8 +277,8 @@ def __init__( fileLine: PostgresConfigurationFileLine_Base, includeData: PgCfgModel__IncludeData, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(includeData) is PgCfgModel__IncludeData super().__init__() @@ -307,23 +303,19 @@ def get_File(self) -> PostgresConfigurationIncludedFile_Base: # -------------------------------------------------------------------- def Delete(self, withLine: bool): - assert type(withLine) == bool # noqa: E721 + assert type(withLine) is bool self.Helper__CheckAlive() - assert type(self.m_IncludeData) == PgCfgModel__IncludeData # noqa: E721 - assert ( # noqa: E721 - type(self.m_IncludeData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 - ) - assert ( # noqa: E721 - type(self.m_IncludeData.m_Parent.m_Parent) == PgCfgModel__FileData # noqa: E721 - ) - assert ( # noqa: E721 + assert type(self.m_IncludeData) is PgCfgModel__IncludeData + assert type(self.m_IncludeData.m_Parent) is PgCfgModel__FileLineData + assert type(self.m_IncludeData.m_Parent.m_Parent) is PgCfgModel__FileData + assert ( type(self.m_IncludeData.m_Parent.m_Parent.m_Parent) - == PgCfgModel__ConfigurationData # noqa: E721 + is PgCfgModel__ConfigurationData ) cfgData = self.m_IncludeData.m_Parent.m_Parent.m_Parent - assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData) is PgCfgModel__ConfigurationData PgCfgModel__DataControllerUtils.Include__delete( cfgData, self.m_IncludeData, withLine @@ -336,12 +328,12 @@ def Private__CheckAlive(self): # Helper methods ----------------------------------------------------- def Helper__CheckAlive(self): assert self.m_IncludeData is not None - assert type(self.m_IncludeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(self.m_IncludeData) is PgCfgModel__IncludeData if not self.m_IncludeData.IsAlive(): RaiseError.IncludeObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(self.m_FileLine) is PostgresConfigurationFileLine_Base assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -361,7 +353,7 @@ def __init__( ): assert parent is not None assert isinstance(parent, PostgresConfigurationFile_Base) - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData super().__init__() @@ -385,16 +377,16 @@ def get_Parent(self) -> PostgresConfigurationFile_Base: # FileLine interface ------------------------------------------------- def __len__(self) -> int: self.Helper__CheckAlive() - assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(self.m_FileLineData.m_Items) == list # noqa: E721 + assert type(self.m_FileLineData) is PgCfgModel__FileLineData + assert type(self.m_FileLineData.m_Items) is list return len(self.m_FileLineData.m_Items) # -------------------------------------------------------------------- def AddComment( self, text: str, offset: typing.Optional[int] = None ) -> PostgresConfigurationComment_Base: - assert type(text) == str # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 + assert type(text) is str + assert offset is None or type(offset) is int self.Helper__CheckAlive() @@ -404,10 +396,10 @@ def AddComment( self.m_FileLineData, offset, text ) assert commentData is not None - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(commentData) is PgCfgModel__CommentData assert commentData.m_Parent is self.m_FileLineData - assert type(commentData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 - assert type(commentData.m_Parent.m_Items) == list # noqa: E721 + assert type(commentData.m_Parent) is PgCfgModel__FileLineData + assert type(commentData.m_Parent.m_Items) is list assert len(commentData.m_Parent.m_Items) > 0 assert commentData.m_Parent.m_Items[-1].m_Element is commentData @@ -415,15 +407,13 @@ def AddComment( fileLineComment = PostgresConfigurationComment_Base(self, commentData) assert fileLineComment is not None - assert ( # noqa: E721 - type(fileLineComment) == PostgresConfigurationComment_Base - ) + assert type(fileLineComment) is PostgresConfigurationComment_Base except: # rollback cfg = self.m_Parent.get_Configuration() assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) assert cfg.m_Data is not None - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData PgCfgModel__DataControllerUtils.Comment__delete( cfg.m_Data, commentData, False @@ -431,7 +421,7 @@ def AddComment( raise assert fileLineComment - assert type(fileLineComment) == PostgresConfigurationComment_Base # noqa: E721 + assert type(fileLineComment) is PostgresConfigurationComment_Base return fileLineComment # -------------------------------------------------------------------- @@ -459,7 +449,7 @@ def AddOption( ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base return option # -------------------------------------------------------------------- @@ -468,7 +458,7 @@ def AddInclude( ) -> PostgresConfigurationInclude_Base: DataVerificator.CheckStringOfFilePath(path) - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" self.Helper__CheckAlive() @@ -477,27 +467,27 @@ def AddInclude( cfg = self.m_Parent.m_Cfg assert isinstance(cfg, PostgresConfiguration_Base) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData # Add/Get file # Add include element baseFolder = cfg.m_Data.OsOps.Path_DirName(self.m_FileLineData.m_Parent.m_Path) - assert type(baseFolder) == str # noqa: E721 + assert type(baseFolder) is str fileData = PgCfgModel__DataControllerUtils.Cfg__GetOrCreateFile__USER( cfg.m_Data, baseFolder, path ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData try: includeData = PgCfgModel__DataControllerUtils.FileLine__add_Include( self.m_FileLineData, path, fileData, offset ) assert includeData is not None - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(includeData) is PgCfgModel__IncludeData assert includeData.m_Path == path assert includeData.m_File is fileData assert includeData.m_Parent == self.m_FileLineData @@ -520,20 +510,20 @@ def AddInclude( # -------------------------------------------------------------------- def Clear(self) -> None: self.Helper__CheckAlive() - assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(self.m_FileLineData) is PgCfgModel__FileLineData cfg = self.m_Parent.get_Configuration() assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) assert cfg.m_Data is not None - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData PgCfgModel__DataControllerUtils.FileLine__clear(cfg.m_Data, self.m_FileLineData) # Helper methods ----------------------------------------------------- def Helper__CheckAlive(self): assert self.m_FileLineData is not None - assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(self.m_FileLineData) is PgCfgModel__FileLineData if not self.m_FileLineData.IsAlive(): RaiseError.FileLineObjectWasDeleted() @@ -590,7 +580,7 @@ def __next__(self) -> PostgresConfigurationFileLine_Base: fileLineData = self.m_FileLineDataIterator.__next__() assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData file = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, fileLineData) assert file is not None @@ -626,9 +616,9 @@ def __len__(self) -> int: fileData = self.m_File.Private__GetFileData() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_Lines is not None - assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileData.m_Lines) is list return len(fileData.m_Lines) @@ -641,9 +631,9 @@ def __iter__(self) -> PostgresConfigurationFileLinesIterator_Base: fileData = self.m_File.Private__GetFileData() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_Lines is not None - assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileData.m_Lines) is list fileLineDataIterator = fileData.m_Lines.__iter__() assert fileLineDataIterator is not None @@ -667,7 +657,7 @@ class PostgresConfigurationFile_Base(PostgresConfigurationFile): # -------------------------------------------------------------------- def __init__(self, cfg: PostgresConfiguration_Base, fileData: PgCfgModel__FileData): assert isinstance(cfg, PostgresConfiguration_Base) - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData super().__init__() @@ -685,15 +675,15 @@ def get_Configuration(self) -> PostgresConfiguration_Base: # File interface ----------------------------------------------------- def __len__(self) -> int: self.Internal__CheckAlive() - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 - assert type(self.m_FileData.m_Lines) == list # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData + assert type(self.m_FileData.m_Lines) is list return len(self.m_FileData.m_Lines) # -------------------------------------------------------------------- def get_Path(self) -> str: self.Internal__CheckAlive() - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 - assert type(self.m_FileData.m_Path) == str # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData + assert type(self.m_FileData.m_Path) is str return self.m_FileData.m_Path # -------------------------------------------------------------------- @@ -704,7 +694,7 @@ def get_Lines(self) -> PostgresConfigurationFileLines_Base: self.m_Lines = PostgresConfigurationFileLines_Base(self.m_Cfg, self) assert self.m_Lines is not None - assert type(self.m_Lines) == PostgresConfigurationFileLines_Base # noqa: E721 + assert type(self.m_Lines) is PostgresConfigurationFileLines_Base assert self.m_Lines.m_Cfg is self.m_Cfg assert self.m_FileData is self.m_FileData @@ -717,16 +707,16 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine_Base: fileLineData = PgCfgModel__DataControllerUtils.File__add_Line(self.m_FileData) assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData.m_Items) is list assert len(fileLineData.m_Items) == 0 assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list # noqa: E721 + assert type(self.m_FileData.m_Lines) is list assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -734,7 +724,7 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine_Base: fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self except: # rollback @@ -744,12 +734,12 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine_Base: raise assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base return fileLine # -------------------------------------------------------------------- def AddComment(self, text: str) -> PostgresConfigurationComment_Base: - assert type(text) == str # noqa: E721 + assert type(text) is str self.Internal__CheckAlive() @@ -758,9 +748,9 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: fileLineData = PgCfgModel__DataControllerUtils.File__add_Line(self.m_FileData) assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list # noqa: E721 + assert type(self.m_FileData.m_Lines) is list assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -769,10 +759,10 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: fileLineData, None, text ) assert commentData is not None - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(commentData) is PgCfgModel__CommentData assert commentData.m_Parent is fileLineData - assert type(commentData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 - assert type(commentData.m_Parent.m_Items) == list # noqa: E721 + assert type(commentData.m_Parent) is PgCfgModel__FileLineData + assert type(commentData.m_Parent.m_Items) is list assert len(commentData.m_Parent.m_Items) == 1 assert commentData.m_Parent.m_Items[0].m_Element is commentData @@ -780,16 +770,14 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self fileLineComment = PostgresConfigurationComment_Base(fileLine, commentData) assert fileLineComment is not None - assert ( # noqa: E721 - type(fileLineComment) == PostgresConfigurationComment_Base - ) + assert type(fileLineComment) is PostgresConfigurationComment_Base except: # rollback PgCfgModel__DataControllerUtils.FileLine__delete( self.m_Cfg.m_Data, fileLineData @@ -797,7 +785,7 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: raise assert fileLineComment - assert type(fileLineComment) == PostgresConfigurationComment_Base # noqa: E721 + assert type(fileLineComment) is PostgresConfigurationComment_Base return fileLineComment # -------------------------------------------------------------------- @@ -822,35 +810,35 @@ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption_Base: ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base return option # -------------------------------------------------------------------- def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: DataVerificator.CheckStringOfFilePath(path) - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" self.Internal__CheckAlive() assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData # Add/Get file # Add empty line # Add include element baseFolder = self.m_Cfg.m_Data.OsOps.Path_DirName(self.m_FileData.m_Path) - assert type(baseFolder) == str # noqa: E721 + assert type(baseFolder) is str fileData = PgCfgModel__DataControllerUtils.Cfg__GetOrCreateFile__USER( self.m_Cfg.m_Data, baseFolder, path ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData try: fileLineData = PgCfgModel__DataControllerUtils.File__add_Line( @@ -858,9 +846,9 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: ) assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list # noqa: E721 + assert type(self.m_FileData.m_Lines) is list assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -869,7 +857,7 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: fileLineData, path, fileData, None ) assert includeData is not None - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(includeData) is PgCfgModel__IncludeData assert includeData.m_Path == path assert includeData.m_File is fileData assert includeData.m_Parent == fileLineData @@ -877,9 +865,7 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: # ----------- fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert ( # noqa: E721 - type(fileLine) == PostgresConfigurationFileLine_Base - ) + assert type(fileLine) is PostgresConfigurationFileLine_Base assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self @@ -924,9 +910,7 @@ def SetOptionValue( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult) return result @@ -962,13 +946,11 @@ def SetOptionValueItem( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult) assert result.m_Cfg is self.m_Cfg assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_OptData.m_Name == name return result @@ -989,7 +971,7 @@ def Internal__CheckAlive(self): class PostgresConfigurationTopLevelFile_Base(PostgresConfigurationFile_Base): def __init__(self, cfg: PostgresConfiguration_Base, fileData: PgCfgModel__FileData): assert isinstance(cfg, PostgresConfiguration_Base) - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData super().__init__(cfg, fileData) @@ -1003,7 +985,7 @@ def get_Parent(self) -> PostgresConfiguration_Base: # Internal interface ------------------------------------------------- def Internal__CheckAlive(self): assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData if not self.m_FileData.IsAlive(): RaiseError.FileObjectWasDeleted() @@ -1023,8 +1005,8 @@ class PostgresConfigurationIncludedFile_Base(PostgresConfigurationFile_Base): def __init__( self, include: PostgresConfigurationInclude_Base, fileData: PgCfgModel__FileData ): - assert type(include) == PostgresConfigurationInclude_Base # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(include) is PostgresConfigurationInclude_Base + assert type(fileData) is PgCfgModel__FileData super().__init__(include.get_Configuration(), fileData) @@ -1041,8 +1023,8 @@ def get_Parent(self) -> PostgresConfigurationInclude_Base: def Internal__CheckAlive(self): assert self.m_FileData is not None assert self.m_Include is not None - assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 - assert type(self.m_Include) == PostgresConfigurationInclude_Base # noqa: E721 + assert type(self.m_FileData) is PgCfgModel__FileData + assert type(self.m_Include) is PostgresConfigurationInclude_Base if not self.m_FileData.IsAlive(): RaiseError.FileObjectWasDeleted() @@ -1073,9 +1055,9 @@ def __init__( eventID: PostgresConfigurationSetOptionValueEventID, ): assert cfg is None or isinstance(cfg, PostgresConfiguration_Base) - assert optData is None or type(optData) == PgCfgModel__OptionData # noqa: E721 + assert optData is None or type(optData) is PgCfgModel__OptionData assert (cfg is None) == (optData is None) - assert type(eventID) == PostgresConfigurationSetOptionValueEventID # noqa: E721 + assert type(eventID) is PostgresConfigurationSetOptionValueEventID self.m_Cfg = cfg self.m_Opt = None @@ -1088,7 +1070,7 @@ def Create__OptWasUpdated( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData # noqa: E721 + assert type(optData) is PgCfgModel__OptionData return __class__( cfg, optData, PostgresConfigurationSetOptionValueEventID.OPTION_WAS_UPDATED @@ -1100,7 +1082,7 @@ def Create__OptWasAdded( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData # noqa: E721 + assert type(optData) is PgCfgModel__OptionData return __class__( cfg, optData, PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -1118,7 +1100,7 @@ def Create__OptValueItemWasAlreadyDefined( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData # noqa: E721 + assert type(optData) is PgCfgModel__OptionData return __class__( cfg, @@ -1132,7 +1114,7 @@ def Create__OptValueItemWasAdded( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData # noqa: E721 + assert type(optData) is PgCfgModel__OptionData return __class__( cfg, @@ -1144,14 +1126,9 @@ def Create__OptValueItemWasAdded( @property def Option(self) -> PostgresConfigurationOption_Base: assert self.m_Cfg is None or isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert ( - self.m_OptData is None - or type(self.m_OptData) == PgCfgModel__OptionData # noqa: E721 - ) + assert self.m_OptData is None or type(self.m_OptData) is PgCfgModel__OptionData assert (self.m_Cfg is None) == (self.m_OptData is None) - assert ( # noqa: E721 - type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID - ) + assert type(self.m_EventID) is PostgresConfigurationSetOptionValueEventID if self.m_OptData is None: assert ( @@ -1180,15 +1157,13 @@ def Option(self) -> PostgresConfigurationOption_Base: ) assert self.m_Opt is not None - assert type(self.m_Opt) == PostgresConfigurationOption_Base # noqa: E721 + assert type(self.m_Opt) is PostgresConfigurationOption_Base return self.m_Opt # --------------------------------------------------------------------- @property def EventID(self) -> PostgresConfigurationSetOptionValueEventID: - assert ( # noqa: E721 - type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID - ) + assert type(self.m_EventID) is PostgresConfigurationSetOptionValueEventID return self.m_EventID @@ -1239,7 +1214,7 @@ def __next__(self) -> PostgresConfigurationFile_Base: fileData = self.m_FileDataIterator.__next__() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData file = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, fileData) assert file is not None @@ -1265,16 +1240,16 @@ def __init__(self, cfg: PostgresConfiguration_Base): def __len__(self) -> int: assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Cfg.m_Data.m_AllFilesByName) is dict return len(self.m_Cfg.m_Data.m_AllFilesByName.values()) # -------------------------------------------------------------------- def __iter__(self) -> PostgresConfiguration_Base__AllFilesIterator: assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Cfg.m_Data.m_AllFilesByName) is dict fileDataIterator = self.m_Cfg.m_Data.m_AllFilesByName.values().__iter__() assert fileDataIterator is not None @@ -1288,8 +1263,8 @@ def __iter__(self) -> PostgresConfiguration_Base__AllFilesIterator: def GetFileByName(self, file_name: str) -> PostgresConfigurationFile_Base: assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Cfg.m_Data.m_AllFilesByName) is dict file_name2 = self.m_Cfg.m_Data.OsOps.Path_NormCase(file_name) @@ -1365,7 +1340,7 @@ def __next__(self) -> PostgresConfigurationFile_Base: optionData = self.m_OptionDataIterator.__next__() assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData option = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, optionData) assert option is not None @@ -1391,16 +1366,16 @@ def __init__(self, cfg: PostgresConfiguration_Base): def __len__(self) -> int: assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Cfg.m_Data.m_AllOptionsByName) is dict return len(self.m_Cfg.m_Data.m_AllOptionsByName.values()) # -------------------------------------------------------------------- def __iter__(self) -> PostgresConfiguration_Base__AllFilesIterator: assert self.m_Cfg is not None assert isinstance(self.m_Cfg, PostgresConfiguration_Base) - assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Cfg.m_Data.m_AllOptionsByName) is dict optionDataIterator = self.m_Cfg.m_Data.m_AllOptionsByName.values().__iter__() assert optionDataIterator is not None @@ -1423,7 +1398,7 @@ class PostgresConfiguration_Base(PostgresConfiguration, PgCfgModel__DataHandler) # -------------------------------------------------------------------- def __init__(self, data_dir: str, osOps: ConfigurationOsOps): - assert type(data_dir) == str # noqa: E721 + assert type(data_dir) is str assert isinstance(osOps, ConfigurationOsOps) super(PostgresConfiguration, self).__init__() @@ -1443,9 +1418,9 @@ def get_Parent(self) -> PostgresConfigurationObject: # PostgresConfiguration interface ------------------------------------ def AddTopLevelFile(self, path: str) -> PostgresConfigurationTopLevelFile_Base: - assert type(path) == str # noqa: E721 + assert type(path) is str assert path != "" - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert isinstance(self.m_Data.OsOps, ConfigurationOsOps) assert self.m_Data.OsOps.Path_BaseName(path) != "" @@ -1457,12 +1432,12 @@ def AddTopLevelFile(self, path: str) -> PostgresConfigurationTopLevelFile_Base: file = PostgresConfigurationFactory_Base.GetObject(self, fileData) assert file is not None - assert type(file) == PostgresConfigurationTopLevelFile_Base # noqa: E721 + assert type(file) is PostgresConfigurationTopLevelFile_Base except: # rollback raise assert file is not None - assert type(file) == PostgresConfigurationTopLevelFile_Base # noqa: E721 + assert type(file) is PostgresConfigurationTopLevelFile_Base return file # -------------------------------------------------------------------- @@ -1480,7 +1455,7 @@ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption_Base: ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert isinstance(option, PostgresConfigurationOption_Base) assert isinstance(option, PostgresConfigurationOption) return option @@ -1500,9 +1475,7 @@ def SetOptionValue( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult) return result @@ -1525,9 +1498,7 @@ def SetOptionValueItem( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult_Base) return result @@ -1535,30 +1506,26 @@ def SetOptionValueItem( # -------------------------------------------------------------------- def get_AllFiles(self) -> PostgresConfiguration_Base__AllFiles: assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData if self.m_AllFiles is None: self.m_AllFiles = PostgresConfiguration_Base__AllFiles(self) assert self.m_AllFiles is not None - assert ( # noqa: E721 - type(self.m_AllFiles) == PostgresConfiguration_Base__AllFiles - ) + assert type(self.m_AllFiles) is PostgresConfiguration_Base__AllFiles assert self.m_AllFiles.m_Cfg is self return self.m_AllFiles # -------------------------------------------------------------------- def get_AllOptions(self) -> PostgresConfiguration_Base__AllOptions: assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData if self.m_AllOptions is None: self.m_AllOptions = PostgresConfiguration_Base__AllOptions(self) assert self.m_AllOptions is not None - assert ( # noqa: E721 - type(self.m_AllOptions) == PostgresConfiguration_Base__AllOptions - ) + assert type(self.m_AllOptions) is PostgresConfiguration_Base__AllOptions assert self.m_AllOptions.m_Cfg is self return self.m_AllOptions @@ -1571,10 +1538,10 @@ def DataHandler__SetOptionValue__Simple( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData # noqa: E721 - or type(targetData) == PgCfgModel__OptionData # noqa: E721 + or type(targetData) is PgCfgModel__FileData + or type(targetData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None # ------------------------------------------------ @@ -1605,10 +1572,10 @@ def DataHandler__GetOptionValue__Simple( ) -> any: assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData # noqa: E721 - or type(sourceData) == PgCfgModel__OptionData # noqa: E721 + or type(sourceData) is PgCfgModel__FileData + or type(sourceData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str # -------------------------------------- ROOT if sourceData is None: @@ -1617,7 +1584,7 @@ def DataHandler__GetOptionValue__Simple( ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Value is not None return self.Helper__PrepareGetValue( @@ -1643,14 +1610,14 @@ def DataHandler__GetOptionValue__Simple( assert fileData.IsAlive() assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict optionData = self.Helper__FindSimpleOption( fileData.m_OptionsByName, optionName ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Value is not None return self.Helper__PrepareGetValue( @@ -1671,10 +1638,10 @@ def DataHandler__GetOptionValue__UnionList( ) -> any: assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData # noqa: E721 - or type(sourceData) == PgCfgModel__OptionData # noqa: E721 + or type(sourceData) is PgCfgModel__FileData + or type(sourceData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str # -------------------------------------- ROOT if sourceData is None: @@ -1685,7 +1652,7 @@ def DataHandler__GetOptionValue__UnionList( if unionList is None: return None - assert type(unionList) == list # noqa: E721 + assert type(unionList) is list return self.Helper__PrepareGetValue(optionName, unionList) typeOfSource = type(sourceData) @@ -1704,10 +1671,10 @@ def DataHandler__GetOptionValue__UnionList( if typeOfSource == PgCfgModel__FileData: sourceFileData: PgCfgModel__FileData = sourceData - assert type(sourceFileData) == PgCfgModel__FileData # noqa: E721 + assert type(sourceFileData) is PgCfgModel__FileData assert sourceFileData.IsAlive() assert sourceFileData.m_OptionsByName is not None - assert type(sourceFileData.m_OptionsByName) == dict # noqa: E721 + assert type(sourceFileData.m_OptionsByName) is dict typeOfOption = type(optionName) @@ -1719,7 +1686,7 @@ def DataHandler__GetOptionValue__UnionList( if unionList is None: return None - assert type(unionList) == list # noqa: E721 + assert type(unionList) is list return self.Helper__PrepareGetValue(optionName, unionList) BugCheckError.UnkObjectDataType(typeOfOption) @@ -1734,10 +1701,10 @@ def DataHandler__ResetOption( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData # noqa: E721 - or type(targetData) == PgCfgModel__OptionData # noqa: E721 + or type(targetData) is PgCfgModel__FileData + or type(targetData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str # -------------------------------- target is NONE if targetData is None: @@ -1767,7 +1734,7 @@ def DataHandler__ResetOption( ) if typeOfTarget is PgCfgModel__FileData: - assert type(targetData) == PgCfgModel__FileData # noqa: E721 + assert type(targetData) is PgCfgModel__FileData eventID = self.Helper__FindAndDeleteOption( targetData.m_OptionsByName, optionName @@ -1792,17 +1759,17 @@ def DataHandler__AddSimpleOption( ) -> PostgresConfigurationOption_Base: assert ( target is None - or type(target) == PgCfgModel__FileData # noqa: E721 - or type(target) == PgCfgModel__FileLineData # noqa: E721 + or type(target) is PgCfgModel__FileData + or type(target) is PgCfgModel__FileLineData ) - assert optionOffset is None or type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert optionOffset is None or type(optionOffset) is int + assert type(optionName) is str assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) is dict typeOfTarget = type(target) @@ -1830,10 +1797,10 @@ def DataHandler__SetUniqueOptionValueItem( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData # noqa: E721 - or type(targetData) == PgCfgModel__OptionData # noqa: E721 + or type(targetData) is PgCfgModel__FileData + or type(targetData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValueItem is not None # -------------------------------- target is NONE @@ -1869,7 +1836,7 @@ def Internal__GetAutoConfFileName(self) -> str: def Internal__GetOptionHandlerToPrepareSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareSetValue" ) @@ -1878,7 +1845,7 @@ def Internal__GetOptionHandlerToPrepareSetValue( def Internal__GetOptionHandlerToPrepareSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValueItem: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareSetValueItem" ) @@ -1887,7 +1854,7 @@ def Internal__GetOptionHandlerToPrepareSetValueItem( def Internal__GetOptionHandlerToPrepareGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareGetValue: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareGetValue" ) @@ -1896,7 +1863,7 @@ def Internal__GetOptionHandlerToPrepareGetValue( def Internal__GetOptionHandlerToSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToSetValue: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToSetValue" ) @@ -1905,7 +1872,7 @@ def Internal__GetOptionHandlerToSetValue( def Internal__GetOptionHandlerToGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToGetValue: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToGetValue" ) @@ -1914,7 +1881,7 @@ def Internal__GetOptionHandlerToGetValue( def Internal__GetOptionHandlerToAddOption( self, name: str ) -> PgCfgModel__OptionHandlerToAddOption: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToAddOption" ) @@ -1923,7 +1890,7 @@ def Internal__GetOptionHandlerToAddOption( def Internal__GetOptionHandlerToSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToSetValueItem: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToSetValueItem" ) @@ -1932,7 +1899,7 @@ def Internal__GetOptionHandlerToSetValueItem( def Internal__GetOptionHandlerToWrite( self, name: str ) -> PgCfgModel__OptionHandlerToWrite: - assert type(name) == str # noqa: E721 + assert type(name) is str RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToWrite" ) @@ -1941,8 +1908,8 @@ def Internal__GetOptionHandlerToWrite( def Helper__FindSimpleOption( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> typing.Optional[PgCfgModel__OptionData]: - assert type(allOptionsByName) == dict # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(allOptionsByName) is dict + assert type(optionName) is str if not (optionName in allOptionsByName.keys()): return None @@ -1951,13 +1918,13 @@ def Helper__FindSimpleOption( assert data is not None - if type(data) == PgCfgModel__OptionData: # noqa: E721 + if type(data) is PgCfgModel__OptionData: assert data.IsAlive() assert data.m_Name == optionName self.Debug__CheckOurObjectData(data) return data - if type(data) == list: # noqa: E721 + if type(data) is list: assert len(data) > 1 BugCheckError.MultipleDefOfOptionIsFound(optionName, len(data)) @@ -1967,8 +1934,8 @@ def Helper__FindSimpleOption( def Helper__AggregateAllOptionValues( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> list: - assert type(allOptionsByName) == dict # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(allOptionsByName) is dict + assert type(optionName) is str if not (optionName in allOptionsByName.keys()): return None @@ -1982,42 +1949,42 @@ def Helper__AggregateAllOptionValues( assert data.IsAlive() assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list # noqa: E721 + assert type(data.m_Value) is list return data.m_Value if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list data = data.copy() - assert type(data) == list # noqa: E721 + assert type(data) is list result = [] for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.m_Name == optionName assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData.m_Value) is list result.extend(self.m_Data) assert result is not None - assert type(result) == list # noqa: E721 + assert type(result) is list return result # Unknown type of option data in dictionary - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str BugCheckError.UnkOptObjectDataType(optionName, typeOfData) # -------------------------------------------------------------------- def Helper__FindAndDeleteOption( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> PostgresConfigurationSetOptionValueEventID: - assert type(allOptionsByName) == dict # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(allOptionsByName) is dict + assert type(optionName) is str if not (optionName in allOptionsByName.keys()): return PostgresConfigurationSetOptionValueEventID.NONE @@ -2036,13 +2003,13 @@ def Helper__FindAndDeleteOption( return PostgresConfigurationSetOptionValueEventID.OPTION_WAS_DELETED if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list data = data.copy() - assert type(data) == list # noqa: E721 + assert type(data) is list for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2057,7 +2024,7 @@ def Helper__FindAndDeleteOption( # Unknown type of option data in dictionary - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str BugCheckError.UnkOptObjectDataType(optionName, typeOfData) # -------------------------------------------------------------------- @@ -2065,22 +2032,22 @@ def Helper__FindAndDeleteOption( def Helper__GetFileForSimpleOption( self, option_name: str ) -> tuple[PgCfgModel__FileData, bool]: - assert type(option_name) == str # noqa: E721 + assert type(option_name) is str assert option_name != "" option_name_parts = option_name.split(".") - assert type(option_name_parts) == list # noqa: E721 + assert type(option_name_parts) is list assert len(option_name_parts) > 0 if len(option_name_parts) > 1: specFileName = "postgresql." + ".".join(option_name_parts[:-1]) + ".conf" - assert type(specFileName) == str # noqa: E721 + assert type(specFileName) is str fileData = self.Helper__FindFile(specFileName) if fileData is not None: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData return (fileData, False) # Let's use standard "postgresql.auto.conf" @@ -2088,7 +2055,7 @@ def Helper__GetFileForSimpleOption( fileData = self.Helper__FindFile(self.Internal__GetAutoConfFileName()) if fileData is not None: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData return (fileData, False) assert fileData is None @@ -2098,20 +2065,20 @@ def Helper__GetFileForSimpleOption( ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData return (fileData, True) # -------------------------------------------------------------------- def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: - assert type(file_name) == str # noqa: E721 + assert type(file_name) is str assert file_name != "" - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert isinstance(self.m_Data.OsOps, ConfigurationOsOps) assert self.m_Data.OsOps.Path_BaseName(file_name) == file_name - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllFilesByName) is dict file_name_n = self.m_Data.OsOps.Path_NormCase(file_name) @@ -2122,10 +2089,10 @@ def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: assert data is not None - if type(data) == PgCfgModel__FileData: # noqa: E721 + if type(data) is PgCfgModel__FileData: return data - if type(data) == list: # noqa: E721 + if type(data) is list: assert len(data) > 1 BugCheckError.MultipleDefOfFileIsFound(file_name_n, len(data)) @@ -2135,7 +2102,7 @@ def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: def Helper__PrepareGetValue(self, optionName: str, optionValue: any) -> any: assert optionName is not None assert optionValue is not None - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str prepareHandler = self.Internal__GetOptionHandlerToPrepareGetValue(optionName) assert prepareHandler is not None @@ -2153,13 +2120,13 @@ def Helper__AddSimpleOption__Common( optionName: str, optionValue: any, ) -> PostgresConfigurationOption_Base: - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) is dict if optionName in self.m_Data.m_AllOptionsByName.keys(): assert self.m_Data.m_AllOptionsByName[optionName] is not None @@ -2167,17 +2134,15 @@ def Helper__AddSimpleOption__Common( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.get_Parent() is not None - assert ( - type(optionData.get_Parent()) == PgCfgModel__FileLineData # noqa: E721 - ) # noqa: E721 + assert type(optionData.get_Parent()) is PgCfgModel__FileLineData anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 + assert type(anotherFileData) is PgCfgModel__FileData RaiseError.OptionIsAlreadyExistInFile(anotherFileData.m_Path, optionName) @@ -2187,14 +2152,14 @@ def Helper__AddSimpleOption__Common( # Let's select the file to append this new option getFileData_r = self.Helper__GetFileForSimpleOption(optionName) - assert type(getFileData_r) == tuple # noqa: E721 + assert type(getFileData_r) is tuple assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 - assert type(getFileData_r[1]) == bool # noqa: E721 + assert type(getFileData_r[0]) is PgCfgModel__FileData + assert type(getFileData_r[1]) is bool fileData = getFileData_r[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData try: # may raise @@ -2203,7 +2168,7 @@ def Helper__AddSimpleOption__Common( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionName in self.m_Data.m_AllOptionsByName.keys() assert optionName in fileData.m_OptionsByName.keys() @@ -2213,7 +2178,7 @@ def Helper__AddSimpleOption__Common( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData except: # rollback line with option assert optionData.IsAlive() @@ -2228,11 +2193,11 @@ def Helper__AddSimpleOption__Common( assert not (optionName in fileData.m_OptionsByName.keys()) raise except: # rollback file - assert type(getFileData_r) == tuple # noqa: E721 + assert type(getFileData_r) is tuple assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 - assert type(getFileData_r[1]) == bool # noqa: E721 + assert type(getFileData_r[0]) is PgCfgModel__FileData + assert type(getFileData_r[1]) is bool if getFileData_r[1]: pass # TODO: delete file @@ -2240,7 +2205,7 @@ def Helper__AddSimpleOption__Common( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2254,22 +2219,22 @@ def Helper__AddSimpleOption__FileLine( optionValue: any, ): assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert optionOffset is None or type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert optionOffset is None or type(optionOffset) is int + assert type(optionName) is str assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) is dict fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict if optionName in fileData.m_OptionsByName.keys(): assert fileData.m_OptionsByName[optionName] is not None @@ -2281,18 +2246,16 @@ def Helper__AddSimpleOption__FileLine( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.get_Parent() is not None - assert ( - type(optionData.get_Parent()) == PgCfgModel__FileLineData # noqa: E721 - ) # noqa: E721 + assert type(optionData.get_Parent()) is PgCfgModel__FileLineData anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 + assert type(anotherFileData) is PgCfgModel__FileData assert anotherFileData is not fileData RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2310,7 +2273,7 @@ def Helper__AddSimpleOption__FileLine( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2319,7 +2282,7 @@ def Helper__AddSimpleOption__FileLine( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData except: PgCfgModel__DataControllerUtils.Option__delete(self.m_Data, optionData()) @@ -2330,7 +2293,7 @@ def Helper__AddSimpleOption__FileLine( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2343,17 +2306,17 @@ def Helper__AddSimpleOption__File( optionValue: any, ): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(optionName) is str assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) is dict assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict if optionName in fileData.m_OptionsByName.keys(): assert fileData.m_OptionsByName[optionName] is not None @@ -2365,18 +2328,16 @@ def Helper__AddSimpleOption__File( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.get_Parent() is not None - assert ( - type(optionData.get_Parent()) == PgCfgModel__FileLineData # noqa: E721 - ) # noqa: E721 + assert type(optionData.get_Parent()) is PgCfgModel__FileLineData anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 + assert type(anotherFileData) is PgCfgModel__FileData assert anotherFileData is not fileData RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2394,7 +2355,7 @@ def Helper__AddSimpleOption__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2403,7 +2364,7 @@ def Helper__AddSimpleOption__File( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData except: PgCfgModel__DataControllerUtils.FileLine__delete( @@ -2416,7 +2377,7 @@ def Helper__AddSimpleOption__File( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2427,12 +2388,12 @@ def Helper__SetSimpleOptionValue__Common( optionName: str, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllOptionsByName) is dict # ------------------------------------------------ optionData = self.Helper__FindSimpleOption( @@ -2440,7 +2401,7 @@ def Helper__SetSimpleOptionValue__Common( ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2455,16 +2416,14 @@ def Helper__SetSimpleOptionValue__Common( result = self.Helper__FinalRegSimpleOptionValue__Common(optionName, optionValue) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult) assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_Cfg is self return result @@ -2476,16 +2435,16 @@ def Helper__SetSimpleOptionValue__File( optionName: str, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(fileData.m_OptionsByName) == dict # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(fileData.m_OptionsByName) is dict + assert type(optionName) is str assert optionValue is not None # ------------------------------------------------ optionData = self.Helper__FindSimpleOption(fileData.m_OptionsByName, optionName) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2504,14 +2463,12 @@ def Helper__SetSimpleOptionValue__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName - assert type(optionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(optionData.m_Parent) is PgCfgModel__FileLineData assert optionData.m_Parent.IsAlive() - assert ( # noqa: E721 - type(optionData.m_Parent.m_Parent) == PgCfgModel__FileData # noqa: E721 - ) + assert type(optionData.m_Parent.m_Parent) is PgCfgModel__FileData assert optionData.m_Parent.m_Parent.IsAlive() RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2523,15 +2480,13 @@ def Helper__SetSimpleOptionValue__File( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2542,7 +2497,7 @@ def Helper__SetSimpleOptionValue__Exact( optionData: PgCfgModel__OptionData, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionValue is not None @@ -2562,12 +2517,12 @@ def Helper__SetUniqueOptionValueItem__Common( optionName: str, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValueItem is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllOptionsByName) is dict # ------------------------------------------------ while True: @@ -2579,10 +2534,10 @@ def Helper__SetUniqueOptionValueItem__Common( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData # noqa: E721 + assert type(data) is PgCfgModel__OptionData assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list # noqa: E721 + assert type(data.m_Value) is list if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( data, optionValueItem @@ -2600,15 +2555,15 @@ def Helper__SetUniqueOptionValueItem__Common( ) if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list assert len(data) > 1 for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.m_Name == optionName assert optionData.m_Value is not None - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData.m_Value) is list if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( optionData, optionValueItem @@ -2633,16 +2588,14 @@ def Helper__SetUniqueOptionValueItem__Common( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert isinstance(result, PostgresConfigurationSetOptionValueResult) assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_OptData.m_Name == optionName assert result.m_Cfg is self @@ -2654,7 +2607,7 @@ def Helper__SetUniqueOptionValueItem__Exact( optionData: PgCfgModel__OptionData, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionValueItem is not None @@ -2668,10 +2621,10 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( optionData: PgCfgModel__OptionData, optionPreparedValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData.m_Value) is list assert optionPreparedValueItem is not None # ------------------------------------------------ @@ -2692,10 +2645,10 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData # noqa: E721 + assert type(data) is PgCfgModel__OptionData # It is the single property! assert data is optionData - assert type(data.m_Value) == list # noqa: E721 + assert type(data.m_Value) is list PgCfgModel__DataControllerUtils.Option__add_ValueItem( data, optionPreparedValueItem @@ -2706,7 +2659,7 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( ) if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list assert len(data) > 1 for optionData2 in data: @@ -2714,15 +2667,15 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( continue assert optionData2 is not None - assert type(optionData2) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData2) is PgCfgModel__OptionData assert optionData2.IsAlive() assert optionData2.m_Name == optionData.m_Name assert optionData2.m_Value is not None - assert type(optionData2.m_Value) == list # noqa: E721 + assert type(optionData2.m_Value) is list assert optionData2.m_Parent.IsAlive() fileData2 = optionData2.m_Parent.m_Parent - assert type(fileData2) == PgCfgModel__FileData # noqa: E721 + assert type(fileData2) is PgCfgModel__FileData assert fileData2.IsAlive() if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( @@ -2748,17 +2701,17 @@ def Helper__SetUniqueOptionValueItem__File( optionName: str, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(optionName) is str assert fileData.IsAlive() assert optionValueItem is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllOptionsByName) is dict assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(fileData.m_OptionsByName) is dict # ------------------------------------------------ C_BUGCHECK_SRC = __class__.__name__ + "::Helper__SetUniqueOptionValueItem__File" @@ -2780,7 +2733,7 @@ def Helper__SetUniqueOptionValueItem__File( assert data.IsAlive() assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list # noqa: E721 + assert type(data.m_Value) is list if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( data, optionValueItem @@ -2798,16 +2751,16 @@ def Helper__SetUniqueOptionValueItem__File( assert typeOfData != PgCfgModel__OptionData if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list assert len(data) > 1 for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.m_Value is not None - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData.m_Value) is list if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( optionData, optionValueItem @@ -2820,7 +2773,7 @@ def Helper__SetUniqueOptionValueItem__File( # Postgres does not support a concatention of option lists BugCheckError.MultipleDefOfOptionIsFound(optionName, len(data)) - assert typeOfData != list # noqa: E721 + assert typeOfData is not list BugCheckError.UnkOptObjectDataType(optionName, typeOfData) @@ -2834,16 +2787,16 @@ def Helper__SetUniqueOptionValueItem__File( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData # noqa: E721 + assert type(data) is PgCfgModel__OptionData assert data.IsAlive() assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list # noqa: E721 + assert type(data.m_Value) is list assert data.get_Parent().IsAlive() fileData2 = data.get_Parent().get_Parent() assert fileData2 is not None - assert type(fileData2) == PgCfgModel__FileData # noqa: E721 + assert type(fileData2) is PgCfgModel__FileData assert fileData2.IsAlive() assert not (fileData2 is fileData) @@ -2859,20 +2812,20 @@ def Helper__SetUniqueOptionValueItem__File( ) if typeOfData == list: - assert type(data) == list # noqa: E721 + assert type(data) is list assert len(data) > 1 for optionData2 in data: assert optionData2 is not None - assert type(optionData2) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData2) is PgCfgModel__OptionData assert optionData2.IsAlive() assert optionData2.m_Name == optionName assert optionData2.m_Value is not None - assert type(optionData2.m_Value) == list # noqa: E721 + assert type(optionData2.m_Value) is list fileData2 = optionData2.get_Parent().get_Parent() assert fileData2 is not None - assert type(fileData2) == PgCfgModel__FileData # noqa: E721 + assert type(fileData2) is PgCfgModel__FileData assert fileData2.IsAlive() assert not (fileData2 is fileData) @@ -2901,15 +2854,13 @@ def Helper__SetUniqueOptionValueItem__File( ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2920,12 +2871,12 @@ def Helper__FinalRegSimpleOptionValue__Common( optionName: str, preparedOptionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert preparedOptionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllOptionsByName) is dict assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) @@ -2933,24 +2884,24 @@ def Helper__FinalRegSimpleOptionValue__Common( getFileData_r = self.Helper__GetFileForSimpleOption(optionName) assert getFileData_r is not None - assert type(getFileData_r) == tuple # noqa: E721 + assert type(getFileData_r) is tuple assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 - assert type(getFileData_r[1]) == bool # noqa: E721 + assert type(getFileData_r[0]) is PgCfgModel__FileData + assert type(getFileData_r[1]) is bool fileData = getFileData_r[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData try: result = self.Helper__FinalRegSimpleOptionValue__File( fileData, optionName, preparedOptionValue ) except: # rollback file - assert type(getFileData_r) == tuple # noqa: E721 + assert type(getFileData_r) is tuple assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 - assert type(getFileData_r[1]) == bool # noqa: E721 + assert type(getFileData_r[0]) is PgCfgModel__FileData + assert type(getFileData_r[1]) is bool if getFileData_r[1]: pass # TODO: delete file @@ -2958,15 +2909,13 @@ def Helper__FinalRegSimpleOptionValue__Common( raise assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(result.m_OptData) is PgCfgModel__OptionData assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2978,13 +2927,13 @@ def Helper__FinalRegSimpleOptionValue__File( optionName: str, preparedOptionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData # noqa: E721a - assert type(optionName) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(optionName) is str assert preparedOptionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(self.m_Data) is PgCfgModel__ConfigurationData + assert type(self.m_Data.m_AllOptionsByName) is dict assert not (optionName in fileData.m_OptionsByName.keys()) assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) @@ -2994,10 +2943,10 @@ def Helper__FinalRegSimpleOptionValue__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Name == optionName - assert type(optionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(optionData.m_Parent) is PgCfgModel__FileLineData assert optionData.m_Parent.m_Parent is fileData assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -3007,9 +2956,7 @@ def Helper__FinalRegSimpleOptionValue__File( self, optionData ) assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -3029,9 +2976,7 @@ def Helper__FinalRegSimpleOptionValue__File( raise assert result is not None - assert ( # noqa: E721 - type(result) == PostgresConfigurationSetOptionValueResult_Base - ) + assert type(result) is PostgresConfigurationSetOptionValueResult_Base assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -3046,10 +2991,10 @@ def Helper__DoesOptionValueAlreadyHaveThisUniqueItem( ) -> bool: assert optionData is not None assert optionValueItem is not None - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list # noqa: E721 + assert type(optionData.m_Value) is list return Helpers.DoesContainerContainsValue__NotNullAndExact( optionData.m_Value, optionValueItem @@ -3061,7 +3006,7 @@ def Debug__CheckOurObjectData(self, data: PgCfgModel__ObjectData): assert isinstance(data, PgCfgModel__ObjectData) stack: typing.Set[PgCfgModel__ObjectData] = set() - assert type(stack) == set # noqa: E721 + assert type(stack) is set ptr = data while ptr is not self.m_Data: @@ -3098,7 +3043,7 @@ def GetObject( assert isinstance(objectData, PgCfgModel__ObjectData) - assert type(stack) == list # noqa: E721 + assert type(stack) is list assert len(stack) > 0 # Build ConfigurationObjects @@ -3160,7 +3105,7 @@ def Helper__CreateFile( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__FileData # noqa: E721 + assert type(objectData) is PgCfgModel__FileData assert isinstance(objectParent, PostgresConfigurationObject) if isinstance(objectParent, PostgresConfiguration_Base): @@ -3177,7 +3122,7 @@ def Helper__CreateFileLine( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__FileLineData # noqa: E721 + assert type(objectData) is PgCfgModel__FileLineData assert isinstance(objectParent, PostgresConfigurationFile_Base) return PostgresConfigurationFileLine_Base(objectParent, objectData) @@ -3189,7 +3134,7 @@ def Helper__CreateFileLineComment( ) -> PostgresConfigurationFile_Base: assert fileLineDataItem is not None assert fileLine is not None - assert type(fileLineDataItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(fileLineDataItem) is PgCfgModel__FileLineData.tagItem assert isinstance(fileLine, PostgresConfigurationFileLine_Base) return PostgresConfigurationComment_Base(fileLine, fileLineDataItem) @@ -3201,7 +3146,7 @@ def Helper__CreateOption( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__OptionData # noqa: E721 + assert type(objectData) is PgCfgModel__OptionData assert isinstance(objectParent, PostgresConfigurationFileLine_Base) return PostgresConfigurationOption_Base(objectParent, objectData) @@ -3218,13 +3163,13 @@ def LoadConfigurationFile( assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str assert filePath != "" existFileDatas: typing.Dict[str, PgCfgModel__FileData] = dict() for fileName in cfg.m_Data.m_AllFilesByName.keys(): - assert type(fileName) == str # noqa: E721 + assert type(fileName) is str assert fileName != "" indexData = cfg.m_Data.m_AllFilesByName[fileName] @@ -3234,15 +3179,15 @@ def LoadConfigurationFile( if typeOfIndexData == PgCfgModel__FileData: fileData: PgCfgModel__FileData = indexData - assert type(fileData.m_Path) == str # noqa: E721 + assert type(fileData.m_Path) is str assert not (fileData.m_Path in existFileDatas.keys()) existFileDatas[fileData.m_Path] = fileData continue if typeOfIndexData == list: for fileData in indexData: - assert type(fileData) == PgCfgModel__FileData # noqa: E721 - assert type(fileData.m_Path) == str # noqa: E721 + assert type(fileData) is PgCfgModel__FileData + assert type(fileData.m_Path) is str assert not (fileData.m_Path in existFileDatas.keys()) existFileDatas[fileData.m_Path] = fileData continue @@ -3254,7 +3199,7 @@ def LoadConfigurationFile( filePath_n = Helpers.NormalizeFilePath( cfg.m_Data.OsOps, cfg.m_Data.m_DataDir, filePath ) - assert type(filePath_n) == str # noqa: E721 + assert type(filePath_n) is str if filePath_n in existFileDatas: return PostgresConfigurationFactory_Base.GetObject( @@ -3263,9 +3208,9 @@ def LoadConfigurationFile( # ---------------------------------------------------------------- rootFile = cfg.AddTopLevelFile(filePath) - assert type(rootFile) == PostgresConfigurationTopLevelFile_Base # noqa: E721 - assert type(rootFile.m_FileData) == PgCfgModel__FileData # noqa: E721 - assert type(rootFile.m_FileData.m_Lines) == list # noqa: E721 + assert type(rootFile) is PostgresConfigurationTopLevelFile_Base + assert type(rootFile.m_FileData) is PgCfgModel__FileData + assert type(rootFile.m_FileData.m_Lines) is list assert rootFile.m_FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert rootFile.m_FileData.m_LastModifiedTimestamp is None assert len(rootFile.m_FileData.m_Lines) == 0 @@ -3289,7 +3234,7 @@ def LoadConfigurationFile( __class__.Helper__LoadFileContent(currentFile, f) # raise lastMDate = f.GetModificationTS() - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime currentFileData.m_LastModifiedTimestamp = lastMDate currentFileData.m_Status = PgCfgModel__FileStatus.EXISTS @@ -3299,19 +3244,17 @@ def LoadConfigurationFile( # enumerate all the includes for fileLineData in currentFileData.m_Lines: - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list for fileLineItem in fileLineData.m_Items: - assert ( # noqa: E721 - type(fileLineItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 - ) + assert type(fileLineItem) is PgCfgModel__FileLineData.tagItem fileLineElementData = fileLineItem.m_Element typeOfFileLineElementData = type(fileLineElementData) - if typeOfFileLineElementData == PgCfgModel__CommentData: + if typeOfFileLineElementData is PgCfgModel__CommentData: continue if typeOfFileLineElementData == PgCfgModel__OptionData: @@ -3320,10 +3263,8 @@ def LoadConfigurationFile( if typeOfFileLineElementData == PgCfgModel__IncludeData: # look at existFileDatas includeData: PgCfgModel__IncludeData = fileLineElementData - assert ( # noqa: E721 - type(includeData.m_File) == PgCfgModel__FileData # noqa: E721 - ) - assert type(includeData.m_File.m_Path) == str # noqa: E721 + assert type(includeData.m_File) is PgCfgModel__FileData + assert type(includeData.m_File.m_Path) is str if includeData.m_File.m_Path in existFileDatas: continue # it is an old file @@ -3371,7 +3312,7 @@ def Helper__LoadFileContent( assert lineData is None break - assert type(lineData) == str # noqa: E721 + assert type(lineData) is str lineReader.SetData(lineData) @@ -3382,10 +3323,10 @@ def Helper__ProcessLineData( file: PostgresConfigurationFile_Base, lineReader: ReadUtils__LineReader ): assert isinstance(file, PostgresConfigurationFile_Base) - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 + assert type(lineReader) is ReadUtils__LineReader fileLine = file.AddEmptyLine() - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base ch: typing.Optional[str] @@ -3421,7 +3362,7 @@ def Helper__ProcessLineData( assert ch is None break - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ReadUtils.IsValidSeqCh2(ch): sequence += ch @@ -3457,8 +3398,8 @@ def Helper__ProcessLineData( def Helper__ProcessLineData__Comment( fileLine: PostgresConfigurationFileLine_Base, lineReader: ReadUtils__LineReader ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(lineReader) is ReadUtils__LineReader commentText = "" commentOffset = lineReader.GetColOffset() @@ -3470,7 +3411,7 @@ def Helper__ProcessLineData__Comment( assert ch is None break - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ReadUtils.IsEOL(ch): break @@ -3484,9 +3425,9 @@ def Helper__ProcessLineData__Include( lineReader: ReadUtils__LineReader, includeOffset: int, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 - assert type(includeOffset) == int # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(lineReader) is ReadUtils__LineReader + assert type(includeOffset) is int assert includeOffset >= 0 # find first quote @@ -3595,7 +3536,7 @@ def Helper__ProcessLineData__Include( filePath += ch continue - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str if len(filePath) == 0: RaiseError.CfgReader__IncludeHasEmptyPath(lineReader.GetLineNum()) @@ -3609,10 +3550,10 @@ def Helper__ProcessLineData__Option( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 - assert type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(lineReader) is ReadUtils__LineReader + assert type(optionOffset) is int + assert type(optionName) is str assert optionName != "" # skeep spaces @@ -3671,10 +3612,10 @@ def Helper__ProcessLineData__Option__Quoted( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 - assert type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(lineReader) is ReadUtils__LineReader + assert type(optionOffset) is int + assert type(optionName) is str assert optionName != "" optionValue = "" @@ -3763,7 +3704,7 @@ def Helper__ProcessLineData__Option__Quoted( optionValue += ch continue - assert type(optionValue) == str # noqa: E721 + assert type(optionValue) is str fileLine.AddOption(optionName, optionValue, optionOffset) @@ -3774,10 +3715,10 @@ def Helper__ProcessLineData__Option__Generic( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 - assert type(lineReader) == ReadUtils__LineReader # noqa: E721 - assert type(optionOffset) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(fileLine) is PostgresConfigurationFileLine_Base + assert type(lineReader) is ReadUtils__LineReader + assert type(optionOffset) is int + assert type(optionName) is str assert optionName != "" optionValue = "" @@ -3789,7 +3730,7 @@ def Helper__ProcessLineData__Option__Generic( assert ch is None break - assert type(ch) == str # noqa: E721 + assert type(ch) is str if ch == "#" or ReadUtils.IsEOL(ch): lineReader.StepBack() @@ -3800,7 +3741,7 @@ def Helper__ProcessLineData__Option__Generic( optionValue = optionValue.strip() - assert type(optionValue) == str # noqa: E721 + assert type(optionValue) is str assert optionValue != "" fileLine.AddOption(optionName, optionValue, optionOffset) @@ -3821,7 +3762,7 @@ class PostgresConfigurationWriterFileCtx_Base: # -------------------------------------------------------------------- def __init__(self, fileData: PgCfgModel__FileData): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData self.FileData = fileData self.Content = None @@ -3850,15 +3791,15 @@ def __init__(self, cfg: PostgresConfiguration_Base): self.NewFiles = list() self.UpdFiles = list() - assert type(self.AllFiles) == list # noqa: E721 - assert type(self.NewFiles) == list # noqa: E721 - assert type(self.UpdFiles) == list # noqa: E721 + assert type(self.AllFiles) is list + assert type(self.NewFiles) is list + assert type(self.UpdFiles) is list # -------------------------------------------------------------------- def Init(self): - assert type(self.AllFiles) == list # noqa: E721 - assert type(self.NewFiles) == list # noqa: E721 - assert type(self.UpdFiles) == list # noqa: E721 + assert type(self.AllFiles) is list + assert type(self.NewFiles) is list + assert type(self.UpdFiles) is list self.AllFiles.clear() self.NewFiles.clear() @@ -3873,24 +3814,24 @@ class PostgresConfigurationWriter_Base: def MakeFileDataContent( ctx: PostgresConfigurationWriterCtx_Base, fileData: PgCfgModel__FileData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base + assert type(fileData) is PgCfgModel__FileData return __class__.Helper__MakeFileDataContent(ctx, fileData) # -------------------------------------------------------------------- def DoWork(ctx: PostgresConfigurationWriterCtx_Base): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData return __class__.Helper__DoWork(ctx) # Helper Methods ----------------------------------------------------- def Helper__DoWork(ctx: PostgresConfigurationWriterCtx_Base): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData # 0. ctx.Init() @@ -3917,13 +3858,13 @@ def Helper__DoWork(ctx: PostgresConfigurationWriterCtx_Base): def Helper__DoWork__Stage01__CreateFileContexts( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData for fileData in ctx.Cfg.m_Data.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData fileCtx = PostgresConfigurationWriterFileCtx_Base(fileData) @@ -3948,16 +3889,14 @@ def Helper__DoWork__Stage01__CreateFileContexts( def Helper__DoWork__Stage02__MakeFileDataContents( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData for fileCtx in ctx.AllFiles: assert fileCtx is not None - assert ( # noqa: E721 - type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - ) - assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileCtx) is PostgresConfigurationWriterFileCtx_Base + assert type(fileCtx.FileData) is PgCfgModel__FileData assert fileCtx.Content is None fileCtx.Content = __class__.Helper__MakeFileDataContent( @@ -3968,22 +3907,18 @@ def Helper__DoWork__Stage02__MakeFileDataContents( def Helper__DoWork__Stage03__OpenUpdFilesToWrite( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData for fileCtx in ctx.UpdFiles: assert fileCtx is not None - assert ( # noqa: E721 - type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - ) - assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileCtx) is PostgresConfigurationWriterFileCtx_Base + assert type(fileCtx.FileData) is PgCfgModel__FileData assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.EXISTS assert fileCtx.FileData.m_LastModifiedTimestamp is not None - assert ( # noqa: E721 - type(fileCtx.FileData.m_LastModifiedTimestamp) == datetime.datetime # noqa: E721 - ) + assert type(fileCtx.FileData.m_LastModifiedTimestamp) is datetime.datetime assert fileCtx.File is None # Let's open an exist file to read and write without truncation @@ -3995,7 +3930,7 @@ def Helper__DoWork__Stage03__OpenUpdFilesToWrite( assert isinstance(fileCtx.File, ConfigurationOsFile) lastMDate = fileCtx.File.GetModificationTS() - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime if fileCtx.FileData.m_LastModifiedTimestamp != lastMDate: RaiseError.FileWasModifiedExternally( @@ -4014,10 +3949,10 @@ def Helper__DoWork__Stage03__OpenUpdFilesToWrite( def Helper__DoWork__Stage04__OpenNewFilesToWrite( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(ctx.NewFiles) == list # noqa: E721 + assert type(ctx.Cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(ctx.NewFiles) is list iFile = 0 @@ -4026,10 +3961,8 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( fileCtx = ctx.NewFiles[iFile] assert fileCtx is not None - assert ( # noqa: E721 - type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - ) - assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileCtx) is PostgresConfigurationWriterFileCtx_Base + assert type(fileCtx.FileData) is PgCfgModel__FileData assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert fileCtx.File is None @@ -4045,7 +3978,7 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( continue except: # Rollback new files - assert type(iFile) == int # noqa: E721 + assert type(iFile) is int assert iFile >= 0 assert iFile <= len(ctx.NewFiles) @@ -4053,10 +3986,8 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( fileCtx = ctx.NewFiles[iFile2] assert fileCtx is not None - assert ( # noqa: E721 - type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - ) - assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileCtx) is PostgresConfigurationWriterFileCtx_Base + assert type(fileCtx.FileData) is PgCfgModel__FileData assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert fileCtx.File is not None @@ -4066,7 +3997,7 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( filePath = fileCtx.File.Name assert filePath is not None - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str assert filePath == fileCtx.FileData.m_Path fileCtx.File.Close() # raise @@ -4083,27 +4014,25 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( def Helper__DoWork__Stage05__WriteContents( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base for iFile in range(len(ctx.AllFiles)): fileCtx = ctx.AllFiles[iFile] assert fileCtx is not None - assert ( # noqa: E721 - type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - ) - assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileCtx) is PostgresConfigurationWriterFileCtx_Base + assert type(fileCtx.FileData) is PgCfgModel__FileData assert fileCtx.File is not None assert isinstance(fileCtx.File, ConfigurationOsFile) assert fileCtx.Content is not None - assert type(fileCtx.Content) == str # noqa: E721 + assert type(fileCtx.Content) is str fileCtx.File.Overwrite(fileCtx.Content) lastMDate = fileCtx.File.GetModificationTS() - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime fileCtx.File.Close() @@ -4114,15 +4043,15 @@ def Helper__DoWork__Stage05__WriteContents( def Helper__MakeFileDataContent( ctx: PostgresConfigurationWriterCtx_Base, fileData: PgCfgModel__FileData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base + assert type(fileData) is PgCfgModel__FileData fileContent = "" for fileLineData in fileData.m_Lines: - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData lineContent = __class__.Helper__FileLineToString(ctx, fileLineData) - assert type(lineContent) == str # noqa: E721 + assert type(lineContent) is str fileContent += lineContent fileContent += "\n" @@ -4133,8 +4062,8 @@ def Helper__FileLineToString( ctx: PostgresConfigurationWriterCtx_Base, fileLineData: PgCfgModel__FileLineData, ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base + assert type(fileLineData) is PgCfgModel__FileLineData fileLineItemCount = len(fileLineData.m_Items) @@ -4144,33 +4073,33 @@ def Helper__FileLineToString( lineContent = "" for lineItem in fileLineData.m_Items: - assert type(lineItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 + assert type(lineItem) is PgCfgModel__FileLineData.tagItem assert lineItem.m_Element is not None assert isinstance(lineItem.m_Element, PgCfgModel__FileLineElementData) assert ( lineItem.m_Element.m_Offset is None - or type(lineItem.m_Element.m_Offset) == int # noqa: E721 + or type(lineItem.m_Element.m_Offset) is int ) assert ( lineItem.m_Element.m_Offset is None or lineItem.m_Element.m_Offset >= 0 ) itemContent = __class__.Helper__ElementToString(ctx, lineItem.m_Element) - assert type(itemContent) == str # noqa: E721 + assert type(itemContent) is str lineContent = __class__.Helper__AppendItemToLine( lineContent, lineItem.m_Element.m_Offset, itemContent ) - assert type(lineContent) == str # noqa: E721 + assert type(lineContent) is str - assert type(lineContent) == str # noqa: E721 + assert type(lineContent) is str return lineContent # -------------------------------------------------------------------- def Helper__AppendItemToLine(lineContent: str, offset: int, text: str) -> str: - assert type(lineContent) == str # noqa: E721 - assert offset is None or type(offset) == int # noqa: E721 - assert type(text) == str # noqa: E721 + assert type(lineContent) is str + assert offset is None or type(offset) is int + assert type(text) is str assert offset is None or offset >= 0 if text == "": @@ -4178,7 +4107,7 @@ def Helper__AppendItemToLine(lineContent: str, offset: int, text: str) -> str: lineContentLen = len(lineContent) - assert type(lineContentLen) == int # noqa: E721 + assert type(lineContentLen) is int assert lineContentLen >= 0 if offset is not None and lineContentLen < offset: @@ -4194,7 +4123,7 @@ def Helper__ElementToString( ctx: PostgresConfigurationWriterCtx_Base, elementData: PgCfgModel__FileLineElementData, ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert elementData is not None assert isinstance(elementData, PgCfgModel__FileLineElementData) @@ -4203,7 +4132,7 @@ def Helper__ElementToString( if typeOfElementData == PgCfgModel__OptionData: return __class__.Helper__OptionToString(ctx, elementData) - if typeOfElementData == PgCfgModel__CommentData: + if typeOfElementData is PgCfgModel__CommentData: return __class__.Helper__CommentToString(ctx, elementData) if typeOfElementData == PgCfgModel__IncludeData: @@ -4215,11 +4144,11 @@ def Helper__ElementToString( def Helper__OptionToString( ctx: PostgresConfigurationWriterCtx_Base, optionData: PgCfgModel__OptionData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(optionData) == PgCfgModel__OptionData # noqa: E721 - assert type(optionData.m_Name) == str # noqa: E721 + assert type(optionData) is PgCfgModel__OptionData + assert type(optionData.m_Name) is str assert optionData.m_Name != "" assert optionData.m_Value is not None @@ -4234,7 +4163,7 @@ def Helper__OptionToString( optValueAsText = writeHandler.OptionValueToString(writeHandlerCtx) - assert type(optValueAsText) == str # noqa: E721 + assert type(optValueAsText) is str assert optValueAsText != "" result = optionData.m_Name + " = " + optValueAsText @@ -4244,12 +4173,12 @@ def Helper__OptionToString( def Helper__CommentToString( ctx: PostgresConfigurationWriterCtx_Base, commentData: PgCfgModel__CommentData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(commentData) is PgCfgModel__CommentData assert commentData.m_Text is not None - assert type(commentData.m_Text) == str # noqa: E721 + assert type(commentData.m_Text) is str assert DataVerificator.IsValidCommentText(commentData.m_Text) @@ -4260,17 +4189,17 @@ def Helper__CommentToString( def Helper__IncludeToString( ctx: PostgresConfigurationWriterCtx_Base, includeData: PgCfgModel__IncludeData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(ctx) is PostgresConfigurationWriterCtx_Base assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(includeData) is PgCfgModel__IncludeData assert includeData.m_Path is not None - assert type(includeData.m_Path) == str # noqa: E721 + assert type(includeData.m_Path) is str assert includeData.m_Path != "" result = "include " + WriteUtils.Pack_Str(includeData.m_Path) - assert type(result) == str # noqa: E721 + assert type(result) is str assert result != "" return result @@ -4290,12 +4219,12 @@ def AddOption( assert isinstance(cfg, PostgresConfiguration_Base) assert ( target is None - or type(target) == PgCfgModel__FileData # noqa: E721 - or type(target) == PgCfgModel__FileLineData # noqa: E721 + or type(target) is PgCfgModel__FileData + or type(target) is PgCfgModel__FileLineData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None - assert optionOffset is None or type(optionOffset) == int # noqa: E721 + assert optionOffset is None or type(optionOffset) is int # ---------------------- preparedOptionValue = __class__.Helper__PrepareSetValue( @@ -4319,7 +4248,7 @@ def AddOption( option = addHandler.AddOption(ctx) assert option is not None - assert type(option) == PostgresConfigurationOption_Base # noqa: E721 + assert type(option) is PostgresConfigurationOption_Base return option # -------------------------------------------------------------------- @@ -4333,11 +4262,11 @@ def SetOptionValue( assert isinstance(cfg, PostgresConfiguration_Base) assert ( targetData is None - or type(targetData) == PgCfgModel__FileData # noqa: E721 - or type(targetData) == PgCfgModel__OptionData # noqa: E721 + or type(targetData) is PgCfgModel__FileData + or type(targetData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 - assert optionOffset is None or type(optionOffset) == int # noqa: E721 + assert type(optionName) is str + assert optionOffset is None or type(optionOffset) is int # ---------------------- if optionValue is None: @@ -4366,7 +4295,7 @@ def SetOptionValue( r = setHandler.SetOptionValue(ctx) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 + assert type(r) is PostgresConfigurationSetOptionValueResult_Base return r @@ -4380,10 +4309,10 @@ def SetOptionValueItem( assert isinstance(cfg, PostgresConfiguration_Base) assert ( targetData is None - or type(targetData) == PgCfgModel__FileData # noqa: E721 - or type(targetData) == PgCfgModel__OptionData # noqa: E721 + or type(targetData) is PgCfgModel__FileData + or type(targetData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str # --------------------------------------- if optionValueItem is None: @@ -4412,7 +4341,7 @@ def SetOptionValueItem( r = setHandler.SetOptionValueItem(ctx) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 + assert type(r) is PostgresConfigurationSetOptionValueResult_Base return r @@ -4425,10 +4354,10 @@ def GetOptionValue( assert isinstance(cfg, PostgresConfiguration_Base) assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData # noqa: E721 - or type(sourceData) == PgCfgModel__OptionData # noqa: E721 + or type(sourceData) is PgCfgModel__FileData + or type(sourceData) is PgCfgModel__OptionData ) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str getHandler = cfg.Internal__GetOptionHandlerToGetValue(optionName) @@ -4444,7 +4373,7 @@ def Helper__PrepareSetValue( cfg: PostgresConfiguration_Base, optionName: str, optionValue: any ) -> any: assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValue is not None prepareHandler = cfg.Internal__GetOptionHandlerToPrepareSetValue(optionName) @@ -4462,7 +4391,7 @@ def Helper__PrepareSetValueItem( cfg: PostgresConfiguration_Base, optionName: str, optionValueItem: any ) -> any: assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionValueItem is not None prepareHandler = cfg.Internal__GetOptionHandlerToPrepareSetValueItem(optionName) diff --git a/src/implementation/v00/configuration_std.py b/src/implementation/v00/configuration_std.py index 3c86c0a..82a734c 100644 --- a/src/implementation/v00/configuration_std.py +++ b/src/implementation/v00/configuration_std.py @@ -309,7 +309,7 @@ def __init__( # -------------------------------------------------------------------- def __init__(self, data_dir: str, cfgOsOps: ConfigurationOsOps = None): - assert type(data_dir) == str # noqa: E721 + assert type(data_dir) is str assert cfgOsOps is None or isinstance(cfgOsOps, ConfigurationOsOps) if cfgOsOps is None: @@ -322,7 +322,7 @@ def __init__(self, data_dir: str, cfgOsOps: ConfigurationOsOps = None): # -------------------------------------------------------------------- @staticmethod def Create(data_dir: str) -> PostgresConfiguration_Std: - assert type(data_dir) == str # noqa: E721 + assert type(data_dir) is str assert isinstance(LocalCfgOsOps, ConfigurationOsOps) return __class__(data_dir, LocalCfgOsOps) @@ -331,13 +331,13 @@ def Create(data_dir: str) -> PostgresConfiguration_Std: def CreateWithCfgOsOps( data_dir: str, cfgOsOps: ConfigurationOsOps ) -> PostgresConfiguration_Std: - assert type(data_dir) == str # noqa: E721 + assert type(data_dir) is str assert isinstance(cfgOsOps, ConfigurationOsOps) return __class__(data_dir, cfgOsOps) # PostgresConfiguration_Base interface ------------------------------- def Internal__GetAutoConfFileName(self): - assert type(__class__.C_POSTGRESQL_AUTO_CONF) == str # noqa: E721 + assert type(__class__.C_POSTGRESQL_AUTO_CONF) is str assert __class__.C_POSTGRESQL_AUTO_CONF != "" return __class__.C_POSTGRESQL_AUTO_CONF @@ -345,11 +345,11 @@ def Internal__GetAutoConfFileName(self): def Internal__GetOptionHandlerToPrepareSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.PrepareSetValue is None: BugCheckError.OptionHandlerToPrepareSetValueIsNotDefined(name) @@ -364,11 +364,11 @@ def Internal__GetOptionHandlerToPrepareSetValue( def Internal__GetOptionHandlerToPrepareGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.PrepareGetValue is None: BugCheckError.OptionHandlerToPrepareGetValueIsNotDefined(name) @@ -383,11 +383,11 @@ def Internal__GetOptionHandlerToPrepareGetValue( def Internal__GetOptionHandlerToPrepareSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValueItem: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.PrepareSetValueItem is None: BugCheckError.OptionHandlerToPrepareSetValueItemIsNotDefined(name) @@ -403,11 +403,11 @@ def Internal__GetOptionHandlerToPrepareSetValueItem( def Internal__GetOptionHandlerToSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToSetValue: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.SetValue is None: BugCheckError.OptionHandlerToSetValueIsNotDefined(name) @@ -420,11 +420,11 @@ def Internal__GetOptionHandlerToSetValue( def Internal__GetOptionHandlerToGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToGetValue: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.GetValue is None: BugCheckError.OptionHandlerToGetValueIsNotDefined(name) @@ -437,11 +437,11 @@ def Internal__GetOptionHandlerToGetValue( def Internal__GetOptionHandlerToAddOption( self, name: str ) -> PgCfgModel__OptionHandlerToAddOption: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.AddOption is None: BugCheckError.OptionHandlerToAddOptionIsNotDefined(name) @@ -456,11 +456,11 @@ def Internal__GetOptionHandlerToAddOption( def Internal__GetOptionHandlerToSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToSetValueItem: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.SetValueItem is None: BugCheckError.OptionHandlerToSetValueIsNotDefined(name) @@ -475,11 +475,11 @@ def Internal__GetOptionHandlerToSetValueItem( def Internal__GetOptionHandlerToWrite( self, name: str ) -> PgCfgModel__OptionHandlerToWrite: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers if optionHandlers.Write is None: BugCheckError.OptionHandlerToWriteIsNotDefined(name) @@ -490,8 +490,8 @@ def Internal__GetOptionHandlerToWrite( # Helper methods ----------------------------------------------------- def Helper__GetOptionHandlers(self, name: str) -> tagOptionHandlers: - assert type(name) == str # noqa: E721 - assert type(self.sm_OptionHandlers) == dict # noqa: E721 + assert type(name) is str + assert type(self.sm_OptionHandlers) is dict if not (name in self.sm_OptionHandlers.keys()): return __class__.sm_OptionHandlers__Std__Generic @@ -499,7 +499,7 @@ def Helper__GetOptionHandlers(self, name: str) -> tagOptionHandlers: optionHandlers = self.sm_OptionHandlers[name] assert optionHandlers is not None - assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 + assert type(optionHandlers) is __class__.tagOptionHandlers return self.sm_OptionHandlers[name] diff --git a/src/os/abstract/configuration_os_ops.py b/src/os/abstract/configuration_os_ops.py index 23ac0fc..27b46f7 100644 --- a/src/os/abstract/configuration_os_ops.py +++ b/src/os/abstract/configuration_os_ops.py @@ -35,7 +35,7 @@ def IsClosed(self) -> bool: RaiseError.MethodIsNotImplemented(__class__, "get_IsClosed") def Overwrite(self, text: str) -> None: - assert type(text) == str # noqa: E721 + assert type(text) is str RaiseError.MethodIsNotImplemented(__class__, "Write") def Close(self): @@ -51,48 +51,48 @@ def GetModificationTS(self) -> datetime.datetime: class ConfigurationOsOps: def Path_IsAbs(self, a: str) -> bool: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_IsAbs") def Path_Join(self, a: str, *p: tuple) -> str: - assert type(a) == str # noqa: E721 - assert type(p) == tuple # noqa: E721 + assert type(a) is str + assert type(p) is tuple RaiseError.MethodIsNotImplemented(__class__, "Path_Join") def Path_NormPath(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_NormPath") def Path_AbsPath(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_AbsPath") def Path_NormCase(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_NormCase") def Path_DirName(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_DirName") def Path_BaseName(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Path_BaseName") def Remove(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str RaiseError.MethodIsNotImplemented(__class__, "Remove") def OpenFileToRead(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str RaiseError.MethodIsNotImplemented(__class__, "OpenFileToRead") def OpenFileToWrite(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str RaiseError.MethodIsNotImplemented(__class__, "OpenFileToWrite") def CreateFile(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str RaiseError.MethodIsNotImplemented(__class__, "CreateFile") diff --git a/src/os/local/configuration_os_ops.py b/src/os/local/configuration_os_ops.py index 03e3620..30b6f2e 100644 --- a/src/os/local/configuration_os_ops.py +++ b/src/os/local/configuration_os_ops.py @@ -53,7 +53,7 @@ def IsClosed(self) -> bool: def ReadLine(self) -> typing.Optional[str]: assert isinstance(self.m_file, io.TextIOWrapper) r = self.m_file.readline() - assert type(r) == str # noqa: E721 + assert type(r) is str if not r: assert r == "" return None @@ -63,7 +63,7 @@ def ReadLine(self) -> typing.Optional[str]: # -------------------------------------------------------------------- def Overwrite(self, text: str) -> None: - assert type(text) == str # noqa: E721 + assert type(text) is str assert isinstance(self.m_file, io.TextIOWrapper) self.m_file.seek(0) self.m_file.write(text) @@ -84,10 +84,10 @@ def GetModificationTS(self) -> datetime.datetime: assert isinstance(self.m_file, io.TextIOWrapper) fd = self.m_file.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime return lastMDate @@ -97,50 +97,50 @@ def GetModificationTS(self) -> datetime.datetime: class ConfigurationOsOps(abstract.ConfigurationOsOps): def Path_IsAbs(self, a: str) -> bool: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.isabs(a) def Path_Join(self, a: str, *p: tuple) -> str: - assert type(a) == str # noqa: E721 - assert type(p) == tuple # noqa: E721 + assert type(a) is str + assert type(p) is tuple return os.path.join(a, *p) def Path_NormPath(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.normpath(a) def Path_AbsPath(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.abspath(a) def Path_NormCase(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.normcase(a) def Path_DirName(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.dirname(a) def Path_BaseName(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str return os.path.basename(a) def Remove(self, a: str) -> str: - assert type(a) == str # noqa: E721 + assert type(a) is str os.remove(a) def OpenFileToRead(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str f = open(filePath) return ConfigurationOsFile(f) def OpenFileToWrite(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str f = open(filePath, mode="r+") return ConfigurationOsFile(f) def CreateFile(self, filePath: str) -> ConfigurationOsFile: - assert type(filePath) == str # noqa: E721 + assert type(filePath) is str f = open(filePath, mode="x") return ConfigurationOsFile(f) diff --git a/tests/CfgFileReader.py b/tests/CfgFileReader.py index bad6499..360d71b 100644 --- a/tests/CfgFileReader.py +++ b/tests/CfgFileReader.py @@ -21,10 +21,10 @@ def __init__(self, text: str): # -------------------------------------------------------------------- def ReadLine(self) -> typing.Optional[str]: - assert type(self.m_file) == io.StringIO # noqa: E721 + assert type(self.m_file) is io.StringIO r = self.m_file.readline() - assert type(r) == str # noqa: E721 + assert type(r) is str if not r: assert r == "" return None diff --git a/tests/ErrorMessageBuilder.py b/tests/ErrorMessageBuilder.py index ff951e5..1f6eba0 100644 --- a/tests/ErrorMessageBuilder.py +++ b/tests/ErrorMessageBuilder.py @@ -10,8 +10,8 @@ class ErrorMessageBuilder: def MethodIsNotImplemented(classType: type, methodName: str): - assert type(classType) == type # noqa: E721 - assert type(methodName) == str # noqa: E721 + assert type(classType) is type + assert type(methodName) is str assert methodName != "" errMsg = "Method {0}::{1} is not implemented.".format( @@ -21,8 +21,8 @@ def MethodIsNotImplemented(classType: type, methodName: str): # -------------------------------------------------------------------- def GetPropertyIsNotImplemented(classType: type, methodName: str): - assert type(classType) == type # noqa: E721 - assert type(methodName) == str # noqa: E721 + assert type(classType) is type + assert type(methodName) is str assert methodName != "" errMsg = "Get property {0}::{1} is not implemented.".format( @@ -38,7 +38,7 @@ def OptionNameIsNone(): # -------------------------------------------------------------------- def OptionNameHasBadType(nameType: type): assert nameType is not None - assert type(nameType) == type # noqa: E721 + assert type(nameType) is type errMsg = "Option name has nad type [{0}]".format(nameType.__name__) return errMsg @@ -55,7 +55,7 @@ def NoneValueIsNotSupported(): # -------------------------------------------------------------------- def NoneOptionValueItemIsNotSupported(optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str assert optionName != "" errMsg = "None value item of option [{0}] is not supported.".format(optionName) @@ -88,9 +88,9 @@ def FileObjectWasDeleted(): # -------------------------------------------------------------------- def BadOptionValueType(optionName: str, optionValueType: type, expectedType: type): - assert type(optionName) == str # noqa: E721 - assert type(optionValueType) == type # noqa: E721 - assert type(expectedType) == type # noqa: E721 + assert type(optionName) is str + assert type(optionValueType) is type + assert type(expectedType) is type errMsg = "Bad option [{0}] value type [{1}]. Expected type is [{2}].".format( optionName, optionValueType.__name__, expectedType.__name__ @@ -99,9 +99,9 @@ def BadOptionValueType(optionName: str, optionValueType: type, expectedType: typ # -------------------------------------------------------------------- def CantConvertOptionValue(optionName: str, sourceType: type, targetType: type): - assert type(optionName) == str # noqa: E721 - assert type(sourceType) == type # noqa: E721 - assert type(targetType) == type # noqa: E721 + assert type(optionName) is str + assert type(sourceType) is type + assert type(targetType) is type errMsg = ( "Can't convert option [{0}] value from type [{1}] to type [{2}].".format( @@ -114,9 +114,9 @@ def CantConvertOptionValue(optionName: str, sourceType: type, targetType: type): def BadOptionValueItemType( optionName: str, optionValueItemType: type, expectedType: type ): - assert type(optionName) == str # noqa: E721 - assert type(optionValueItemType) == type # noqa: E721 - assert type(expectedType) == type # noqa: E721 + assert type(optionName) is str + assert type(optionValueItemType) is type + assert type(expectedType) is type errMsg = ( "Bad option [{0}] value item type [{1}]. Expected type is [{2}].".format( @@ -137,8 +137,8 @@ def FileIsAlreadyRegistered(file_path: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -149,8 +149,8 @@ def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -161,8 +161,8 @@ def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInFile(filePath: str, optionName: str): - assert type(filePath) == str # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(filePath) is str + assert type(optionName) is str assert filePath != "" assert optionName != "" @@ -173,8 +173,8 @@ def OptionIsAlreadyExistInFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionValueItemIsAlreadyDefined(filePath: str, optName: str, valueItem: any): - assert type(filePath) == str # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(filePath) is str + assert type(optName) is str errMsg = "Another definition of option [{1}] value item [{2}] is found in the file [{0}].".format( filePath, optName, valueItem @@ -185,8 +185,8 @@ def OptionValueItemIsAlreadyDefined(filePath: str, optName: str, valueItem: any) def OptionValueItemIsAlreadyDefinedInAnotherFile( filePath: str, optName: str, valueItem: any ): - assert type(filePath) == str # noqa: E721 - assert type(optName) == str # noqa: E721 + assert type(filePath) is str + assert type(optName) is str errMsg = "Definition of option [{1}] value item [{2}] is found in another file [{0}].".format( filePath, optName, valueItem @@ -195,15 +195,15 @@ def OptionValueItemIsAlreadyDefinedInAnotherFile( # -------------------------------------------------------------------- def UnknownFileName(fileName: str): - assert type(fileName) == str # noqa: E721 + assert type(fileName) is str errMsg = "Unknown file name [{0}].".format(fileName) return errMsg # -------------------------------------------------------------------- def MultipleDefOfFileIsFound(fileName: str, count: int): - assert type(fileName) == str # noqa: E721 - assert type(count) == int # noqa: E721 + assert type(fileName) is str + assert type(count) is int errMsg = "Multiple definitition of file [{0}] is found - {1}.".format( fileName, count @@ -221,9 +221,9 @@ def FileWasModifiedExternally( ourLastMDate: datetime.datetime, curLastMDate: datetime.datetime, ): - assert type(filePath) == str # noqa: E721 - assert type(ourLastMDate) == datetime.datetime # noqa: E721 - assert type(curLastMDate) == datetime.datetime # noqa: E721 + assert type(filePath) is str + assert type(ourLastMDate) is datetime.datetime + assert type(curLastMDate) is datetime.datetime errMsg = "File [{0}] was modified externally. Our timestamp is [{1}]. The current file timestamp is [{2}].".format( filePath, ourLastMDate, curLastMDate @@ -237,7 +237,7 @@ def FileLineAlreadyHasComment(): # -------------------------------------------------------------------- def FileLineAlreadyHasOption(optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str errMsg = "File line already has the option [{0}].".format(optionName) return errMsg @@ -249,9 +249,9 @@ def FileLineAlreadyHasIncludeDirective(): # -------------------------------------------------------------------- def CfgReader__UnexpectedSymbol(lineNum: int, colNum: int, ch: str): - assert type(lineNum) == int # noqa: E721 - assert type(colNum) == int # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(colNum) is int + assert type(ch) is str errMsg = "Unexpected symbol in line {0}, column {1}: [{2}]".format( lineNum, colNum, ch @@ -260,7 +260,7 @@ def CfgReader__UnexpectedSymbol(lineNum: int, colNum: int, ch: str): # -------------------------------------------------------------------- def CfgReader__IncludeWithoutPath(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Include directive in line {0} does not have a path.".format(lineNum) @@ -268,7 +268,7 @@ def CfgReader__IncludeWithoutPath(lineNum: int): # -------------------------------------------------------------------- def CfgReader__EndOfIncludePathIsNotFound(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "The end of an include path is not found. Line {0}.".format(lineNum) @@ -276,7 +276,7 @@ def CfgReader__EndOfIncludePathIsNotFound(lineNum: int): # -------------------------------------------------------------------- def CfgReader__IncompletedEscapeInInclude(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Escape in an include path is not completed. Line {0}.".format(lineNum) @@ -284,9 +284,9 @@ def CfgReader__IncompletedEscapeInInclude(lineNum: int): # -------------------------------------------------------------------- def CfgReader__UnknownEscapedSymbolInInclude(lineNum: int, colNum: int, ch: str): - assert type(lineNum) == int # noqa: E721 - assert type(colNum) == int # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(colNum) is int + assert type(ch) is str assert lineNum >= 0 assert colNum >= 0 assert ch != "" @@ -298,7 +298,7 @@ def CfgReader__UnknownEscapedSymbolInInclude(lineNum: int, colNum: int, ch: str) # -------------------------------------------------------------------- def CfgReader__IncludeHasEmptyPath(lineNum: int): - assert type(lineNum) == int # noqa: E721 + assert type(lineNum) is int assert lineNum >= 0 errMsg = "Include in line {0} has an empty path.".format(lineNum) @@ -306,8 +306,8 @@ def CfgReader__IncludeHasEmptyPath(lineNum: int): # -------------------------------------------------------------------- def CfgReader__OptionWithoutValue(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -318,8 +318,8 @@ def CfgReader__OptionWithoutValue(optionName: str, lineNum: int): # -------------------------------------------------------------------- def CfgReader__EndQuotedOptionValueIsNotFound(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -330,8 +330,8 @@ def CfgReader__EndQuotedOptionValueIsNotFound(optionName: str, lineNum: int): # -------------------------------------------------------------------- def CfgReader__IncompletedEscapeInQuotedOptionValue(optionName: str, lineNum: int): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str assert lineNum >= 0 assert optionName != "" @@ -344,9 +344,9 @@ def CfgReader__IncompletedEscapeInQuotedOptionValue(optionName: str, lineNum: in def CfgReader__UnknownEscapedSymbolInQuotedOptionValue( optionName: str, lineNum: int, colNum: int, ch: str ): - assert type(lineNum) == int # noqa: E721 - assert type(optionName) == str # noqa: E721 - assert type(ch) == str # noqa: E721 + assert type(lineNum) is int + assert type(optionName) is str + assert type(ch) is str assert lineNum >= 0 assert optionName != "" assert ch != "" diff --git a/tests/TestConfigHelper.py b/tests/TestConfigHelper.py index bcf403a..8275043 100644 --- a/tests/TestConfigHelper.py +++ b/tests/TestConfigHelper.py @@ -27,7 +27,7 @@ def NoCleanup() -> bool: # -------------------------------------------------------------------- def Helper__ToBoolean(v, envVarName: str) -> bool: - assert type(envVarName) == str # noqa: E721 + assert type(envVarName) is str typeV = type(v) diff --git a/tests/TestGlobalCache.py b/tests/TestGlobalCache.py index 6ccfe7d..6cbec8f 100644 --- a/tests/TestGlobalCache.py +++ b/tests/TestGlobalCache.py @@ -25,7 +25,7 @@ def GetOrCreateResource(globalResourceID: str, resourceFactory) -> any: assert isinstance(globalResourceID, str) assert __class__.sm_Guard is not None assert __class__.sm_Dict is not None - assert type(__class__.sm_Dict) == dict # noqa: E721 + assert type(__class__.sm_Dict) is dict with __class__.sm_Guard: if globalResourceID in __class__.sm_Dict.keys(): @@ -42,11 +42,11 @@ def GetOrCreateResource(globalResourceID: str, resourceFactory) -> any: def ReleaseAllResources(): assert __class__.sm_Guard is not None assert __class__.sm_Dict is not None - assert type(__class__.sm_Dict) == dict # noqa: E721 + assert type(__class__.sm_Dict) is dict with __class__.sm_Guard: emptyDict: typing.Dict[str, any] = dict() - assert type(emptyDict) == dict # noqa: E721 + assert type(emptyDict) is dict curDict = __class__.sm_Dict diff --git a/tests/TestServices.py b/tests/TestServices.py index 4021248..a655b35 100644 --- a/tests/TestServices.py +++ b/tests/TestServices.py @@ -72,7 +72,7 @@ def CleanTestTmpDirBeforeExit(function: pytest.Function): return tmpDir = __class__.Helper__GetCurTestTmpDir(function) - assert type(tmpDir) == str # noqa: E721 + assert type(tmpDir) is str if not os.path.exists(tmpDir): return diff --git a/tests/TestStartupData.py b/tests/TestStartupData.py index 061cf1a..ed5a096 100755 --- a/tests/TestStartupData.py +++ b/tests/TestStartupData.py @@ -21,7 +21,7 @@ class TestStartupData__Helper: # -------------------------------------------------------------------- def GetStartTS() -> datetime.datetime: - assert type(__class__.sm_StartTS) == datetime.datetime # noqa: E721 + assert type(__class__.sm_StartTS) is datetime.datetime return __class__.sm_StartTS # -------------------------------------------------------------------- @@ -40,7 +40,7 @@ def CalcRootTmpDir() -> str: rootDir = __class__.CalcRootDir() resultPath = os.path.join(rootDir, "tmp") - assert type(resultPath) == str # noqa: E721 + assert type(resultPath) is str return resultPath # -------------------------------------------------------------------- @@ -51,7 +51,7 @@ def CalcRootLogDir() -> str: rootDir = __class__.CalcRootDir() resultPath = os.path.join(rootDir, "logs") - assert type(resultPath) == str # noqa: E721 + assert type(resultPath) is str return resultPath # -------------------------------------------------------------------- @@ -99,24 +99,22 @@ class TestStartupData: # -------------------------------------------------------------------- def GetRootDir() -> str: - assert type(__class__.sm_RootDir) == str # noqa: E721 + assert type(__class__.sm_RootDir) is str return __class__.sm_RootDir # -------------------------------------------------------------------- def GetRootLogDir() -> str: - assert type(__class__.sm_RootLogDir) == str # noqa: E721 + assert type(__class__.sm_RootLogDir) is str return __class__.sm_RootLogDir # -------------------------------------------------------------------- def GetCurrentTestWorkerSignature() -> str: - assert type(__class__.sm_CurrentTestWorkerSignature) == str # noqa: E721 + assert type(__class__.sm_CurrentTestWorkerSignature) is str return __class__.sm_CurrentTestWorkerSignature # -------------------------------------------------------------------- def GetRootTmpDataDirForCurrentTestWorker() -> str: - assert ( # noqa: E721 - type(__class__.sm_RootTmpDataDirForCurrentTestWorker) == str - ) + assert type(__class__.sm_RootTmpDataDirForCurrentTestWorker) is str return __class__.sm_RootTmpDataDirForCurrentTestWorker diff --git a/tests/ThrowError.py b/tests/ThrowError.py index f1af4e0..1f2fae1 100644 --- a/tests/ThrowError.py +++ b/tests/ThrowError.py @@ -7,12 +7,12 @@ class ThrowError: def EnvVarIsNotDefined(envVarName: str): - assert type(envVarName) == str # noqa: E721 + assert type(envVarName) is str raise Exception("System env variable [{0}] is not defined.".format(envVarName)) # -------------------------------------------------------------------- def EnvVarHasBadValue(envVarName: str): - assert type(envVarName) == str # noqa: E721 + assert type(envVarName) is str raise Exception("System env variable [{0}] has bad value.".format(envVarName)) diff --git a/tests/conftest.py b/tests/conftest.py index b850376..1078a16 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -94,7 +94,7 @@ class TEST_PROCESS_STATS: # -------------------------------------------------------------------- def incrementTotalTestCount() -> None: - assert type(__class__.cTotalTests) == int # noqa: E721 + assert type(__class__.cTotalTests) is int assert __class__.cTotalTests >= 0 __class__.cTotalTests += 1 @@ -103,7 +103,7 @@ def incrementTotalTestCount() -> None: # -------------------------------------------------------------------- def incrementNotExecutedTestCount() -> None: - assert type(__class__.cNotExecutedTests) == int # noqa: E721 + assert type(__class__.cNotExecutedTests) is int assert __class__.cNotExecutedTests >= 0 __class__.cNotExecutedTests += 1 @@ -112,7 +112,7 @@ def incrementNotExecutedTestCount() -> None: # -------------------------------------------------------------------- def incrementExecutedTestCount() -> int: - assert type(__class__.cExecutedTests) == int # noqa: E721 + assert type(__class__.cExecutedTests) is int assert __class__.cExecutedTests >= 0 __class__.cExecutedTests += 1 @@ -122,7 +122,7 @@ def incrementExecutedTestCount() -> int: # -------------------------------------------------------------------- def incrementPassedTestCount() -> None: - assert type(__class__.cPassedTests) == int # noqa: E721 + assert type(__class__.cPassedTests) is int assert __class__.cPassedTests >= 0 __class__.cPassedTests += 1 @@ -131,11 +131,11 @@ def incrementPassedTestCount() -> None: # -------------------------------------------------------------------- def incrementFailedTestCount(testID: str, errCount: int) -> None: - assert type(testID) == str # noqa: E721 - assert type(errCount) == int # noqa: E721 + assert type(testID) is str + assert type(errCount) is int assert errCount > 0 - assert type(__class__.FailedTests) == list # noqa: E721 - assert type(__class__.cFailedTests) == int # noqa: E721 + assert type(__class__.FailedTests) is list + assert type(__class__.cFailedTests) is int assert __class__.cFailedTests >= 0 __class__.FailedTests.append((testID, errCount)) # raise? @@ -146,7 +146,7 @@ def incrementFailedTestCount(testID: str, errCount: int) -> None: assert len(__class__.FailedTests) == __class__.cFailedTests # -------- - assert type(__class__.cTotalErrors) == int # noqa: E721 + assert type(__class__.cTotalErrors) is int assert __class__.cTotalErrors >= 0 __class__.cTotalErrors += errCount @@ -155,11 +155,11 @@ def incrementFailedTestCount(testID: str, errCount: int) -> None: # -------------------------------------------------------------------- def incrementXFailedTestCount(testID: str, errCount: int) -> None: - assert type(testID) == str # noqa: E721 - assert type(errCount) == int # noqa: E721 + assert type(testID) is str + assert type(errCount) is int assert errCount >= 0 - assert type(__class__.XFailedTests) == list # noqa: E721 - assert type(__class__.cXFailedTests) == int # noqa: E721 + assert type(__class__.XFailedTests) is list + assert type(__class__.cXFailedTests) is int assert __class__.cXFailedTests >= 0 __class__.XFailedTests.append((testID, errCount)) # raise? @@ -171,7 +171,7 @@ def incrementXFailedTestCount(testID: str, errCount: int) -> None: # -------------------------------------------------------------------- def incrementSkippedTestCount() -> None: - assert type(__class__.cSkippedTests) == int # noqa: E721 + assert type(__class__.cSkippedTests) is int assert __class__.cSkippedTests >= 0 __class__.cSkippedTests += 1 @@ -180,9 +180,9 @@ def incrementSkippedTestCount() -> None: # -------------------------------------------------------------------- def incrementNotXFailedTests(testID: str) -> None: - assert type(testID) == str # noqa: E721 - assert type(__class__.NotXFailedTests) == list # noqa: E721 - assert type(__class__.cNotXFailedTests) == int # noqa: E721 + assert type(testID) is str + assert type(__class__.NotXFailedTests) is list + assert type(__class__.cNotXFailedTests) is int assert __class__.cNotXFailedTests >= 0 __class__.NotXFailedTests.append(testID) # raise? @@ -194,12 +194,12 @@ def incrementNotXFailedTests(testID: str) -> None: # -------------------------------------------------------------------- def incrementWarningTestCount(testID: str, warningCount: int) -> None: - assert type(testID) == str # noqa: E721 - assert type(warningCount) == int # noqa: E721 + assert type(testID) is str + assert type(warningCount) is int assert testID != "" assert warningCount > 0 - assert type(__class__.WarningTests) == list # noqa: E721 - assert type(__class__.cWarningTests) == int # noqa: E721 + assert type(__class__.WarningTests) is list + assert type(__class__.cWarningTests) is int assert __class__.cWarningTests >= 0 __class__.WarningTests.append((testID, warningCount)) # raise? @@ -210,7 +210,7 @@ def incrementWarningTestCount(testID: str, warningCount: int) -> None: assert len(__class__.WarningTests) == __class__.cWarningTests # -------- - assert type(__class__.cTotalWarnings) == int # noqa: E721 + assert type(__class__.cTotalWarnings) is int assert __class__.cTotalWarnings >= 0 __class__.cTotalWarnings += warningCount @@ -219,7 +219,7 @@ def incrementWarningTestCount(testID: str, warningCount: int) -> None: # -------------------------------------------------------------------- def incrementUnexpectedTests() -> None: - assert type(__class__.cUnexpectedTests) == int # noqa: E721 + assert type(__class__.cUnexpectedTests) is int assert __class__.cUnexpectedTests >= 0 __class__.cUnexpectedTests += 1 @@ -228,9 +228,9 @@ def incrementUnexpectedTests() -> None: # -------------------------------------------------------------------- def incrementAchtungTestCount(testID: str) -> None: - assert type(testID) == str # noqa: E721 - assert type(__class__.AchtungTests) == list # noqa: E721 - assert type(__class__.cAchtungTests) == int # noqa: E721 + assert type(testID) is str + assert type(__class__.AchtungTests) is list + assert type(__class__.cAchtungTests) is int assert __class__.cAchtungTests >= 0 __class__.AchtungTests.append(testID) # raise? @@ -294,8 +294,8 @@ def helper__makereport__setup( assert outcome is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(call) is pytest.CallInfo + assert type(outcome) is T_PLUGGY_RESULT C_LINE1 = "******************************************************" @@ -305,7 +305,7 @@ def helper__makereport__setup( rep: pytest.TestReport = outcome.get_result() assert rep is not None - assert type(rep) == pytest.TestReport # noqa: E721 + assert type(rep) is pytest.TestReport if rep.outcome == "skipped": TEST_PROCESS_STATS.incrementNotExecutedTestCount() @@ -362,29 +362,29 @@ def helper__makereport__call( assert outcome is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(call) is pytest.CallInfo + assert type(outcome) is T_PLUGGY_RESULT # -------- item_error_msg_count1 = item.stash.get(g_error_msg_count_key, 0) - assert type(item_error_msg_count1) == int # noqa: E721 + assert type(item_error_msg_count1) is int assert item_error_msg_count1 >= 0 item_error_msg_count2 = item.stash.get(g_critical_msg_count_key, 0) - assert type(item_error_msg_count2) == int # noqa: E721 + assert type(item_error_msg_count2) is int assert item_error_msg_count2 >= 0 item_error_msg_count = item_error_msg_count1 + item_error_msg_count2 # -------- item_warning_msg_count = item.stash.get(g_warning_msg_count_key, 0) - assert type(item_warning_msg_count) == int # noqa: E721 + assert type(item_warning_msg_count) is int assert item_warning_msg_count >= 0 # -------- rep = outcome.get_result() assert rep is not None - assert type(rep) == pytest.TestReport # noqa: E721 + assert type(rep) is pytest.TestReport # -------- testID = helper__build_test_id(item) @@ -393,12 +393,12 @@ def helper__makereport__call( assert call.start <= call.stop startDT = datetime.datetime.fromtimestamp(call.start) - assert type(startDT) == datetime.datetime # noqa: E721 + assert type(startDT) is datetime.datetime stopDT = datetime.datetime.fromtimestamp(call.stop) - assert type(stopDT) == datetime.datetime # noqa: E721 + assert type(stopDT) is datetime.datetime testDurration = stopDT - startDT - assert type(testDurration) == datetime.timedelta # noqa: E721 + assert type(testDurration) is datetime.timedelta # -------- exitStatus = None @@ -407,7 +407,7 @@ def helper__makereport__call( assert call.excinfo is not None # research assert call.excinfo.value is not None # research - if type(call.excinfo.value) == _pytest.outcomes.Skipped: # noqa: E721 + if type(call.excinfo.value) is _pytest.outcomes.Skipped: assert not hasattr(rep, "wasxfail") exitStatus = ExitStatusNames.SKIPPED @@ -416,7 +416,7 @@ def helper__makereport__call( TEST_PROCESS_STATS.incrementSkippedTestCount() - elif type(call.excinfo.value) == _pytest.outcomes.XFailed: # noqa: E721 E501 + elif type(call.excinfo.value) is _pytest.outcomes.XFailed: exitStatus = ExitStatusNames.XFAILED reasonText = str(call.excinfo.value) reasonMsgTempl = "XFAIL REASON: {0}" @@ -427,12 +427,12 @@ def helper__makereport__call( exitStatus = ExitStatusNames.XFAILED assert hasattr(rep, "wasxfail") assert rep.wasxfail is not None - assert type(rep.wasxfail) == str # noqa: E721 + assert type(rep.wasxfail) is str reasonText = rep.wasxfail reasonMsgTempl = "XFAIL REASON: {0}" - if type(call.excinfo.value) == SIGNAL_EXCEPTION: # noqa: E721 + if type(call.excinfo.value) is SIGNAL_EXCEPTION: pass else: logging.error(call.excinfo.value) @@ -440,10 +440,10 @@ def helper__makereport__call( TEST_PROCESS_STATS.incrementXFailedTestCount(testID, item_error_msg_count) - assert type(reasonText) == str # noqa: E721 + assert type(reasonText) is str if reasonText != "": - assert type(reasonMsgTempl) == str # noqa: E721 + assert type(reasonMsgTempl) is str logging.info("*") logging.info("* " + reasonMsgTempl.format(reasonText)) @@ -451,7 +451,7 @@ def helper__makereport__call( assert call.excinfo is not None assert call.excinfo.value is not None - if type(call.excinfo.value) == SIGNAL_EXCEPTION: # noqa: E721 + if type(call.excinfo.value) is SIGNAL_EXCEPTION: assert item_error_msg_count > 0 pass else: @@ -466,7 +466,7 @@ def helper__makereport__call( assert call.excinfo is None if hasattr(rep, "wasxfail"): - assert type(rep.wasxfail) == str # noqa: E721 + assert type(rep.wasxfail) is str TEST_PROCESS_STATS.incrementNotXFailedTests(testID) @@ -501,8 +501,8 @@ def helper__makereport__call( TestServices.CleanTestTmpDirBeforeExit(item) # -------- - assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721 - assert type(testDurration) == datetime.timedelta # noqa: E721 + assert type(TEST_PROCESS_STATS.cTotalDuration) is datetime.timedelta + assert type(testDurration) is datetime.timedelta TEST_PROCESS_STATS.cTotalDuration += testDurration @@ -543,13 +543,13 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo): assert call is not None # it may be pytest.Function or _pytest.unittest.TestCaseFunction assert isinstance(item, pytest.Function) - assert type(call) == pytest.CallInfo # noqa: E721 + assert type(call) is pytest.CallInfo outcome = yield assert outcome is not None - assert type(outcome) == T_PLUGGY_RESULT # noqa: E721 + assert type(outcome) is T_PLUGGY_RESULT - assert type(call.when) == str # noqa: E721 + assert type(call.when) is str if call.when == "collect": return @@ -638,11 +638,11 @@ def __call__(self, record: logging.LogRecord): assert self._warn_counter is not None assert self._critical_counter is not None - assert type(self._err_counter) == int # noqa: E721 + assert type(self._err_counter) is int assert self._err_counter >= 0 - assert type(self._warn_counter) == int # noqa: E721 + assert type(self._warn_counter) is int assert self._warn_counter >= 0 - assert type(self._critical_counter) == int # noqa: E721 + assert type(self._critical_counter) is int assert self._critical_counter >= 0 r = self._old_method(record) @@ -695,27 +695,27 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function): try: with LogWrapper2() as logWrapper: - assert type(logWrapper) == LogWrapper2 # noqa: E721 + assert type(logWrapper) is LogWrapper2 assert logWrapper._old_method is not None - assert type(logWrapper._err_counter) == int # noqa: E721 + assert type(logWrapper._err_counter) is int assert logWrapper._err_counter == 0 - assert type(logWrapper._warn_counter) == int # noqa: E721 + assert type(logWrapper._warn_counter) is int assert logWrapper._warn_counter == 0 - assert type(logWrapper._critical_counter) == int # noqa: E721 + assert type(logWrapper._critical_counter) is int assert logWrapper._critical_counter == 0 assert logging.root.handle is logWrapper r = yield assert r is not None - assert type(r) == T_PLUGGY_RESULT # noqa: E721 + assert type(r) is T_PLUGGY_RESULT assert logWrapper._old_method is not None - assert type(logWrapper._err_counter) == int # noqa: E721 + assert type(logWrapper._err_counter) is int assert logWrapper._err_counter >= 0 - assert type(logWrapper._warn_counter) == int # noqa: E721 + assert type(logWrapper._warn_counter) is int assert logWrapper._warn_counter >= 0 - assert type(logWrapper._critical_counter) == int # noqa: E721 + assert type(logWrapper._critical_counter) is int assert logWrapper._critical_counter >= 0 assert logging.root.handle is logWrapper @@ -751,7 +751,7 @@ def helper__calc_W(n: int) -> int: assert n > 0 x = int(math.log10(n)) - assert type(x) == int # noqa: E721 + assert type(x) is int assert x >= 0 x += 1 return x @@ -759,7 +759,7 @@ def helper__calc_W(n: int) -> int: # ------------------------------------------------------------------------ def helper__print_test_list(tests: typing.List[str]) -> None: - assert type(tests) == list # noqa: E721 + assert type(tests) is list assert helper__calc_W(9) == 1 assert helper__calc_W(10) == 2 @@ -778,7 +778,7 @@ def helper__print_test_list(tests: typing.List[str]) -> None: nTest = 0 for t in tests: - assert type(t) == str # noqa: E721 + assert type(t) is str assert t != "" nTest += 1 logging.info(templateLine.format(nTest, t)) @@ -786,7 +786,7 @@ def helper__print_test_list(tests: typing.List[str]) -> None: # ------------------------------------------------------------------------ def helper__print_test_list2(tests: typing.List[T_TUPLE__str_int]) -> None: - assert type(tests) == list # noqa: E721 + assert type(tests) is list assert helper__calc_W(9) == 1 assert helper__calc_W(10) == 2 @@ -805,10 +805,10 @@ def helper__print_test_list2(tests: typing.List[T_TUPLE__str_int]) -> None: nTest = 0 for t in tests: - assert type(t) == tuple # noqa: E721 + assert type(t) is tuple assert len(t) == 2 - assert type(t[0]) == str # noqa: E721 - assert type(t[1]) == int # noqa: E721 + assert type(t[0]) is str + assert type(t[1]) is int assert t[0] != "" assert t[1] >= 0 nTest += 1 @@ -830,7 +830,7 @@ def pytest_sessionfinish(): global g_worker_log_is_created # noqa: F824 assert g_test_process_kind is not None - assert type(g_test_process_kind) == T_TEST_PROCESS_KIND # noqa: E721 + assert type(g_test_process_kind) is T_TEST_PROCESS_KIND if g_test_process_kind == T_TEST_PROCESS_KIND.Master: return @@ -838,14 +838,14 @@ def pytest_sessionfinish(): assert g_test_process_kind == T_TEST_PROCESS_KIND.Worker assert g_test_process_mode is not None - assert type(g_test_process_mode) == T_TEST_PROCESS_MODE # noqa: E721 + assert type(g_test_process_mode) is T_TEST_PROCESS_MODE if g_test_process_mode == T_TEST_PROCESS_MODE.Collect: return assert g_test_process_mode == T_TEST_PROCESS_MODE.ExecTests - assert type(g_worker_log_is_created) == bool # noqa: E721 + assert type(g_worker_log_is_created) is bool assert g_worker_log_is_created logging.info("") @@ -856,17 +856,17 @@ def pytest_sessionfinish(): C_LINE1 = "---------------------------" def LOCAL__print_line1_with_header(header: str): - assert type(C_LINE1) == str # noqa: E721 - assert type(header) == str # noqa: E721 + assert type(C_LINE1) is str + assert type(header) is str assert header != "" logging.info(C_LINE1 + " [" + header + "]") def LOCAL__print_test_list( header: str, test_count: int, test_list: typing.List[str] ): - assert type(header) == str # noqa: E721 - assert type(test_count) == int # noqa: E721 - assert type(test_list) == list # noqa: E721 + assert type(header) is str + assert type(test_count) is int + assert type(test_list) is list assert header != "" assert test_count >= 0 assert len(test_list) == test_count @@ -880,9 +880,9 @@ def LOCAL__print_test_list( def LOCAL__print_test_list2( header: str, test_count: int, test_list: typing.List[T_TUPLE__str_int] ): - assert type(header) == str # noqa: E721 - assert type(test_count) == int # noqa: E721 - assert type(test_list) == list # noqa: E721 + assert type(header) is str + assert type(test_count) is int + assert type(test_list) is list assert header != "" assert test_count >= 0 assert len(test_list) == test_count @@ -942,7 +942,7 @@ def LOCAL__print_test_list2( logging.info(" UNEXPECTED : {0}".format(TEST_PROCESS_STATS.cUnexpectedTests)) logging.info("") - assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721 + assert type(TEST_PROCESS_STATS.cTotalDuration) is datetime.timedelta LOCAL__print_line1_with_header("TIME") logging.info("") @@ -1008,7 +1008,7 @@ def helper__pytest_configure__logging(config: pytest.Config) -> None: log_file_path = os.path.join(log_dir, log_name) assert log_file_path is not None - assert type(log_file_path) == str # noqa: E721 + assert type(log_file_path) is str logging_plugin.set_log_path(log_file_path) return @@ -1030,8 +1030,8 @@ def pytest_configure(config: pytest.Config) -> None: g_test_process_mode = helper__detect_test_process_mode(config) g_test_process_kind = helper__detect_test_process_kind(config) - assert type(g_test_process_kind) == T_TEST_PROCESS_KIND # noqa: E721 - assert type(g_test_process_mode) == T_TEST_PROCESS_MODE # noqa: E721 + assert type(g_test_process_kind) is T_TEST_PROCESS_KIND + assert type(g_test_process_mode) is T_TEST_PROCESS_MODE if g_test_process_kind == T_TEST_PROCESS_KIND.Master: pass diff --git a/tests/core/configuration/read_utils/ReadUtils/Unpack_StrList2/test_set001__common.py b/tests/core/configuration/read_utils/ReadUtils/Unpack_StrList2/test_set001__common.py index 1212419..0e25ae0 100644 --- a/tests/core/configuration/read_utils/ReadUtils/Unpack_StrList2/test_set001__common.py +++ b/tests/core/configuration/read_utils/ReadUtils/Unpack_StrList2/test_set001__common.py @@ -21,9 +21,9 @@ class tagData002: result: typing.List[str] def __init__(self, d: str, s: str, r: typing.List[str]): - assert type(d) == str # noqa: E721 - assert type(s) == str # noqa: E721 - assert type(r) == list # noqa: E721 + assert type(d) is str + assert type(s) is str + assert type(r) is list self.descr = d self.source = s @@ -139,12 +139,12 @@ def __init__(self, d: str, s: str, r: typing.List[str]): @pytest.fixture(params=sm_Data002, ids=[x.descr for x in sm_Data002]) def data002(self, request: pytest.FixtureRequest) -> tagData002: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagData002 # noqa: E721 + assert type(request.param) is __class__.tagData002 return request.param # -------------------------------------------------------------------- def test_002__generic(self, data002: tagData002): - assert type(data002) == __class__.tagData002 # noqa: E721 + assert type(data002) is __class__.tagData002 assert ReadUtils.Unpack_StrList2(data002.source) == data002.result diff --git a/tests/core/configuration/write_utils/WriteUtils/Helper__PackStrListItem2/test_set001__common.py b/tests/core/configuration/write_utils/WriteUtils/Helper__PackStrListItem2/test_set001__common.py index 699de5a..f9f5c87 100644 --- a/tests/core/configuration/write_utils/WriteUtils/Helper__PackStrListItem2/test_set001__common.py +++ b/tests/core/configuration/write_utils/WriteUtils/Helper__PackStrListItem2/test_set001__common.py @@ -20,9 +20,9 @@ class tagData002: result: str def __init__(self, d: str, s: str, r: str): - assert type(d) == str # noqa: E721 - assert type(s) == str # noqa: E721 - assert type(r) == str # noqa: E721 + assert type(d) is str + assert type(s) is str + assert type(r) is str self.descr = d self.source = s @@ -103,12 +103,12 @@ def __init__(self, d: str, s: str, r: str): @pytest.fixture(params=sm_Data002, ids=[x.descr for x in sm_Data002]) def data002(self, request: pytest.FixtureRequest) -> tagData002: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagData002 # noqa: E721 + assert type(request.param) is __class__.tagData002 return request.param # -------------------------------------------------------------------- def test_002__generic(self, data002: tagData002): - assert type(data002) == __class__.tagData002 # noqa: E721 + assert type(data002) is __class__.tagData002 assert WriteUtils.Helper__PackStrListItem2(data002.source) == data002.result diff --git a/tests/core/configuration/write_utils/WriteUtils/Pack_Str/test_set001__common.py b/tests/core/configuration/write_utils/WriteUtils/Pack_Str/test_set001__common.py index d2f7cf7..01dc20d 100644 --- a/tests/core/configuration/write_utils/WriteUtils/Pack_Str/test_set001__common.py +++ b/tests/core/configuration/write_utils/WriteUtils/Pack_Str/test_set001__common.py @@ -20,9 +20,9 @@ class tagData002: result: str def __init__(self, d: str, s: str, r: str): - assert type(d) == str # noqa: E721 - assert type(s) == str # noqa: E721 - assert type(r) == str # noqa: E721 + assert type(d) is str + assert type(s) is str + assert type(r) is str self.descr = d self.source = s @@ -118,12 +118,12 @@ def __init__(self, d: str, s: str, r: str): @pytest.fixture(params=sm_Data002, ids=[x.descr for x in sm_Data002]) def data002(self, request: pytest.FixtureRequest) -> tagData002: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagData002 # noqa: E721 + assert type(request.param) is __class__.tagData002 return request.param # -------------------------------------------------------------------- def test_002__generic(self, data002: tagData002): - assert type(data002) == __class__.tagData002 # noqa: E721 + assert type(data002) is __class__.tagData002 assert WriteUtils.Pack_Str(data002.source) == data002.result diff --git a/tests/core/configuration/write_utils/WriteUtils/Pack_StrList2/test_set001__common.py b/tests/core/configuration/write_utils/WriteUtils/Pack_StrList2/test_set001__common.py index a4612be..6b792e6 100644 --- a/tests/core/configuration/write_utils/WriteUtils/Pack_StrList2/test_set001__common.py +++ b/tests/core/configuration/write_utils/WriteUtils/Pack_StrList2/test_set001__common.py @@ -21,9 +21,9 @@ class tagData002: result: str def __init__(self, d: str, s: typing.List[str], r: str): - assert type(d) == str # noqa: E721 - assert type(s) == list # noqa: E721 - assert type(r) == str # noqa: E721 + assert type(d) is str + assert type(s) is list + assert type(r) is str self.descr = d self.source = s @@ -129,12 +129,12 @@ def __init__(self, d: str, s: typing.List[str], r: str): @pytest.fixture(params=sm_Data002, ids=[x.descr for x in sm_Data002]) def data002(self, request: pytest.FixtureRequest) -> tagData002: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagData002 # noqa: E721 + assert type(request.param) is __class__.tagData002 return request.param # -------------------------------------------------------------------- def test_002__generic(self, data002: tagData002): - assert type(data002) == __class__.tagData002 # noqa: E721 + assert type(data002) is __class__.tagData002 assert WriteUtils.Pack_StrList2(data002.source) == data002.result diff --git a/tests/implementation/v00/configuration_std/Mix/test_set001__generic_support_of_options.py b/tests/implementation/v00/configuration_std/Mix/test_set001__generic_support_of_options.py index 75b1269..8a48bda 100644 --- a/tests/implementation/v00/configuration_std/Mix/test_set001__generic_support_of_options.py +++ b/tests/implementation/v00/configuration_std/Mix/test_set001__generic_support_of_options.py @@ -30,7 +30,7 @@ class TestSet001__GenericSupportOfOptions: @pytest.fixture(params=sm_data001, ids=[x[0] for x in sm_data001]) def data001(self, request: pytest.FixtureRequest) -> typing.Tuple[any, any]: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 3 return request.param[1:] @@ -41,7 +41,7 @@ def test_001__set_get( assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) @@ -61,7 +61,7 @@ def test_001__set_get( @pytest.fixture(params=sm_data002, ids=[x[0] for x in sm_data002]) def data002(self, request: pytest.FixtureRequest) -> typing.Tuple[any, any]: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 3 return request.param[1:] @@ -70,11 +70,11 @@ def test_002__write_and_read( self, request: pytest.FixtureRequest, data002: typing.Tuple[any, any] ): assert isinstance(request, pytest.FixtureRequest) - assert type(data002) == tuple # noqa: E721 + assert type(data002) is tuple assert len(data002) == 2 rootTmpDir = TestServices.GetCurTestTmpDir(request) - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str os.makedirs(rootTmpDir, exist_ok=True) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddOption/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddOption/test_set001__common.py index 21f0c12..9e5ae6c 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddOption/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddOption/test_set001__common.py @@ -35,17 +35,17 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001__int_opt(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir option = cfg.AddOption(optName, 123) - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert isinstance(option, PgCfg_Option) __class__.Helper__CheckStateOfCfgWithOneIntOpt(cfg, option, optName, 123) @@ -56,68 +56,66 @@ def test_001__int_opt(self, request: pytest.FixtureRequest, optName: str): def Helper__CheckStateOfCfgWithOneIntOpt( cfg: PgCfg_Std, opt: PgCfg_Option_Base, optName: str, optValue: int ): - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(opt) == PgCfg_Option_Base # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(opt) is PgCfg_Option_Base assert opt.get_Configuration() is cfg assert opt.get_Name() == optName assert opt.get_Value() == optValue - assert type(opt) == PgCfg_Option_Base # noqa: E721 - assert type(opt.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(opt) is PgCfg_Option_Base + assert type(opt.m_OptionData) is PgCfgModel__OptionData assert opt.m_OptionData.m_Name == optName assert opt.m_OptionData.m_Value == optValue assert opt.m_OptionData.m_Parent is not None - assert type(opt.m_OptionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(opt.m_OptionData.m_Parent) is PgCfgModel__FileLineData fileLine = opt.get_Parent() assert fileLine is opt.get_Parent() - assert type(fileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine) is PgCfg_FileLine_Base assert len(fileLine) == 1 fileLineData: PgCfgModel__FileLineData = opt.m_OptionData.m_Parent assert fileLineData is fileLine.m_FileLineData - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list assert len(fileLineData.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData.m_Items[0]) == PgCfgModel__FileLineData.tagItem - ) + assert type(fileLineData.m_Items[0]) is PgCfgModel__FileLineData.tagItem assert fileLineData.m_Items[0].m_Element is opt.m_OptionData assert fileLineData.m_Items[0].m_Element.m_Offset is None - assert type(fileLineData.m_Parent) == PgCfgModel__FileData # noqa: E721 - assert type(fileLineData.get_Parent()) == PgCfgModel__FileData # noqa: E721 + assert type(fileLineData.m_Parent) is PgCfgModel__FileData + assert type(fileLineData.get_Parent()) is PgCfgModel__FileData assert fileLineData.get_Parent() is fileLineData.m_Parent file = fileLine.get_Parent() - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert len(file) == 1 fileData = fileLineData.m_Parent assert fileData is not None assert fileData is file.m_FileData - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_Path == os.path.join( cfg.m_Data.m_DataDir, cfg.C_POSTGRESQL_AUTO_CONF ) assert fileData.m_Parent is cfg.m_Data - assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileData.m_Lines) is list assert len(fileData.m_Lines) == 1 assert fileData.m_Lines[0] is fileLineData - assert type(cfg.m_Data.m_Files) == list # noqa: E721 + assert type(cfg.m_Data.m_Files) is list assert len(cfg.m_Data.m_Files) == 1 - assert type(cfg.m_Data.m_Files[0]) == PgCfgModel__FileData # noqa: E721 + assert type(cfg.m_Data.m_Files[0]) is PgCfgModel__FileData assert cfg.m_Data.m_Files[0] is fileData - assert type(cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(cfg.m_Data.m_AllFilesByName) is dict assert len(cfg.m_Data.m_AllFilesByName) == 1 assert len(cfg.m_Data.m_AllFilesByName.keys()) == 1 assert cfg.C_POSTGRESQL_AUTO_CONF in cfg.m_Data.m_AllFilesByName.keys() assert len(cfg.m_Data.m_AllFilesByName.values()) == 1 assert fileData in cfg.m_Data.m_AllFilesByName.values() - assert type(cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(cfg.m_Data.m_AllOptionsByName) is dict assert len(cfg.m_Data.m_AllOptionsByName) == 1 assert optName in cfg.m_Data.m_AllOptionsByName.keys() assert len(cfg.m_Data.m_AllOptionsByName.values()) == 1 @@ -127,13 +125,13 @@ def Helper__CheckStateOfCfgWithOneIntOpt( @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_002__None_value(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir with pytest.raises(Exception, match=re.escape("None value is not supported.")): @@ -144,10 +142,10 @@ def test_003__empty_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir with pytest.raises(Exception, match=re.escape("Option name is empty.")): @@ -158,10 +156,10 @@ def test_004__None_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir with pytest.raises(Exception, match=re.escape("Option name is None.")): @@ -171,13 +169,13 @@ def test_004__None_name(self, request: pytest.FixtureRequest): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_005__already_defined(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir option = cfg.AddOption(optName, 123) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddTopLevelFile/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddTopLevelFile/test_set001__common.py index ef2f428..125e086 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddTopLevelFile/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/AddTopLevelFile/test_set001__common.py @@ -20,7 +20,7 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -28,7 +28,7 @@ def test_001(self, request: pytest.FixtureRequest): file1 = cfg.AddTopLevelFile(C_FILE_NAME) assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base assert len(cfg.get_AllFiles()) == 1 assert ( diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/GetOptionValue/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/GetOptionValue/test_set001__common.py index 45062fa..abbd492 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/GetOptionValue/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/GetOptionValue/test_set001__common.py @@ -28,20 +28,20 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001__port(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) set_r = cfg.SetOptionValue(optName, 123) - assert type(set_r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(set_r) is PgCfg_SetOptionResult_Base assert isinstance(set_r, PgCfg_SetOptionResult) assert set_r.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED set_r_option: PgCfg_Option_Base = set_r.Option assert set_r_option is not None - assert type(set_r_option) == PgCfg_Option_Base # noqa: E721 + assert type(set_r_option) is PgCfg_Option_Base assert isinstance(set_r_option, PostgresConfigurationOption) assert set_r.Option is set_r_option # check a cache @@ -50,7 +50,7 @@ def test_001__port(self, request: pytest.FixtureRequest, optName: str): assert set_r_option.get_Value() == 123 get_r = cfg.GetOptionValue(optName) - assert type(get_r) == int # noqa: E721 + assert type(get_r) is int assert get_r == 123 # -------------------------------------------------------------------- @@ -58,7 +58,7 @@ def test_002__None_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -70,7 +70,7 @@ def test_003__empty_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -84,7 +84,7 @@ def test_004__opt_with_list__get_None(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/Mix/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/Mix/test_set001__common.py index 2dc26db..a3977e7 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/Mix/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/Mix/test_set001__common.py @@ -20,10 +20,10 @@ def test_001__get_Configuration(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir assert cfg.get_Configuration() is cfg @@ -33,10 +33,10 @@ def test_002__get_Parent(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir assert cfg.get_Parent() is None diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValue/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValue/test_set001__common.py index 00c1595..ee6e6fd 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValue/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValue/test_set001__common.py @@ -40,22 +40,22 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001__int_opt(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r = cfg.SetOptionValue(optName, 123) - assert type(r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r) is PgCfg_SetOptionResult_Base assert isinstance(r, PgCfg_SetOptionResult) assert r.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED r_option: PgCfg_Option_Base = r.Option assert r_option is not None - assert type(r_option) == PgCfg_Option_Base # noqa: E721 + assert type(r_option) is PgCfg_Option_Base assert isinstance(r_option, PostgresConfigurationOption) assert r.Option is r_option # check a cache @@ -67,22 +67,22 @@ def test_001__int_opt(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_002__port___reasign(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r = cfg.SetOptionValue(optName, 123) r = cfg.SetOptionValue(optName, 321) - assert type(r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r) is PgCfg_SetOptionResult_Base assert r.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_UPDATED r_option: PgCfg_Option_Base = r.Option assert r_option is not None - assert type(r_option) == PgCfg_Option_Base # noqa: E721 + assert type(r_option) is PgCfg_Option_Base assert isinstance(r_option, PostgresConfigurationOption) assert r.Option is r_option # check a cache @@ -92,68 +92,66 @@ def test_002__port___reasign(self, request: pytest.FixtureRequest, optName: str) def Helper__CheckStateOfCfgWithOneOpt( cfg: PgCfg_Std, opt: PgCfg_Option_Base, optName: str, optValue: any ): - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(opt) == PgCfg_Option_Base # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(opt) is PgCfg_Option_Base assert opt.get_Configuration() is cfg assert opt.get_Name() == optName assert opt.get_Value() == optValue - assert type(opt) == PgCfg_Option_Base # noqa: E721 - assert type(opt.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(opt) is PgCfg_Option_Base + assert type(opt.m_OptionData) is PgCfgModel__OptionData assert opt.m_OptionData.m_Name == optName assert opt.m_OptionData.m_Value == optValue assert opt.m_OptionData.m_Parent is not None - assert type(opt.m_OptionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(opt.m_OptionData.m_Parent) is PgCfgModel__FileLineData fileLine = opt.get_Parent() assert fileLine is opt.get_Parent() - assert type(fileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine) is PgCfg_FileLine_Base assert len(fileLine) == 1 fileLineData: PgCfgModel__FileLineData = opt.m_OptionData.m_Parent assert fileLineData is fileLine.m_FileLineData - assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 - assert type(fileLineData.m_Items) == list # noqa: E721 + assert type(fileLineData) is PgCfgModel__FileLineData + assert type(fileLineData.m_Items) is list assert len(fileLineData.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData.m_Items[0]) == PgCfgModel__FileLineData.tagItem - ) + assert type(fileLineData.m_Items[0]) is PgCfgModel__FileLineData.tagItem assert fileLineData.m_Items[0].m_Element is opt.m_OptionData assert fileLineData.m_Items[0].m_Element.m_Offset is None - assert type(fileLineData.m_Parent) == PgCfgModel__FileData # noqa: E721 - assert type(fileLineData.get_Parent()) == PgCfgModel__FileData # noqa: E721 + assert type(fileLineData.m_Parent) is PgCfgModel__FileData + assert type(fileLineData.get_Parent()) is PgCfgModel__FileData assert fileLineData.get_Parent() is fileLineData.m_Parent file = fileLine.get_Parent() - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert len(file) == 1 fileData = fileLineData.m_Parent assert fileData is not None assert fileData is file.m_FileData - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData assert fileData.m_Path == os.path.join( cfg.m_Data.m_DataDir, "postgresql.auto.conf" ) assert fileData.m_Parent is cfg.m_Data - assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileData.m_Lines) is list assert len(fileData.m_Lines) == 1 assert fileData.m_Lines[0] is fileLineData - assert type(cfg.m_Data.m_Files) == list # noqa: E721 + assert type(cfg.m_Data.m_Files) is list assert len(cfg.m_Data.m_Files) == 1 - assert type(cfg.m_Data.m_Files[0]) == PgCfgModel__FileData # noqa: E721 + assert type(cfg.m_Data.m_Files[0]) is PgCfgModel__FileData assert cfg.m_Data.m_Files[0] is fileData - assert type(cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 + assert type(cfg.m_Data.m_AllFilesByName) is dict assert len(cfg.m_Data.m_AllFilesByName) == 1 assert len(cfg.m_Data.m_AllFilesByName.keys()) == 1 assert "postgresql.auto.conf" in cfg.m_Data.m_AllFilesByName.keys() assert len(cfg.m_Data.m_AllFilesByName.values()) == 1 assert fileData in cfg.m_Data.m_AllFilesByName.values() - assert type(cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(cfg.m_Data.m_AllOptionsByName) is dict assert len(cfg.m_Data.m_AllOptionsByName) == 1 assert optName in cfg.m_Data.m_AllOptionsByName.keys() assert len(cfg.m_Data.m_AllOptionsByName.values()) == 1 @@ -164,7 +162,7 @@ def test_003__port___bad_type(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -181,7 +179,7 @@ def test_004__port___cont_convert_value(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -197,23 +195,23 @@ def test_004__port___cont_convert_value(self, request: pytest.FixtureRequest): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_006(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 123) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 123 r2 = cfg.SetOptionValue(optName, 321) - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base assert r2.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_UPDATED assert r2.Option.get_Name() == optName assert r2.Option.get_Value() == 321 @@ -222,7 +220,7 @@ def test_006(self, request: pytest.FixtureRequest, optName: str): # -------------- DIRECT ASSIGN r3 = r1.Option.set_Value(555) - assert type(r3) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r3) is PgCfg_SetOptionResult_Base assert r3.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_UPDATED assert r3.Option is r1.Option assert r3.Option.get_Name() == optName @@ -235,17 +233,17 @@ def test_006(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_007__set_None(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r = cfg.SetOptionValue(optName, None) - assert type(r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r) is PgCfg_SetOptionResult_Base assert r.m_EventID == PgCfg_SetOptionEventID.NONE assert r.m_Cfg is None assert r.m_Opt is None @@ -256,17 +254,17 @@ def test_007__set_None(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_008__set_Int_set_None(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 123) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.m_Cfg is cfg assert r1.m_OptData is not None @@ -275,12 +273,12 @@ def test_008__set_Int_set_None(self, request: pytest.FixtureRequest, optName: st assert r1.Option is r1.m_Opt assert len(cfg.m_Data.m_Files) == 1 - assert type(cfg.m_Data.m_Files[0]) == PgCfgModel__FileData # noqa: E721 + assert type(cfg.m_Data.m_Files[0]) is PgCfgModel__FileData assert len(cfg.m_Data.m_Files[0].m_Lines) == 1 assert len(cfg.m_Data.m_AllOptionsByName) == 1 r2 = cfg.SetOptionValue(optName, None) - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base assert r2.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_DELETED assert r2.m_Cfg is None assert r2.m_Opt is None @@ -288,11 +286,11 @@ def test_008__set_Int_set_None(self, request: pytest.FixtureRequest, optName: st assert r2.Option is None assert len(cfg.m_Data.m_Files) == 1 - assert type(cfg.m_Data.m_Files[0]) == PgCfgModel__FileData # noqa: E721 + assert type(cfg.m_Data.m_Files[0]) is PgCfgModel__FileData assert len(cfg.m_Data.m_Files[0].m_Lines) == 0 assert len(cfg.m_Data.m_AllOptionsByName) == 0 - assert type(r1.Option) == PgCfg_Option_Base # noqa: E721 + assert type(r1.Option) is PgCfg_Option_Base assert isinstance(r1.Option, PgCfg_Option) with pytest.raises(Exception, match=re.escape("Option object was deleted.")): @@ -314,7 +312,7 @@ def test_008__set_Int_set_None(self, request: pytest.FixtureRequest, optName: st r1.Option.get_Configuration() r3 = cfg.SetOptionValue(optName, None) - assert type(r3) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r3) is PgCfg_SetOptionResult_Base assert r3.m_EventID == PgCfg_SetOptionEventID.NONE assert r3.m_Cfg is None assert r3.m_Opt is None @@ -326,15 +324,15 @@ def test_009__spec_file(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file1 = cfg.AddTopLevelFile("postgresql.proxima.conf") assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 - assert type(file1.m_FileData) == PgCfgModel__FileData # noqa: E721 - assert type(file1.m_FileData.m_OptionsByName) == dict # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base + assert type(file1.m_FileData) is PgCfgModel__FileData + assert type(file1.m_FileData.m_OptionsByName) is dict assert len(file1.m_FileData.m_OptionsByName) == 0 assert len(cfg.get_AllFiles()) == 1 @@ -352,8 +350,8 @@ def test_009__spec_file(self, request: pytest.FixtureRequest): assert len(file1.m_FileData.m_OptionsByName) == 0 rs1 = cfg.SetOptionValue(C_OPT_NAME, optValue) - assert type(rs1) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(rs1.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(rs1) is PgCfg_SetOptionResult_Base + assert type(rs1.m_OptData) is PgCfgModel__OptionData assert rs1.m_OptData.m_Value == optValue assert rs1.m_OptData.m_Name == C_OPT_NAME assert rs1.Option.get_Name() == C_OPT_NAME @@ -363,19 +361,19 @@ def test_009__spec_file(self, request: pytest.FixtureRequest): assert len(file1.get_Lines()) == 1 assert len(file1.m_FileData.m_OptionsByName) == 1 assert C_OPT_NAME in file1.m_FileData.m_OptionsByName.keys() - assert ( # noqa: E721 + assert ( type(file1.m_FileData.m_OptionsByName[C_OPT_NAME]) - == PgCfgModel__OptionData + is PgCfgModel__OptionData ) assert file1.m_FileData.m_OptionsByName[C_OPT_NAME] is rs1.m_OptData assert cfg.m_Data is not None - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 - assert type(cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData + assert type(cfg.m_Data.m_AllOptionsByName) is dict assert C_OPT_NAME in cfg.m_Data.m_AllOptionsByName.keys() - assert ( # noqa: E721 + assert ( type(cfg.m_Data.m_AllOptionsByName[C_OPT_NAME]) - == PgCfgModel__OptionData + is PgCfgModel__OptionData ) assert cfg.m_Data.m_AllOptionsByName[C_OPT_NAME] is rs1.m_OptData @@ -388,7 +386,7 @@ def test_010__None_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -400,7 +398,7 @@ def test_011__empty_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -417,9 +415,9 @@ def test_011__empty_name(self, request: pytest.FixtureRequest): @pytest.fixture(params=sm_data012__values, ids=[x[0] for x in sm_data012__values]) def data012(self, request: pytest.FixtureRequest) -> typing.Tuple[str, any, any]: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 4 - assert type(request.param[0]) == str # noqa: E721 + assert type(request.param[0]) is str return request.param[1:] # -------------------------------------------------------------------- @@ -427,23 +425,23 @@ def test_012__one_opt( self, request: pytest.FixtureRequest, data012: typing.Tuple[str, any, any] ): assert isinstance(request, pytest.FixtureRequest) - assert type(data012) == tuple # noqa: E721 + assert type(data012) is tuple assert len(data012) == 3 rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r = cfg.SetOptionValue(data012[0], data012[1]) - assert type(r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r) is PgCfg_SetOptionResult_Base assert isinstance(r, PgCfg_SetOptionResult) assert r.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED r_option: PgCfg_Option_Base = r.Option assert r_option is not None - assert type(r_option) == PgCfg_Option_Base # noqa: E721 + assert type(r_option) is PgCfg_Option_Base assert isinstance(r_option, PostgresConfigurationOption) assert r.Option is r_option # check a cache diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py index a83d134..9ba374d 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py @@ -28,7 +28,7 @@ def test_001(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -38,8 +38,8 @@ def test_001(self, request: pytest.FixtureRequest): r1 = cfg.SetOptionValueItem(C_OPT_NAME, "biha") assert r1 is not None - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(r1.EventID) == PgCfg_SetOptionEventID # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base + assert type(r1.EventID) is PgCfg_SetOptionEventID if nPass == 0: assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED @@ -49,16 +49,16 @@ def test_001(self, request: pytest.FixtureRequest): ) assert r1.m_OptData is not None - assert type(r1.m_OptData.m_Name) == str # noqa: E721 + assert type(r1.m_OptData.m_Name) is str assert r1.m_OptData.m_Name == C_OPT_NAME - assert type(r1.m_OptData.m_Value) == list # noqa: E721 + assert type(r1.m_OptData.m_Value) is list assert len(r1.m_OptData.m_Value) == 1 assert r1.m_OptData.m_Value[0] is not None - assert type(r1.m_OptData.m_Value[0]) == str # noqa: E721 + assert type(r1.m_OptData.m_Value[0]) is str assert r1.m_OptData.m_Value[0] == "biha" assert r1.m_OptData.m_Value == ["biha"] - assert type(r1.Option) == PgCfg_Option_Base # noqa: E721 + assert type(r1.Option) is PgCfg_Option_Base assert r1.Option is r1.m_Opt # check cache assert r1.Option.m_OptionData is r1.m_OptData assert r1.Option.get_Name() == C_OPT_NAME @@ -75,7 +75,7 @@ def test_002(self, request: pytest.FixtureRequest): optValues = ["biha", "proxima", "biha", "proxima"] rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -93,7 +93,7 @@ def test_002(self, request: pytest.FixtureRequest): ) optValueWillBeAdded = not (optValue in index) - assert type(optValueWillBeAdded) == bool # noqa: E721 + assert type(optValueWillBeAdded) is bool if optValueWillBeAdded: expectedValue.append(optValue) @@ -102,8 +102,8 @@ def test_002(self, request: pytest.FixtureRequest): r1 = cfg.SetOptionValueItem(C_OPT_NAME, optValue) assert r1 is not None - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(r1.EventID) == PgCfg_SetOptionEventID # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base + assert type(r1.EventID) is PgCfg_SetOptionEventID if len(expectedValue) == 1: assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED @@ -115,19 +115,19 @@ def test_002(self, request: pytest.FixtureRequest): ) assert r1.m_OptData is not None - assert type(r1.m_OptData.m_Name) == str # noqa: E721 + assert type(r1.m_OptData.m_Name) is str assert r1.m_OptData.m_Name == C_OPT_NAME - assert type(r1.m_OptData.m_Value) == list # noqa: E721 + assert type(r1.m_OptData.m_Value) is list assert len(r1.m_OptData.m_Value) == len(expectedValue) for i in range(len(expectedValue)): assert r1.m_OptData.m_Value[i] is not None - assert type(r1.m_OptData.m_Value[i]) == str # noqa: E721 + assert type(r1.m_OptData.m_Value[i]) is str assert r1.m_OptData.m_Value[i] == expectedValue[i] assert r1.m_OptData.m_Value == expectedValue - assert type(r1.Option) == PgCfg_Option_Base # noqa: E721 + assert type(r1.Option) is PgCfg_Option_Base assert r1.Option is r1.m_Opt # check cache assert r1.Option.m_OptionData is r1.m_OptData assert r1.Option.get_Name() == C_OPT_NAME @@ -142,7 +142,7 @@ def test_003(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -163,7 +163,7 @@ def test_004__check_get_prepare_filter__unique( C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -186,7 +186,7 @@ def test_005__check_get_prepare_filter__to_str( C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -209,7 +209,7 @@ def test_006__set_value_item_with_bad_type(self, request: pytest.FixtureRequest) C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -237,7 +237,7 @@ def test_007__set_None(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllFiles/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllFiles/test_set001__common.py index bc74963..cde4fd3 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllFiles/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllFiles/test_set001__common.py @@ -27,13 +27,13 @@ def test_000(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) allFiles1 = cfg.get_AllFiles() assert allFiles1 is not None - assert type(allFiles1) == PgCfg_Base__AllFiles # noqa: E721 + assert type(allFiles1) is PgCfg_Base__AllFiles assert isinstance(allFiles1, PgCfg_Files) assert len(allFiles1) == 0 @@ -46,10 +46,10 @@ def test_000(self, request: pytest.FixtureRequest): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -57,14 +57,14 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): allFiles1 = cfg.get_AllFiles() assert allFiles1 is not None - assert type(allFiles1) == PgCfg_Base__AllFiles # noqa: E721 + assert type(allFiles1) is PgCfg_Base__AllFiles assert isinstance(allFiles1, PgCfg_Files) assert len(allFiles1) == 1 allFiles1_list: list[PgCfg_TopLevelFile_Base] = [] for file in allFiles1: assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base allFiles1_list.append(file) assert allFiles1_list is not None @@ -79,23 +79,23 @@ def test_002__iter(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) allFiles1 = cfg.get_AllFiles() - assert type(allFiles1) == PgCfg_Base__AllFiles # noqa: E721 + assert type(allFiles1) is PgCfg_Base__AllFiles it1 = allFiles1.__iter__() assert it1 is not None - assert type(it1) == PgCfg_Base__AllFilesIterator # noqa: E721 + assert type(it1) is PgCfg_Base__AllFilesIterator assert isinstance(it1, PgCfg_FilesIterator) assert it1.m_Cfg is cfg assert it1.m_FileDataIterator is not None it1a = it1.__iter__() assert it1a is not None - assert type(it1a) == PgCfg_Base__AllFilesIterator # noqa: E721 + assert type(it1a) is PgCfg_Base__AllFilesIterator assert isinstance(it1a, PgCfg_FilesIterator) assert it1a.m_Cfg is cfg @@ -108,7 +108,7 @@ def test_003__transform_to_list(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py index 0392433..ee01010 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py @@ -27,13 +27,13 @@ def test_000(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) allOptions1 = cfg.get_AllOptions() assert allOptions1 is not None - assert type(allOptions1) == PgCfg_Base__AllOptions # noqa: E721 + assert type(allOptions1) is PgCfg_Base__AllOptions assert isinstance(allOptions1, PgCfg_Options) assert len(allOptions1) == 0 @@ -46,10 +46,10 @@ def test_000(self, request: pytest.FixtureRequest): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -57,14 +57,14 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): allOptions1 = cfg.get_AllOptions() assert allOptions1 is not None - assert type(allOptions1) == PgCfg_Base__AllOptions # noqa: E721 + assert type(allOptions1) is PgCfg_Base__AllOptions assert isinstance(allOptions1, PgCfg_Options) assert len(allOptions1) == 1 allOptions1_list: list[PgCfg_Option_Base] = [] for option in allOptions1: assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert isinstance(option, PgCfg_Option) allOptions1_list.append(option) @@ -81,23 +81,23 @@ def test_002__iter(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) allOptions1 = cfg.get_AllOptions() - assert type(allOptions1) == PgCfg_Base__AllOptions # noqa: E721 + assert type(allOptions1) is PgCfg_Base__AllOptions it1 = allOptions1.__iter__() assert it1 is not None - assert type(it1) == PgCfg_Base__AllOptionsIterator # noqa: E721 + assert type(it1) is PgCfg_Base__AllOptionsIterator assert isinstance(it1, PgCfg_OptionsIterator) assert it1.m_Cfg is cfg assert it1.m_OptionDataIterator is not None it1a = it1.__iter__() assert it1a is not None - assert type(it1a) == PgCfg_Base__AllOptionsIterator # noqa: E721 + assert type(it1a) is PgCfg_Base__AllOptionsIterator assert isinstance(it1a, PgCfg_OptionsIterator) assert it1a.m_Cfg is cfg @@ -110,7 +110,7 @@ def test_003__transform_to_list(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -127,7 +127,7 @@ def test_004__two_options(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -140,9 +140,9 @@ def test_004__two_options(self, request: pytest.FixtureRequest): for opt in cfg.get_AllOptions(): assert opt is not None - assert type(opt) == PgCfg_Option_Base # noqa: E721 + assert type(opt) is PgCfg_Option_Base assert isinstance(opt, PgCfg_Option) - assert type(opt) == PgCfg_Option_Base # noqa: E721 + assert type(opt) is PgCfg_Option_Base assert not opt.get_Name() in names diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationComment/Delete/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationComment/Delete/test_set001__common.py index b8231f6..f4096c1 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationComment/Delete/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationComment/Delete/test_set001__common.py @@ -20,7 +20,7 @@ def test_001__withLine(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -34,7 +34,7 @@ def test_001__withLine(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 - assert type(comment) == PgCfg_Comment_Base # noqa: E721 + assert type(comment) is PgCfg_Comment_Base comment.Delete(True) @@ -64,7 +64,7 @@ def test_002__withoutLine(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -78,7 +78,7 @@ def test_002__withoutLine(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 - assert type(comment) == PgCfg_Comment_Base # noqa: E721 + assert type(comment) is PgCfg_Comment_Base comment.Delete(False) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddComment/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddComment/test_set001__common.py index 1608a06..50243ac 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddComment/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddComment/test_set001__common.py @@ -31,16 +31,16 @@ class TestSet001__Common: ) def offset001(self, request: pytest.FixtureRequest) -> typing.Optional[int]: assert isinstance(request, pytest.FixtureRequest) - assert request.param is None or type(request.param) == int # noqa: E721 + assert request.param is None or type(request.param) is int return request.param # -------------------------------------------------------------------- def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[int]): assert isinstance(request, pytest.FixtureRequest) - assert offset001 is None or type(offset001) == int # noqa: E721 + assert offset001 is None or type(offset001) is int rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -55,9 +55,9 @@ def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[in assert len(fileLine) == 1 assert comment is not None - assert type(comment) == PgCfg_Comment_Base # noqa: E721 + assert type(comment) is PgCfg_Comment_Base assert comment.m_FileLine is fileLine - assert type(comment.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert type(comment.m_CommentData) is PgCfgModel__CommentData assert comment.m_CommentData.m_Offset == offset001 assert comment.m_CommentData.IsAlive() @@ -73,7 +73,7 @@ def test_E01__second_comment_in_line(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -91,9 +91,9 @@ def test_E01__second_comment_in_line(self, request: pytest.FixtureRequest): fileLine.AddComment("comment2", 4) assert comment is not None - assert type(comment) == PgCfg_Comment_Base # noqa: E721 + assert type(comment) is PgCfg_Comment_Base assert comment.m_FileLine is fileLine - assert type(comment.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert type(comment.m_CommentData) is PgCfgModel__CommentData assert comment.m_CommentData.m_Offset == 3 assert comment.m_CommentData.IsAlive() @@ -109,7 +109,7 @@ def test_E02__bad_symbol(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddInclude/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddInclude/test_set001__common.py index 76fe395..db2b28b 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddInclude/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddInclude/test_set001__common.py @@ -36,16 +36,16 @@ class TestSet001__Common: ) def offset001(self, request: pytest.FixtureRequest) -> typing.Optional[int]: assert isinstance(request, pytest.FixtureRequest) - assert request.param is None or type(request.param) == int # noqa: E721 + assert request.param is None or type(request.param) is int return request.param # -------------------------------------------------------------------- def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[int]): assert isinstance(request, pytest.FixtureRequest) - assert offset001 is None or type(offset001) == int # noqa: E721 + assert offset001 is None or type(offset001) is int rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -62,10 +62,10 @@ def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[in assert len(fileLine) == 1 assert include is not None - assert type(include) == PgCfg_Include_Base # noqa: E721 + assert type(include) is PgCfg_Include_Base assert include.m_FileLine.m_FileLineData is fileLine.m_FileLineData assert include.m_FileLine is fileLine - assert type(include.m_IncludeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(include.m_IncludeData) is PgCfgModel__IncludeData assert include.m_IncludeData.m_Offset == offset001 assert include.m_IncludeData.IsAlive() @@ -76,7 +76,7 @@ def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[in assert include.get_Parent() is fileLine includedFile = include.get_File() - assert type(includedFile) == PgCfg_IncludedFile_Base # noqa: E721 + assert type(includedFile) is PgCfg_IncludedFile_Base # assert include.get_File() is includedFile assert includedFile.get_Path() == os.path.join(rootTmpDir, C_FILE_NAME) assert includedFile.get_Parent() is include @@ -86,7 +86,7 @@ def test_E01__after_option(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -106,9 +106,9 @@ def test_E01__after_option(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == 2 assert option.m_OptionData.IsAlive() @@ -126,7 +126,7 @@ def test_E02__after_include(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -152,7 +152,7 @@ def test_E03__after_comment(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddOption/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddOption/test_set001__common.py index a564c9e..8dbdf34 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddOption/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/AddOption/test_set001__common.py @@ -32,16 +32,16 @@ class TestSet001__Common: ) def offset001(self, request: pytest.FixtureRequest) -> typing.Optional[int]: assert isinstance(request, pytest.FixtureRequest) - assert request.param is None or type(request.param) == int # noqa: E721 + assert request.param is None or type(request.param) is int return request.param # -------------------------------------------------------------------- def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[int]): assert isinstance(request, pytest.FixtureRequest) - assert offset001 is None or type(offset001) == int # noqa: E721 + assert offset001 is None or type(offset001) is int rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -56,9 +56,9 @@ def test_001(self, request: pytest.FixtureRequest, offset001: typing.Optional[in assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == offset001 assert option.m_OptionData.IsAlive() @@ -76,10 +76,10 @@ def test_002__shared_preload_libraries( self, request: pytest.FixtureRequest, offset001: typing.Optional[int] ): assert isinstance(request, pytest.FixtureRequest) - assert offset001 is None or type(offset001) == int # noqa: E721 + assert offset001 is None or type(offset001) is int rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -99,9 +99,9 @@ def test_002__shared_preload_libraries( assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == offset001 assert option.m_OptionData.IsAlive() @@ -119,10 +119,10 @@ def test_003__shared_preload_libraries__as_str( self, request: pytest.FixtureRequest, offset001: typing.Optional[int] ): assert isinstance(request, pytest.FixtureRequest) - assert offset001 is None or type(offset001) == int # noqa: E721 + assert offset001 is None or type(offset001) is int rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -142,9 +142,9 @@ def test_003__shared_preload_libraries__as_str( assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == offset001 assert option.m_OptionData.IsAlive() @@ -164,7 +164,7 @@ def test_004__shared_preload_libraries__with_None_item( assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -193,7 +193,7 @@ def test_E01__after_option(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -213,9 +213,9 @@ def test_E01__after_option(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == 2 assert option.m_OptionData.IsAlive() @@ -233,7 +233,7 @@ def test_E02__after_include(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -259,7 +259,7 @@ def test_E03__after_comment(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -285,7 +285,7 @@ def test_E04__conflict_with_this_file(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -311,9 +311,9 @@ def test_E04__conflict_with_this_file(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == 2 assert option.m_OptionData.IsAlive() @@ -331,7 +331,7 @@ def test_E05__conflict_with_another_file(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -357,9 +357,9 @@ def test_E05__conflict_with_another_file(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.m_FileLine.m_FileLineData is fileLine.m_FileLineData - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert option.m_OptionData.m_Offset == 2 assert option.m_OptionData.IsAlive() diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/Clear/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/Clear/test_set001__common.py index 9bb3277..7afe5a1 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/Clear/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationFileLine/Clear/test_set001__common.py @@ -37,13 +37,13 @@ def test_001__line_with_option(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) set_r = cfg.SetOptionValue("port", 123) assert set_r is not None - assert type(set_r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(set_r) is PgCfg_SetOptionResult_Base assert set_r.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert set_r.Option.get_Configuration() is cfg assert set_r.Option.get_Parent().get_Parent().get_Parent() is cfg @@ -54,27 +54,27 @@ def test_001__line_with_option(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert file.get_Path() == os.path.join(rootTmpDir, "postgresql.auto.conf") fileLines = file.get_Lines() assert fileLines is not None - assert type(fileLines) == PgCfg_FileLines_Base # noqa: E721 + assert type(fileLines) is PgCfg_FileLines_Base assert isinstance(fileLines, PgCfg_FileLines) assert len(fileLines) == 1 fileLine = fileLines.__iter__().__next__() assert fileLine is not None - assert type(fileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine) is PgCfg_FileLine_Base assert isinstance(fileLine, PgCfg_FileLine) assert len(fileLine) == 1 assert set_r.m_OptData is not None - assert type(set_r.m_OptData) == PgCfgModel__OptionData # noqa: E721 - assert type(set_r.m_OptData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(set_r.m_OptData) is PgCfgModel__OptionData + assert type(set_r.m_OptData.m_Parent) is PgCfgModel__FileLineData fileLine.Clear() @@ -99,7 +99,7 @@ def test_001__line_with_option(self, request: pytest.FixtureRequest): set_r.Option.get_Configuration() assert set_r.m_OptData is not None - assert type(set_r.m_OptData) == PgCfgModel__OptionData # noqa: E721 + assert type(set_r.m_OptData) is PgCfgModel__OptionData assert set_r.m_OptData.m_Parent is None # -------------------------------------------------------------------- @@ -107,7 +107,7 @@ def test_002__line_with_comment(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -117,21 +117,21 @@ def test_002__line_with_comment(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) assert len(file) == 1 comment1 = file.AddComment("1") assert comment1 is not None - assert type(comment1) == PgCfg_Comment_Base # noqa: E721 + assert type(comment1) is PgCfg_Comment_Base assert isinstance(comment1, PgCfg_Comment) assert comment1.get_Text() == "1" assert len(file) == 2 fileLine = comment1.get_Parent() assert fileLine is not None - assert type(fileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine) is PgCfg_FileLine_Base assert len(fileLine) == 1 assert ( @@ -142,7 +142,7 @@ def test_002__line_with_comment(self, request: pytest.FixtureRequest): assert len(fileLine) == 0 assert comment1.m_CommentData is not None - assert type(comment1.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert type(comment1.m_CommentData) is PgCfgModel__CommentData assert comment1.m_CommentData.m_Parent is None diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationInclude/Delete/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationInclude/Delete/test_set001__common.py index d0003f1..5ee1223 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationInclude/Delete/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationInclude/Delete/test_set001__common.py @@ -21,7 +21,7 @@ def test_001__withLine(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -35,7 +35,7 @@ def test_001__withLine(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 - assert type(include) == PgCfg_Include_Base # noqa: E721 + assert type(include) is PgCfg_Include_Base include.Delete(True) @@ -65,7 +65,7 @@ def test_002__withoutLine(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -79,7 +79,7 @@ def test_002__withoutLine(self, request: pytest.FixtureRequest): assert len(fileLine) == 1 - assert type(include) == PgCfg_Include_Base # noqa: E721 + assert type(include) is PgCfg_Include_Base include.Delete(False) @@ -111,7 +111,7 @@ def test_003__line_with_comment__delete_withLine( assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -126,7 +126,7 @@ def test_003__line_with_comment__delete_withLine( assert len(fileLine) == 2 - assert type(include) == PgCfg_Include_Base # noqa: E721 + assert type(include) is PgCfg_Include_Base include.Delete(True) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/Mix/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/Mix/test_set001__common.py index e17be52..ee721b6 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/Mix/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/Mix/test_set001__common.py @@ -28,95 +28,85 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 234) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 234 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg # -------------------------------------------------------------------- @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_002__set_Value__int(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 234) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 234 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg r2 = r1.Option.set_Value(432) - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base assert r2.EventID == PgCfg_SetOptionEventID.OPTION_WAS_UPDATED assert r2.Option.get_Name() == optName assert r2.Option.get_Value() == 432 - assert type(r2.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r2.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r2.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r2.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r2.Option.get_Parent().get_Parent().get_Parent() is cfg assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 432 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg # -------------------------------------------------------------------- @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_003__set_Value__None(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 234) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 234 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg r2 = r1.Option.set_Value(None) - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base assert r2.EventID == PgCfg_SetOptionEventID.OPTION_WAS_DELETED assert r2.Option is None @@ -141,24 +131,22 @@ def test_004__set_Value__invalid( self, request: pytest.FixtureRequest, optName: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 234) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 234 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg invalidValues = [True, False] @@ -183,24 +171,22 @@ def test_005__set_Value__cant_convert_value( self, request: pytest.FixtureRequest, optName: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValue(optName, 234) - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED assert r1.Option.get_Name() == optName assert r1.Option.get_Value() == 234 - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg invalidValues = ["qwe", "123."] diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/set_ValueItem/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/set_ValueItem/test_set001__common.py index ef8a656..110138b 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/set_ValueItem/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationOption/set_ValueItem/test_set001__common.py @@ -29,20 +29,18 @@ def test_001(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValueItem(C_OPT_NAME, "biha") - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.Option.get_Name() == C_OPT_NAME assert r1.Option.get_Value() == ["biha"] - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg assert r1.Option.get_Value() == ["biha"] @@ -53,7 +51,7 @@ def test_001(self, request: pytest.FixtureRequest): r2 = r1.Option.set_ValueItem("proxima") assert r2 is not None - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base if nPass == 0: assert r2.EventID == PgCfg_SetOptionEventID.VALUE_ITEM_WAS_ADDED @@ -65,7 +63,7 @@ def test_001(self, request: pytest.FixtureRequest): assert r2.m_OptData is not None assert r2.m_OptData is r1.m_OptData assert r2.m_OptData.m_Value is not None - assert type(r2.m_OptData.m_Value) == list # noqa: E721 + assert type(r2.m_OptData.m_Value) is list assert len(r2.m_OptData.m_Value) == 2 assert r2.m_OptData.m_Value[0] == "biha" assert r2.m_OptData.m_Value[1] == "proxima" @@ -79,20 +77,18 @@ def test_002__set_None(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValueItem(C_OPT_NAME, "biha") - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.Option.get_Name() == C_OPT_NAME assert r1.Option.get_Value() == ["biha"] - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg with pytest.raises(Exception, match=re.escape("None value is not supported.")): @@ -107,20 +103,18 @@ def test_003__set_value_item_with_bad_type(self, request: pytest.FixtureRequest) C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfg.m_Data) is PgCfgModel__ConfigurationData assert cfg.m_Data.m_DataDir == rootTmpDir r1 = cfg.SetOptionValueItem(C_OPT_NAME, "biha") - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.Option.get_Name() == C_OPT_NAME assert r1.Option.get_Value() == ["biha"] - assert type(r1.Option.get_Parent()) == PgCfg_FileLine_Base # noqa: E721 - assert ( - type(r1.Option.get_Parent().get_Parent()) == PgCfg_TopLevelFile_Base - ) # noqa: E721 + assert type(r1.Option.get_Parent()) is PgCfg_FileLine_Base + assert type(r1.Option.get_Parent().get_Parent()) is PgCfg_TopLevelFile_Base assert r1.Option.get_Parent().get_Parent().get_Parent() is cfg errMsg = ( diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadConfigurationFile/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadConfigurationFile/test_set001__common.py index c91a34b..193090e 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadConfigurationFile/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadConfigurationFile/test_set001__common.py @@ -40,9 +40,9 @@ def test_000__empty(self, request: pytest.FixtureRequest): with open(filePath, "x") as f: fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime f.close() # --------------- @@ -56,10 +56,10 @@ def test_000__empty(self, request: pytest.FixtureRequest): assert len(cfg.get_AllFiles()) == 1 file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert file.m_FileData.m_Status == PgCfgModel__FileStatus.EXISTS assert file.m_FileData.m_LastModifiedTimestamp == lastMDate assert len(file.m_FileData.m_Lines) == 0 @@ -86,9 +86,9 @@ def test_001__comment_and_options(self, request: pytest.FixtureRequest): # fmt: on fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate) == datetime.datetime # noqa: E721 + assert type(lastMDate) is datetime.datetime f.close() # --------------- @@ -102,10 +102,10 @@ def test_001__comment_and_options(self, request: pytest.FixtureRequest): assert len(cfg.get_AllFiles()) == 1 file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert file.m_FileData.m_Status == PgCfgModel__FileStatus.EXISTS assert file.m_FileData.m_LastModifiedTimestamp == lastMDate @@ -122,9 +122,7 @@ def test_001__comment_and_options(self, request: pytest.FixtureRequest): assert len(fileDataLines[4].m_Items) == 0 # LINE 0 - assert ( # noqa: E721 - type(fileDataLines[0].m_Items[0].m_Element) == PgCfgModel__CommentData - ) + assert type(fileDataLines[0].m_Items[0].m_Element) is PgCfgModel__CommentData assert ( fileDataLines[0].m_Items[0].m_Element.m_Text == "It is a test configuration file" @@ -132,30 +130,22 @@ def test_001__comment_and_options(self, request: pytest.FixtureRequest): assert fileDataLines[0].m_Items[0].m_Element.m_Offset == 0 # LINE 1 - assert ( # noqa: E721 - type(fileDataLines[1].m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileDataLines[1].m_Items[0].m_Element) is PgCfgModel__OptionData assert fileDataLines[1].m_Items[0].m_Element.m_Name == "port" assert fileDataLines[1].m_Items[0].m_Element.m_Value == 123 assert fileDataLines[1].m_Items[0].m_Element.m_Offset == 0 - assert ( # noqa: E721 - type(fileDataLines[1].m_Items[1].m_Element) == PgCfgModel__CommentData - ) + assert type(fileDataLines[1].m_Items[1].m_Element) is PgCfgModel__CommentData assert fileDataLines[1].m_Items[1].m_Element.m_Text == "It is a port" assert fileDataLines[1].m_Items[1].m_Element.m_Offset == 9 # LINE 3 - assert ( # noqa: E721 - type(fileDataLines[3].m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileDataLines[3].m_Items[0].m_Element) is PgCfgModel__OptionData assert fileDataLines[3].m_Items[0].m_Element.m_Name == "listen_addresses" assert fileDataLines[3].m_Items[0].m_Element.m_Value == "*" assert fileDataLines[3].m_Items[0].m_Element.m_Offset == 0 - assert ( # noqa: E721 - type(fileDataLines[3].m_Items[1].m_Element) == PgCfgModel__CommentData - ) + assert type(fileDataLines[3].m_Items[1].m_Element) is PgCfgModel__CommentData assert fileDataLines[3].m_Items[1].m_Element.m_Text == "addresses" assert fileDataLines[3].m_Items[1].m_Element.m_Offset == 21 @@ -181,9 +171,9 @@ def test_002__two_files(self, request: pytest.FixtureRequest): # fmt: on fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate1 = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate1) == datetime.datetime # noqa: E721 + assert type(lastMDate1) is datetime.datetime f.close() # --------------- @@ -198,9 +188,9 @@ def test_002__two_files(self, request: pytest.FixtureRequest): # fmt: on fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate2 = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate2) == datetime.datetime # noqa: E721 + assert type(lastMDate2) is datetime.datetime f.close() # --------------- @@ -246,9 +236,9 @@ def test_003__two_files__duplication_and_cycles( # fmt: on fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate1 = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate1) == datetime.datetime # noqa: E721 + assert type(lastMDate1) is datetime.datetime f.close() # --------------- @@ -265,9 +255,9 @@ def test_003__two_files__duplication_and_cycles( # fmt: on fd = f.fileno() - assert type(fd) == int # noqa: E721 + assert type(fd) is int lastMDate2 = datetime.datetime.fromtimestamp(os.path.getmtime(fd)) - assert type(lastMDate2) == datetime.datetime # noqa: E721 + assert type(lastMDate2) is datetime.datetime f.close() # --------------- diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadFileDataContent/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadFileDataContent/test_set001__common.py index 4298508..a699b3c 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadFileDataContent/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationReader_Base/LoadFileDataContent/test_set001__common.py @@ -31,7 +31,7 @@ def test_001__empty(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(rootTmpDir) @@ -40,10 +40,10 @@ def test_001__empty(self, request: pytest.FixtureRequest): assert isinstance(file1, PgCfg_File_Base) assert isinstance(file1, PgCfg_TopLevelFile_Base) assert file1.m_FileData is not None - assert type(file1.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file1.m_FileData) is PgCfgModel__FileData assert file1.m_FileData.m_Lines is not None - assert type(file1.m_FileData.m_Lines) == list # noqa: E721 - assert type(file1.m_FileData.m_Path) == str # noqa: E721 + assert type(file1.m_FileData.m_Lines) is list + assert type(file1.m_FileData.m_Path) is str assert file1.m_FileData.m_Path == os.path.join( rootTmpDir, cfg.C_POSTGRESQL_CONF, @@ -55,9 +55,9 @@ def test_001__empty(self, request: pytest.FixtureRequest): assert len(file1) == 0 assert file1.m_FileData is not None - assert type(file1.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file1.m_FileData) is PgCfgModel__FileData assert file1.m_FileData.m_Lines is not None - assert type(file1.m_FileData.m_Lines) == list # noqa: E721 + assert type(file1.m_FileData.m_Lines) is list assert len(file1.m_FileData.m_Lines) == 0 # -------------------------------------------------------------------- @@ -65,7 +65,7 @@ def test_002__space(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -84,7 +84,7 @@ def test_003__empty_line_with_eol(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -103,7 +103,7 @@ def test_101__comment(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -118,9 +118,7 @@ def test_101__comment(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__CommentData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__CommentData assert fileLineData0.m_Items[0].m_Element.m_Offset == 1 assert fileLineData0.m_Items[0].m_Element.m_Text == " comment " @@ -129,7 +127,7 @@ def test_102__two_comments(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -144,17 +142,13 @@ def test_102__two_comments(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__CommentData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__CommentData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Text == "comment1" fileLineData1 = file1.m_FileData.m_Lines[1] assert len(fileLineData1.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData1.m_Items[0].m_Element) == PgCfgModel__CommentData - ) + assert type(fileLineData1.m_Items[0].m_Element) is PgCfgModel__CommentData assert fileLineData1.m_Items[0].m_Element.m_Offset == 4 assert fileLineData1.m_Items[0].m_Element.m_Text == "comment2" @@ -175,18 +169,18 @@ def test_102__two_comments(self, request: pytest.FixtureRequest): @pytest.fixture(params=sm_data201__assign, ids=[x[0] for x in sm_data201__assign]) def data201__assign(self, request: pytest.FixtureRequest) -> str: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 2 - assert type(request.param[1]) == str # noqa: E721 + assert type(request.param[1]) is str return request.param[1] # -------------------------------------------------------------------- def test_201__option(self, request: pytest.FixtureRequest, data201__assign: str): assert isinstance(request, pytest.FixtureRequest) - assert type(data201__assign) == str # noqa: E721 + assert type(data201__assign) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -201,9 +195,7 @@ def test_201__option(self, request: pytest.FixtureRequest, data201__assign: str) fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 123 @@ -213,7 +205,7 @@ def test_202__option(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -228,9 +220,7 @@ def test_202__option(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 234 @@ -240,7 +230,7 @@ def test_203__option__without_assign(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -255,9 +245,7 @@ def test_203__option__without_assign(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 234 @@ -284,9 +272,9 @@ def test_203__option__without_assign(self, request: pytest.FixtureRequest): @pytest.fixture(params=sm_data204, ids=[x[0] for x in sm_data204]) def data204_tail(self, request: pytest.FixtureRequest) -> str: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 2 - assert type(request.param[1]) == str # noqa: E721 + assert type(request.param[1]) is str return request.param[1] # -------------------------------------------------------------------- @@ -294,10 +282,10 @@ def test_204__option_without_value( self, request: pytest.FixtureRequest, data204_tail: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(data204_tail) == str # noqa: E721 + assert type(data204_tail) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -315,7 +303,7 @@ def test_211__option_with_comment(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -330,16 +318,12 @@ def test_211__option_with_comment(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 2 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 123 - assert ( # noqa: E721 - type(fileLineData0.m_Items[1].m_Element) == PgCfgModel__CommentData - ) + assert type(fileLineData0.m_Items[1].m_Element) is PgCfgModel__CommentData assert fileLineData0.m_Items[1].m_Element.m_Offset == 9 assert fileLineData0.m_Items[1].m_Element.m_Text == "comment" @@ -348,7 +332,7 @@ def test_212__option_with_comment_immediate(self, request: pytest.FixtureRequest assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -363,16 +347,12 @@ def test_212__option_with_comment_immediate(self, request: pytest.FixtureRequest fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 2 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 123 - assert ( # noqa: E721 - type(fileLineData0.m_Items[1].m_Element) == PgCfgModel__CommentData - ) + assert type(fileLineData0.m_Items[1].m_Element) is PgCfgModel__CommentData assert fileLineData0.m_Items[1].m_Element.m_Offset == 8 assert fileLineData0.m_Items[1].m_Element.m_Text == "comment " @@ -381,7 +361,7 @@ def test_301__optionQ(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -396,9 +376,7 @@ def test_301__optionQ(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "port" assert fileLineData0.m_Items[0].m_Element.m_Value == 123 @@ -408,10 +386,10 @@ def test_302__optionQ__empty( self, request: pytest.FixtureRequest, data201__assign: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(data201__assign) == str # noqa: E721 + assert type(data201__assign) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -426,9 +404,7 @@ def test_302__optionQ__empty( fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "listen_addresses" assert fileLineData0.m_Items[0].m_Element.m_Value == "" @@ -438,7 +414,7 @@ def test_303__optionQ__two_quote(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -453,9 +429,7 @@ def test_303__optionQ__two_quote(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "listen_addresses" assert fileLineData0.m_Items[0].m_Element.m_Value == "'" @@ -479,7 +453,7 @@ def test_303__optionQ__two_quote(self, request: pytest.FixtureRequest): @pytest.fixture(params=sm_endData304, ids=[x[0] for x in sm_endData304]) def endData304(self, request: pytest.FixtureRequest) -> typing.Tuple[str, str, str]: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 + assert type(request.param) is tuple assert len(request.param) == 3 return request.param @@ -488,10 +462,10 @@ def test_304__optionQ__escape( self, request: pytest.FixtureRequest, endData304: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(endData304) == tuple # noqa: E721 + assert type(endData304) is tuple rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -506,9 +480,7 @@ def test_304__optionQ__escape( fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__OptionData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__OptionData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == "listen_addresses" assert fileLineData0.m_Items[0].m_Element.m_Value == endData304[2] @@ -527,8 +499,8 @@ def test_304__optionQ__escape( @pytest.fixture(params=sm_data3E01, ids=[x[0] for x in sm_data3E01]) def endData3E01(self, request: pytest.FixtureRequest) -> str: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 - assert type(request.param[1]) == str # noqa: E721 + assert type(request.param) is tuple + assert type(request.param[1]) is str return request.param[1] # -------------------------------------------------------------------- @@ -536,10 +508,10 @@ def test_3E01__optionQ__no_end_quote( self, request: pytest.FixtureRequest, endData3E01: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(endData3E01) == str # noqa: E721 + assert type(endData3E01) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -565,8 +537,8 @@ def test_3E01__optionQ__no_end_quote( @pytest.fixture(params=sm_data3E02, ids=[x[0] for x in sm_data3E02]) def endData3E02(self, request: pytest.FixtureRequest) -> str: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == tuple # noqa: E721 - assert type(request.param[1]) == str # noqa: E721 + assert type(request.param) is tuple + assert type(request.param[1]) is str return request.param[1] # -------------------------------------------------------------------- @@ -574,10 +546,10 @@ def test_3E02__optionQ__incompleted_escape( self, request: pytest.FixtureRequest, endData3E02: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(endData3E02) == str # noqa: E721 + assert type(endData3E02) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -598,7 +570,7 @@ def test_3E03__optionQ__unk_escaped_symbol(self, request: pytest.FixtureRequest) assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -619,7 +591,7 @@ def test_401__include(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -634,9 +606,7 @@ def test_401__include(self, request: pytest.FixtureRequest): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 - type(fileLineData0.m_Items[0].m_Element) == PgCfgModel__IncludeData - ) + assert type(fileLineData0.m_Items[0].m_Element) is PgCfgModel__IncludeData assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Path == "a.conf" @@ -648,7 +618,7 @@ def test_4E01__empty_path(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -677,10 +647,10 @@ def test_4E02__incompleted_path( self, request: pytest.FixtureRequest, data4E02: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(data4E02) == str # noqa: E721 + assert type(data4E02) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -699,7 +669,7 @@ def test_4E03__unknown_escape_symbol(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -729,10 +699,10 @@ def test_4E04__incompleted_escape( self, request: pytest.FixtureRequest, data4E04: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(data4E04) == str # noqa: E721 + assert type(data4E04) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -772,10 +742,10 @@ def test_4E05__include_without_path( self, request: pytest.FixtureRequest, data4E05: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(data4E05) == str # noqa: E721 + assert type(data4E05) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddComment/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddComment/test_set001__common.py index 8c34098..ab00127 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddComment/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddComment/test_set001__common.py @@ -33,7 +33,7 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -43,38 +43,36 @@ def test_001(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert file.get_Path() == os.path.join(rootTmpDir, "postgresql.auto.conf") fileLines = file.get_Lines() assert fileLines is not None - assert type(fileLines) == PgCfg_FileLines_Base # noqa: E721 + assert type(fileLines) is PgCfg_FileLines_Base assert isinstance(fileLines, PgCfg_FileLines) assert len(fileLines) == 1 comment2 = file.AddComment("HELLO!") assert comment2 is not None - assert type(comment2) == PgCfg_Comment_Base # noqa: E721 + assert type(comment2) is PgCfg_Comment_Base assert isinstance(comment2, PgCfg_Comment) assert len(fileLines) == 2 fileLines_v: list[PgCfg_FileLine_Base] = list(fileLines) assert len(fileLines_v) == 2 - assert type(fileLines_v[-1]) == PgCfg_FileLine_Base # noqa: E721 - assert ( # noqa: E721 - type(fileLines_v[-1].m_FileLineData) == PgCfgModel__FileLineData - ) - assert type(fileLines_v[-1].m_FileLineData.m_Items) == list # noqa: E721 + assert type(fileLines_v[-1]) is PgCfg_FileLine_Base + assert type(fileLines_v[-1].m_FileLineData) is PgCfgModel__FileLineData + assert type(fileLines_v[-1].m_FileLineData.m_Items) is list assert len(fileLines_v[-1].m_FileLineData.m_Items) == 1 - assert ( # noqa: E721 + assert ( type(fileLines_v[-1].m_FileLineData.m_Items[0]) - == PgCfgModel__FileLineData.tagItem + is PgCfgModel__FileLineData.tagItem ) - assert ( # noqa: E721 + assert ( type(fileLines_v[-1].m_FileLineData.m_Items[0].m_Element) - == PgCfgModel__CommentData + is PgCfgModel__CommentData ) assert fileLines_v[-1].m_FileLineData.m_Items[0].m_Element.m_Offset is None assert fileLines_v[-1].m_FileLineData.m_Items[0].m_Element.m_Text == "HELLO!" @@ -100,7 +98,7 @@ def test_002(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -110,21 +108,21 @@ def test_002(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) assert len(file) == 1 comment1 = file.AddComment("1") assert comment1 is not None - assert type(comment1) == PgCfg_Comment_Base # noqa: E721 + assert type(comment1) is PgCfg_Comment_Base assert isinstance(comment1, PgCfg_Comment) assert comment1.get_Text() == "1" assert len(file) == 2 comment2 = file.AddComment("") assert comment2 is not None - assert type(comment2) == PgCfg_Comment_Base # noqa: E721 + assert type(comment2) is PgCfg_Comment_Base assert isinstance(comment2, PgCfg_Comment) assert comment2.get_Text() == "" assert len(file) == 3 diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddEmptyLine/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddEmptyLine/test_set001__common.py index ccdd6d7..994392f 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddEmptyLine/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddEmptyLine/test_set001__common.py @@ -26,7 +26,7 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -36,20 +36,20 @@ def test_001(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert file.get_Path() == os.path.join(rootTmpDir, "postgresql.auto.conf") fileLines = file.get_Lines() assert fileLines is not None - assert type(fileLines) == PgCfg_FileLines_Base # noqa: E721 + assert type(fileLines) is PgCfg_FileLines_Base assert isinstance(fileLines, PgCfg_FileLines) assert len(fileLines) == 1 fileLine2 = file.AddEmptyLine() assert fileLine2 is not None - assert type(fileLine2) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine2) is PgCfg_FileLine_Base assert isinstance(fileLine2, PgCfg_FileLine) assert len(fileLines) == 2 diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py index 8a27635..e60de43 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py @@ -27,13 +27,13 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file1 = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base C_BIHA_CONF_FILE_NAME = "postgresql.biha.conf" @@ -114,13 +114,13 @@ def test_002__include_twice(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file1 = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base C_BIHA_CONF_FILE_NAME = "postgresql.biha.conf" @@ -151,13 +151,13 @@ def test_003__empty_file_path(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file1 = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base with pytest.raises(Exception, match=re.escape("File path is empty.")): file1.AddInclude("") diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddOption/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddOption/test_set001__common.py index ab4d2fd..37e65c9 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddOption/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddOption/test_set001__common.py @@ -27,23 +27,23 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert file.get_Path() == os.path.join(rootTmpDir, cfg.C_POSTGRESQL_CONF) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData C_OPT_NAME = "port" option = file.AddOption(C_OPT_NAME, 123) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert option is not None assert option.get_Configuration() is cfg @@ -53,7 +53,7 @@ def test_001(self, request: pytest.FixtureRequest): assert option.get_Name() == C_OPT_NAME assert option.get_Value() == 123 assert option.m_OptionData is not None - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert C_OPT_NAME in file.m_FileData.m_OptionsByName.keys() assert file.m_FileData.m_OptionsByName[C_OPT_NAME] is option.m_OptionData @@ -68,7 +68,7 @@ def test_002__already_in_this(self, request: pytest.FixtureRequest): C_OPT_NAME = "port" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -101,7 +101,7 @@ def test_003__already_in_another(self, request: pytest.FixtureRequest): C_OPT_NAME = "proxima.port" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -138,7 +138,7 @@ def test_004__bad_value_type(self, request: pytest.FixtureRequest): C_OPT_NAME = "proxima.port" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -161,7 +161,7 @@ def test_004__cant_convert_value(self, request: pytest.FixtureRequest): C_OPT_NAME = "proxima.port" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -184,7 +184,7 @@ def test_005__None_value(self, request: pytest.FixtureRequest): C_OPT_NAME = "proxima.port" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -201,7 +201,7 @@ def test_006__None_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -218,7 +218,7 @@ def test_007__empty_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/GetOptionValue/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/GetOptionValue/test_set001__common.py index a4c5b01..38c4a0a 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/GetOptionValue/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/GetOptionValue/test_set001__common.py @@ -21,10 +21,10 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001__no_opt(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -36,10 +36,10 @@ def test_001__no_opt(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_002(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -63,7 +63,7 @@ def test_003__opt_with_list__get_None(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -80,7 +80,7 @@ def test_004__opt_with_list__with_data(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -92,7 +92,7 @@ def test_004__opt_with_list__with_data(self, request: pytest.FixtureRequest): logging.info("----------- nPass: {0}".format(nPass)) v = file.GetOptionValue(C_OPT_NAME) - assert type(v) == list # noqa: E721 + assert type(v) is list assert v == ["xxx"] v.append("yyy") diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValue/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValue/test_set001__common.py index a0df523..6bc8745 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValue/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValue/test_set001__common.py @@ -38,21 +38,21 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) assert file.get_Path() == os.path.join(rootTmpDir, cfg.C_POSTGRESQL_CONF) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert len(file.get_Lines()) == 0 assert len(list(file.get_Lines())) == 0 @@ -60,13 +60,13 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): set_r1 = file.SetOptionValue(optName, 123) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert set_r1 is not None - assert type(set_r1) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(set_r1.m_EventID) == PgCfg_SetOptionEventID # noqa: E721 - assert type(set_r1.m_OptData) == PgCfgModel__OptionData # noqa: E721 - assert type(set_r1.m_Cfg) == PgCfg_Std # noqa: E721 + assert type(set_r1) is PgCfg_SetOptionResult_Base + assert type(set_r1.m_EventID) is PgCfg_SetOptionEventID + assert type(set_r1.m_OptData) is PgCfgModel__OptionData + assert type(set_r1.m_Cfg) is PgCfg_Std assert isinstance(set_r1.m_Cfg, PgCfg_Base) assert isinstance(set_r1.m_Cfg, PgCfg) assert set_r1.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED @@ -75,23 +75,21 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): assert set_r1.m_OptData.m_Value == 123 assert set_r1.m_OptData.get_Parent().get_Parent() is file.m_FileData - assert type(file.m_FileData.m_Lines) == list # noqa: E721 + assert type(file.m_FileData.m_Lines) is list assert len(file.m_FileData.m_Lines) == 1 - assert ( # noqa: E721 - type(file.m_FileData.m_Lines[0]) == PgCfgModel__FileLineData - ) - assert type(file.m_FileData.m_Lines[0].m_Items) == list # noqa: E721 + assert type(file.m_FileData.m_Lines[0]) is PgCfgModel__FileLineData + assert type(file.m_FileData.m_Lines[0].m_Items) is list assert len(file.m_FileData.m_Lines[0].m_Items) == 1 assert file.m_FileData.m_Lines[0].m_Items[0].m_Element is not None - assert ( # noqa: E721 + assert ( type(file.m_FileData.m_Lines[0].m_Items[0].m_Element) - == PgCfgModel__OptionData + is PgCfgModel__OptionData ) assert file.m_FileData.m_Lines[0].m_Items[0].m_Element is set_r1.m_OptData option = set_r1.Option assert option is not None - assert type(option) == PgCfg_Option_Base # noqa: E721 + assert type(option) is PgCfg_Option_Base assert option.get_Configuration() is cfg assert set_r1.Option is option # check cache @@ -103,17 +101,17 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): optionFileLine = option.get_Parent() assert optionFileLine is not None - assert type(optionFileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(optionFileLine) is PgCfg_FileLine_Base assert optionFileLine.m_FileLineData.m_Items[0].m_Element is set_r1.m_OptData optionFile = optionFileLine.get_Parent() - assert type(optionFile) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(optionFile) is PgCfg_TopLevelFile_Base assert isinstance(optionFile, PgCfg_File_Base) assert isinstance(optionFile, PgCfg_File) assert optionFile.m_FileData == optionFile.m_FileData assert option.m_OptionData is not None - assert type(option.m_OptionData) == PgCfgModel__OptionData # noqa: E721 + assert type(option.m_OptionData) is PgCfgModel__OptionData assert optName in optionFile.m_FileData.m_OptionsByName.keys() assert optionFile.m_FileData.m_OptionsByName[optName] is option.m_OptionData @@ -124,7 +122,7 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): assert cfg.GetOptionValue(optName) == 123 set_r2 = cfg.SetOptionValue(optName, 321) - assert type(set_r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(set_r2) is PgCfg_SetOptionResult_Base assert set_r2.m_OptData is option.m_OptionData assert set_r2.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_UPDATED @@ -139,10 +137,10 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_002__set_None(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -154,11 +152,11 @@ def test_002__set_None(self, request: pytest.FixtureRequest, optName: str): set_r2 = file.SetOptionValue(optName, None) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert set_r2 is not None - assert type(set_r2) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(set_r2.m_EventID) == PgCfg_SetOptionEventID # noqa: E721 + assert type(set_r2) is PgCfg_SetOptionResult_Base + assert type(set_r2.m_EventID) is PgCfg_SetOptionEventID assert set_r2.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_DELETED assert set_r2.m_Cfg is None assert set_r2.m_OptData is None @@ -168,11 +166,11 @@ def test_002__set_None(self, request: pytest.FixtureRequest, optName: str): set_r3 = file.SetOptionValue(optName, None) assert file.m_FileData is not None - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert set_r3 is not None - assert type(set_r3) == PgCfg_SetOptionResult_Base # noqa: E721 - assert type(set_r3.m_EventID) == PgCfg_SetOptionEventID # noqa: E721 + assert type(set_r3) is PgCfg_SetOptionResult_Base + assert type(set_r3.m_EventID) is PgCfg_SetOptionEventID assert set_r3.m_EventID == PgCfg_SetOptionEventID.NONE assert set_r3.m_Cfg is None assert set_r3.m_OptData is None @@ -183,10 +181,10 @@ def test_002__set_None(self, request: pytest.FixtureRequest, optName: str): @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_003__already_exist(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -194,7 +192,7 @@ def test_003__already_exist(self, request: pytest.FixtureRequest, optName: str): file2 = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_AUTO_CONF) option1 = file1.SetOptionValue(optName, 123).Option - assert type(option1) == PgCfg_Option_Base # noqa: E721 + assert type(option1) is PgCfg_Option_Base assert option1.get_Name() == optName assert option1.get_Value() == 123 @@ -224,10 +222,10 @@ def test_004__set_value_with_bad_type( self, request: pytest.FixtureRequest, optName: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -256,10 +254,10 @@ def test_005__cant_convert_value( self, request: pytest.FixtureRequest, optName: str ): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValueItem/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValueItem/test_set001__common.py index ecc43b9..f2d1a4c 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValueItem/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/SetOptionValueItem/test_set001__common.py @@ -27,7 +27,7 @@ def test_001__set_None(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -44,7 +44,7 @@ def test_002__set_value_item_with_bad_type(self, request: pytest.FixtureRequest) C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -66,7 +66,7 @@ def test_003(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -78,7 +78,7 @@ def test_003(self, request: pytest.FixtureRequest): r1 = file.SetOptionValueItem(C_OPT_NAME, "biha") assert r1 is not None - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base if nPass == 0: assert r1.m_EventID == PgCfg_SetOptionEventID.OPTION_WAS_ADDED @@ -89,13 +89,13 @@ def test_003(self, request: pytest.FixtureRequest): ) assert r1.m_OptData is not None - assert type(r1.m_OptData) == PgCfgModel__OptionData # noqa: E721 - assert type(r1.m_OptData.m_Name) == str # noqa: E721 + assert type(r1.m_OptData) is PgCfgModel__OptionData + assert type(r1.m_OptData.m_Name) is str assert r1.m_OptData.m_Name == C_OPT_NAME assert r1.m_OptData.m_Value is not None - assert type(r1.m_OptData.m_Value) == list # noqa: E721 + assert type(r1.m_OptData.m_Value) is list assert len(r1.m_OptData.m_Value) == 1 - assert type(r1.m_OptData.m_Value[0]) == str # noqa: E721 + assert type(r1.m_OptData.m_Value[0]) is str assert r1.m_OptData.m_Value[0] == "biha" assert r1.m_OptData.m_Value == ["biha"] @@ -122,7 +122,7 @@ def test_004__already_defined_in_another_file(self, request: pytest.FixtureReque C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -153,7 +153,7 @@ def test_005__opt_is_defined_in_another_file(self, request: pytest.FixtureReques C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -184,7 +184,7 @@ def test_006__two_items(self, request: pytest.FixtureRequest): C_OPT_NAME = "shared_preload_libraries" rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -193,12 +193,12 @@ def test_006__two_items(self, request: pytest.FixtureRequest): r1 = file.SetOptionValueItem(C_OPT_NAME, "biha") assert r1 is not None - assert type(r1) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r1) is PgCfg_SetOptionResult_Base assert r1.Option.get_Value() == ["biha"] r2 = file.SetOptionValueItem(C_OPT_NAME, "proxima") assert r2 is not None - assert type(r2) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(r2) is PgCfg_SetOptionResult_Base assert r2.EventID == PgCfg_SetOptionEventID.VALUE_ITEM_WAS_ADDED assert r2.Option.get_Value() == ["biha", "proxima"] diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/get_Lines/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/get_Lines/test_set001__common.py index 3da6795..a357d71 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/get_Lines/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/get_Lines/test_set001__common.py @@ -31,7 +31,7 @@ def test_001__Lines(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) @@ -41,13 +41,13 @@ def test_001__Lines(self, request: pytest.FixtureRequest): file = cfg.get_AllFiles().__iter__().__next__() assert file is not None - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert file.get_Path() == os.path.join(rootTmpDir, "postgresql.auto.conf") fileLines = file.get_Lines() assert fileLines is not None - assert type(fileLines) == PgCfg_FileLines_Base # noqa: E721 + assert type(fileLines) is PgCfg_FileLines_Base assert isinstance(fileLines, PgCfg_FileLines) assert len(fileLines) == 1 @@ -57,12 +57,12 @@ def test_001__Lines(self, request: pytest.FixtureRequest): fileLines_it = fileLines.__iter__() assert fileLines_it is not None - assert type(fileLines_it) == PgCfg_FileLinesIterator_Base # noqa: E721 + assert type(fileLines_it) is PgCfg_FileLinesIterator_Base assert isinstance(fileLines_it, PgCfg_FileLinesIterator) fileLine = fileLines_it.__next__() assert fileLine is not None - assert type(fileLine) == PgCfg_FileLine_Base # noqa: E721 + assert type(fileLine) is PgCfg_FileLine_Base assert isinstance(fileLine, PgCfg_FileLine) cfg.SetOptionValue("port", None) @@ -77,20 +77,20 @@ def test_001__Lines__iterator(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) set_r = cfg.SetOptionValue("port", 123) - assert type(set_r) == PgCfg_SetOptionResult_Base # noqa: E721 + assert type(set_r) is PgCfg_SetOptionResult_Base assert isinstance(set_r, PgCfg_SetOptionResult) file = set_r.Option.get_Parent().get_Parent() - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base it1 = file.get_Lines().__iter__() - assert type(it1) == PgCfg_FileLinesIterator_Base # noqa: E721 + assert type(it1) is PgCfg_FileLinesIterator_Base assert isinstance(it1, PgCfg_FileLinesIterator) it1a = it1.__iter__() diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork/test_set001__work.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork/test_set001__work.py index 2798733..1d27b41 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork/test_set001__work.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/DoWork/test_set001__work.py @@ -39,10 +39,10 @@ def test_000__empty(self, request: pytest.FixtureRequest): cfg = PgCfg_Std(rootTmpDir) file = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_AUTO_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert file.m_FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert file.m_FileData.m_LastModifiedTimestamp is None @@ -74,7 +74,7 @@ def test_000__empty(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) @@ -95,10 +95,10 @@ def test_001(self, request: pytest.FixtureRequest): cfg.SetOptionValue("port", portNumber) file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_AUTO_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData assert file.m_FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert file.m_FileData.m_LastModifiedTimestamp is None @@ -141,7 +141,7 @@ def test_001(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) @@ -225,7 +225,7 @@ def test_003__two_files(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) @@ -243,10 +243,10 @@ def test_004__check_truncate(self, request: pytest.FixtureRequest): cfg.SetOptionValue("listen_addresses", "*") file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_AUTO_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData # --------------- cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -256,7 +256,7 @@ def test_004__check_truncate(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) assert fileContent_n == "port = 123\nlisten_addresses = '*'\n" @@ -264,10 +264,10 @@ def test_004__check_truncate(self, request: pytest.FixtureRequest): cfg.SetOptionValue("port", None) file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_AUTO_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData # --------------- cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -277,7 +277,7 @@ def test_004__check_truncate(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) assert fileContent_n == "listen_addresses = '*'\n" @@ -353,10 +353,10 @@ def test_E02__external_modification(self, request: pytest.FixtureRequest): cfg.SetOptionValue("listen_addresses", "*") file = cfg.get_AllFiles().GetFileByName(cfg.C_POSTGRESQL_AUTO_CONF) - assert type(file) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file) is PgCfg_TopLevelFile_Base assert isinstance(file, PgCfg_File_Base) assert isinstance(file, PgCfg_File) - assert type(file.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(file.m_FileData) is PgCfgModel__FileData # --------------- cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -366,12 +366,12 @@ def test_E02__external_modification(self, request: pytest.FixtureRequest): with open(file.get_Path(), "r") as f: fileContent = f.read() assert fileContent is not None - assert type(fileContent) == str # noqa: E721 + assert type(fileContent) is str fileContent_n = __class__.Helper__norm_content(fileContent) assert fileContent_n == "port = 123\nlisten_addresses = '*'\n" mdate1 = file.m_FileData.m_LastModifiedTimestamp - assert type(mdate1) == datetime.datetime # noqa: E721 + assert type(mdate1) is datetime.datetime logging.info("Last1 modification date is [{0}]".format(mdate1)) mdate2 = mdate1 + datetime.timedelta(seconds=1) @@ -402,10 +402,10 @@ def test_E02__external_modification(self, request: pytest.FixtureRequest): # -------------------------------------------------------------------- def Helper__norm_content(text: str) -> str: assert text is not None - assert type(text) == str # noqa: E721 + assert type(text) is str r = text.replace("\r\n", "\r") assert r is not None - assert type(r) == str # noqa: E721 + assert type(r) is str return r diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/test_set001__common.py index a5656b5..234f542 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationWriter_Base/test_set001__common.py @@ -25,7 +25,7 @@ class TestSet001__Common: @pytest.mark.parametrize("optName", sm_OPTS001, ids=lambda x: f"{x}") def test_001(self, request: pytest.FixtureRequest, optName: str): assert isinstance(request, pytest.FixtureRequest) - assert type(optName) == str # noqa: E721 + assert type(optName) is str rootTmpDir = TestServices.GetRootTmpDir() cfg = PgCfg_Std(rootTmpDir) @@ -33,7 +33,7 @@ def test_001(self, request: pytest.FixtureRequest, optName: str): assert len(cfg.m_Data.m_Files) == 1 fileData = cfg.m_Data.m_Files[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -52,7 +52,7 @@ def test_002__two_opts(self, request: pytest.FixtureRequest): assert len(cfg.m_Data.m_Files) == 1 fileData = cfg.m_Data.m_Files[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -79,7 +79,7 @@ def test_003__opt1_emptyline_opt2(self, request: pytest.FixtureRequest): assert len(cfg.m_Data.m_Files) == 1 fileData = cfg.m_Data.m_Files[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -106,7 +106,7 @@ def test_004__opt1_comment_opt2(self, request: pytest.FixtureRequest): assert len(cfg.m_Data.m_Files) == 1 fileData = cfg.m_Data.m_Files[0] - assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData) is PgCfgModel__FileData cfgWriterCtx = PgCfg_WriterCtx_Base(cfg) @@ -152,7 +152,7 @@ def test_006__opt_with_list__empty(self, request: pytest.FixtureRequest): r = file.SetOptionValueItem(C_OPT_NAME, "a") - assert type(r.Option.m_OptionData.m_Value) == list # noqa: E721 + assert type(r.Option.m_OptionData.m_Value) is list r.Option.m_OptionData.m_Value.clear() assert len(r.Option.m_OptionData.m_Value) == 0 @@ -231,9 +231,9 @@ class tagData009: result: str def __init__(self, d: str, f: str, r: str): - assert type(d) == str # noqa: E721 - assert type(f) == str # noqa: E721 - assert type(r) == str # noqa: E721 + assert type(d) is str + assert type(f) is str + assert type(r) is str self.descr = d self.fileName = f @@ -263,7 +263,7 @@ def __init__(self, d: str, f: str, r: str): @pytest.fixture(params=sm_Data009, ids=[x.descr for x in sm_Data009]) def data009(self, request: pytest.FixtureRequest) -> tagData009: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == __class__.tagData009 # noqa: E721 + assert type(request.param) is __class__.tagData009 return request.param # -------------------------------------------------------------------- @@ -271,7 +271,7 @@ def test_009__include__mix( self, request: pytest.FixtureRequest, data009: tagData009 ): assert isinstance(request, pytest.FixtureRequest) - assert type(data009) == __class__.tagData009 # noqa: E721 + assert type(data009) is __class__.tagData009 rootTmpDir = TestServices.GetRootTmpDir() cfg = PgCfg_Std(rootTmpDir) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration__AllFiles/GetFileByName/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration__AllFiles/GetFileByName/test_set001__common.py index 678d4c6..63ee038 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration__AllFiles/GetFileByName/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration__AllFiles/GetFileByName/test_set001__common.py @@ -21,13 +21,13 @@ def test_001(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) file1 = cfg.AddTopLevelFile(cfg.C_POSTGRESQL_CONF) assert file1 is not None - assert type(file1) == PgCfg_TopLevelFile_Base # noqa: E721 + assert type(file1) is PgCfg_TopLevelFile_Base assert ( cfg.get_AllFiles() @@ -41,7 +41,7 @@ def test_002__unk_file_name(self, request: pytest.FixtureRequest): assert isinstance(request, pytest.FixtureRequest) rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str cfg = PgCfg_Std(TestServices.GetRootTmpDir()) diff --git a/tests/implementation/v00/configuration_std/Options/STD/generic/bool_option/test_set001__common.py b/tests/implementation/v00/configuration_std/Options/STD/generic/bool_option/test_set001__common.py index 6aa05ad..2fa7ec1 100644 --- a/tests/implementation/v00/configuration_std/Options/STD/generic/bool_option/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Options/STD/generic/bool_option/test_set001__common.py @@ -32,7 +32,7 @@ class TestSet001__Common: @pytest.fixture(params=sm_OptionNames, ids=[x for x in sm_OptionNames]) def optionName(self, request: pytest.fixture) -> str: assert isinstance(request, pytest.FixtureRequest) - assert type(request.param) == str # noqa: E721 + assert type(request.param) is str return request.param # -------------------------------------------------------------------- @@ -97,7 +97,7 @@ def __init__(self, set_value: any, get_value: bool): # -------------------------------------------------------------------- def test_001__ok(self, optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str rootTmpDir = TestServices.GetRootTmpDir() @@ -107,7 +107,7 @@ def test_001__ok(self, optionName: str): cfg = PgCfg_Std(rootTmpDir) data = __class__.sm_Data001[iData] - assert type(data) == __class__.tagData001 # noqa: E721 + assert type(data) is __class__.tagData001 try: logging.info( @@ -133,7 +133,8 @@ def test_001__ok(self, optionName: str): ) ) - assert type(actualValue) == type(data.get_value) # noqa: E721 + assert type(actualValue) is bool + assert type(data.get_value) is bool assert actualValue == data.get_value except Exception as e: logging.error(str(e)) @@ -159,7 +160,7 @@ def __init__(self, set_value: any): # -------------------------------------------------------------------- def test_002__cant_convert_value(self, optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str rootTmpDir = TestServices.GetRootTmpDir() @@ -169,7 +170,7 @@ def test_002__cant_convert_value(self, optionName: str): cfg = PgCfg_Std(rootTmpDir) data = __class__.sm_Data002[iData] - assert type(data) == __class__.tagData002 # noqa: E721 + assert type(data) is __class__.tagData002 logging.info( "Set value [{}]: [{}]".format( @@ -204,7 +205,7 @@ def __init__(self, set_value: any): # -------------------------------------------------------------------- def test_003__bad_option_value_type(self, optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str rootTmpDir = TestServices.GetRootTmpDir() @@ -214,7 +215,7 @@ def test_003__bad_option_value_type(self, optionName: str): cfg = PgCfg_Std(rootTmpDir) data = __class__.sm_Data003[iData] - assert type(data) == __class__.tagData003 # noqa: E721 + assert type(data) is __class__.tagData003 logging.info( "Set value [{}]: [{}]".format( @@ -240,8 +241,8 @@ class tagData101_Assign: text: str def __init__(self, sign: str, text: str): - assert type(sign) == str # noqa: E721 - assert type(text) == str # noqa: E721 + assert type(sign) is str + assert type(text) is str self.sign = sign self.text = text @@ -265,9 +266,9 @@ class tagData101_Quote: quote2: str def __init__(self, sign: str, quote1: str, quote2: str): - assert type(sign) == str # noqa: E721 - assert type(quote1) == str # noqa: E721 - assert type(quote2) == str # noqa: E721 + assert type(sign) is str + assert type(quote1) is str + assert type(quote2) is str self.sign = sign self.quote1 = quote1 self.quote2 = quote2 @@ -337,10 +338,10 @@ def __init__(self, source: any, result: bool): # -------------------------------------------------------------------- def test_101__parse_file_line(self, optionName: str): - assert type(optionName) == str # noqa: E721 + assert type(optionName) is str rootTmpDir = TestServices.GetRootTmpDir() - assert type(rootTmpDir) == str # noqa: E721 + assert type(rootTmpDir) is str for iAssign in range(len(__class__.sm_Data101_assigns)): for iQuote in range(len(__class__.sm_Data101_quotes)): @@ -375,9 +376,9 @@ def test_101__parse_file_line(self, optionName: str): fileLineData0 = file1.m_FileData.m_Lines[0] assert len(fileLineData0.m_Items) == 1 - assert ( # noqa: E721 + assert ( type(fileLineData0.m_Items[0].m_Element) - == PgCfgModel__OptionData # noqa: E721 + is PgCfgModel__OptionData ) assert fileLineData0.m_Items[0].m_Element.m_Offset == 0 assert fileLineData0.m_Items[0].m_Element.m_Name == optionName