Class: 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
Constructors
new Bunch()
new Bunch(
opts
?):Bunch
Parameters
Parameter | Type |
---|---|
opts ? | object |
Returns Bunch
Defined in generated/utils/Bunch.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/utils/Bunch.ts:23 |
_isInitialized | boolean | false | generated/utils/Bunch.ts:22 |
_py | PythonBridge | undefined | generated/utils/Bunch.ts:21 |
id | string | undefined | generated/utils/Bunch.ts:18 |
opts | any | undefined | generated/utils/Bunch.ts:19 |
Accessors
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/utils/Bunch.ts:30
Methods
clear()
clear(
opts
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:94
copy()
copy(
opts
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:117
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/utils/Bunch.ts:80
fromkeys()
fromkeys(
opts
):Promise
<any
>
Create a new dictionary with keys from iterable and values set to value.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:143
get()
get(
opts
):Promise
<any
>
Return the value for key if key is in the dictionary, else default.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:169
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/utils/Bunch.ts:43
items()
items(
opts
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:192
keys()
keys(
opts
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:215
pop()
pop(
opts
):Promise
<any
>
If key is not found, default is returned if given, otherwise KeyError is raised
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:241
popitem()
popitem(
opts
):Promise
<any
>
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.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:269
setdefault()
setdefault(
opts
):Promise
<any
>
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.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:297
update()
update(
opts
):Promise
<any
>
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]
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:323
values()
values(
opts
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/utils/Bunch.ts:346