IExtendedDictionary
QuantConnect.Interfaces.IExtendedDictionary
Bases: Generic[QuantConnect_Interfaces_IExtendedDictionary_TKey, QuantConnect_Interfaces_IExtendedDictionary_TValue]
Represents a generic collection of key/value pairs that implements python dictionary methods.
fromkeys
fromkeys(
sequence: List[
QuantConnect_Interfaces_IExtendedDictionary_TKey
],
) -> Any
fromkeys(
sequence: List[
QuantConnect_Interfaces_IExtendedDictionary_TKey
],
value: QuantConnect_Interfaces_IExtendedDictionary_TValue,
) -> Any
Signature descriptions:
-
Creates a new dictionary from the given sequence of elements.
-
Creates a new dictionary from the given sequence of elements with a value provided by the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
List[QuantConnect_Interfaces_IExtendedDictionary_TKey]
|
Sequence of elements which is to be used as keys for the new dictionary |
required |
value
|
Optional[QuantConnect_Interfaces_IExtendedDictionary_TValue]
|
Value which is set to each each element of the dictionary |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Returns a new dictionary with the given sequence of elements as the keys of the dictionary. |
get
get(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
get(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
value: QuantConnect_Interfaces_IExtendedDictionary_TValue,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
Returns the value for the specified key if key is in dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Interfaces_IExtendedDictionary_TKey
|
Key to be searched in the dictionary |
required |
value
|
Optional[QuantConnect_Interfaces_IExtendedDictionary_TValue]
|
Value to be returned if the key is not found. The default value is null. |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_Interfaces_IExtendedDictionary_TValue
|
The value for the specified key if key is in dictionary. |
pop
pop(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
pop(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
default_value: QuantConnect_Interfaces_IExtendedDictionary_TValue,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
Removes and returns an element from a dictionary having the given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Interfaces_IExtendedDictionary_TKey
|
Key which is to be searched for removal |
required |
default_value
|
Optional[QuantConnect_Interfaces_IExtendedDictionary_TValue]
|
Value which is to be returned when the key is not in the dictionary |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_Interfaces_IExtendedDictionary_TValue
|
If key is found - removed/popped element from the dictionary |
setdefault
setdefault(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
setdefault(
key: QuantConnect_Interfaces_IExtendedDictionary_TKey,
default_value: QuantConnect_Interfaces_IExtendedDictionary_TValue,
) -> QuantConnect_Interfaces_IExtendedDictionary_TValue
Returns the value of a key (if the key is in dictionary). If not, it inserts key with a value to the dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
QuantConnect_Interfaces_IExtendedDictionary_TKey
|
Key with null/None value is inserted to the dictionary if key is not in the dictionary. |
required |
default_value
|
Optional[QuantConnect_Interfaces_IExtendedDictionary_TValue]
|
Default value |
None
|
Returns:
| Type | Description |
|---|---|
QuantConnect_Interfaces_IExtendedDictionary_TValue
|
The value of the key if it is in the dictionary |
clear
clear() -> None
Removes all keys and values from the IExtendedDictionary{TKey, TValue}.
copy
copy() -> Any
Creates a shallow copy of the IExtendedDictionary{TKey, TValue}.
Returns:
| Type | Description |
|---|---|
Any
|
Returns a shallow copy of the dictionary. It doesn't modify the original dictionary. |
items
items() -> Any
Returns a view object that displays a list of dictionary's (key, value) tuple pairs.
Returns:
| Type | Description |
|---|---|
Any
|
Returns a view object that displays a list of a given dictionary's (key, value) tuple pair. |
keys
keys() -> Any
Returns a view object that displays a list of all the keys in the dictionary
Returns:
| Type | Description |
|---|---|
Any
|
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
popitem() -> Any
Returns and removes an arbitrary element (key, value) pair from the dictionary.
Returns:
| Type | Description |
|---|---|
Any
|
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. |
update
update(other: Any) -> None
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:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
Any
|
Takes either a dictionary or an iterable object of key/value pairs (generally tuples). |
required |
values
values() -> Any
Returns a view object that displays a list of all the values in the dictionary.
Returns:
| Type | Description |
|---|---|
Any
|
Returns a view object that displays a list of all values in a given dictionary. |