From a7c762eb2e2d7b617f99f2637a1e07d6fcb21c99 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 21 Jan 2026 04:51:32 +0100 Subject: [PATCH] ConfigurableParameter: do not magically overwrite the 'name' attribute The ClassVarMeta metaclass used to derive each ConfigurableParameter's 'name' attribute automatically from the Python class name (via camel_to_snake()). Stop doing this, for three reasons: 1) Python class names follow constraints that do not fit the naming commonly used in CSV files. For example, a name like "5GS-SUCI-CalcInfo" starts with a digit and contains dashes, neither of which is permissible in a class name. 2) Python class names live in their own namespace, distinct from the one used to present eSIM parameters to end users. Deriving the UI name from the class name couples these two namespaces together. Taken together, (1) and (2) mean that automatic naming both imposes class-name constraints on the user-visible names and merges the internal Python namespace with the publicly shown one - a layer violation from the perspective of UI design. 3) Overriding 'name' from __new__() makes manual naming impossible: a subclass that sets 'name = "bar"' as a class attribute would still end up with the value computed by the metaclass, which is surprising and hard to track down: class MySuper(metaclass=...): # __new__ sets name = 'foo' ... class MySub(MySuper): name = 'bar' print(MySub().name) # 'foo', not 'bar' as one would expect Change-Id: I6f631444c6addeb7ccc5f6c55b9be3dc83409169 Jenkins: skip-card-test --- pySim/esim/saip/personalization.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index eb819348..4799d128 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -52,7 +52,6 @@ class ClassVarMeta(abc.ABCMeta): x = super().__new__(metacls, name, bases, namespace) for k, v in kwargs.items(): setattr(x, k, v) - setattr(x, 'name', camel_to_snake(name)) return x class ConfigurableParameter(abc.ABC, metaclass=ClassVarMeta):