Lean  $LEAN_TAG$
QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue > Interface Template Reference

Represents a generic collection of key/value pairs that implements python dictionary methods. More...

Public Member Functions

void clear ()
 Removes all keys and values from the IExtendedDictionary<TKey, TValue>. More...
 
PyDict copy ()
 Creates a shallow copy of the IExtendedDictionary<TKey, TValue>. More...
 
PyDict fromkeys (TKey[] sequence)
 Creates a new dictionary from the given sequence of elements. More...
 
PyDict fromkeys (TKey[] sequence, TValue value)
 Creates a new dictionary from the given sequence of elements with a value provided by the user. More...
 
TValue get (TKey key)
 Returns the value for the specified key if key is in dictionary. More...
 
TValue get (TKey key, TValue value)
 Returns the value for the specified key if key is in dictionary. More...
 
PyList items ()
 Returns a view object that displays a list of dictionary's (key, value) tuple pairs. More...
 
PyList keys ()
 Returns a view object that displays a list of all the keys in the dictionary More...
 
PyTuple popitem ()
 Returns and removes an arbitrary element (key, value) pair from the dictionary. More...
 
TValue setdefault (TKey key)
 Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary. More...
 
TValue setdefault (TKey key, TValue default_value)
 Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary. More...
 
TValue pop (TKey key)
 Removes and returns an element from a dictionary having the given key. More...
 
TValue pop (TKey key, TValue default_value)
 Removes and returns an element from a dictionary having the given key. More...
 
void update (PyObject other)
 Updates the dictionary with the elements from the another dictionary object or from an iterable of key/value pairs. The update() method adds element(s) to the dictionary if the key is not in the dictionary.If the key is in the dictionary, it updates the key with the new value. More...
 
PyList values ()
 Returns a view object that displays a list of all the values in the dictionary. More...
 

Detailed Description

Represents a generic collection of key/value pairs that implements python dictionary methods.

Definition at line 23 of file IExtendedDictionary.cs.

Member Function Documentation

◆ clear()

void QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.clear ( )

Removes all keys and values from the IExtendedDictionary<TKey, TValue>.

◆ copy()

PyDict QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.copy ( )

Creates a shallow copy of the IExtendedDictionary<TKey, TValue>.

Returns
Returns a shallow copy of the dictionary. It doesn't modify the original dictionary.

◆ fromkeys() [1/2]

PyDict QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.fromkeys ( TKey[]  sequence)

Creates a new dictionary from the given sequence of elements.

Parameters
sequenceSequence of elements which is to be used as keys for the new dictionary
Returns
Returns a new dictionary with the given sequence of elements as the keys of the dictionary.

◆ fromkeys() [2/2]

PyDict QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.fromkeys ( TKey[]  sequence,
TValue  value 
)

Creates a new dictionary from the given sequence of elements with a value provided by the user.

Parameters
sequenceSequence of elements which is to be used as keys for the new dictionary
valueValue which is set to each each element of the dictionary
Returns
Returns a new dictionary with the given sequence of elements as the keys of the dictionary. Each element of the newly created dictionary is set to the provided value.

◆ get() [1/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.get ( TKey  key)

Returns the value for the specified key if key is in dictionary.

Parameters
keyKey to be searched in the dictionary
Returns
The value for the specified key if key is in dictionary. None if the key is not found and value is not specified.

◆ get() [2/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.get ( TKey  key,
TValue  value 
)

Returns the value for the specified key if key is in dictionary.

Parameters
keyKey to be searched in the dictionary
valueValue to be returned if the key is not found. The default value is null.
Returns
The value for the specified key if key is in dictionary. value if the key is not found and value is specified.

◆ items()

PyList QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.items ( )

Returns a view object that displays a list of dictionary's (key, value) tuple pairs.

Returns
Returns a view object that displays a list of a given dictionary's (key, value) tuple pair.

◆ keys()

PyList QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.keys ( )

Returns a view object that displays a list of all the keys in the dictionary

Returns
Returns a view object that displays a list of all the keys. When the dictionary is changed, the view object also reflect these changes.

◆ popitem()

PyTuple QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.popitem ( )

Returns and removes an arbitrary element (key, value) pair from the dictionary.

Returns
Returns an arbitrary element (key, value) pair from the dictionary removes an arbitrary element(the same element which is returned) from the dictionary. Note: Arbitrary elements and random elements are not same.The popitem() doesn't return a random element.

◆ setdefault() [1/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.setdefault ( TKey  key)

Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary.

Parameters
keyKey with null/None value is inserted to the dictionary if key is not in the dictionary.
Returns
The value of the key if it is in the dictionary None if key is not in the dictionary

◆ setdefault() [2/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.setdefault ( TKey  key,
TValue  default_value 
)

Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary.

Parameters
keyKey with a value default_value is inserted to the dictionary if key is not in the dictionary.
default_valueDefault value
Returns
The value of the key if it is in the dictionary default_value if key is not in the dictionary and default_value is specified

◆ pop() [1/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.pop ( TKey  key)

Removes and returns an element from a dictionary having the given key.

Parameters
keyKey which is to be searched for removal
Returns
If key is found - removed/popped element from the dictionary If key is not found - KeyError exception is raised

◆ pop() [2/2]

TValue QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.pop ( TKey  key,
TValue  default_value 
)

Removes and returns an element from a dictionary having the given key.

Parameters
keyKey which is to be searched for removal
default_valueValue which is to be returned when the key is not in the dictionary
Returns
If key is found - removed/popped element from the dictionary If key is not found - value specified as the second argument(default)

◆ update()

void QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.update ( PyObject  other)

Updates the dictionary with the elements from the another dictionary object or from an iterable of key/value pairs. The update() method adds element(s) to the dictionary if the key is not in the dictionary.If the key is in the dictionary, it updates the key with the new value.

Parameters
otherTakes either a dictionary or an iterable object of key/value pairs (generally tuples).

◆ values()

PyList QuantConnect.Interfaces.IExtendedDictionary< TKey, TValue >.values ( )

Returns a view object that displays a list of all the values in the dictionary.

Returns
Returns a view object that displays a list of all values in a given dictionary.

The documentation for this interface was generated from the following file: