Bunch
Container object exposing keys as attributes.
Bunch objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, bunch\["value\_key"\]
, or by an attribute, bunch.value\_key
.
Examples
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new Bunch(opts?: object): Bunch;
Parameters
Name | Type |
---|---|
opts? | object |
Returns
Defined in: generated/utils/Bunch.ts:25 (opens in a new tab)
Methods
clear()
Signature
clear(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:94 (opens in a new tab)
copy()
Signature
copy(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:117 (opens in a new tab)
dispose()
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Signature
dispose(): Promise<void>;
Returns
Promise
<void
>
Defined in: generated/utils/Bunch.ts:80 (opens in a new tab)
fromkeys()
Create a new dictionary with keys from iterable and values set to value.
Signature
fromkeys(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:143 (opens in a new tab)
get()
Return the value for key if key is in the dictionary, else default.
Signature
get(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:169 (opens in a new tab)
init()
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Signature
init(py: PythonBridge): Promise<void>;
Parameters
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/utils/Bunch.ts:43 (opens in a new tab)
items()
Signature
items(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:192 (opens in a new tab)
keys()
Signature
keys(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:215 (opens in a new tab)
pop()
If key is not found, default is returned if given, otherwise KeyError is raised
Signature
pop(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:241 (opens in a new tab)
popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
Signature
popitem(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:269 (opens in a new tab)
setdefault()
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
Signature
setdefault(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:297 (opens in a new tab)
update()
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
Signature
update(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:323 (opens in a new tab)
values()
Signature
values(opts: object): Promise<any>;
Parameters
Name | Type |
---|---|
opts | object |
Returns
Promise
<any
>
Defined in: generated/utils/Bunch.ts:346 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/utils/Bunch.ts:23 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/utils/Bunch.ts:22 (opens in a new tab)
_py
PythonBridge
Defined in: generated/utils/Bunch.ts:21 (opens in a new tab)
id
string
Defined in: generated/utils/Bunch.ts:18 (opens in a new tab)
opts
any
Defined in: generated/utils/Bunch.ts:19 (opens in a new tab)
Accessors
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/utils/Bunch.ts:30 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/utils/Bunch.ts:34 (opens in a new tab)