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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-07-27 14:11:42 +02:00
commit b2b726b632

View file

@ -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]