Skip to content

Commit

Permalink
feat: first implementation of showing a message on inclusion of unkno…
Browse files Browse the repository at this point in the history
…wn keywords (#622)
  • Loading branch information
MRVermeulenDeltares committed Apr 19, 2024
1 parent 41ac1f1 commit c0af81c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion hydrolib/core/dflowfm/ini/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ class INIBasedModel(BaseModel, ABC):
_file_path_style_converter = FilePathStyleConverter()

class Config:
extra = Extra.ignore
extra = Extra.allow
arbitrary_types_allowed = False

def __init__(self, **data):
super().__init__(**data)
self._check_for_unknown_keys()

def _check_for_unknown_keys(self):
read_keys = set(self.__fields_set__)
known_keys = set(self.__fields__)

unknown_keys = read_keys - known_keys - self._exclude_fields()
if unknown_keys:
print("Unknown keys included:", unknown_keys)

@classmethod
def _supports_comments(cls):
Expand Down

0 comments on commit c0af81c

Please sign in to comment.