Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
25
venv/Lib/site-packages/traitlets/utils/bunch.py
Normal file
25
venv/Lib/site-packages/traitlets/utils/bunch.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""Yet another implementation of bunch
|
||||
|
||||
attribute-access of items on a dict.
|
||||
"""
|
||||
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
class Bunch(dict):
|
||||
"""A dict with attribute-access"""
|
||||
def __getattr__(self, key):
|
||||
try:
|
||||
return self.__getitem__(key)
|
||||
except KeyError:
|
||||
raise AttributeError(key)
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
self.__setitem__(key, value)
|
||||
|
||||
def __dir__(self):
|
||||
# py2-compat: can't use super because dict doesn't have __dir__
|
||||
names = dir({})
|
||||
names.extend(self.keys())
|
||||
return names
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue