From bcab7f8f1575156e27d1d69158c0f6e9df470ee3 Mon Sep 17 00:00:00 2001 From: Mike Evans-Larah Date: Fri, 29 Aug 2025 09:24:57 +0100 Subject: [PATCH] Fix string representation for DataLakeLayer to ensure backward compatibility with Python 3.11+ --- src/corvus_python/storage/storage_configuration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/corvus_python/storage/storage_configuration.py b/src/corvus_python/storage/storage_configuration.py index b6ef14e..4e14fda 100644 --- a/src/corvus_python/storage/storage_configuration.py +++ b/src/corvus_python/storage/storage_configuration.py @@ -15,6 +15,19 @@ class DataLakeLayer(str, Enum): SILVER = "silver" GOLD = "gold" + def __str__(self): + """Returns the string representation of the data lake layer. + The default behaviour of Enums with "mix-ins" changed in Python 3.11 + to return the member name instead of the value, so we need to be explicit + to maintain backward compatibility. See: https://github.com/python/cpython/pull/22392 + TODO: once Python 3.10 compatibility is no longer required, use StrEnum instead + and remove this method. + + Returns: + str: The string representation of the data lake layer. + """ + return self.value + class StorageConfiguration(ABC): """Base class for a class that provides configuration for persistent storage.