From fffe1445b537335b857ae518efcdf925c2bd3300 Mon Sep 17 00:00:00 2001 From: Christoph Schmidt <christoph.,schmidt@tugraz.at> Date: Wed, 24 Jan 2024 13:44:29 +0100 Subject: [PATCH] Added overloaded typecast method --- src/confighandler/controller/fields/FieldFloat.py | 4 ++++ src/confighandler/controller/fields/FieldInt.py | 4 ++++ src/confighandler/controller/fields/FieldList.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/confighandler/controller/fields/FieldFloat.py b/src/confighandler/controller/fields/FieldFloat.py index 7177513..40f1b1a 100644 --- a/src/confighandler/controller/fields/FieldFloat.py +++ b/src/confighandler/controller/fields/FieldFloat.py @@ -20,3 +20,7 @@ class FieldFloat(Field): def _yaml_repr(self): return float(self.value) + + def __float__(self): + # return str(self.as_dataframe()) + return float(self.get()) \ No newline at end of file diff --git a/src/confighandler/controller/fields/FieldInt.py b/src/confighandler/controller/fields/FieldInt.py index 2309f47..47e09cb 100644 --- a/src/confighandler/controller/fields/FieldInt.py +++ b/src/confighandler/controller/fields/FieldInt.py @@ -20,3 +20,7 @@ class FieldInt(Field): def _yaml_repr(self): return int(self.value) + + def __int__(self): + # return str(self.as_dataframe()) + return int(self.get()) \ No newline at end of file diff --git a/src/confighandler/controller/fields/FieldList.py b/src/confighandler/controller/fields/FieldList.py index 07e03ee..01567e3 100644 --- a/src/confighandler/controller/fields/FieldList.py +++ b/src/confighandler/controller/fields/FieldList.py @@ -21,3 +21,7 @@ class FieldList(Field): def _yaml_repr(self): return str(self.value) + + def __iter__(self): + # return str(self.as_dataframe()) + return list(self.get()) \ No newline at end of file -- GitLab