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

Python Reference

Constructors

new Bunch()

new Bunch(opts?): Bunch

Parameters

ParameterType
opts?object

Returns Bunch

Defined in generated/utils/Bunch.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/utils/Bunch.ts:23
_isInitializedbooleanfalsegenerated/utils/Bunch.ts:22
_pyPythonBridgeundefinedgenerated/utils/Bunch.ts:21
idstringundefinedgenerated/utils/Bunch.ts:18
optsanyundefinedgenerated/utils/Bunch.ts:19

Accessors

py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/utils/Bunch.ts:30

Methods

clear()

clear(opts): Promise<any>

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/Bunch.ts:94


copy()

copy(opts): Promise<any>

Parameters

ParameterType
optsobject

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

ParameterType
optsobject

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

ParameterType
optsobject

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

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/utils/Bunch.ts:43


items()

items(opts): Promise<any>

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/Bunch.ts:192


keys()

keys(opts): Promise<any>

Parameters

ParameterType
optsobject

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

ParameterType
optsobject

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

ParameterType
optsobject

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

ParameterType
optsobject

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

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/Bunch.ts:323


values()

values(opts): Promise<any>

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/Bunch.ts:346