From d30e73a679b3884133fded585db23121f6a8cff3 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sun, 17 Dec 2023 18:26:57 -0800 Subject: [PATCH] Do not add duplicate settings when generating a namespace --- settngs/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/settngs/__init__.py b/settngs/__init__.py index 581284d..929dd6c 100644 --- a/settngs/__init__.py +++ b/settngs/__init__.py @@ -324,7 +324,9 @@ def generate_ns(definitions: Definitions) -> str: if type_name == 'Any': type_name = 'typing.Any' - attributes.append(f' {setting.internal_name}: {type_name}') + attribute = f' {setting.internal_name}: {type_name}' + if attribute not in attributes: + attributes.append(attribute) # Add a blank line between groups if attributes and attributes[-1] != '': attributes.append('')