From 7a200f888088a52f2a728777b49e278d4af1ea2a Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Tue, 24 Feb 2026 08:35:53 +0300 Subject: [PATCH 1/3] Tests are checked with ruff --- tests/TestConfigHelper.py | 8 ++++---- .../SetOptionValueItem/test_set001__common.py | 2 +- .../get_AllOptions/test_set001__common.py | 2 +- .../AddInclude/test_set001__common.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/TestConfigHelper.py b/tests/TestConfigHelper.py index 8275043..e5a99a3 100644 --- a/tests/TestConfigHelper.py +++ b/tests/TestConfigHelper.py @@ -13,7 +13,7 @@ class TestConfigHelper: def NoCleanup() -> bool: - if not (TestConfigPropNames.TEST_CFG__NO_CLEANUP in os.environ.keys()): + if TestConfigPropNames.TEST_CFG__NO_CLEANUP not in os.environ.keys(): return False v = os.environ[TestConfigPropNames.TEST_CFG__NO_CLEANUP] @@ -31,10 +31,10 @@ def Helper__ToBoolean(v, envVarName: str) -> bool: typeV = type(v) - if typeV == bool: + if typeV is bool: return v - if typeV == str: + if typeV is str: vv = str(v).upper() if vv in __class__.sm_YES: @@ -45,7 +45,7 @@ def Helper__ToBoolean(v, envVarName: str) -> bool: ThrowError.EnvVarHasBadValue(envVarName) - if typeV == int: + if typeV is int: if v == 0: return False diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py index 9ba374d..9004263 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/SetOptionValueItem/test_set001__common.py @@ -92,7 +92,7 @@ def test_002(self, request: pytest.FixtureRequest): ) ) - optValueWillBeAdded = not (optValue in index) + optValueWillBeAdded = optValue not in index assert type(optValueWillBeAdded) is bool if optValueWillBeAdded: diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py index ee01010..0fee721 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfiguration/get_AllOptions/test_set001__common.py @@ -144,7 +144,7 @@ def test_004__two_options(self, request: pytest.FixtureRequest): assert isinstance(opt, PgCfg_Option) assert type(opt) is PgCfg_Option_Base - assert not opt.get_Name() in names + assert opt.get_Name() not in names names.add(opt.get_Name()) diff --git a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py index e60de43..c66df52 100644 --- a/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py +++ b/tests/implementation/v00/configuration_std/Objects/PostgresConfigurationTopLevelFile/AddInclude/test_set001__common.py @@ -69,7 +69,7 @@ def test_001(self, request: pytest.FixtureRequest): ) assert file1.m_FileData in cfg.m_Data.m_Files - assert not (bihaConfFile.m_FileData in cfg.m_Data.m_Files) + assert bihaConfFile.m_FileData not in cfg.m_Data.m_Files assert len(cfg.m_Data.m_Files) == 1 assert cfg.m_Data.m_Files[0] is file1.m_FileData From 30da19f56de3f4930ce381428642de2383a46190 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Tue, 24 Feb 2026 09:25:02 +0300 Subject: [PATCH 2/3] Src is checked with ruff --- src/core/bugcheck_error.py | 2 +- src/core/controller_utils.py | 22 ++-- src/core/helpers.py | 4 +- ..._handler_to_prepare_set_value__std__int.py | 4 +- ..._handler_to_prepare_set_value__std__str.py | 2 +- ...prepare_set_value__std__unique_str_list.py | 4 +- ...ler_to_prepare_set_value_item__std__str.py | 2 +- .../option_handler_to_write__std__generic.py | 6 +- src/implementation/v00/configuration_base.py | 104 +++++++++--------- src/implementation/v00/configuration_std.py | 2 +- 10 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/core/bugcheck_error.py b/src/core/bugcheck_error.py index 76566e3..14af6e2 100644 --- a/src/core/bugcheck_error.py +++ b/src/core/bugcheck_error.py @@ -195,7 +195,7 @@ def UnexpectedSituation(bugcheckSrc: str, bugcheckPoint: str, explain: str): bugcheckSrc, bugcheckPoint ) - if not (explain is None) and explain != "": + if explain is not None and explain != "": errMsg += " " errMsg += explain diff --git a/src/core/controller_utils.py b/src/core/controller_utils.py index 78ba8b4..52be385 100644 --- a/src/core/controller_utils.py +++ b/src/core/controller_utils.py @@ -545,7 +545,7 @@ def Helper__InsertFileIntoIndex( assert fileKey != "" assert fileData.IsAlive() - if not (fileKey in filesByStrKeyDictionary.keys()): + if fileKey not in filesByStrKeyDictionary.keys(): filesByStrKeyDictionary[fileKey] = fileData else: indexItemData = filesByStrKeyDictionary[fileKey] @@ -574,7 +574,7 @@ def Helper__DeleteFileIntoIndex( assert fileKey != "" assert fileData.IsAlive() - if not (fileKey in filesByStrKeyDictionary.keys()): + if fileKey not in filesByStrKeyDictionary.keys(): BugCheckError.FileIsNotFoundInIndex(fileKey, fileData.m_Path) indexItemData = filesByStrKeyDictionary[fileKey] @@ -586,14 +586,14 @@ def Helper__DeleteFileIntoIndex( if typeOfIndexItemData == fileData: assert indexItemData is fileData - if not (indexItemData is fileData): + if indexItemData is not fileData: BugCheckError.FileIsNotFoundInIndex(fileKey, fileData.m_Path) filesByStrKeyDictionary.pop(fileKey) - assert not (fileKey in filesByStrKeyDictionary.keys()) + assert fileKey not in filesByStrKeyDictionary.keys() return - if typeOfIndexItemData == list: + if typeOfIndexItemData is list: assert type(indexItemData) is list assert len(indexItemData) > 1 @@ -635,7 +635,7 @@ def Helper__InsertOptionIntoIndex( assert type(optionsByNameDictionary) is dict assert type(optionData) is PgCfgModel__OptionData - if not (optionData.m_Name in optionsByNameDictionary.keys()): + if optionData.m_Name not in optionsByNameDictionary.keys(): optionsByNameDictionary[optionData.m_Name] = optionData return @@ -666,7 +666,7 @@ def Helper__DeleteOptionFromIndex( assert type(optionsByNameDictionary) is dict assert type(optionData) is PgCfgModel__OptionData - if not (optionData.m_Name in optionsByNameDictionary.keys()): + if optionData.m_Name not in optionsByNameDictionary.keys(): BugCheckError.OptionIsNotFoundInIndex(optionData.m_Name) data = optionsByNameDictionary[optionData.m_Name] @@ -675,17 +675,17 @@ def Helper__DeleteOptionFromIndex( typeOfData = type(data) - if typeOfData == PgCfgModel__OptionData: + if typeOfData is PgCfgModel__OptionData: assert data is optionData - if not (data is optionData): + if data is not optionData: BugCheckError.OptionIsNotFoundInIndex(optionData.m_Name) optionsByNameDictionary.pop(optionData.m_Name) - assert not (optionData.m_Name in optionsByNameDictionary.keys()) + assert optionData.m_Name not in optionsByNameDictionary.keys() return - if typeOfData == list: + if typeOfData is list: assert type(data) is list assert len(data) > 1 diff --git a/src/core/helpers.py b/src/core/helpers.py index dce2327..c5092d8 100644 --- a/src/core/helpers.py +++ b/src/core/helpers.py @@ -33,11 +33,11 @@ def ExtractFirstOptionFromIndexItem( typeOfIndexItem = type(indexItem) - if typeOfIndexItem == OptionData: + if typeOfIndexItem is OptionData: assert indexItem.m_Name == optionName return indexItem - if typeOfIndexItem == list: + if typeOfIndexItem is list: assert len(indexItem) > 1 assert indexItem[0] is not None assert type(indexItem[0]) is OptionData 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 aa5063f..f33fb4a 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 @@ -26,13 +26,13 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: + if typeOfOptionValue is int: return ctx.OptionValue optionName = ctx.OptionName assert type(optionName) is str - if typeOfOptionValue == str: + if typeOfOptionValue is str: if not str(ctx.OptionValue).isnumeric(): RaiseError.CantConvertOptionValue(optionName, typeOfOptionValue, int) 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 e0487c0..51ddc44 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 @@ -26,7 +26,7 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue != str: + if typeOfOptionValue is not str: optionName = ctx.OptionName assert type(optionName) is str RaiseError.BadOptionValueType(optionName, typeOfOptionValue, str) 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 009c9ac..78d1854 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 @@ -32,12 +32,12 @@ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any: typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == str: + if typeOfOptionValue is str: result = ReadUtils.Unpack_StrList2(ctx.OptionValue) assert result is not None assert type(result) is list return result - elif typeOfOptionValue == list: + elif typeOfOptionValue is list: result: typing.List[str] = list() index: typing.Set[str] = set() 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 a14df8a..bc610fc 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 @@ -26,7 +26,7 @@ def PrepareSetValueItem(self, ctx: OptionHandlerCtxToPrepareSetValueItem) -> any typeOfOptionValue = type(ctx.OptionValueItem) - if typeOfOptionValue != str: + if typeOfOptionValue is not str: optionName = ctx.OptionName assert type(optionName) is str RaiseError.BadOptionValueItemType(optionName, typeOfOptionValue, str) 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 9ebf053..02dd59c 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 @@ -36,13 +36,13 @@ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str: typeOfOptionValue = type(ctx.OptionValue) - if typeOfOptionValue == int: + if typeOfOptionValue is int: return __class__.sm_Handler_For_Int.OptionValueToString(ctx) - if typeOfOptionValue == str: + if typeOfOptionValue is str: return __class__.sm_Handler_For_Str.OptionValueToString(ctx) - if typeOfOptionValue == bool: + if typeOfOptionValue is bool: return __class__.sm_Handler_For_Bool.OptionValueToString(ctx) BugCheckError.UnknownOptionValueType(ctx.OptionName, typeOfOptionValue) diff --git a/src/implementation/v00/configuration_base.py b/src/implementation/v00/configuration_base.py index cbec914..a2f25f0 100644 --- a/src/implementation/v00/configuration_base.py +++ b/src/implementation/v00/configuration_base.py @@ -1268,7 +1268,7 @@ def GetFileByName(self, file_name: str) -> PostgresConfigurationFile_Base: file_name2 = self.m_Cfg.m_Data.OsOps.Path_NormCase(file_name) - if not (file_name2 in self.m_Cfg.m_Data.m_AllFilesByName.keys()): + if file_name2 not in self.m_Cfg.m_Data.m_AllFilesByName.keys(): RaiseError.UnknownFileName(file_name) indexData = self.m_Cfg.m_Data.m_AllFilesByName[file_name2] @@ -1277,14 +1277,14 @@ def GetFileByName(self, file_name: str) -> PostgresConfigurationFile_Base: typeOfIndexData = type(indexData) - if typeOfIndexData == PgCfgModel__FileData: + if typeOfIndexData is PgCfgModel__FileData: assert self.m_Cfg.m_Data.OsOps.Path_BaseName(indexData.m_Path) == file_name2 file = PostgresConfigurationFactory_Base.GetObject(self.m_Cfg, indexData) assert file is not None assert isinstance(file, PostgresConfigurationFile_Base) return file - if typeOfIndexData == list: + if typeOfIndexData is list: assert len(typeOfIndexData) > 1 RaiseError.MultipleDefOfFileIsFound(file_name, len(indexData)) @@ -1668,7 +1668,7 @@ def DataHandler__GetOptionValue__UnionList( return self.Helper__PrepareGetValue(optionData.m_Name, optionData.m_Value) # -------------------------------------- FILE DATA - if typeOfSource == PgCfgModel__FileData: + if typeOfSource is PgCfgModel__FileData: sourceFileData: PgCfgModel__FileData = sourceData assert type(sourceFileData) is PgCfgModel__FileData @@ -1678,7 +1678,7 @@ def DataHandler__GetOptionValue__UnionList( typeOfOption = type(optionName) - if typeOfOption == str: + if typeOfOption is str: unionList = self.Helper__AggregateAllOptionValues( sourceFileData.m_OptionsByName, optionName ) @@ -1911,7 +1911,7 @@ def Helper__FindSimpleOption( assert type(allOptionsByName) is dict assert type(optionName) is str - if not (optionName in allOptionsByName.keys()): + if optionName not in allOptionsByName.keys(): return None data = allOptionsByName[optionName] @@ -1937,7 +1937,7 @@ def Helper__AggregateAllOptionValues( assert type(allOptionsByName) is dict assert type(optionName) is str - if not (optionName in allOptionsByName.keys()): + if optionName not in allOptionsByName.keys(): return None data = allOptionsByName[optionName] @@ -1945,14 +1945,14 @@ def Helper__AggregateAllOptionValues( typeOfData = type(data) - if typeOfData == PgCfgModel__OptionData: + if typeOfData is PgCfgModel__OptionData: assert data.IsAlive() assert data.m_Name == optionName assert data.m_Value is not None assert type(data.m_Value) is list return data.m_Value - if typeOfData == list: + if typeOfData is list: assert type(data) is list data = data.copy() assert type(data) is list @@ -1986,7 +1986,7 @@ def Helper__FindAndDeleteOption( assert type(allOptionsByName) is dict assert type(optionName) is str - if not (optionName in allOptionsByName.keys()): + if optionName not in allOptionsByName.keys(): return PostgresConfigurationSetOptionValueEventID.NONE data = allOptionsByName[optionName] @@ -2002,7 +2002,7 @@ def Helper__FindAndDeleteOption( return PostgresConfigurationSetOptionValueEventID.OPTION_WAS_DELETED - if typeOfData == list: + if typeOfData is list: assert type(data) is list data = data.copy() assert type(data) is list @@ -2018,7 +2018,7 @@ def Helper__FindAndDeleteOption( ) # [2025-01-02] It is expected - assert not (optionName in allOptionsByName.keys()) + assert optionName not in allOptionsByName.keys() return PostgresConfigurationSetOptionValueEventID.OPTION_WAS_DELETED @@ -2082,7 +2082,7 @@ def Helper__FindFile(self, file_name: str) -> PgCfgModel__FileData: file_name_n = self.m_Data.OsOps.Path_NormCase(file_name) - if not (file_name_n in self.m_Data.m_AllFilesByName.keys()): + if file_name_n not in self.m_Data.m_AllFilesByName.keys(): return None data = self.m_Data.m_AllFilesByName[file_name_n] @@ -2189,8 +2189,8 @@ def Helper__AddSimpleOption__Common( assert not optionData.IsAlive() - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) - assert not (optionName in fileData.m_OptionsByName.keys()) + assert optionName not in self.m_Data.m_AllOptionsByName.keys() + assert optionName not in fileData.m_OptionsByName.keys() raise except: # rollback file assert type(getFileData_r) is tuple @@ -2262,8 +2262,8 @@ def Helper__AddSimpleOption__FileLine( anotherFileData.m_Path, optionName ) - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() # OK. Let's add this option assert optionValue is not None @@ -2288,8 +2288,8 @@ def Helper__AddSimpleOption__FileLine( PgCfgModel__DataControllerUtils.Option__delete(self.m_Data, optionData()) assert not optionData.IsAlive() - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() raise assert option is not None @@ -2344,8 +2344,8 @@ def Helper__AddSimpleOption__File( anotherFileData.m_Path, optionName ) - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() # OK. Let's add this option assert optionValue is not None @@ -2372,8 +2372,8 @@ def Helper__AddSimpleOption__File( ) assert not optionData.IsAlive() - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() raise assert option is not None @@ -2526,7 +2526,7 @@ def Helper__SetUniqueOptionValueItem__Common( # ------------------------------------------------ while True: - if not (optionName in self.m_Data.m_AllOptionsByName.keys()): + if optionName not in self.m_Data.m_AllOptionsByName.keys(): break data = self.m_Data.m_AllOptionsByName[optionName] @@ -2554,7 +2554,7 @@ def Helper__SetUniqueOptionValueItem__Common( self, data ) - if typeOfData == list: + if typeOfData is list: assert type(data) is list assert len(data) > 1 @@ -2579,7 +2579,7 @@ def Helper__SetUniqueOptionValueItem__Common( BugCheckError.UnkOptObjectDataType(optionName, typeOfData) # ------------------------------------------------ - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in self.m_Data.m_AllOptionsByName.keys() # OK. Let's add a new option with list that contains our optionValueItem @@ -2644,7 +2644,7 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( typeOfData = type(data) - if typeOfData == PgCfgModel__OptionData: + if typeOfData is PgCfgModel__OptionData: assert type(data) is PgCfgModel__OptionData # It is the single property! assert data is optionData @@ -2658,7 +2658,7 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( self, data ) - if typeOfData == list: + if typeOfData is list: assert type(data) is list assert len(data) > 1 @@ -2689,8 +2689,8 @@ def Helper__SetUniqueOptionPreparedValueItem__Exact( # TODO: We have to take into account overriding the values of postgresql.conf BugCheckError.MultipleDefOfOptionIsFound(optionData.m_Name, len(data)) - assert typeOfData != PgCfgModel__OptionData - assert typeOfData != list + assert typeOfData is not PgCfgModel__OptionData + assert typeOfData is not list BugCheckError.UnkOptObjectDataType(optionData.m_Name, typeOfData) @@ -2718,9 +2718,9 @@ def Helper__SetUniqueOptionValueItem__File( # ------------------------------------------------ while True: - if not (optionName in self.m_Data.m_AllOptionsByName.keys()): + if optionName not in self.m_Data.m_AllOptionsByName.keys(): # It is an absolutely new option - assert not (optionName in fileData.m_OptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() break if optionName in fileData.m_OptionsByName.keys(): @@ -2750,7 +2750,7 @@ def Helper__SetUniqueOptionValueItem__File( assert typeOfData != PgCfgModel__OptionData - if typeOfData == list: + if typeOfData is list: assert type(data) is list assert len(data) > 1 @@ -2777,7 +2777,7 @@ def Helper__SetUniqueOptionValueItem__File( BugCheckError.UnkOptObjectDataType(optionName, typeOfData) - assert not (optionName in fileData.m_OptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() assert optionName in self.m_Data.m_AllOptionsByName.keys() @@ -2798,7 +2798,7 @@ def Helper__SetUniqueOptionValueItem__File( assert fileData2 is not None assert type(fileData2) is PgCfgModel__FileData assert fileData2.IsAlive() - assert not (fileData2 is fileData) + assert fileData2 is not fileData if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( data, optionValueItem @@ -2811,7 +2811,7 @@ def Helper__SetUniqueOptionValueItem__File( fileData2.m_Path, optionName ) - if typeOfData == list: + if typeOfData is list: assert type(data) is list assert len(data) > 1 @@ -2827,7 +2827,7 @@ def Helper__SetUniqueOptionValueItem__File( assert fileData2 is not None assert type(fileData2) is PgCfgModel__FileData assert fileData2.IsAlive() - assert not (fileData2 is fileData) + assert fileData2 is not fileData if __class__.Helper__DoesOptionValueAlreadyHaveThisUniqueItem( optionData2, optionValueItem @@ -2846,8 +2846,8 @@ def Helper__SetUniqueOptionValueItem__File( BugCheckError.UnkOptObjectDataType(optionName, typeOfData) - assert not (optionName is fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() result = self.Helper__FinalRegSimpleOptionValue__File( fileData, optionName, [optionValueItem] @@ -2878,7 +2878,7 @@ def Helper__FinalRegSimpleOptionValue__Common( assert type(self.m_Data) is PgCfgModel__ConfigurationData assert type(self.m_Data.m_AllOptionsByName) is dict - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in self.m_Data.m_AllOptionsByName.keys() # Select the file to append this new option getFileData_r = self.Helper__GetFileForSimpleOption(optionName) @@ -2935,8 +2935,8 @@ def Helper__FinalRegSimpleOptionValue__File( assert type(self.m_Data) is PgCfgModel__ConfigurationData assert type(self.m_Data.m_AllOptionsByName) is dict - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() optionData = PgCfgModel__DataControllerUtils.File__add_Option( self.m_Data, fileData, optionName, preparedOptionValue @@ -2971,8 +2971,8 @@ def Helper__FinalRegSimpleOptionValue__File( assert not optionData.IsAlive() - assert not (optionName in fileData.m_OptionsByName.keys()) - assert not (optionName in self.m_Data.m_AllOptionsByName.keys()) + assert optionName not in fileData.m_OptionsByName.keys() + assert optionName not in self.m_Data.m_AllOptionsByName.keys() raise assert result is not None @@ -3012,7 +3012,7 @@ def Debug__CheckOurObjectData(self, data: PgCfgModel__ObjectData): while ptr is not self.m_Data: assert ptr is not None assert isinstance(ptr, PgCfgModel__ObjectData) - assert not (ptr in stack) + assert ptr not in stack stack.add(ptr) ptr = ptr.get_Parent() @@ -3180,15 +3180,15 @@ def LoadConfigurationFile( if typeOfIndexData == PgCfgModel__FileData: fileData: PgCfgModel__FileData = indexData assert type(fileData.m_Path) is str - assert not (fileData.m_Path in existFileDatas.keys()) + assert fileData.m_Path not in existFileDatas.keys() existFileDatas[fileData.m_Path] = fileData continue - if typeOfIndexData == list: + if typeOfIndexData is list: for fileData in indexData: assert type(fileData) is PgCfgModel__FileData assert type(fileData.m_Path) is str - assert not (fileData.m_Path in existFileDatas.keys()) + assert fileData.m_Path not in existFileDatas.keys() existFileDatas[fileData.m_Path] = fileData continue continue @@ -3239,7 +3239,7 @@ def LoadConfigurationFile( currentFileData.m_LastModifiedTimestamp = lastMDate currentFileData.m_Status = PgCfgModel__FileStatus.EXISTS - assert not (currentFileData.m_Path in existFileDatas.keys()) + assert currentFileData.m_Path not in existFileDatas.keys() existFileDatas[currentFileData.m_Path] = currentFileData # enumerate all the includes @@ -3872,9 +3872,9 @@ def Helper__DoWork__Stage01__CreateFileContexts( assert fileCtx.Content is None assert fileCtx.File is None - assert not (fileCtx in ctx.AllFiles) - assert not (fileCtx in ctx.NewFiles) - assert not (fileCtx in ctx.UpdFiles) + assert fileCtx not in ctx.AllFiles + assert fileCtx not in ctx.NewFiles + assert fileCtx not in ctx.UpdFiles ctx.AllFiles.append(fileCtx) diff --git a/src/implementation/v00/configuration_std.py b/src/implementation/v00/configuration_std.py index 82a734c..e81a811 100644 --- a/src/implementation/v00/configuration_std.py +++ b/src/implementation/v00/configuration_std.py @@ -493,7 +493,7 @@ def Helper__GetOptionHandlers(self, name: str) -> tagOptionHandlers: assert type(name) is str assert type(self.sm_OptionHandlers) is dict - if not (name in self.sm_OptionHandlers.keys()): + if name not in self.sm_OptionHandlers.keys(): return __class__.sm_OptionHandlers__Std__Generic optionHandlers = self.sm_OptionHandlers[name] From 84b786fe43ae092b4b2264e092d9a2a1589d01e3 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Tue, 24 Feb 2026 09:32:50 +0300 Subject: [PATCH 3/3] [CI] A stage "Lint with ruff" is added --- .github/workflows/package-verification.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package-verification.yml b/.github/workflows/package-verification.yml index 387f820..a1df507 100644 --- a/.github/workflows/package-verification.yml +++ b/.github/workflows/package-verification.yml @@ -27,10 +27,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 flake8-pyproject + python -m pip install flake8 flake8-pyproject ruff - name: Lint with flake8 run: | flake8 . + - name: Lint with ruff + run: | + ruff check . test: runs-on: ubuntu-latest