mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
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:
parent
e03491bee3
commit
b2b726b632
1 changed files with 11 additions and 0 deletions
11
tools/python/jwutils/Bunch.py
Normal file
11
tools/python/jwutils/Bunch.py
Normal 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]
|
||||
Loading…
Add table
Add a link
Reference in a new issue