2021-09-24 15:24:43 +00:00
|
|
|
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
|
|
|
|
|
2021-10-27 13:13:59 +00:00
|
|
|
Skylib module containing functions that operate on dictionaries.
|
|
|
|
|
2022-08-30 18:57:34 +00:00
|
|
|
<a id="dicts.add"></a>
|
2021-09-24 15:24:43 +00:00
|
|
|
|
2019-02-28 22:43:57 +00:00
|
|
|
## dicts.add
|
|
|
|
|
|
|
|
<pre>
|
2019-03-26 11:38:49 +00:00
|
|
|
dicts.add(<a href="#dicts.add-dictionaries">dictionaries</a>, <a href="#dicts.add-kwargs">kwargs</a>)
|
2019-02-28 22:43:57 +00:00
|
|
|
</pre>
|
|
|
|
|
|
|
|
Returns a new `dict` that has all the entries of the given dictionaries.
|
|
|
|
|
|
|
|
If the same key is present in more than one of the input dictionaries, the
|
|
|
|
last of them in the argument list overrides any earlier ones.
|
|
|
|
|
|
|
|
This function is designed to take zero or one arguments as well as multiple
|
|
|
|
dictionaries, so that it follows arithmetic identities and callers can avoid
|
|
|
|
special cases for their inputs: the sum of zero dictionaries is the empty
|
|
|
|
dictionary, and the sum of a single dictionary is a copy of itself.
|
|
|
|
|
|
|
|
|
2021-09-24 15:24:43 +00:00
|
|
|
**PARAMETERS**
|
|
|
|
|
|
|
|
|
|
|
|
| Name | Description | Default Value |
|
2021-10-27 13:13:59 +00:00
|
|
|
| :------------- | :------------- | :------------- |
|
|
|
|
| <a id="dicts.add-dictionaries"></a>dictionaries | Zero or more dictionaries to be added. | none |
|
|
|
|
| <a id="dicts.add-kwargs"></a>kwargs | Additional dictionary passed as keyword args. | none |
|
|
|
|
|
|
|
|
**RETURNS**
|
|
|
|
|
|
|
|
A new `dict` that has all the entries of the given dictionaries.
|
2019-02-28 22:43:57 +00:00
|
|
|
|
|
|
|
|
2022-08-30 18:57:34 +00:00
|
|
|
<a id="dicts.omit"></a>
|
2022-03-28 16:06:10 +00:00
|
|
|
|
|
|
|
## dicts.omit
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
dicts.omit(<a href="#dicts.omit-dictionary">dictionary</a>, <a href="#dicts.omit-keys">keys</a>)
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Returns a new `dict` that has all the entries of `dictionary` with keys not in `keys`.
|
|
|
|
|
|
|
|
**PARAMETERS**
|
|
|
|
|
|
|
|
|
|
|
|
| Name | Description | Default Value |
|
|
|
|
| :------------- | :------------- | :------------- |
|
2024-04-24 21:40:06 +00:00
|
|
|
| <a id="dicts.omit-dictionary"></a>dictionary | A `dict`. | none |
|
2022-03-28 16:06:10 +00:00
|
|
|
| <a id="dicts.omit-keys"></a>keys | A sequence. | none |
|
|
|
|
|
|
|
|
**RETURNS**
|
|
|
|
|
|
|
|
A new `dict` that has all the entries of `dictionary` with keys not in `keys`.
|
|
|
|
|
|
|
|
|
2022-08-30 18:57:34 +00:00
|
|
|
<a id="dicts.pick"></a>
|
2022-03-28 16:06:10 +00:00
|
|
|
|
|
|
|
## dicts.pick
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
dicts.pick(<a href="#dicts.pick-dictionary">dictionary</a>, <a href="#dicts.pick-keys">keys</a>)
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Returns a new `dict` that has all the entries of `dictionary` with keys in `keys`.
|
|
|
|
|
|
|
|
**PARAMETERS**
|
|
|
|
|
|
|
|
|
|
|
|
| Name | Description | Default Value |
|
|
|
|
| :------------- | :------------- | :------------- |
|
2024-04-24 21:40:06 +00:00
|
|
|
| <a id="dicts.pick-dictionary"></a>dictionary | A `dict`. | none |
|
2022-03-28 16:06:10 +00:00
|
|
|
| <a id="dicts.pick-keys"></a>keys | A sequence. | none |
|
|
|
|
|
|
|
|
**RETURNS**
|
|
|
|
|
|
|
|
A new `dict` that has all the entries of `dictionary` with keys in `keys`.
|
|
|
|
|
|
|
|
|