diff --git a/src/abstract/v00/configuration.py b/src/abstract/v00/configuration.py index 284864b..a46bde4 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 + assert type(withLineIfLast) == bool # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "Delete") @@ -162,7 +162,7 @@ def get_File(self) -> PostgresConfigurationFile: # -------------------------------------------------------------------- def Delete(self, withLine: bool): - assert type(withLine) == bool + assert type(withLine) == bool # noqa: E721 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 - assert (offset is None) or (type(offset) == int) + assert type(text) == str # noqa: E721 + assert (offset is None) or (type(offset) == int) # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "AddComment") # -------------------------------------------------------------------- def AddOption( self, name: str, value: any, offset: typing.Optional[int] ) -> PostgresConfigurationOption: - assert type(name) == str + assert type(name) == str # noqa: E721 assert name != "" assert value is not None - assert (offset is None) or (type(offset) == int) + assert (offset is None) or (type(offset) == int) # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "AddOption") # -------------------------------------------------------------------- def AddInclude( self, path: str, offset: typing.Optional[int] ) -> PostgresConfigurationInclude: - assert type(path) == str + assert type(path) == str # noqa: E721 assert path != "" - assert (offset is None) or (type(offset) == int) + assert (offset is None) or (type(offset) == int) # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "AddInclude") # -------------------------------------------------------------------- @@ -271,19 +271,19 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine: # -------------------------------------------------------------------- def AddComment(self, text: str) -> PostgresConfigurationComment: - assert type(text) == str + assert type(text) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "AddComment") # -------------------------------------------------------------------- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption: - assert type(name) == str + assert type(name) == str # noqa: E721 assert name != "" assert value is not None RaiseError.MethodIsNotImplemented(__class__, "AddOption") # -------------------------------------------------------------------- def AddInclude(self, path: str) -> PostgresConfigurationInclude: - assert type(path) == str + assert type(path) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") # -------------------------------------------------------------------- def SetOptionValueItem( self, name: str, value_item: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str + assert type(name) == str # noqa: E721 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 + assert type(path) == str # noqa: E721 assert path != "" RaiseError.MethodIsNotImplemented(__class__, "AddTopLevelFile") # -------------------------------------------------------------------- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption: - assert type(name) == str + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") # -------------------------------------------------------------------- def SetOptionValueItem( self, name: str, value_item: any ) -> PostgresConfigurationSetOptionValueResult: - assert type(name) == str + assert type(name) == str # noqa: E721 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 5e0c63f..06e3c55 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 + assert type(objectType) == type # noqa: E721 errMsg = "[BUG CHECK] Unknown object data type [{0}].".format(objectType) raise Exception(errMsg) # -------------------------------------------------------------------- def MultipleDefOfOptionIsFound(optName: str, count: int): - assert type(optName) == str - assert type(count) == int + assert type(optName) == str # noqa: E721 + assert type(count) == int # noqa: E721 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 - assert type(optDataType) == type + assert type(optName) == str # noqa: E721 + assert type(optDataType) == type # noqa: E721 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 - assert type(count) == int + assert type(fileName) == str # noqa: E721 + assert type(count) == int # noqa: E721 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 - assert type(fileDataType) == type + assert type(fileName) == str # noqa: E721 + assert type(fileDataType) == type # noqa: E721 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 + assert type(filePath) == str # noqa: E721 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 - assert type(filePath) == str + assert type(fileKey) == str # noqa: E721 + assert type(filePath) == str # noqa: E721 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 + assert type(optName) == str # noqa: E721 errMsg = "[BUG CHECK] Option [{0}] is not found in index.".format(optName) raise Exception(errMsg) # -------------------------------------------------------------------- def OptionIsNotFoundInFileLine(optName: str): - assert type(optName) == str + assert type(optName) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 + assert type(name) == str # noqa: E721 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 - assert type(bugcheckPoint) == str - assert explain is None or type(explain) == str + assert type(bugcheckSrc) == str # noqa: E721 + assert type(bugcheckPoint) == str # noqa: E721 + assert explain is None or type(explain) == str # noqa: E721 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 + assert type(optionName) == str # noqa: E721 assert optionName != "" - assert type(typeOfOptionValue) == type + assert type(typeOfOptionValue) == type # noqa: E721 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 8165d8e..dab2366 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 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert value is not None optionData.m_Value = value # -------------------------------------------------------------------- def Option__add_ValueItem(optionData: PgCfgModel__OptionData, valueItem: any): - assert type(optionData) == PgCfgModel__OptionData - assert type(optionData.m_Value) == list + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData.m_Value) == list # noqa: E721 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 - assert type(optionData) == PgCfgModel__OptionData - assert type(withLine) == bool + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(withLine) == bool # noqa: E721 fileLineData = optionData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 __class__.Helper__DeleteOption(cfgData, optionData) @@ -70,13 +70,13 @@ def Include__delete( includeData: PgCfgModel__IncludeData, withLine: bool, ): - assert type(cfgData) == PgCfgModel__ConfigurationData - assert type(includeData) == PgCfgModel__IncludeData - assert type(withLine) == bool + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 + assert type(withLine) == bool # noqa: E721 fileLineData = includeData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 __class__.Helper__DeleteInclude(includeData) @@ -93,9 +93,9 @@ def Comment__delete( commentData: PgCfgModel__CommentData, withLineIfLast: bool, ): - assert type(cfgData) == PgCfgModel__ConfigurationData - assert type(commentData) == PgCfgModel__CommentData - assert type(withLineIfLast) == bool + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 + assert type(withLineIfLast) == bool # noqa: E721 commentData.IsAlive() @@ -103,7 +103,7 @@ def Comment__delete( fileLineData = commentData.m_Parent assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 __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 - assert (offset is None) or (type(offset) == int) - assert type(text) == str - assert type(fileLineData.m_Items) == list + 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 fileLineData.IsAlive() @@ -137,8 +137,8 @@ def FileLine__add_Comment( def Helper__CheckThatWeCanAddCommentToFileLine( fileLineData: PgCfgModel__FileLineData, ): - assert type(fileLineData) == PgCfgModel__FileLineData - assert type(fileLineData.m_Items) == list + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData.m_Items) == list # noqa: E721 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 + assert type(lastItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 assert lastItem.m_Element is not None assert isinstance(lastItem.m_Element, PgCfgModel__FileLineElementData) @@ -172,11 +172,11 @@ def FileLine__add_Include( fileData: PgCfgModel__FileData, offset: typing.Optional[int], ) -> PgCfgModel__IncludeData: - assert type(fileLineData) == PgCfgModel__FileLineData - assert type(filePath) == str - assert type(fileData) == PgCfgModel__FileData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(filePath) == str # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert filePath != "" - assert offset is None or type(offset) == int + assert offset is None or type(offset) == int # noqa: E721 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 - assert type(fileLineData) == PgCfgModel__FileLineData - assert type(optName) == str + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(optName) == str # noqa: E721 assert optValue is not None assert optName != "" - assert type(fileLineData.m_Items) == list - assert optOffset is None or type(optOffset) == int + assert type(fileLineData.m_Items) == list # noqa: E721 + assert optOffset is None or type(optOffset) == int # noqa: E721 __class__.Helper__CheckThatWeCanAddWorkDataToFileLine(fileLineData) fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 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 + assert type(fileLineData.m_Items) == list # noqa: E721 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 - assert type(fileLineData.m_Items) == list + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData.m_Items) == list # noqa: E721 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 + assert type(lastItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 assert lastItem.m_Element is not None assert isinstance(lastItem.m_Element, PgCfgModel__FileLineElementData) @@ -281,8 +281,8 @@ def FileLine__delete( ): assert cfgData is not None assert fileLineData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list + assert type(fileLineData.m_Items) == list # noqa: E721 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 - assert type(fileData) == PgCfgModel__FileData - assert type(optName) == str + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(optName) == str # noqa: E721 assert optValue is not None newLineData = DataControllerUtils.File__add_Line(fileData) # raise - assert type(newLineData) == PgCfgModel__FileLineData + assert type(newLineData) == PgCfgModel__FileLineData # noqa: E721 try: optionData = __class__.FileLine__add_Option( cfgData, newLineData, optName, optValue, None ) # raise - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.m_Name == optName except: DataControllerUtils.FileLine__delete(cfgData, newLineData) raise assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() return optionData # -------------------------------------------------------------------- def File__add_Line(fileData: PgCfgModel__FileData) -> PgCfgModel__FileLineData: - assert type(fileData) == PgCfgModel__FileData - assert type(fileData.m_Lines) == list + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData.m_Lines) == list # noqa: E721 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 - assert type(cfgData.m_Files) == list - assert type(cfgData.m_AllFilesByName) == dict + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData.m_Files) == list # noqa: E721 + assert type(cfgData.m_AllFilesByName) == dict # noqa: E721 assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(file_name) == str + assert type(file_name) == str # noqa: E721 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 + assert type(newFilePath) == str # noqa: E721 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 - assert type(cfgData.m_Files) == list - assert type(cfgData.m_AllFilesByName) == dict - assert type(path) == str + 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 isinstance(cfgData.OsOps, ConfigurationOsOps) assert path != "" newFilePath = Helpers.NormalizeFilePath(cfgData.OsOps, cfgData.m_DataDir, path) - assert type(newFilePath) == str + assert type(newFilePath) == str # noqa: E721 assert newFilePath != "" # TODO: use index for fileData in cfgData.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 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 - assert type(cfgData.m_Files) == list - assert type(cfgData.m_AllFilesByName) == dict + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(cfgData.m_Files) == list # noqa: E721 + assert type(cfgData.m_AllFilesByName) == dict # noqa: E721 assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(baseFolder) == str - assert type(path) == str + assert type(baseFolder) == str # noqa: E721 + assert type(path) == str # noqa: E721 assert path != "" newFilePath = Helpers.NormalizeFilePath(cfgData.OsOps, baseFolder, path) - assert type(newFilePath) == str + assert type(newFilePath) == str # noqa: E721 assert newFilePath != "" # TODO: use index for fileData in cfgData.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 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 - assert type(fileData.m_Lines) == list - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData.m_Lines) == list # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 + assert type(ptr) == PgCfgModel__FileLineData # noqa: E721 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 - assert type(fileLineData.m_Items) == list + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData.m_Items) == list # noqa: E721 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 + assert type(ptr) == PgCfgModel__FileLineData.tagItem # noqa: E721 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 + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(fileData) == PgCfgModel__FileData - assert type(fileData.m_Path) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData.m_Path) == str # noqa: E721 assert fileData.m_Path != "" assert fileData.IsAlive() fileName = cfgData.OsOps.Path_BaseName(fileData.m_Path) - assert type(fileName) == str + assert type(fileName) == str # noqa: E721 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 + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 assert isinstance(cfgData.OsOps, ConfigurationOsOps) - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.m_Path != "" assert fileData.IsAlive() fileName = cfgData.OsOps.Path_BaseName(fileData.m_Path) - assert type(fileName) == str + assert type(fileName) == str # noqa: E721 assert fileName != "" __class__.Helper__DeleteFileIntoIndex( @@ -538,9 +538,9 @@ def Helper__InsertFileIntoIndex( fileKey: str, fileData: PgCfgModel__FileData, ): - assert type(filesByStrKeyDictionary) == dict - assert type(fileKey) == str - assert type(fileData) == PgCfgModel__FileData + assert type(filesByStrKeyDictionary) == dict # noqa: E721 + assert type(fileKey) == str # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 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 + assert type(indexItemData) == list # noqa: E721 assert len(indexItemData) > 0 indexItemData.append(fileData) # throw - assert type(filesByStrKeyDictionary[fileKey]) == list + assert type(filesByStrKeyDictionary[fileKey]) == list # noqa: E721 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 - assert type(fileKey) == str - assert type(fileData) == PgCfgModel__FileData + assert type(filesByStrKeyDictionary) == dict # noqa: E721 + assert type(fileKey) == str # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileKey != "" assert fileData.IsAlive() @@ -594,13 +594,13 @@ def Helper__DeleteFileIntoIndex( return if typeOfIndexItemData == list: - assert type(indexItemData) == list + assert type(indexItemData) == list # noqa: E721 assert len(indexItemData) > 1 for i in range(len(indexItemData)): ptr = indexItemData[i] assert ptr is not None - assert type(ptr) == PgCfgModel__FileData + assert type(ptr) == PgCfgModel__FileData # noqa: E721 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 + assert type(indexItemData) == list # noqa: E721 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 - assert type(optionData) == PgCfgModel__OptionData + assert type(optionsByNameDictionary) == dict # noqa: E721 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 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: + if typeOfData == PgCfgModel__OptionData: # noqa: E721 assert data is not optionData optionsByNameDictionary[optionData.m_Name] = [data, optionData] return if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 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 - assert type(optionData) == PgCfgModel__OptionData + assert type(optionsByNameDictionary) == dict # noqa: E721 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 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 + assert type(data) == list # noqa: E721 assert len(data) > 1 for i in range(len(data)): ptr = data[i] assert ptr is not None - assert type(ptr) == PgCfgModel__OptionData - assert type(ptr.m_Name) == str + assert type(ptr) == PgCfgModel__OptionData # noqa: E721 + assert type(ptr.m_Name) == str # noqa: E721 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 + assert type(data) == list # noqa: E721 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 - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list + assert type(fileLineData.m_Items) == list # noqa: E721 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 + assert type(fileLineData.m_Items) == list # noqa: E721 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 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list + assert type(fileLineData.m_Items) == list # noqa: E721 for item in fileLineData.m_Items: assert item is not None - assert type(item) == PgCfgModel__FileLineData.tagItem + assert type(item) == PgCfgModel__FileLineData.tagItem # noqa: E721 assert item.m_Element is not None assert isinstance(item.m_Element, PgCfgModel__FileLineElementData) @@ -786,7 +786,7 @@ def Helper__DeleteElement( ): assert cfgData is not None assert objectData is not None - assert type(cfgData) == PgCfgModel__ConfigurationData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 assert isinstance(objectData, PgCfgModel__ObjectData) typeOfObjectData = type(objectData) @@ -804,7 +804,7 @@ def Helper__DeleteElement( # -------------------------------------------------------------------- def Helper__DeleteComment(commentData: PgCfgModel__CommentData): - assert type(commentData) == PgCfgModel__CommentData + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 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 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 - assert type(optionData) == PgCfgModel__OptionData - assert type(optionData.m_Name) == str + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData.m_Name) == str # noqa: E721 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 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.IsAlive() # 1.3 - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 assert optionData.m_Name in fileData.m_OptionsByName.keys() # 1.4 - assert type(cfgData.m_AllOptionsByName) == dict + assert type(cfgData.m_AllOptionsByName) == dict # noqa: E721 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 + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 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 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 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 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 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 + assert type(fileLineData.m_Items) == list # noqa: E721 assert len(fileLineData.m_Items) == 0 # delete from file diff --git a/src/core/data_verificator.py b/src/core/data_verificator.py index 91eb1d0..4100b09 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: + if type(name) != str: # noqa: E721 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 + assert type(text) == str # noqa: E721 - assert type(__class__.sm_InvalidCommentSymbols) == str + assert type(__class__.sm_InvalidCommentSymbols) == str # noqa: E721 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 + assert type(text) == str # noqa: E721 - assert type(__class__.sm_InvalidCommentSymbols) == str + assert type(__class__.sm_InvalidCommentSymbols) == str # noqa: E721 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 + assert type(text) == str # noqa: E721 if text == "": RaiseError.FilePathIsEmpty() diff --git a/src/core/handlers.py b/src/core/handlers.py index 38eb3e4..4dccaf7 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 - or type(targetData) == FileLineData + or type(targetData) == FileData # noqa: E721 + or type(targetData) == FileLineData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 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 - or type(sourceData) == OptionData + or type(sourceData) == FileData # noqa: E721 + or type(sourceData) == OptionData # noqa: E721 ) - assert type(optionName) == str or type(optionName) == OptionData + assert type(optionName) == str or type(optionName) == OptionData # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "DataHandler__GetOptionValue__Simple" ) @@ -60,10 +60,10 @@ def DataHandler__GetOptionValue__UnionList( ) -> any: assert ( sourceData is None - or type(sourceData) == FileData - or type(sourceData) == OptionData + or type(sourceData) == FileData # noqa: E721 + or type(sourceData) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "DataHandler__GetOptionValue__UnionList" ) @@ -76,10 +76,10 @@ def DataHandler__ResetOption( ) -> any: assert ( targetData is None - or type(targetData) == FileData - or type(targetData) == OptionData + or type(targetData) == FileData # noqa: E721 + or type(targetData) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "DataHandler__ResetOption") # -------------------------------------------------------------------- @@ -91,10 +91,12 @@ def DataHandler__AddSimpleOption( optionValue: any, ) -> any: assert ( - target is None or type(target) == FileData or type(target) == FileLineData + target is None + or type(target) == FileData + or type(target) == FileLineData # noqa: E721 E501 ) - assert optionOffset is None or type(optionOffset) == int - assert type(optionName) == str + assert optionOffset is None or type(optionOffset) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 assert optionValue is not None RaiseError.MethodIsNotImplemented(__class__, "DataHandler__AddSimpleOption") @@ -107,10 +109,10 @@ def DataHandler__SetUniqueOptionValueItem( ) -> any: assert ( targetData is None - or type(targetData) == FileData - or type(optionName) == OptionData + or type(targetData) == FileData # noqa: E721 + or type(optionName) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValueItem is not None RaiseError.MethodIsNotImplemented( __class__, "DataHandler__SetUniqueOptionValueItem" @@ -147,10 +149,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( targetData is None - or type(targetData) == FileData - or type(targetData) == OptionData + or type(targetData) == FileData # noqa: E721 + or type(targetData) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 self.DataHandler = dataHandler self.TargetData = targetData @@ -168,7 +170,7 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValue(self, ctx: OptionHandlerCtxToSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToSetValue + assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 assert ctx.OptionName is not None assert ctx.OptionValue is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue") @@ -193,10 +195,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( sourceData is None - or type(sourceData) == FileData - or type(sourceData) == OptionData + or type(sourceData) == FileData # noqa: E721 + or type(sourceData) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 self.DataHandler = dataHandler self.SourceData = sourceData @@ -213,13 +215,13 @@ def __init__(self): # interface ---------------------------------------------------------- def GetOptionValue(self, ctx: OptionHandlerCtxToGetValue) -> any: - assert type(ctx) == OptionHandlerCtxToGetValue + assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData - or type(ctx.SourceData) == OptionData + or type(ctx.SourceData) == FileData # noqa: E721 + or type(ctx.SourceData) == OptionData # noqa: E721 ) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue") @@ -245,9 +247,11 @@ def __init__( ): assert isinstance(dataHandler, ConfigurationDataHandler) assert ( - target is None or type(target) == FileData or type(target) == FileLineData + target is None + or type(target) == FileData + or type(target) == FileLineData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None self.DataHandler = dataHandler @@ -267,7 +271,7 @@ def __init__(self): # interface ---------------------------------------------------------- def AddOption(self, ctx: OptionHandlerCtxToSetValue) -> any: - assert type(ctx) == OptionHandlerCtxToSetValue + assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "AddOption") @@ -292,10 +296,10 @@ def __init__( assert isinstance(dataHandler, ConfigurationDataHandler) assert ( targetData is None - or type(targetData) == FileData - or type(targetData) == OptionData + or type(targetData) == FileData # noqa: E721 + or type(targetData) == OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 self.DataHandler = dataHandler self.TargetData = targetData @@ -313,13 +317,13 @@ def __init__(self): # interface ---------------------------------------------------------- def SetOptionValueItem(self, ctx: OptionHandlerCtxToSetValueItem) -> any: - assert type(ctx) == OptionHandlerCtxToSetValueItem + assert type(ctx) == OptionHandlerCtxToSetValueItem # noqa: E721 assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData - or type(ctx.TargetData) == OptionData + or type(ctx.TargetData) == FileData # noqa: E721 + or type(ctx.TargetData) == OptionData # noqa: E721 ) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValueItem is not None RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem") @@ -341,7 +345,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None self.DataHandler = dataHandler @@ -359,7 +363,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareSetValue + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "PrepareSetValue") @@ -380,7 +384,7 @@ def __init__( optionValueItem: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValueItem is not None self.DataHandler = dataHandler @@ -398,7 +402,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareSetValueItem(self, ctx: OptionHandlerCtxToPrepareSetValueItem) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem + assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "PrepareSetValueItem") @@ -419,7 +423,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None self.DataHandler = dataHandler @@ -437,7 +441,7 @@ def __init__(self): # interface ---------------------------------------------------------- def PrepareGetValue(self, ctx: OptionHandlerCtxToPrepareGetValue) -> str: - assert type(ctx) == OptionHandlerCtxToPrepareGetValue + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "PrepareGetValue") @@ -458,7 +462,7 @@ def __init__( optionValue: any, ): assert isinstance(dataHandler, ConfigurationDataHandler) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None self.DataHandler = dataHandler @@ -476,7 +480,7 @@ def __init__(self): # interface ---------------------------------------------------------- def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: - assert type(ctx) == OptionHandlerCtxToWrite + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "OptionValueToString") diff --git a/src/core/helpers.py b/src/core/helpers.py index b938226..e16fa43 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 + assert type(option) == str or type(option) == OptionData # noqa: E721 typeOption = type(option) - if typeOption == str: + if typeOption == str: # noqa: E721 return option - if typeOption == OptionData: + if typeOption == OptionData: # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 + assert type(indexItem[0]) == OptionData # noqa: E721 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) + assert type(x) == type(value) # noqa: E721 if x == value: return True @@ -65,14 +65,12 @@ def DoesContainerContainsValue__NotNullAndExact( # -------------------------------------------------------------------- def NormalizeFilePath( - cfgOsOps: ConfigurationOsOps, - baseFolder: str, - filePath: str + cfgOsOps: ConfigurationOsOps, baseFolder: str, filePath: str ) -> str: assert cfgOsOps is not None assert isinstance(cfgOsOps, ConfigurationOsOps) - assert type(baseFolder) == str - assert type(filePath) == str + assert type(baseFolder) == str # noqa: E721 + assert type(filePath) == str # noqa: E721 assert filePath != "" newFilePath = None @@ -83,7 +81,7 @@ def NormalizeFilePath( newFilePath = cfgOsOps.Path_Join(baseFolder, filePath) newFilePath = cfgOsOps.Path_NormPath(newFilePath) - assert type(newFilePath) == str + assert type(newFilePath) == str # noqa: E721 assert newFilePath != "" newFilePath = cfgOsOps.Path_AbsPath(newFilePath) diff --git a/src/core/model.py b/src/core/model.py index db83e7b..811b65f 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 - assert offset is None or type(offset) == int + assert type(parent) == FileLineData # noqa: E721 + assert offset is None or type(offset) == int # noqa: E721 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 + assert type(self.m_Parent) == FileLineData # noqa: E721 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 - assert offset is None or type(offset) == int - assert type(text) == str + assert type(parent) == FileLineData # noqa: E721 + assert offset is None or type(offset) == int # noqa: E721 + assert type(text) == str # noqa: E721 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 - assert offset is None or type(offset) == int - assert type(name) == str + assert type(parent) == FileLineData # noqa: E721 + assert offset is None or type(offset) == int # noqa: E721 + assert type(name) == str # noqa: E721 assert value is not None assert name != "" @@ -123,10 +123,10 @@ def __init__( path: str, fileData: FileData, ): - assert type(parent) == FileLineData - assert type(path) == str - assert type(fileData) == FileData - assert offset is None or type(offset) == int + 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 parent.IsAlive() assert fileData.IsAlive() @@ -159,7 +159,7 @@ def __init__(self, element: FileLineElementData): # -------------------------------------------------------------------- def __init__(self, parent: FileData): - assert type(parent) == FileData + assert type(parent) == FileData # noqa: E721 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 + assert type(self.m_Parent) == FileData # noqa: E721 return self.m_Parent # -------------------------------------------------------------------- @@ -212,8 +212,8 @@ class FileData(ObjectData): # -------------------------------------------------------------------- def __init__(self, parent: ConfigurationData, path: str): - assert type(parent) == ConfigurationData - assert type(path) == str + assert type(parent) == ConfigurationData # noqa: E721 + assert type(path) == str # noqa: E721 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 + assert type(self.m_OptionsByName) == dict # noqa: E721 - assert type(self.m_Path) == str + assert type(self.m_Path) == str # noqa: E721 assert self.m_Path != "" # Object interface --------------------------------------------------- def get_Parent(self) -> ConfigurationData: - assert type(self.m_Parent) == ConfigurationData + assert type(self.m_Parent) == ConfigurationData # noqa: E721 return self.m_Parent # -------------------------------------------------------------------- @@ -257,12 +257,14 @@ class ConfigurationData(ObjectData): m_Files: typing.List[FileData] - m_AllOptionsByName: typing.Dict[str, typing.Union[OptionData, typing.List[OptionData]]] + m_AllOptionsByName: typing.Dict[ + str, typing.Union[OptionData, typing.List[OptionData]] + ] m_AllFilesByName: typing.Dict[str, typing.Union[FileData, typing.List[FileData]]] # -------------------------------------------------------------------- def __init__(self, data_dir: str, osOps: ConfigurationOsOps): - assert type(data_dir) == str + assert type(data_dir) == str # noqa: E721 assert isinstance(osOps, ConfigurationOsOps) super().__init__() @@ -274,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 - assert type(self.m_AllOptionsByName) == dict - assert type(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 # 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 78e9866..7cf5e52 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 + assert type(ctx) == OptionHandlerCtxToAddOption # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.Target is None - or type(ctx.Target) == FileData - or type(ctx.Target) == FileLineData + or type(ctx.Target) == FileData # noqa: E721 + or type(ctx.Target) == FileLineData # noqa: E721 ) - assert ctx.OptionOffset is None or type(ctx.OptionOffset) == int - assert type(ctx.OptionName) == str + assert ctx.OptionOffset is None or type(ctx.OptionOffset) == int # noqa: E721 + assert type(ctx.OptionName) == str # noqa: E721 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 9bfea61..6e9587b 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 + assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData - or type(ctx.SourceData) == OptionData + or type(ctx.SourceData) == FileData # noqa: E721 + or type(ctx.SourceData) == OptionData # noqa: E721 ) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 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 44f0741..0d0f446 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 + assert type(ctx) == OptionHandlerCtxToGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.SourceData is None - or type(ctx.SourceData) == FileData - or type(ctx.SourceData) == OptionData + or type(ctx.SourceData) == FileData # noqa: E721 + or type(ctx.SourceData) == OptionData # noqa: E721 ) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 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 ba36acc..bab6601 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 + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == bool + assert type(ctx.OptionValue) == bool # noqa: E721 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 c31674b..fe72d48 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 + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: + if typeOfOptionValue == int: # noqa: E721 pass # OK - elif typeOfOptionValue == str: + elif typeOfOptionValue == str: # noqa: E721 pass # OK - elif typeOfOptionValue == bool: + elif typeOfOptionValue == bool: # noqa: E721 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 0b78a1e..cba6a9d 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 + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == int + assert type(ctx.OptionValue) == int # noqa: E721 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 0f84758..befd497 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 + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None # [2025-04-13] Research - assert type(ctx.OptionValue) == str + assert type(ctx.OptionValue) == str # noqa: E721 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 9be26f8..59897a0 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 + assert type(ctx) == OptionHandlerCtxToPrepareGetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None - assert type(ctx.OptionValue) == list + assert type(ctx.OptionValue) == list # noqa: E721 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 67e75d8..6ee7c23 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None optionValue = ctx.OptionValue optionValueType = type(optionValue) - if optionValueType == bool: + if optionValueType == bool: # noqa: E721 return optionValue - if optionValueType == int: - assert type(optionValue) == int + if optionValueType == int: # noqa: E721 + assert type(optionValue) == int # noqa: E721 if optionValue == 0: return False @@ -62,8 +62,8 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: RaiseError.CantConvertOptionValue(ctx.OptionName, optionValueType, bool) - if optionValueType == str: - assert type(optionValue) == str + if optionValueType == str: # noqa: E721 + assert type(optionValue) == str # noqa: E721 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 6ad5fb3..1b465f9 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: + if typeOfOptionValue == int: # noqa: E721 pass # OK - elif typeOfOptionValue == str: + elif typeOfOptionValue == str: # noqa: E721 pass # OK - elif typeOfOptionValue == bool: + elif typeOfOptionValue == bool: # noqa: E721 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 27cf359..1e03513 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 8bee191..f8c6536 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None typeOfOptionValue = type(ctx.OptionValue) if typeOfOptionValue != str: optionName = ctx.OptionName - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 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 49daae4..734b1ab 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 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 + assert type(result) == list # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 85846bf..492f015 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 + assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValueItem is not None typeOfOptionValue = type(ctx.OptionValueItem) if typeOfOptionValue != str: optionName = ctx.OptionName - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 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 996f782..743a0a2 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 + assert type(ctx) == OptionHandlerCtxToSetValue # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData - or type(ctx.TargetData) == OptionData + or type(ctx.TargetData) == FileData # noqa: E721 + or type(ctx.TargetData) == OptionData # noqa: E721 ) 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 a2f8b0c..9e49cf6 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 + assert type(ctx) == OptionHandlerCtxToSetValueItem # noqa: E721 assert isinstance(ctx.DataHandler, ConfigurationDataHandler) assert ( ctx.TargetData is None - or type(ctx.TargetData) == FileData - or type(ctx.TargetData) == OptionData + or type(ctx.TargetData) == FileData # noqa: E721 + or type(ctx.TargetData) == OptionData # noqa: E721 ) - assert type(ctx.OptionName) == str + assert type(ctx.OptionName) == str # noqa: E721 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 35489f4..6601866 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 - assert type(ctx.OptionName) == str + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 + assert type(ctx.OptionName) == str # noqa: E721 assert ctx.OptionValue is not None typeOfValue = type(ctx.OptionValue) - if typeOfValue == bool: + if typeOfValue == bool: # noqa: E721 typedValue = bool(ctx.OptionValue) else: RaiseError.BadOptionValueItemType(ctx.OptionName, typeOfValue, bool) - assert type(typedValue) == bool + assert type(typedValue) == bool # noqa: E721 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 6f5e3e2..bfed98b 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 + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 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 68ca959..6f1836e 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 + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 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 31d45d8..3ff84c8 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 + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 assert ctx.OptionValue is not None typedValue = str(ctx.OptionValue) result = WriteUtils.Pack_Str(typedValue) - assert type(result) == str + assert type(result) == str # noqa: E721 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 13020b8..aef23e1 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 + assert type(ctx) == OptionHandlerCtxToWrite # noqa: E721 assert ctx.OptionValue is not None - assert type(ctx.OptionValue) == list + assert type(ctx.OptionValue) == list # noqa: E721 result = WriteUtils.Pack_StrList2(ctx.OptionValue) - assert type(result) == str + assert type(result) == str # noqa: E721 result = WriteUtils.Pack_Str(result) - assert type(result) == str + assert type(result) == str # noqa: E721 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 07c7d95..1803858 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 - assert type(methodName) == str + assert type(classType) == type # noqa: E721 + assert type(methodName) == str # noqa: E721 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 - assert type(methodName) == str + assert type(classType) == type # noqa: E721 + assert type(methodName) == str # noqa: E721 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 + assert type(nameType) == type # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 - assert type(optionValueType) == type - assert type(expectedType) == type + assert type(optionName) == str # noqa: E721 + assert type(optionValueType) == type # noqa: E721 + assert type(expectedType) == type # noqa: E721 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 - assert type(sourceType) == type - assert type(targetType) == type + assert type(optionName) == str # noqa: E721 + assert type(sourceType) == type # noqa: E721 + assert type(targetType) == type # noqa: E721 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 - assert type(optionValueItemType) == type - assert type(expectedType) == type + assert type(optionName) == str # noqa: E721 + assert type(optionValueItemType) == type # noqa: E721 + assert type(expectedType) == type # noqa: E721 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 - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 assert filePath != "" assert optionName != "" @@ -148,8 +148,8 @@ def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): - assert type(filePath) == str - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 assert filePath != "" assert optionName != "" @@ -160,8 +160,8 @@ def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInFile(filePath: str, optionName: str): - assert type(filePath) == str - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optName) == str + assert type(filePath) == str # noqa: E721 + assert type(optName) == str # noqa: E721 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 - assert type(optName) == str + assert type(filePath) == str # noqa: E721 + assert type(optName) == str # noqa: E721 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 + assert type(fileName) == str # noqa: E721 errMsg = "Unknown file name [{0}].".format(fileName) raise Exception(errMsg) # -------------------------------------------------------------------- def MultipleDefOfFileIsFound(fileName: str, count: int): - assert type(fileName) == str - assert type(count) == int + assert type(fileName) == str # noqa: E721 + assert type(count) == int # noqa: E721 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 - assert type(ourLastMDate) == datetime.datetime - assert type(curLastMDate) == datetime.datetime + assert type(filePath) == str # noqa: E721 + assert type(ourLastMDate) == datetime.datetime # noqa: E721 + assert type(curLastMDate) == datetime.datetime # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 - assert type(colNum) == int - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(colNum) == int # noqa: E721 + assert type(ch) == str # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 - assert type(colNum) == int - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(colNum) == int # noqa: E721 + assert type(ch) == str # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 + assert type(ch) == str # noqa: E721 assert lineNum >= 0 assert optionName != "" assert ch != "" diff --git a/src/core/read_utils.py b/src/core/read_utils.py index db55c4c..d665c39 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 + assert type(tabSize) == int # noqa: E721 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 - assert type(self.m_LineNum) == int + assert type(lineData) == str # noqa: E721 + assert type(self.m_LineNum) == int # noqa: E721 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 + assert type(self.m_LineNum) == int # noqa: E721 assert self.m_LineNum >= 0 return self.m_LineNum # -------------------------------------------------------------------- def GetColNum(self) -> int: - assert type(self.m_ColNum) == int + assert type(self.m_ColNum) == int # noqa: E721 assert self.m_ColNum >= 0 return self.m_ColNum # -------------------------------------------------------------------- def GetColOffset(self) -> int: - assert type(self.m_ColNum) == int + assert type(self.m_ColNum) == int # noqa: E721 assert self.m_ColNum > 0 return self.m_ColNum - 1 # -------------------------------------------------------------------- def StepBack(self): - assert type(self.m_Next) == int - assert type(self.m_ColNum) == int - assert type(self.m_Data) == 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 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 - assert type(self.m_ColNum) == int - assert type(self.m_Data) == 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 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 + assert type(ch) == str # noqa: E721 assert ch != "" - assert type(self.m_TabSize) == int + assert type(self.m_TabSize) == int # noqa: E721 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 + assert type(ch) == str # noqa: E721 if ch == " ": return True @@ -136,7 +136,7 @@ def IsSpace(ch: str) -> bool: # -------------------------------------------------------------------- def IsEOL(ch: str) -> bool: - assert type(ch) == str + assert type(ch) == str # noqa: E721 if ch == "\n": return True @@ -145,7 +145,7 @@ def IsEOL(ch: str) -> bool: # -------------------------------------------------------------------- def IsValidSeqCh1(ch: str) -> bool: - assert type(ch) == str + assert type(ch) == str # noqa: E721 if ch.isalpha(): return True @@ -157,7 +157,7 @@ def IsValidSeqCh1(ch: str) -> bool: # -------------------------------------------------------------------- def IsValidSeqCh2(ch: str) -> bool: - assert type(ch) == str + assert type(ch) == str # noqa: E721 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 + assert type(source) == str # noqa: E721 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 - assert type(ch) == str + assert type(ctx) == tagCtx # noqa: E721 + assert type(ch) == str # noqa: E721 assert len(ch) == 1 - assert type(isData) == bool + assert type(isData) == bool # noqa: E721 if ctx.curValueItem is None: ctx.curValueItem = ch else: - assert type(ctx.curValueItem) == str + assert type(ctx.curValueItem) == str # noqa: E721 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 + assert type(ctx) == tagCtx # noqa: E721 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 d906724..fca78fb 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 + assert type(strList) == list # noqa: E721 result = "" sep = "" index: typing.Set[str] = set() - assert type(index) == set + assert type(index) == set # noqa: E721 for x in strList: assert x is not None - assert type(x) == str + assert type(x) == str # noqa: E721 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 + assert type(text) == str # noqa: E721 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 + assert type(itemText) == str # noqa: E721 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 + assert type(itemText) == str # noqa: E721 if itemText == "": return True diff --git a/src/implementation/v00/configuration_base.py b/src/implementation/v00/configuration_base.py index d0a002a..ec93b4c 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 - assert type(commentData) == PgCfgModel__CommentData + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 assert commentData.m_Parent is fileLine.m_FileLineData @@ -104,25 +104,29 @@ def get_Parent(self) -> PostgresConfigurationFileLine_Base: # Comment interface -------------------------------------------------- def get_Text(self) -> str: self.Helper__CheckAlive() - assert type(self.m_CommentData) == PgCfgModel__CommentData - assert type(self.m_CommentData.m_Text) == str + assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert type(self.m_CommentData.m_Text) == str # noqa: E721 return self.m_CommentData.m_Text # -------------------------------------------------------------------- def Delete(self, withLineIfLast: bool): - assert type(withLineIfLast) == bool + assert type(withLineIfLast) == bool # noqa: E721 self.Helper__CheckAlive() - assert type(self.m_CommentData) == PgCfgModel__CommentData - assert type(self.m_CommentData.m_Parent) == PgCfgModel__FileLineData - assert type(self.m_CommentData.m_Parent.m_Parent) == PgCfgModel__FileData + assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 + assert ( + type(self.m_CommentData.m_Parent) == PgCfgModel__FileLineData + ) # noqa: E721 + assert ( + type(self.m_CommentData.m_Parent.m_Parent) == PgCfgModel__FileData + ) # noqa: E721 assert ( type(self.m_CommentData.m_Parent.m_Parent.m_Parent) - == PgCfgModel__ConfigurationData + == PgCfgModel__ConfigurationData # noqa: E721 ) cfgData = self.m_CommentData.m_Parent.m_Parent.m_Parent - assert type(cfgData) == PgCfgModel__ConfigurationData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 PgCfgModel__DataControllerUtils.Comment__delete( cfgData, self.m_CommentData, withLineIfLast @@ -131,12 +135,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 + assert type(self.m_CommentData) == PgCfgModel__CommentData # noqa: E721 if not self.m_CommentData.IsAlive(): RaiseError.CommentObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base + assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -154,8 +158,8 @@ def __init__( fileLine: PostgresConfigurationFileLine_Base, optionData: PgCfgModel__OptionData, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(optionData) == PgCfgModel__OptionData + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 super().__init__() @@ -211,7 +215,7 @@ def set_Value(self, value: any) -> PostgresConfigurationSetOptionValueResult_Bas None, # offset ) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base + assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 assert r.m_OptData is None or r.m_OptData is self.m_OptionData assert r.m_Opt is None @@ -240,7 +244,7 @@ def set_ValueItem( value_item, ) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base + assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 assert r.m_OptData is not None assert r.m_OptData is self.m_OptionData @@ -254,12 +258,12 @@ def set_ValueItem( # Helper methods ----------------------------------------------------- def Helper__CheckAlive(self): assert self.m_OptionData is not None - assert type(self.m_OptionData) == PgCfgModel__OptionData + assert type(self.m_OptionData) == PgCfgModel__OptionData # noqa: E721 if not self.m_OptionData.IsAlive(): RaiseError.OptionObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base + assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -277,8 +281,8 @@ def __init__( fileLine: PostgresConfigurationFileLine_Base, includeData: PgCfgModel__IncludeData, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(includeData) == PgCfgModel__IncludeData + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 super().__init__() @@ -303,19 +307,23 @@ def get_File(self) -> PostgresConfigurationIncludedFile_Base: # -------------------------------------------------------------------- def Delete(self, withLine: bool): - assert type(withLine) == bool + assert type(withLine) == bool # noqa: E721 self.Helper__CheckAlive() - assert type(self.m_IncludeData) == PgCfgModel__IncludeData - assert type(self.m_IncludeData.m_Parent) == PgCfgModel__FileLineData - assert type(self.m_IncludeData.m_Parent.m_Parent) == PgCfgModel__FileData + assert type(self.m_IncludeData) == PgCfgModel__IncludeData # noqa: E721 + assert ( + type(self.m_IncludeData.m_Parent) == PgCfgModel__FileLineData + ) # noqa: E721 + assert ( + type(self.m_IncludeData.m_Parent.m_Parent) == PgCfgModel__FileData + ) # noqa: E721 assert ( type(self.m_IncludeData.m_Parent.m_Parent.m_Parent) - == PgCfgModel__ConfigurationData + == PgCfgModel__ConfigurationData # noqa: E721 ) cfgData = self.m_IncludeData.m_Parent.m_Parent.m_Parent - assert type(cfgData) == PgCfgModel__ConfigurationData + assert type(cfgData) == PgCfgModel__ConfigurationData # noqa: E721 PgCfgModel__DataControllerUtils.Include__delete( cfgData, self.m_IncludeData, withLine @@ -328,12 +336,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 + assert type(self.m_IncludeData) == PgCfgModel__IncludeData # noqa: E721 if not self.m_IncludeData.IsAlive(): RaiseError.IncludeObjectWasDeleted() - assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base + assert type(self.m_FileLine) == PostgresConfigurationFileLine_Base # noqa: E721 assert isinstance(self.m_FileLine, PostgresConfigurationFileLine) @@ -353,7 +361,7 @@ def __init__( ): assert parent is not None assert isinstance(parent, PostgresConfigurationFile_Base) - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 super().__init__() @@ -377,16 +385,16 @@ def get_Parent(self) -> PostgresConfigurationFile_Base: # FileLine interface ------------------------------------------------- def __len__(self) -> int: self.Helper__CheckAlive() - assert type(self.m_FileLineData) == PgCfgModel__FileLineData - assert type(self.m_FileLineData.m_Items) == list + assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(self.m_FileLineData.m_Items) == list # noqa: E721 return len(self.m_FileLineData.m_Items) # -------------------------------------------------------------------- def AddComment( self, text: str, offset: typing.Optional[int] = None ) -> PostgresConfigurationComment_Base: - assert type(text) == str - assert offset is None or type(offset) == int + assert type(text) == str # noqa: E721 + assert offset is None or type(offset) == int # noqa: E721 self.Helper__CheckAlive() @@ -396,10 +404,10 @@ def AddComment( self.m_FileLineData, offset, text ) assert commentData is not None - assert type(commentData) == PgCfgModel__CommentData + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 assert commentData.m_Parent is self.m_FileLineData - assert type(commentData.m_Parent) == PgCfgModel__FileLineData - assert type(commentData.m_Parent.m_Items) == list + assert type(commentData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(commentData.m_Parent.m_Items) == list # noqa: E721 assert len(commentData.m_Parent.m_Items) > 0 assert commentData.m_Parent.m_Items[-1].m_Element is commentData @@ -407,13 +415,15 @@ def AddComment( fileLineComment = PostgresConfigurationComment_Base(self, commentData) assert fileLineComment is not None - assert type(fileLineComment) == PostgresConfigurationComment_Base + assert ( + type(fileLineComment) == PostgresConfigurationComment_Base + ) # noqa: E721 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 + assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 PgCfgModel__DataControllerUtils.Comment__delete( cfg.m_Data, commentData, False @@ -421,7 +431,7 @@ def AddComment( raise assert fileLineComment - assert type(fileLineComment) == PostgresConfigurationComment_Base + assert type(fileLineComment) == PostgresConfigurationComment_Base # noqa: E721 return fileLineComment # -------------------------------------------------------------------- @@ -449,7 +459,7 @@ def AddOption( ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 return option # -------------------------------------------------------------------- @@ -458,7 +468,7 @@ def AddInclude( ) -> PostgresConfigurationInclude_Base: DataVerificator.CheckStringOfFilePath(path) - assert type(path) == str + assert type(path) == str # noqa: E721 assert path != "" self.Helper__CheckAlive() @@ -467,27 +477,27 @@ def AddInclude( cfg = self.m_Parent.m_Cfg assert isinstance(cfg, PostgresConfiguration_Base) - assert type(cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 # Add/Get file # Add include element baseFolder = cfg.m_Data.OsOps.Path_DirName(self.m_FileLineData.m_Parent.m_Path) - assert type(baseFolder) == str + assert type(baseFolder) == str # noqa: E721 fileData = PgCfgModel__DataControllerUtils.Cfg__GetOrCreateFile__USER( cfg.m_Data, baseFolder, path ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 try: includeData = PgCfgModel__DataControllerUtils.FileLine__add_Include( self.m_FileLineData, path, fileData, offset ) assert includeData is not None - assert type(includeData) == PgCfgModel__IncludeData + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 assert includeData.m_Path == path assert includeData.m_File is fileData assert includeData.m_Parent == self.m_FileLineData @@ -510,20 +520,20 @@ def AddInclude( # -------------------------------------------------------------------- def Clear(self) -> None: self.Helper__CheckAlive() - assert type(self.m_FileLineData) == PgCfgModel__FileLineData + assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 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 + assert type(cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 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 + assert type(self.m_FileLineData) == PgCfgModel__FileLineData # noqa: E721 if not self.m_FileLineData.IsAlive(): RaiseError.FileLineObjectWasDeleted() @@ -580,7 +590,7 @@ def __next__(self) -> PostgresConfigurationFileLine_Base: fileLineData = self.m_FileLineDataIterator.__next__() assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 file = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, fileLineData) assert file is not None @@ -616,9 +626,9 @@ def __len__(self) -> int: fileData = self.m_File.Private__GetFileData() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.m_Lines is not None - assert type(fileData.m_Lines) == list + assert type(fileData.m_Lines) == list # noqa: E721 return len(fileData.m_Lines) @@ -631,9 +641,9 @@ def __iter__(self) -> PostgresConfigurationFileLinesIterator_Base: fileData = self.m_File.Private__GetFileData() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.m_Lines is not None - assert type(fileData.m_Lines) == list + assert type(fileData.m_Lines) == list # noqa: E721 fileLineDataIterator = fileData.m_Lines.__iter__() assert fileLineDataIterator is not None @@ -657,7 +667,7 @@ class PostgresConfigurationFile_Base(PostgresConfigurationFile): # -------------------------------------------------------------------- def __init__(self, cfg: PostgresConfiguration_Base, fileData: PgCfgModel__FileData): assert isinstance(cfg, PostgresConfiguration_Base) - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 super().__init__() @@ -675,15 +685,15 @@ def get_Configuration(self) -> PostgresConfiguration_Base: # File interface ----------------------------------------------------- def __len__(self) -> int: self.Internal__CheckAlive() - assert type(self.m_FileData) == PgCfgModel__FileData - assert type(self.m_FileData.m_Lines) == list + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData.m_Lines) == list # noqa: E721 return len(self.m_FileData.m_Lines) # -------------------------------------------------------------------- def get_Path(self) -> str: self.Internal__CheckAlive() - assert type(self.m_FileData) == PgCfgModel__FileData - assert type(self.m_FileData.m_Path) == str + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_FileData.m_Path) == str # noqa: E721 return self.m_FileData.m_Path # -------------------------------------------------------------------- @@ -694,7 +704,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 + assert type(self.m_Lines) == PostgresConfigurationFileLines_Base # noqa: E721 assert self.m_Lines.m_Cfg is self.m_Cfg assert self.m_FileData is self.m_FileData @@ -707,16 +717,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 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 assert fileLineData.IsAlive() assert fileLineData.m_Items is not None - assert type(fileLineData.m_Items) == list + assert type(fileLineData.m_Items) == list # noqa: E721 assert len(fileLineData.m_Items) == 0 assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list + assert type(self.m_FileData.m_Lines) == list # noqa: E721 assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -724,7 +734,7 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine_Base: fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self except: # rollback @@ -734,12 +744,12 @@ def AddEmptyLine(self) -> PostgresConfigurationFileLine_Base: raise assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 return fileLine # -------------------------------------------------------------------- def AddComment(self, text: str) -> PostgresConfigurationComment_Base: - assert type(text) == str + assert type(text) == str # noqa: E721 self.Internal__CheckAlive() @@ -748,9 +758,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 + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list + assert type(self.m_FileData.m_Lines) == list # noqa: E721 assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -759,10 +769,10 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: fileLineData, None, text ) assert commentData is not None - assert type(commentData) == PgCfgModel__CommentData + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 assert commentData.m_Parent is fileLineData - assert type(commentData.m_Parent) == PgCfgModel__FileLineData - assert type(commentData.m_Parent.m_Items) == list + assert type(commentData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 + assert type(commentData.m_Parent.m_Items) == list # noqa: E721 assert len(commentData.m_Parent.m_Items) == 1 assert commentData.m_Parent.m_Items[0].m_Element is commentData @@ -770,14 +780,16 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self fileLineComment = PostgresConfigurationComment_Base(fileLine, commentData) assert fileLineComment is not None - assert type(fileLineComment) == PostgresConfigurationComment_Base + assert ( + type(fileLineComment) == PostgresConfigurationComment_Base + ) # noqa: E721 except: # rollback PgCfgModel__DataControllerUtils.FileLine__delete( self.m_Cfg.m_Data, fileLineData @@ -785,7 +797,7 @@ def AddComment(self, text: str) -> PostgresConfigurationComment_Base: raise assert fileLineComment - assert type(fileLineComment) == PostgresConfigurationComment_Base + assert type(fileLineComment) == PostgresConfigurationComment_Base # noqa: E721 return fileLineComment # -------------------------------------------------------------------- @@ -810,35 +822,35 @@ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption_Base: ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 return option # -------------------------------------------------------------------- def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: DataVerificator.CheckStringOfFilePath(path) - assert type(path) == str + assert type(path) == str # noqa: E721 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 + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 # 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 + assert type(baseFolder) == str # noqa: E721 fileData = PgCfgModel__DataControllerUtils.Cfg__GetOrCreateFile__USER( self.m_Cfg.m_Data, baseFolder, path ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 try: fileLineData = PgCfgModel__DataControllerUtils.File__add_Line( @@ -846,9 +858,9 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: ) assert self.m_FileData is not None - assert type(self.m_FileData) == PgCfgModel__FileData + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 assert self.m_FileData.m_Lines is not None - assert type(self.m_FileData.m_Lines) == list + assert type(self.m_FileData.m_Lines) == list # noqa: E721 assert len(self.m_FileData.m_Lines) > 0 assert self.m_FileData.m_Lines[-1] is fileLineData @@ -857,7 +869,7 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: fileLineData, path, fileData, None ) assert includeData is not None - assert type(includeData) == PgCfgModel__IncludeData + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 assert includeData.m_Path == path assert includeData.m_File is fileData assert includeData.m_Parent == fileLineData @@ -865,7 +877,9 @@ def AddInclude(self, path: str) -> PostgresConfigurationInclude_Base: # ----------- fileLine = PostgresConfigurationFileLine_Base(self, fileLineData) assert fileLine is not None - assert type(fileLine) == PostgresConfigurationFileLine_Base + assert ( + type(fileLine) == PostgresConfigurationFileLine_Base + ) # noqa: E721 assert fileLine.m_FileLineData is fileLineData assert fileLine.m_Parent is self @@ -910,7 +924,9 @@ def SetOptionValue( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert isinstance(result, PostgresConfigurationSetOptionValueResult) return result @@ -946,11 +962,13 @@ def SetOptionValueItem( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 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 + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_OptData.m_Name == name return result @@ -971,7 +989,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 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 super().__init__(cfg, fileData) @@ -985,7 +1003,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 + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 if not self.m_FileData.IsAlive(): RaiseError.FileObjectWasDeleted() @@ -1005,8 +1023,8 @@ class PostgresConfigurationIncludedFile_Base(PostgresConfigurationFile_Base): def __init__( self, include: PostgresConfigurationInclude_Base, fileData: PgCfgModel__FileData ): - assert type(include) == PostgresConfigurationInclude_Base - assert type(fileData) == PgCfgModel__FileData + assert type(include) == PostgresConfigurationInclude_Base # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 super().__init__(include.get_Configuration(), fileData) @@ -1023,8 +1041,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 - assert type(self.m_Include) == PostgresConfigurationInclude_Base + assert type(self.m_FileData) == PgCfgModel__FileData # noqa: E721 + assert type(self.m_Include) == PostgresConfigurationInclude_Base # noqa: E721 if not self.m_FileData.IsAlive(): RaiseError.FileObjectWasDeleted() @@ -1055,9 +1073,9 @@ def __init__( eventID: PostgresConfigurationSetOptionValueEventID, ): assert cfg is None or isinstance(cfg, PostgresConfiguration_Base) - assert optData is None or type(optData) == PgCfgModel__OptionData + assert optData is None or type(optData) == PgCfgModel__OptionData # noqa: E721 assert (cfg is None) == (optData is None) - assert type(eventID) == PostgresConfigurationSetOptionValueEventID + assert type(eventID) == PostgresConfigurationSetOptionValueEventID # noqa: E721 self.m_Cfg = cfg self.m_Opt = None @@ -1070,7 +1088,7 @@ def Create__OptWasUpdated( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData + assert type(optData) == PgCfgModel__OptionData # noqa: E721 return __class__( cfg, optData, PostgresConfigurationSetOptionValueEventID.OPTION_WAS_UPDATED @@ -1082,7 +1100,7 @@ def Create__OptWasAdded( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData + assert type(optData) == PgCfgModel__OptionData # noqa: E721 return __class__( cfg, optData, PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -1100,7 +1118,7 @@ def Create__OptValueItemWasAlreadyDefined( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData + assert type(optData) == PgCfgModel__OptionData # noqa: E721 return __class__( cfg, @@ -1114,7 +1132,7 @@ def Create__OptValueItemWasAdded( ) -> PostgresConfigurationSetOptionValueResult_Base: assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optData) == PgCfgModel__OptionData + assert type(optData) == PgCfgModel__OptionData # noqa: E721 return __class__( cfg, @@ -1126,9 +1144,13 @@ 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 + assert ( + self.m_OptData is None or type(self.m_OptData) == PgCfgModel__OptionData + ) # noqa: E721 assert (self.m_Cfg is None) == (self.m_OptData is None) - assert type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID + assert ( + type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID + ) # noqa: E721 if self.m_OptData is None: assert ( @@ -1157,13 +1179,15 @@ def Option(self) -> PostgresConfigurationOption_Base: ) assert self.m_Opt is not None - assert type(self.m_Opt) == PostgresConfigurationOption_Base + assert type(self.m_Opt) == PostgresConfigurationOption_Base # noqa: E721 return self.m_Opt # --------------------------------------------------------------------- @property def EventID(self) -> PostgresConfigurationSetOptionValueEventID: - assert type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID + assert ( + type(self.m_EventID) == PostgresConfigurationSetOptionValueEventID + ) # noqa: E721 return self.m_EventID @@ -1214,7 +1238,7 @@ def __next__(self) -> PostgresConfigurationFile_Base: fileData = self.m_FileDataIterator.__next__() assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 file = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, fileData) assert file is not None @@ -1240,16 +1264,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 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 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 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 fileDataIterator = self.m_Cfg.m_Data.m_AllFilesByName.values().__iter__() assert fileDataIterator is not None @@ -1263,8 +1287,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 - assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data.m_AllFilesByName) == dict # noqa: E721 file_name2 = self.m_Cfg.m_Data.OsOps.Path_NormCase(file_name) @@ -1340,7 +1364,7 @@ def __next__(self) -> PostgresConfigurationFile_Base: optionData = self.m_OptionDataIterator.__next__() assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 option = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, optionData) assert option is not None @@ -1366,16 +1390,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 - assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 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 - assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Cfg.m_Data.m_AllOptionsByName) == dict # noqa: E721 optionDataIterator = self.m_Cfg.m_Data.m_AllOptionsByName.values().__iter__() assert optionDataIterator is not None @@ -1418,7 +1442,7 @@ def get_Parent(self) -> PostgresConfigurationObject: # PostgresConfiguration interface ------------------------------------ def AddTopLevelFile(self, path: str) -> PostgresConfigurationTopLevelFile_Base: - assert type(path) == str + assert type(path) == str # noqa: E721 assert path != "" assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 assert isinstance(self.m_Data.OsOps, ConfigurationOsOps) @@ -1432,12 +1456,12 @@ def AddTopLevelFile(self, path: str) -> PostgresConfigurationTopLevelFile_Base: file = PostgresConfigurationFactory_Base.GetObject(self, fileData) assert file is not None - assert type(file) == PostgresConfigurationTopLevelFile_Base + assert type(file) == PostgresConfigurationTopLevelFile_Base # noqa: E721 except: # rollback raise assert file is not None - assert type(file) == PostgresConfigurationTopLevelFile_Base + assert type(file) == PostgresConfigurationTopLevelFile_Base # noqa: E721 return file # -------------------------------------------------------------------- @@ -1455,7 +1479,7 @@ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption_Base: ) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert isinstance(option, PostgresConfigurationOption_Base) assert isinstance(option, PostgresConfigurationOption) return option @@ -1475,7 +1499,9 @@ def SetOptionValue( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert isinstance(result, PostgresConfigurationSetOptionValueResult) return result @@ -1498,7 +1524,9 @@ def SetOptionValueItem( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert isinstance(result, PostgresConfigurationSetOptionValueResult_Base) return result @@ -1506,26 +1534,30 @@ def SetOptionValueItem( # -------------------------------------------------------------------- def get_AllFiles(self) -> PostgresConfiguration_Base__AllFiles: assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 if self.m_AllFiles is None: self.m_AllFiles = PostgresConfiguration_Base__AllFiles(self) assert self.m_AllFiles is not None - assert type(self.m_AllFiles) == PostgresConfiguration_Base__AllFiles + assert ( + type(self.m_AllFiles) == PostgresConfiguration_Base__AllFiles + ) # noqa: E721 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 + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 if self.m_AllOptions is None: self.m_AllOptions = PostgresConfiguration_Base__AllOptions(self) assert self.m_AllOptions is not None - assert type(self.m_AllOptions) == PostgresConfiguration_Base__AllOptions + assert ( + type(self.m_AllOptions) == PostgresConfiguration_Base__AllOptions + ) # noqa: E721 assert self.m_AllOptions.m_Cfg is self return self.m_AllOptions @@ -1538,10 +1570,10 @@ def DataHandler__SetOptionValue__Simple( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData - or type(targetData) == PgCfgModel__OptionData + or type(targetData) == PgCfgModel__FileData # noqa: E721 + or type(targetData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None # ------------------------------------------------ @@ -1572,10 +1604,10 @@ def DataHandler__GetOptionValue__Simple( ) -> any: assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData - or type(sourceData) == PgCfgModel__OptionData + or type(sourceData) == PgCfgModel__FileData # noqa: E721 + or type(sourceData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 # -------------------------------------- ROOT if sourceData is None: @@ -1584,7 +1616,7 @@ def DataHandler__GetOptionValue__Simple( ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Value is not None return self.Helper__PrepareGetValue( @@ -1610,14 +1642,14 @@ def DataHandler__GetOptionValue__Simple( assert fileData.IsAlive() assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 optionData = self.Helper__FindSimpleOption( fileData.m_OptionsByName, optionName ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Value is not None return self.Helper__PrepareGetValue( @@ -1638,10 +1670,10 @@ def DataHandler__GetOptionValue__UnionList( ) -> any: assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData - or type(sourceData) == PgCfgModel__OptionData + or type(sourceData) == PgCfgModel__FileData # noqa: E721 + or type(sourceData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 # -------------------------------------- ROOT if sourceData is None: @@ -1652,7 +1684,7 @@ def DataHandler__GetOptionValue__UnionList( if unionList is None: return None - assert type(unionList) == list + assert type(unionList) == list # noqa: E721 return self.Helper__PrepareGetValue(optionName, unionList) typeOfSource = type(sourceData) @@ -1671,10 +1703,10 @@ def DataHandler__GetOptionValue__UnionList( if typeOfSource == PgCfgModel__FileData: sourceFileData: PgCfgModel__FileData = sourceData - assert type(sourceFileData) == PgCfgModel__FileData + assert type(sourceFileData) == PgCfgModel__FileData # noqa: E721 assert sourceFileData.IsAlive() assert sourceFileData.m_OptionsByName is not None - assert type(sourceFileData.m_OptionsByName) == dict + assert type(sourceFileData.m_OptionsByName) == dict # noqa: E721 typeOfOption = type(optionName) @@ -1686,7 +1718,7 @@ def DataHandler__GetOptionValue__UnionList( if unionList is None: return None - assert type(unionList) == list + assert type(unionList) == list # noqa: E721 return self.Helper__PrepareGetValue(optionName, unionList) BugCheckError.UnkObjectDataType(typeOfOption) @@ -1701,10 +1733,10 @@ def DataHandler__ResetOption( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData - or type(targetData) == PgCfgModel__OptionData + or type(targetData) == PgCfgModel__FileData # noqa: E721 + or type(targetData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 # -------------------------------- target is NONE if targetData is None: @@ -1734,7 +1766,7 @@ def DataHandler__ResetOption( ) if typeOfTarget is PgCfgModel__FileData: - assert type(targetData) == PgCfgModel__FileData + assert type(targetData) == PgCfgModel__FileData # noqa: E721 eventID = self.Helper__FindAndDeleteOption( targetData.m_OptionsByName, optionName @@ -1759,17 +1791,17 @@ def DataHandler__AddSimpleOption( ) -> PostgresConfigurationOption_Base: assert ( target is None - or type(target) == PgCfgModel__FileData - or type(target) == PgCfgModel__FileLineData + or type(target) == PgCfgModel__FileData # noqa: E721 + or type(target) == PgCfgModel__FileLineData # noqa: E721 ) - assert optionOffset is None or type(optionOffset) == int - assert type(optionName) == str + assert optionOffset is None or type(optionOffset) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 typeOfTarget = type(target) @@ -1797,10 +1829,10 @@ def DataHandler__SetUniqueOptionValueItem( ) -> PostgresConfigurationSetOptionValueResult_Base: assert ( targetData is None - or type(targetData) == PgCfgModel__FileData - or type(targetData) == PgCfgModel__OptionData + or type(targetData) == PgCfgModel__FileData # noqa: E721 + or type(targetData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValueItem is not None # -------------------------------- target is NONE @@ -1836,7 +1868,7 @@ def Internal__GetAutoConfFileName(self) -> str: def Internal__GetOptionHandlerToPrepareSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareSetValue" ) @@ -1845,7 +1877,7 @@ def Internal__GetOptionHandlerToPrepareSetValue( def Internal__GetOptionHandlerToPrepareSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValueItem: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareSetValueItem" ) @@ -1854,7 +1886,7 @@ def Internal__GetOptionHandlerToPrepareSetValueItem( def Internal__GetOptionHandlerToPrepareGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareGetValue: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToPrepareGetValue" ) @@ -1863,7 +1895,7 @@ def Internal__GetOptionHandlerToPrepareGetValue( def Internal__GetOptionHandlerToSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToSetValue: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToSetValue" ) @@ -1872,7 +1904,7 @@ def Internal__GetOptionHandlerToSetValue( def Internal__GetOptionHandlerToGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToGetValue: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToGetValue" ) @@ -1881,7 +1913,7 @@ def Internal__GetOptionHandlerToGetValue( def Internal__GetOptionHandlerToAddOption( self, name: str ) -> PgCfgModel__OptionHandlerToAddOption: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToAddOption" ) @@ -1890,7 +1922,7 @@ def Internal__GetOptionHandlerToAddOption( def Internal__GetOptionHandlerToSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToSetValueItem: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToSetValueItem" ) @@ -1899,7 +1931,7 @@ def Internal__GetOptionHandlerToSetValueItem( def Internal__GetOptionHandlerToWrite( self, name: str ) -> PgCfgModel__OptionHandlerToWrite: - assert type(name) == str + assert type(name) == str # noqa: E721 RaiseError.MethodIsNotImplemented( __class__, "Internal__GetOptionHandlerToWrite" ) @@ -1908,8 +1940,8 @@ def Internal__GetOptionHandlerToWrite( def Helper__FindSimpleOption( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> typing.Optional[PgCfgModel__OptionData]: - assert type(allOptionsByName) == dict - assert type(optionName) == str + assert type(allOptionsByName) == dict # noqa: E721 + assert type(optionName) == str # noqa: E721 if not (optionName in allOptionsByName.keys()): return None @@ -1918,13 +1950,13 @@ def Helper__FindSimpleOption( assert data is not None - if type(data) == PgCfgModel__OptionData: + if type(data) == PgCfgModel__OptionData: # noqa: E721 assert data.IsAlive() assert data.m_Name == optionName self.Debug__CheckOurObjectData(data) return data - if type(data) == list: + if type(data) == list: # noqa: E721 assert len(data) > 1 BugCheckError.MultipleDefOfOptionIsFound(optionName, len(data)) @@ -1934,8 +1966,8 @@ def Helper__FindSimpleOption( def Helper__AggregateAllOptionValues( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> list: - assert type(allOptionsByName) == dict - assert type(optionName) == str + assert type(allOptionsByName) == dict # noqa: E721 + assert type(optionName) == str # noqa: E721 if not (optionName in allOptionsByName.keys()): return None @@ -1949,42 +1981,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 + assert type(data.m_Value) == list # noqa: E721 return data.m_Value if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 data = data.copy() - assert type(data) == list + assert type(data) == list # noqa: E721 result = [] for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.m_Name == optionName assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list + assert type(optionData.m_Value) == list # noqa: E721 result.extend(self.m_Data) assert result is not None - assert type(result) == list + assert type(result) == list # noqa: E721 return result # Unknown type of option data in dictionary - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 BugCheckError.UnkOptObjectDataType(optionName, typeOfData) # -------------------------------------------------------------------- def Helper__FindAndDeleteOption( self, allOptionsByName: dict[str, PgCfgModel__OptionData], optionName: str ) -> PostgresConfigurationSetOptionValueEventID: - assert type(allOptionsByName) == dict - assert type(optionName) == str + assert type(allOptionsByName) == dict # noqa: E721 + assert type(optionName) == str # noqa: E721 if not (optionName in allOptionsByName.keys()): return PostgresConfigurationSetOptionValueEventID.NONE @@ -2003,13 +2035,13 @@ def Helper__FindAndDeleteOption( return PostgresConfigurationSetOptionValueEventID.OPTION_WAS_DELETED if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 data = data.copy() - assert type(data) == list + assert type(data) == list # noqa: E721 for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2024,7 +2056,7 @@ def Helper__FindAndDeleteOption( # Unknown type of option data in dictionary - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 BugCheckError.UnkOptObjectDataType(optionName, typeOfData) # -------------------------------------------------------------------- @@ -2032,22 +2064,22 @@ def Helper__FindAndDeleteOption( def Helper__GetFileForSimpleOption( self, option_name: str ) -> tuple[PgCfgModel__FileData, bool]: - assert type(option_name) == str + assert type(option_name) == str # noqa: E721 assert option_name != "" option_name_parts = option_name.split(".") - assert type(option_name_parts) == list + assert type(option_name_parts) == list # noqa: E721 assert len(option_name_parts) > 0 if len(option_name_parts) > 1: specFileName = "postgresql." + ".".join(option_name_parts[:-1]) + ".conf" - assert type(specFileName) == str + assert type(specFileName) == str # noqa: E721 fileData = self.Helper__FindFile(specFileName) if fileData is not None: - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 return (fileData, False) # Let's use standard "postgresql.auto.conf" @@ -2055,7 +2087,7 @@ def Helper__GetFileForSimpleOption( fileData = self.Helper__FindFile(self.Internal__GetAutoConfFileName()) if fileData is not None: - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 return (fileData, False) assert fileData is None @@ -2065,20 +2097,20 @@ def Helper__GetFileForSimpleOption( ) assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 return (fileData, True) # -------------------------------------------------------------------- def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: - assert type(file_name) == str + assert type(file_name) == str # noqa: E721 assert file_name != "" assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 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 - assert type(self.m_Data.m_AllFilesByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllFilesByName) == dict # noqa: E721 file_name_n = self.m_Data.OsOps.Path_NormCase(file_name) @@ -2089,10 +2121,10 @@ def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: assert data is not None - if type(data) == PgCfgModel__FileData: + if type(data) == PgCfgModel__FileData: # noqa: E721 return data - if type(data) == list: + if type(data) == list: # noqa: E721 assert len(data) > 1 BugCheckError.MultipleDefOfFileIsFound(file_name_n, len(data)) @@ -2102,7 +2134,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 + assert type(optionName) == str # noqa: E721 prepareHandler = self.Internal__GetOptionHandlerToPrepareGetValue(optionName) assert prepareHandler is not None @@ -2120,13 +2152,13 @@ def Helper__AddSimpleOption__Common( optionName: str, optionValue: any, ) -> PostgresConfigurationOption_Base: - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 if optionName in self.m_Data.m_AllOptionsByName.keys(): assert self.m_Data.m_AllOptionsByName[optionName] is not None @@ -2134,15 +2166,17 @@ def Helper__AddSimpleOption__Common( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.get_Parent() is not None - assert type(optionData.get_Parent()) == PgCfgModel__FileLineData + assert ( + type(optionData.get_Parent()) == PgCfgModel__FileLineData + ) # noqa: E721 anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData + assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 RaiseError.OptionIsAlreadyExistInFile(anotherFileData.m_Path, optionName) @@ -2152,14 +2186,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 + assert type(getFileData_r) == tuple # noqa: E721 assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData - assert type(getFileData_r[1]) == bool + assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 + assert type(getFileData_r[1]) == bool # noqa: E721 fileData = getFileData_r[0] - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 try: # may raise @@ -2168,7 +2202,7 @@ def Helper__AddSimpleOption__Common( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionName in self.m_Data.m_AllOptionsByName.keys() assert optionName in fileData.m_OptionsByName.keys() @@ -2178,7 +2212,7 @@ def Helper__AddSimpleOption__Common( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData except: # rollback line with option assert optionData.IsAlive() @@ -2193,11 +2227,11 @@ def Helper__AddSimpleOption__Common( assert not (optionName in fileData.m_OptionsByName.keys()) raise except: # rollback file - assert type(getFileData_r) == tuple + assert type(getFileData_r) == tuple # noqa: E721 assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData - assert type(getFileData_r[1]) == bool + assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 + assert type(getFileData_r[1]) == bool # noqa: E721 if getFileData_r[1]: pass # TODO: delete file @@ -2205,7 +2239,7 @@ def Helper__AddSimpleOption__Common( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2219,22 +2253,22 @@ def Helper__AddSimpleOption__FileLine( optionValue: any, ): assert fileLineData is not None - assert type(fileLineData) == PgCfgModel__FileLineData - assert optionOffset is None or type(optionOffset) == int - assert type(optionName) == str + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert optionOffset is None or type(optionOffset) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 fileData = fileLineData.m_Parent assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 if optionName in fileData.m_OptionsByName.keys(): assert fileData.m_OptionsByName[optionName] is not None @@ -2246,16 +2280,18 @@ def Helper__AddSimpleOption__FileLine( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.get_Parent() is not None - assert type(optionData.get_Parent()) == PgCfgModel__FileLineData + assert ( + type(optionData.get_Parent()) == PgCfgModel__FileLineData + ) # noqa: E721 anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData + assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 assert anotherFileData is not fileData RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2273,7 +2309,7 @@ def Helper__AddSimpleOption__FileLine( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2282,7 +2318,7 @@ def Helper__AddSimpleOption__FileLine( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData except: PgCfgModel__DataControllerUtils.Option__delete(self.m_Data, optionData()) @@ -2293,7 +2329,7 @@ def Helper__AddSimpleOption__FileLine( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2306,17 +2342,17 @@ def Helper__AddSimpleOption__File( optionValue: any, ): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData - assert type(optionName) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(optionName) == str # noqa: E721 assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 assert self.m_Data.m_AllOptionsByName is not None - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 if optionName in fileData.m_OptionsByName.keys(): assert fileData.m_OptionsByName[optionName] is not None @@ -2328,16 +2364,18 @@ def Helper__AddSimpleOption__File( optionData = Helpers.ExtractFirstOptionFromIndexItem(optionName, indexItem) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.get_Parent() is not None - assert type(optionData.get_Parent()) == PgCfgModel__FileLineData + assert ( + type(optionData.get_Parent()) == PgCfgModel__FileLineData + ) # noqa: E721 anotherFileData = optionData.get_Parent().get_Parent() assert anotherFileData is not None - assert type(anotherFileData) == PgCfgModel__FileData + assert type(anotherFileData) == PgCfgModel__FileData # noqa: E721 assert anotherFileData is not fileData RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2355,7 +2393,7 @@ def Helper__AddSimpleOption__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2364,7 +2402,7 @@ def Helper__AddSimpleOption__File( option = PostgresConfigurationFactory_Base.GetObject(self, optionData) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData except: PgCfgModel__DataControllerUtils.FileLine__delete( @@ -2377,7 +2415,7 @@ def Helper__AddSimpleOption__File( raise assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 assert option.m_OptionData is optionData assert option.m_OptionData.IsAlive() return option @@ -2388,12 +2426,12 @@ def Helper__SetSimpleOptionValue__Common( optionName: str, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 # ------------------------------------------------ optionData = self.Helper__FindSimpleOption( @@ -2401,7 +2439,7 @@ def Helper__SetSimpleOptionValue__Common( ) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2416,14 +2454,16 @@ def Helper__SetSimpleOptionValue__Common( result = self.Helper__FinalRegSimpleOptionValue__Common(optionName, optionValue) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 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 + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_Cfg is self return result @@ -2435,16 +2475,16 @@ def Helper__SetSimpleOptionValue__File( optionName: str, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData - assert type(fileData.m_OptionsByName) == dict - assert type(optionName) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData.m_OptionsByName) == dict # noqa: E721 + assert type(optionName) == str # noqa: E721 assert optionValue is not None # ------------------------------------------------ optionData = self.Helper__FindSimpleOption(fileData.m_OptionsByName, optionName) if optionData is not None: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName @@ -2463,12 +2503,14 @@ def Helper__SetSimpleOptionValue__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName - assert type(optionData.m_Parent) == PgCfgModel__FileLineData + assert type(optionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 assert optionData.m_Parent.IsAlive() - assert type(optionData.m_Parent.m_Parent) == PgCfgModel__FileData + assert ( + type(optionData.m_Parent.m_Parent) == PgCfgModel__FileData + ) # noqa: E721 assert optionData.m_Parent.m_Parent.IsAlive() RaiseError.OptionIsAlreadyExistInAnotherFile( @@ -2480,13 +2522,15 @@ def Helper__SetSimpleOptionValue__File( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2497,7 +2541,7 @@ def Helper__SetSimpleOptionValue__Exact( optionData: PgCfgModel__OptionData, optionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionValue is not None @@ -2517,12 +2561,12 @@ def Helper__SetUniqueOptionValueItem__Common( optionName: str, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValueItem is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 # ------------------------------------------------ while True: @@ -2534,10 +2578,10 @@ def Helper__SetUniqueOptionValueItem__Common( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData + assert type(data) == PgCfgModel__OptionData # noqa: E721 assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list + assert type(data.m_Value) == list # noqa: E721 if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( data, optionValueItem @@ -2555,15 +2599,15 @@ def Helper__SetUniqueOptionValueItem__Common( ) if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 assert len(data) > 1 for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.m_Name == optionName assert optionData.m_Value is not None - assert type(optionData.m_Value) == list + assert type(optionData.m_Value) == list # noqa: E721 if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( optionData, optionValueItem @@ -2588,14 +2632,16 @@ def Helper__SetUniqueOptionValueItem__Common( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 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 + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_OptData.m_Name == optionName assert result.m_Cfg is self @@ -2607,7 +2653,7 @@ def Helper__SetUniqueOptionValueItem__Exact( optionData: PgCfgModel__OptionData, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionValueItem is not None @@ -2621,10 +2667,10 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( optionData: PgCfgModel__OptionData, optionPreparedValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list + assert type(optionData.m_Value) == list # noqa: E721 assert optionPreparedValueItem is not None # ------------------------------------------------ @@ -2645,10 +2691,10 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData + assert type(data) == PgCfgModel__OptionData # noqa: E721 # It is the single property! assert data is optionData - assert type(data.m_Value) == list + assert type(data.m_Value) == list # noqa: E721 PgCfgModel__DataControllerUtils.Option__add_ValueItem( data, optionPreparedValueItem @@ -2659,7 +2705,7 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( ) if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 assert len(data) > 1 for optionData2 in data: @@ -2667,15 +2713,15 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( continue assert optionData2 is not None - assert type(optionData2) == PgCfgModel__OptionData + assert type(optionData2) == PgCfgModel__OptionData # noqa: E721 assert optionData2.IsAlive() assert optionData2.m_Name == optionData.m_Name assert optionData2.m_Value is not None - assert type(optionData2.m_Value) == list + assert type(optionData2.m_Value) == list # noqa: E721 assert optionData2.m_Parent.IsAlive() fileData2 = optionData2.m_Parent.m_Parent - assert type(fileData2) == PgCfgModel__FileData + assert type(fileData2) == PgCfgModel__FileData # noqa: E721 assert fileData2.IsAlive() if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( @@ -2701,17 +2747,17 @@ def Helper__SetUniqueOptionValueItem__File( optionName: str, optionValueItem: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData - assert type(optionName) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(optionName) == str # noqa: E721 assert fileData.IsAlive() assert optionValueItem is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 assert fileData.m_OptionsByName is not None - assert type(fileData.m_OptionsByName) == dict + assert type(fileData.m_OptionsByName) == dict # noqa: E721 # ------------------------------------------------ C_BUGCHECK_SRC = __class__.__name__ + "::Helper__SetUniqueOptionValueItem__File" @@ -2733,7 +2779,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 + assert type(data.m_Value) == list # noqa: E721 if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( data, optionValueItem @@ -2751,16 +2797,16 @@ def Helper__SetUniqueOptionValueItem__File( assert typeOfData != PgCfgModel__OptionData if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 assert len(data) > 1 for optionData in data: assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName assert optionData.m_Value is not None - assert type(optionData.m_Value) == list + assert type(optionData.m_Value) == list # noqa: E721 if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( optionData, optionValueItem @@ -2773,7 +2819,7 @@ def Helper__SetUniqueOptionValueItem__File( # Postgres does not support a concatention of option lists BugCheckError.MultipleDefOfOptionIsFound(optionName, len(data)) - assert typeOfData != list + assert typeOfData != list # noqa: E721 BugCheckError.UnkOptObjectDataType(optionName, typeOfData) @@ -2787,16 +2833,16 @@ def Helper__SetUniqueOptionValueItem__File( typeOfData = type(data) if typeOfData == PgCfgModel__OptionData: - assert type(data) == PgCfgModel__OptionData + assert type(data) == PgCfgModel__OptionData # noqa: E721 assert data.IsAlive() assert data.m_Name == optionName assert data.m_Value is not None - assert type(data.m_Value) == list + assert type(data.m_Value) == list # noqa: E721 assert data.get_Parent().IsAlive() fileData2 = data.get_Parent().get_Parent() assert fileData2 is not None - assert type(fileData2) == PgCfgModel__FileData + assert type(fileData2) == PgCfgModel__FileData # noqa: E721 assert fileData2.IsAlive() assert not (fileData2 is fileData) @@ -2812,20 +2858,20 @@ def Helper__SetUniqueOptionValueItem__File( ) if typeOfData == list: - assert type(data) == list + assert type(data) == list # noqa: E721 assert len(data) > 1 for optionData2 in data: assert optionData2 is not None - assert type(optionData2) == PgCfgModel__OptionData + assert type(optionData2) == PgCfgModel__OptionData # noqa: E721 assert optionData2.IsAlive() assert optionData2.m_Name == optionName assert optionData2.m_Value is not None - assert type(optionData2.m_Value) == list + assert type(optionData2.m_Value) == list # noqa: E721 fileData2 = optionData2.get_Parent().get_Parent() assert fileData2 is not None - assert type(fileData2) == PgCfgModel__FileData + assert type(fileData2) == PgCfgModel__FileData # noqa: E721 assert fileData2.IsAlive() assert not (fileData2 is fileData) @@ -2854,13 +2900,15 @@ def Helper__SetUniqueOptionValueItem__File( ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2871,12 +2919,12 @@ def Helper__FinalRegSimpleOptionValue__Common( optionName: str, preparedOptionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert preparedOptionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) @@ -2884,24 +2932,24 @@ def Helper__FinalRegSimpleOptionValue__Common( getFileData_r = self.Helper__GetFileForSimpleOption(optionName) assert getFileData_r is not None - assert type(getFileData_r) == tuple + assert type(getFileData_r) == tuple # noqa: E721 assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData - assert type(getFileData_r[1]) == bool + assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 + assert type(getFileData_r[1]) == bool # noqa: E721 fileData = getFileData_r[0] - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 try: result = self.Helper__FinalRegSimpleOptionValue__File( fileData, optionName, preparedOptionValue ) except: # rollback file - assert type(getFileData_r) == tuple + assert type(getFileData_r) == tuple # noqa: E721 assert len(getFileData_r) == 2 - assert type(getFileData_r[0]) == PgCfgModel__FileData - assert type(getFileData_r[1]) == bool + assert type(getFileData_r[0]) == PgCfgModel__FileData # noqa: E721 + assert type(getFileData_r[1]) == bool # noqa: E721 if getFileData_r[1]: pass # TODO: delete file @@ -2909,13 +2957,15 @@ def Helper__FinalRegSimpleOptionValue__Common( raise assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED ) assert result.m_OptData is not None - assert type(result.m_OptData) == PgCfgModel__OptionData + assert type(result.m_OptData) == PgCfgModel__OptionData # noqa: E721 assert result.m_OptData.IsAlive() assert result.m_OptData.m_Name == optionName return result @@ -2927,13 +2977,13 @@ def Helper__FinalRegSimpleOptionValue__File( optionName: str, preparedOptionValue: any, ) -> PostgresConfigurationSetOptionValueResult_Base: - assert type(fileData) == PgCfgModel__FileData - assert type(optionName) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721a + assert type(optionName) == str # noqa: E721 assert preparedOptionValue is not None assert self.m_Data is not None - assert type(self.m_Data) == PgCfgModel__ConfigurationData - assert type(self.m_Data.m_AllOptionsByName) == dict + assert type(self.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(self.m_Data.m_AllOptionsByName) == dict # noqa: E721 assert not (optionName in fileData.m_OptionsByName.keys()) assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) @@ -2943,10 +2993,10 @@ def Helper__FinalRegSimpleOptionValue__File( ) assert optionData is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Name == optionName - assert type(optionData.m_Parent) == PgCfgModel__FileLineData + assert type(optionData.m_Parent) == PgCfgModel__FileLineData # noqa: E721 assert optionData.m_Parent.m_Parent is fileData assert optionName in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2956,7 +3006,9 @@ def Helper__FinalRegSimpleOptionValue__File( self, optionData ) assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -2976,7 +3028,9 @@ def Helper__FinalRegSimpleOptionValue__File( raise assert result is not None - assert type(result) == PostgresConfigurationSetOptionValueResult_Base + assert ( + type(result) == PostgresConfigurationSetOptionValueResult_Base + ) # noqa: E721 assert ( result.m_EventID == PostgresConfigurationSetOptionValueEventID.OPTION_WAS_ADDED @@ -2991,10 +3045,10 @@ def Helper__DoesOptionValueAlreadyHaveThisUniqueItem( ) -> bool: assert optionData is not None assert optionValueItem is not None - assert type(optionData) == PgCfgModel__OptionData + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 assert optionData.IsAlive() assert optionData.m_Value is not None - assert type(optionData.m_Value) == list + assert type(optionData.m_Value) == list # noqa: E721 return Helpers.DoesContainerContainsValue__NotNullAndExact( optionData.m_Value, optionValueItem @@ -3006,7 +3060,7 @@ def Debug__CheckOurObjectData(self, data: PgCfgModel__ObjectData): assert isinstance(data, PgCfgModel__ObjectData) stack: typing.Set[PgCfgModel__ObjectData] = set() - assert type(stack) == set + assert type(stack) == set # noqa: E721 ptr = data while ptr is not self.m_Data: @@ -3043,7 +3097,7 @@ def GetObject( assert isinstance(objectData, PgCfgModel__ObjectData) - assert type(stack) == list + assert type(stack) == list # noqa: E721 assert len(stack) > 0 # Build ConfigurationObjects @@ -3105,7 +3159,7 @@ def Helper__CreateFile( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__FileData + assert type(objectData) == PgCfgModel__FileData # noqa: E721 assert isinstance(objectParent, PostgresConfigurationObject) if isinstance(objectParent, PostgresConfiguration_Base): @@ -3122,7 +3176,7 @@ def Helper__CreateFileLine( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__FileLineData + assert type(objectData) == PgCfgModel__FileLineData # noqa: E721 assert isinstance(objectParent, PostgresConfigurationFile_Base) return PostgresConfigurationFileLine_Base(objectParent, objectData) @@ -3134,7 +3188,7 @@ def Helper__CreateFileLineComment( ) -> PostgresConfigurationFile_Base: assert fileLineDataItem is not None assert fileLine is not None - assert type(fileLineDataItem) == PgCfgModel__FileLineData.tagItem + assert type(fileLineDataItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 assert isinstance(fileLine, PostgresConfigurationFileLine_Base) return PostgresConfigurationComment_Base(fileLine, fileLineDataItem) @@ -3146,7 +3200,7 @@ def Helper__CreateOption( ) -> PostgresConfigurationFile_Base: assert objectData is not None assert objectParent is not None - assert type(objectData) == PgCfgModel__OptionData + assert type(objectData) == PgCfgModel__OptionData # noqa: E721 assert isinstance(objectParent, PostgresConfigurationFileLine_Base) return PostgresConfigurationOption_Base(objectParent, objectData) @@ -3163,13 +3217,13 @@ def LoadConfigurationFile( assert cfg is not None assert isinstance(cfg, PostgresConfiguration_Base) - assert type(filePath) == str + assert type(filePath) == str # noqa: E721 assert filePath != "" existFileDatas: typing.Dict[str, PgCfgModel__FileData] = dict() for fileName in cfg.m_Data.m_AllFilesByName.keys(): - assert type(fileName) == str + assert type(fileName) == str # noqa: E721 assert fileName != "" indexData = cfg.m_Data.m_AllFilesByName[fileName] @@ -3179,15 +3233,15 @@ def LoadConfigurationFile( if typeOfIndexData == PgCfgModel__FileData: fileData: PgCfgModel__FileData = indexData - assert type(fileData.m_Path) == str + assert type(fileData.m_Path) == str # noqa: E721 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 - assert type(fileData.m_Path) == str + assert type(fileData) == PgCfgModel__FileData # noqa: E721 + assert type(fileData.m_Path) == str # noqa: E721 assert not (fileData.m_Path in existFileDatas.keys()) existFileDatas[fileData.m_Path] = fileData continue @@ -3196,8 +3250,10 @@ def LoadConfigurationFile( BugCheckError.UnkFileObjectDataType(fileName, typeOfIndexData) # ---------------------------------------------------------------- - filePath_n = Helpers.NormalizeFilePath(cfg.m_Data.OsOps, cfg.m_Data.m_DataDir, filePath) - assert type(filePath_n) == str + filePath_n = Helpers.NormalizeFilePath( + cfg.m_Data.OsOps, cfg.m_Data.m_DataDir, filePath + ) + assert type(filePath_n) == str # noqa: E721 if filePath_n in existFileDatas: return PostgresConfigurationFactory_Base.GetObject( @@ -3206,9 +3262,9 @@ def LoadConfigurationFile( # ---------------------------------------------------------------- rootFile = cfg.AddTopLevelFile(filePath) - assert type(rootFile) == PostgresConfigurationTopLevelFile_Base - assert type(rootFile.m_FileData) == PgCfgModel__FileData - assert type(rootFile.m_FileData.m_Lines) == list + 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 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 @@ -3232,7 +3288,7 @@ def LoadConfigurationFile( __class__.Helper__LoadFileContent(currentFile, f) # raise lastMDate = f.GetModificationTS() - assert type(lastMDate) == datetime.datetime + assert type(lastMDate) == datetime.datetime # noqa: E721 currentFileData.m_LastModifiedTimestamp = lastMDate currentFileData.m_Status = PgCfgModel__FileStatus.EXISTS @@ -3242,11 +3298,13 @@ def LoadConfigurationFile( # enumerate all the includes for fileLineData in currentFileData.m_Lines: - assert type(fileLineData) == PgCfgModel__FileLineData - assert type(fileLineData.m_Items) == list + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 + assert type(fileLineData.m_Items) == list # noqa: E721 for fileLineItem in fileLineData.m_Items: - assert type(fileLineItem) == PgCfgModel__FileLineData.tagItem + assert ( + type(fileLineItem) == PgCfgModel__FileLineData.tagItem + ) # noqa: E721 fileLineElementData = fileLineItem.m_Element @@ -3261,8 +3319,10 @@ def LoadConfigurationFile( if typeOfFileLineElementData == PgCfgModel__IncludeData: # look at existFileDatas includeData: PgCfgModel__IncludeData = fileLineElementData - assert type(includeData.m_File) == PgCfgModel__FileData - assert type(includeData.m_File.m_Path) == str + assert ( + type(includeData.m_File) == PgCfgModel__FileData + ) # noqa: E721 + assert type(includeData.m_File.m_Path) == str # noqa: E721 if includeData.m_File.m_Path in existFileDatas: continue # it is an old file @@ -3310,7 +3370,7 @@ def Helper__LoadFileContent( assert lineData is None break - assert type(lineData) == str + assert type(lineData) == str # noqa: E721 lineReader.SetData(lineData) @@ -3321,10 +3381,10 @@ def Helper__ProcessLineData( file: PostgresConfigurationFile_Base, lineReader: ReadUtils__LineReader ): assert isinstance(file, PostgresConfigurationFile_Base) - assert type(lineReader) == ReadUtils__LineReader + assert type(lineReader) == ReadUtils__LineReader # noqa: E721 fileLine = file.AddEmptyLine() - assert type(fileLine) == PostgresConfigurationFileLine_Base + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 ch: typing.Optional[str] @@ -3360,7 +3420,7 @@ def Helper__ProcessLineData( assert ch is None break - assert type(ch) == str + assert type(ch) == str # noqa: E721 if ReadUtils.IsValidSeqCh2(ch): sequence += ch @@ -3396,8 +3456,8 @@ def Helper__ProcessLineData( def Helper__ProcessLineData__Comment( fileLine: PostgresConfigurationFileLine_Base, lineReader: ReadUtils__LineReader ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(lineReader) == ReadUtils__LineReader + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(lineReader) == ReadUtils__LineReader # noqa: E721 commentText = "" commentOffset = lineReader.GetColOffset() @@ -3409,7 +3469,7 @@ def Helper__ProcessLineData__Comment( assert ch is None break - assert type(ch) == str + assert type(ch) == str # noqa: E721 if ReadUtils.IsEOL(ch): break @@ -3423,9 +3483,9 @@ def Helper__ProcessLineData__Include( lineReader: ReadUtils__LineReader, includeOffset: int, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(lineReader) == ReadUtils__LineReader - assert type(includeOffset) == int + assert type(fileLine) == PostgresConfigurationFileLine_Base # noqa: E721 + assert type(lineReader) == ReadUtils__LineReader # noqa: E721 + assert type(includeOffset) == int # noqa: E721 assert includeOffset >= 0 # find first quote @@ -3534,7 +3594,7 @@ def Helper__ProcessLineData__Include( filePath += ch continue - assert type(filePath) == str + assert type(filePath) == str # noqa: E721 if len(filePath) == 0: RaiseError.CfgReader__IncludeHasEmptyPath(lineReader.GetLineNum()) @@ -3548,10 +3608,10 @@ def Helper__ProcessLineData__Option( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(lineReader) == ReadUtils__LineReader - assert type(optionOffset) == int - assert type(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 optionName != "" # skeep spaces @@ -3610,10 +3670,10 @@ def Helper__ProcessLineData__Option__Quoted( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(lineReader) == ReadUtils__LineReader - assert type(optionOffset) == int - assert type(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 optionName != "" optionValue = "" @@ -3702,7 +3762,7 @@ def Helper__ProcessLineData__Option__Quoted( optionValue += ch continue - assert type(optionValue) == str + assert type(optionValue) == str # noqa: E721 fileLine.AddOption(optionName, optionValue, optionOffset) @@ -3713,10 +3773,10 @@ def Helper__ProcessLineData__Option__Generic( optionOffset: int, optionName: str, ): - assert type(fileLine) == PostgresConfigurationFileLine_Base - assert type(lineReader) == ReadUtils__LineReader - assert type(optionOffset) == int - assert type(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 optionName != "" optionValue = "" @@ -3728,7 +3788,7 @@ def Helper__ProcessLineData__Option__Generic( assert ch is None break - assert type(ch) == str + assert type(ch) == str # noqa: E721 if ch == "#" or ReadUtils.IsEOL(ch): lineReader.StepBack() @@ -3739,7 +3799,7 @@ def Helper__ProcessLineData__Option__Generic( optionValue = optionValue.strip() - assert type(optionValue) == str + assert type(optionValue) == str # noqa: E721 assert optionValue != "" fileLine.AddOption(optionName, optionValue, optionOffset) @@ -3760,7 +3820,7 @@ class PostgresConfigurationWriterFileCtx_Base: # -------------------------------------------------------------------- def __init__(self, fileData: PgCfgModel__FileData): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 self.FileData = fileData self.Content = None @@ -3789,15 +3849,15 @@ def __init__(self, cfg: PostgresConfiguration_Base): self.NewFiles = list() self.UpdFiles = list() - assert type(self.AllFiles) == list - assert type(self.NewFiles) == list - assert type(self.UpdFiles) == list + assert type(self.AllFiles) == list # noqa: E721 + assert type(self.NewFiles) == list # noqa: E721 + assert type(self.UpdFiles) == list # noqa: E721 # -------------------------------------------------------------------- def Init(self): - assert type(self.AllFiles) == list - assert type(self.NewFiles) == list - assert type(self.UpdFiles) == list + assert type(self.AllFiles) == list # noqa: E721 + assert type(self.NewFiles) == list # noqa: E721 + assert type(self.UpdFiles) == list # noqa: E721 self.AllFiles.clear() self.NewFiles.clear() @@ -3812,24 +3872,24 @@ class PostgresConfigurationWriter_Base: def MakeFileDataContent( ctx: PostgresConfigurationWriterCtx_Base, fileData: PgCfgModel__FileData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base - assert type(fileData) == PgCfgModel__FileData + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 return __class__.Helper__MakeFileDataContent(ctx, fileData) # -------------------------------------------------------------------- def DoWork(ctx: PostgresConfigurationWriterCtx_Base): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 return __class__.Helper__DoWork(ctx) # Helper Methods ----------------------------------------------------- def Helper__DoWork(ctx: PostgresConfigurationWriterCtx_Base): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 # 0. ctx.Init() @@ -3856,13 +3916,13 @@ def Helper__DoWork(ctx: PostgresConfigurationWriterCtx_Base): def Helper__DoWork__Stage01__CreateFileContexts( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 for fileData in ctx.Cfg.m_Data.m_AllFilesByName.values(): assert fileData is not None - assert type(fileData) == PgCfgModel__FileData + assert type(fileData) == PgCfgModel__FileData # noqa: E721 fileCtx = PostgresConfigurationWriterFileCtx_Base(fileData) @@ -3887,14 +3947,16 @@ def Helper__DoWork__Stage01__CreateFileContexts( def Helper__DoWork__Stage02__MakeFileDataContents( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 for fileCtx in ctx.AllFiles: assert fileCtx is not None - assert type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - assert type(fileCtx.FileData) == PgCfgModel__FileData + assert ( + type(fileCtx) == PostgresConfigurationWriterFileCtx_Base + ) # noqa: E721 + assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 assert fileCtx.Content is None fileCtx.Content = __class__.Helper__MakeFileDataContent( @@ -3905,28 +3967,34 @@ def Helper__DoWork__Stage02__MakeFileDataContents( def Helper__DoWork__Stage03__OpenUpdFilesToWrite( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 for fileCtx in ctx.UpdFiles: assert fileCtx is not None - assert type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - assert type(fileCtx.FileData) == PgCfgModel__FileData + assert ( + type(fileCtx) == PostgresConfigurationWriterFileCtx_Base + ) # noqa: E721 + assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.EXISTS assert fileCtx.FileData.m_LastModifiedTimestamp is not None - assert type(fileCtx.FileData.m_LastModifiedTimestamp) == datetime.datetime + assert ( + type(fileCtx.FileData.m_LastModifiedTimestamp) == datetime.datetime + ) # noqa: E721 assert fileCtx.File is None # Let's open an exist file to read and write without truncation - fileCtx.File = ctx.Cfg.m_Data.OsOps.OpenFileToWrite(fileCtx.FileData.m_Path) # raise + fileCtx.File = ctx.Cfg.m_Data.OsOps.OpenFileToWrite( + fileCtx.FileData.m_Path + ) # raise assert fileCtx.File is not None assert isinstance(fileCtx.File, ConfigurationOsFile) lastMDate = fileCtx.File.GetModificationTS() - assert type(lastMDate) == datetime.datetime + assert type(lastMDate) == datetime.datetime # noqa: E721 if fileCtx.FileData.m_LastModifiedTimestamp != lastMDate: RaiseError.FileWasModifiedExternally( @@ -3945,10 +4013,10 @@ def Helper__DoWork__Stage03__OpenUpdFilesToWrite( def Helper__DoWork__Stage04__OpenNewFilesToWrite( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData - assert type(ctx.NewFiles) == list + assert type(ctx.Cfg.m_Data) == PgCfgModel__ConfigurationData # noqa: E721 + assert type(ctx.NewFiles) == list # noqa: E721 iFile = 0 @@ -3957,13 +4025,17 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( fileCtx = ctx.NewFiles[iFile] assert fileCtx is not None - assert type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - assert type(fileCtx.FileData) == PgCfgModel__FileData + assert ( + type(fileCtx) == PostgresConfigurationWriterFileCtx_Base + ) # noqa: E721 + assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert fileCtx.File is None - fileCtx.File = ctx.Cfg.m_Data.OsOps.CreateFile(fileCtx.FileData.m_Path) # raise + fileCtx.File = ctx.Cfg.m_Data.OsOps.CreateFile( + fileCtx.FileData.m_Path + ) # raise assert fileCtx.File is not None assert isinstance(fileCtx.File, ConfigurationOsFile) @@ -3972,7 +4044,7 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( continue except: # Rollback new files - assert type(iFile) == int + assert type(iFile) == int # noqa: E721 assert iFile >= 0 assert iFile <= len(ctx.NewFiles) @@ -3980,8 +4052,10 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( fileCtx = ctx.NewFiles[iFile2] assert fileCtx is not None - assert type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - assert type(fileCtx.FileData) == PgCfgModel__FileData + assert ( + type(fileCtx) == PostgresConfigurationWriterFileCtx_Base + ) # noqa: E721 + assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 assert fileCtx.FileData.m_Status == PgCfgModel__FileStatus.IS_NEW assert fileCtx.File is not None @@ -3991,7 +4065,7 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( filePath = fileCtx.File.Name assert filePath is not None - assert type(filePath) == str + assert type(filePath) == str # noqa: E721 assert filePath == fileCtx.FileData.m_Path fileCtx.File.Close() # raise @@ -4008,25 +4082,27 @@ def Helper__DoWork__Stage04__OpenNewFilesToWrite( def Helper__DoWork__Stage05__WriteContents( ctx: PostgresConfigurationWriterCtx_Base, ): - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 for iFile in range(len(ctx.AllFiles)): fileCtx = ctx.AllFiles[iFile] assert fileCtx is not None - assert type(fileCtx) == PostgresConfigurationWriterFileCtx_Base - assert type(fileCtx.FileData) == PgCfgModel__FileData + assert ( + type(fileCtx) == PostgresConfigurationWriterFileCtx_Base + ) # noqa: E721 + assert type(fileCtx.FileData) == PgCfgModel__FileData # noqa: E721 assert fileCtx.File is not None assert isinstance(fileCtx.File, ConfigurationOsFile) assert fileCtx.Content is not None - assert type(fileCtx.Content) == str + assert type(fileCtx.Content) == str # noqa: E721 fileCtx.File.Overwrite(fileCtx.Content) lastMDate = fileCtx.File.GetModificationTS() - assert type(lastMDate) == datetime.datetime + assert type(lastMDate) == datetime.datetime # noqa: E721 fileCtx.File.Close() @@ -4037,15 +4113,15 @@ def Helper__DoWork__Stage05__WriteContents( def Helper__MakeFileDataContent( ctx: PostgresConfigurationWriterCtx_Base, fileData: PgCfgModel__FileData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base - assert type(fileData) == PgCfgModel__FileData + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(fileData) == PgCfgModel__FileData # noqa: E721 fileContent = "" for fileLineData in fileData.m_Lines: - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 lineContent = __class__.Helper__FileLineToString(ctx, fileLineData) - assert type(lineContent) == str + assert type(lineContent) == str # noqa: E721 fileContent += lineContent fileContent += "\n" @@ -4056,8 +4132,8 @@ def Helper__FileLineToString( ctx: PostgresConfigurationWriterCtx_Base, fileLineData: PgCfgModel__FileLineData, ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base - assert type(fileLineData) == PgCfgModel__FileLineData + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 + assert type(fileLineData) == PgCfgModel__FileLineData # noqa: E721 fileLineItemCount = len(fileLineData.m_Items) @@ -4067,34 +4143,33 @@ def Helper__FileLineToString( lineContent = "" for lineItem in fileLineData.m_Items: - assert type(lineItem) == PgCfgModel__FileLineData.tagItem - assert type(lineItem) == PgCfgModel__FileLineData.tagItem + assert type(lineItem) == PgCfgModel__FileLineData.tagItem # noqa: E721 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 + or type(lineItem.m_Element.m_Offset) == int # noqa: E721 ) 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 + assert type(itemContent) == str # noqa: E721 lineContent = __class__.Helper__AppendItemToLine( lineContent, lineItem.m_Element.m_Offset, itemContent ) - assert type(lineContent) == str + assert type(lineContent) == str # noqa: E721 - assert type(lineContent) == str + assert type(lineContent) == str # noqa: E721 return lineContent # -------------------------------------------------------------------- def Helper__AppendItemToLine(lineContent: str, offset: int, text: str) -> str: - assert type(lineContent) == str - assert offset is None or type(offset) == int - assert type(text) == str + assert type(lineContent) == str # noqa: E721 + assert offset is None or type(offset) == int # noqa: E721 + assert type(text) == str # noqa: E721 assert offset is None or offset >= 0 if text == "": @@ -4102,7 +4177,7 @@ def Helper__AppendItemToLine(lineContent: str, offset: int, text: str) -> str: lineContentLen = len(lineContent) - assert type(lineContentLen) == int + assert type(lineContentLen) == int # noqa: E721 assert lineContentLen >= 0 if offset is not None and lineContentLen < offset: @@ -4118,7 +4193,7 @@ def Helper__ElementToString( ctx: PostgresConfigurationWriterCtx_Base, elementData: PgCfgModel__FileLineElementData, ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert elementData is not None assert isinstance(elementData, PgCfgModel__FileLineElementData) @@ -4139,11 +4214,11 @@ def Helper__ElementToString( def Helper__OptionToString( ctx: PostgresConfigurationWriterCtx_Base, optionData: PgCfgModel__OptionData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(optionData) == PgCfgModel__OptionData - assert type(optionData.m_Name) == str + assert type(optionData) == PgCfgModel__OptionData # noqa: E721 + assert type(optionData.m_Name) == str # noqa: E721 assert optionData.m_Name != "" assert optionData.m_Value is not None @@ -4158,7 +4233,7 @@ def Helper__OptionToString( optValueAsText = writeHandler.OptionValueToString(writeHandlerCtx) - assert type(optValueAsText) == str + assert type(optValueAsText) == str # noqa: E721 assert optValueAsText != "" result = optionData.m_Name + " = " + optValueAsText @@ -4168,12 +4243,12 @@ def Helper__OptionToString( def Helper__CommentToString( ctx: PostgresConfigurationWriterCtx_Base, commentData: PgCfgModel__CommentData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(commentData) == PgCfgModel__CommentData + assert type(commentData) == PgCfgModel__CommentData # noqa: E721 assert commentData.m_Text is not None - assert type(commentData.m_Text) == str + assert type(commentData.m_Text) == str # noqa: E721 assert DataVerificator.IsValidCommentText(commentData.m_Text) @@ -4184,17 +4259,17 @@ def Helper__CommentToString( def Helper__IncludeToString( ctx: PostgresConfigurationWriterCtx_Base, includeData: PgCfgModel__IncludeData ) -> str: - assert type(ctx) == PostgresConfigurationWriterCtx_Base + assert type(ctx) == PostgresConfigurationWriterCtx_Base # noqa: E721 assert ctx.Cfg is not None assert isinstance(ctx.Cfg, PostgresConfiguration_Base) - assert type(includeData) == PgCfgModel__IncludeData + assert type(includeData) == PgCfgModel__IncludeData # noqa: E721 assert includeData.m_Path is not None - assert type(includeData.m_Path) == str + assert type(includeData.m_Path) == str # noqa: E721 assert includeData.m_Path != "" result = "include " + WriteUtils.Pack_Str(includeData.m_Path) - assert type(result) == str + assert type(result) == str # noqa: E721 assert result != "" return result @@ -4214,12 +4289,12 @@ def AddOption( assert isinstance(cfg, PostgresConfiguration_Base) assert ( target is None - or type(target) == PgCfgModel__FileData - or type(target) == PgCfgModel__FileLineData + or type(target) == PgCfgModel__FileData # noqa: E721 + or type(target) == PgCfgModel__FileLineData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None - assert optionOffset is None or type(optionOffset) == int + assert optionOffset is None or type(optionOffset) == int # noqa: E721 # ---------------------- preparedOptionValue = __class__.Helper__PrepareSetValue( @@ -4243,7 +4318,7 @@ def AddOption( option = addHandler.AddOption(ctx) assert option is not None - assert type(option) == PostgresConfigurationOption_Base + assert type(option) == PostgresConfigurationOption_Base # noqa: E721 return option # -------------------------------------------------------------------- @@ -4257,11 +4332,11 @@ def SetOptionValue( assert isinstance(cfg, PostgresConfiguration_Base) assert ( targetData is None - or type(targetData) == PgCfgModel__FileData - or type(targetData) == PgCfgModel__OptionData + or type(targetData) == PgCfgModel__FileData # noqa: E721 + or type(targetData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str - assert optionOffset is None or type(optionOffset) == int + assert type(optionName) == str # noqa: E721 + assert optionOffset is None or type(optionOffset) == int # noqa: E721 # ---------------------- if optionValue is None: @@ -4290,7 +4365,7 @@ def SetOptionValue( r = setHandler.SetOptionValue(ctx) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base + assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 return r @@ -4304,10 +4379,10 @@ def SetOptionValueItem( assert isinstance(cfg, PostgresConfiguration_Base) assert ( targetData is None - or type(targetData) == PgCfgModel__FileData - or type(targetData) == PgCfgModel__OptionData + or type(targetData) == PgCfgModel__FileData # noqa: E721 + or type(targetData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 # --------------------------------------- if optionValueItem is None: @@ -4336,7 +4411,7 @@ def SetOptionValueItem( r = setHandler.SetOptionValueItem(ctx) - assert type(r) == PostgresConfigurationSetOptionValueResult_Base + assert type(r) == PostgresConfigurationSetOptionValueResult_Base # noqa: E721 return r @@ -4349,10 +4424,10 @@ def GetOptionValue( assert isinstance(cfg, PostgresConfiguration_Base) assert ( sourceData is None - or type(sourceData) == PgCfgModel__FileData - or type(sourceData) == PgCfgModel__OptionData + or type(sourceData) == PgCfgModel__FileData # noqa: E721 + or type(sourceData) == PgCfgModel__OptionData # noqa: E721 ) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 getHandler = cfg.Internal__GetOptionHandlerToGetValue(optionName) @@ -4368,10 +4443,7 @@ def Helper__PrepareSetValue( cfg: PostgresConfiguration_Base, optionName: str, optionValue: any ) -> any: assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optionName) == str - assert optionValue is not None - - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 assert optionValue is not None prepareHandler = cfg.Internal__GetOptionHandlerToPrepareSetValue(optionName) @@ -4389,7 +4461,7 @@ def Helper__PrepareSetValueItem( cfg: PostgresConfiguration_Base, optionName: str, optionValueItem: any ) -> any: assert isinstance(cfg, PostgresConfiguration_Base) - assert type(optionName) == str + assert type(optionName) == str # noqa: E721 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 93bd863..3c86c0a 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 + assert type(data_dir) == str # noqa: E721 assert cfgOsOps is None or isinstance(cfgOsOps, ConfigurationOsOps) if cfgOsOps is None: @@ -322,23 +322,22 @@ def __init__(self, data_dir: str, cfgOsOps: ConfigurationOsOps = None): # -------------------------------------------------------------------- @staticmethod def Create(data_dir: str) -> PostgresConfiguration_Std: - assert type(data_dir) == str + assert type(data_dir) == str # noqa: E721 assert isinstance(LocalCfgOsOps, ConfigurationOsOps) return __class__(data_dir, LocalCfgOsOps) # -------------------------------------------------------------------- @staticmethod def CreateWithCfgOsOps( - data_dir: str, - cfgOsOps: ConfigurationOsOps + data_dir: str, cfgOsOps: ConfigurationOsOps ) -> PostgresConfiguration_Std: - assert type(data_dir) == str + assert type(data_dir) == str # noqa: E721 assert isinstance(cfgOsOps, ConfigurationOsOps) return __class__(data_dir, cfgOsOps) # PostgresConfiguration_Base interface ------------------------------- def Internal__GetAutoConfFileName(self): - assert type(__class__.C_POSTGRESQL_AUTO_CONF) == str + assert type(__class__.C_POSTGRESQL_AUTO_CONF) == str # noqa: E721 assert __class__.C_POSTGRESQL_AUTO_CONF != "" return __class__.C_POSTGRESQL_AUTO_CONF @@ -346,11 +345,11 @@ def Internal__GetAutoConfFileName(self): def Internal__GetOptionHandlerToPrepareSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.PrepareSetValue is None: BugCheckError.OptionHandlerToPrepareSetValueIsNotDefined(name) @@ -365,11 +364,11 @@ def Internal__GetOptionHandlerToPrepareSetValue( def Internal__GetOptionHandlerToPrepareGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValue: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.PrepareGetValue is None: BugCheckError.OptionHandlerToPrepareGetValueIsNotDefined(name) @@ -384,11 +383,11 @@ def Internal__GetOptionHandlerToPrepareGetValue( def Internal__GetOptionHandlerToPrepareSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToPrepareSetValueItem: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.PrepareSetValueItem is None: BugCheckError.OptionHandlerToPrepareSetValueItemIsNotDefined(name) @@ -404,11 +403,11 @@ def Internal__GetOptionHandlerToPrepareSetValueItem( def Internal__GetOptionHandlerToSetValue( self, name: str ) -> PgCfgModel__OptionHandlerToSetValue: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.SetValue is None: BugCheckError.OptionHandlerToSetValueIsNotDefined(name) @@ -421,11 +420,11 @@ def Internal__GetOptionHandlerToSetValue( def Internal__GetOptionHandlerToGetValue( self, name: str ) -> PgCfgModel__OptionHandlerToGetValue: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.GetValue is None: BugCheckError.OptionHandlerToGetValueIsNotDefined(name) @@ -438,11 +437,11 @@ def Internal__GetOptionHandlerToGetValue( def Internal__GetOptionHandlerToAddOption( self, name: str ) -> PgCfgModel__OptionHandlerToAddOption: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.AddOption is None: BugCheckError.OptionHandlerToAddOptionIsNotDefined(name) @@ -457,11 +456,11 @@ def Internal__GetOptionHandlerToAddOption( def Internal__GetOptionHandlerToSetValueItem( self, name: str ) -> PgCfgModel__OptionHandlerToSetValueItem: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.SetValueItem is None: BugCheckError.OptionHandlerToSetValueIsNotDefined(name) @@ -476,11 +475,11 @@ def Internal__GetOptionHandlerToSetValueItem( def Internal__GetOptionHandlerToWrite( self, name: str ) -> PgCfgModel__OptionHandlerToWrite: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 optionHandlers = self.Helper__GetOptionHandlers(name) - assert type(optionHandlers) == __class__.tagOptionHandlers + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 if optionHandlers.Write is None: BugCheckError.OptionHandlerToWriteIsNotDefined(name) @@ -491,8 +490,8 @@ def Internal__GetOptionHandlerToWrite( # Helper methods ----------------------------------------------------- def Helper__GetOptionHandlers(self, name: str) -> tagOptionHandlers: - assert type(name) == str - assert type(self.sm_OptionHandlers) == dict + assert type(name) == str # noqa: E721 + assert type(self.sm_OptionHandlers) == dict # noqa: E721 if not (name in self.sm_OptionHandlers.keys()): return __class__.sm_OptionHandlers__Std__Generic @@ -500,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 + assert type(optionHandlers) == __class__.tagOptionHandlers # noqa: E721 return self.sm_OptionHandlers[name] diff --git a/src/os/abstract/configuration_os_ops.py b/src/os/abstract/configuration_os_ops.py index 209db11..23ac0fc 100644 --- a/src/os/abstract/configuration_os_ops.py +++ b/src/os/abstract/configuration_os_ops.py @@ -95,4 +95,5 @@ def CreateFile(self, filePath: str) -> ConfigurationOsFile: assert type(filePath) == str # noqa: E721 RaiseError.MethodIsNotImplemented(__class__, "CreateFile") + # ////////////////////////////////////////////////////////////////////////////// diff --git a/tests/ErrorMessageBuilder.py b/tests/ErrorMessageBuilder.py index fc320bf..ff951e5 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 - assert type(methodName) == str + assert type(classType) == type # noqa: E721 + assert type(methodName) == str # noqa: E721 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 - assert type(methodName) == str + assert type(classType) == type # noqa: E721 + assert type(methodName) == str # noqa: E721 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 + assert type(nameType) == type # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 - assert type(optionValueType) == type - assert type(expectedType) == type + assert type(optionName) == str # noqa: E721 + assert type(optionValueType) == type # noqa: E721 + assert type(expectedType) == type # noqa: E721 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 - assert type(sourceType) == type - assert type(targetType) == type + assert type(optionName) == str # noqa: E721 + assert type(sourceType) == type # noqa: E721 + assert type(targetType) == type # noqa: E721 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 - assert type(optionValueItemType) == type - assert type(expectedType) == type + assert type(optionName) == str # noqa: E721 + assert type(optionValueItemType) == type # noqa: E721 + assert type(expectedType) == type # noqa: E721 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 - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 assert filePath != "" assert optionName != "" @@ -149,8 +149,8 @@ def OptionIsAlreadyExistInThisFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): - assert type(filePath) == str - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 assert filePath != "" assert optionName != "" @@ -161,8 +161,8 @@ def OptionIsAlreadyExistInAnotherFile(filePath: str, optionName: str): # -------------------------------------------------------------------- def OptionIsAlreadyExistInFile(filePath: str, optionName: str): - assert type(filePath) == str - assert type(optionName) == str + assert type(filePath) == str # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optName) == str + assert type(filePath) == str # noqa: E721 + assert type(optName) == str # noqa: E721 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 - assert type(optName) == str + assert type(filePath) == str # noqa: E721 + assert type(optName) == str # noqa: E721 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 + assert type(fileName) == str # noqa: E721 errMsg = "Unknown file name [{0}].".format(fileName) return errMsg # -------------------------------------------------------------------- def MultipleDefOfFileIsFound(fileName: str, count: int): - assert type(fileName) == str - assert type(count) == int + assert type(fileName) == str # noqa: E721 + assert type(count) == int # noqa: E721 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 - assert type(ourLastMDate) == datetime.datetime - assert type(curLastMDate) == datetime.datetime + assert type(filePath) == str # noqa: E721 + assert type(ourLastMDate) == datetime.datetime # noqa: E721 + assert type(curLastMDate) == datetime.datetime # noqa: E721 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 + assert type(optionName) == str # noqa: E721 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 - assert type(colNum) == int - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(colNum) == int # noqa: E721 + assert type(ch) == str # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 - assert type(colNum) == int - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(colNum) == int # noqa: E721 + assert type(ch) == str # noqa: E721 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 + assert type(lineNum) == int # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 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 - assert type(optionName) == str - assert type(ch) == str + assert type(lineNum) == int # noqa: E721 + assert type(optionName) == str # noqa: E721 + assert type(ch) == str # noqa: E721 assert lineNum >= 0 assert optionName != "" assert ch != ""