From b55aff5f5b78eceb2c939f8496fc0e366724c950 Mon Sep 17 00:00:00 2001 From: David Almeida Date: Wed, 8 Jan 2025 16:15:23 +0100 Subject: [PATCH] Remove redundant NomenclatureConfig attribute --- nomenclature/codelist.py | 6 +----- nomenclature/config.py | 1 - .../illegal_chars/char_in_external_repo/nomenclature.yaml | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/nomenclature/codelist.py b/nomenclature/codelist.py index 329158e5..4ea5aa29 100644 --- a/nomenclature/codelist.py +++ b/nomenclature/codelist.py @@ -336,11 +336,7 @@ def read_excel(cls, name, source, sheet_name, col, attrs=None): def check_illegal_characters(self, config: NomenclatureConfig) -> dict[str, Code]: """Check that no illegal characters are left in codes after tag replacement""" - illegal = ( - ["{", "}"] + config.illegal_characters - if config.check_illegal_characters - else ["{", "}"] - ) + illegal = ["{", "}"] + config.illegal_characters errors = ErrorCollector() def _check_string(value): diff --git a/nomenclature/config.py b/nomenclature/config.py index 6ccd5b79..fb5272c2 100644 --- a/nomenclature/config.py +++ b/nomenclature/config.py @@ -245,7 +245,6 @@ class NomenclatureConfig(BaseModel): repositories: dict[str, Repository] = Field(default_factory=dict) definitions: DataStructureConfig = Field(default_factory=DataStructureConfig) mappings: RegionMappingConfig = Field(default_factory=RegionMappingConfig) - check_illegal_characters: bool = True illegal_characters: list[str] = [":", ";", '"'] model_config = ConfigDict(use_enum_values=True) diff --git a/tests/data/codelist/illegal_chars/char_in_external_repo/nomenclature.yaml b/tests/data/codelist/illegal_chars/char_in_external_repo/nomenclature.yaml index 70e238e4..4aaede1e 100644 --- a/tests/data/codelist/illegal_chars/char_in_external_repo/nomenclature.yaml +++ b/tests/data/codelist/illegal_chars/char_in_external_repo/nomenclature.yaml @@ -8,5 +8,4 @@ definitions: variable: repository: - common-definitions -check_illegal_characters: true illegal_characters: ["'"] # these are known to be present in common-definitions variables