From b2b726b632026219311e4a66203e6ddf67ed9584 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 27 Jul 2025 14:11:42 +0200 Subject: [PATCH] Bunch: Add class jwutils.Bunch is a simple wrapper around a dictionary, which allows member-type access to to dictionary data. Signed-off-by: Jan Lindemann --- tools/python/jwutils/Bunch.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tools/python/jwutils/Bunch.py diff --git a/tools/python/jwutils/Bunch.py b/tools/python/jwutils/Bunch.py new file mode 100644 index 0000000..dc49a44 --- /dev/null +++ b/tools/python/jwutils/Bunch.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +from typing import Any + +class Bunch: # export + + def __init__(self, **kwargs): + self.__dict__.update(kwargs) + + def __getitem__(self, key: str) -> Any: + return self.__dict__[key]