xref: /aosp_15_r20/external/bazel-skylib/docs/dicts_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3Skylib module containing functions that operate on dictionaries.
4
5<a id="dicts.add"></a>
6
7## dicts.add
8
9<pre>
10dicts.add(<a href="#dicts.add-dictionaries">dictionaries</a>, <a href="#dicts.add-kwargs">kwargs</a>)
11</pre>
12
13Returns a new `dict` that has all the entries of the given dictionaries.
14
15If the same key is present in more than one of the input dictionaries, the
16last of them in the argument list overrides any earlier ones.
17
18This function is designed to take zero or one arguments as well as multiple
19dictionaries, so that it follows arithmetic identities and callers can avoid
20special cases for their inputs: the sum of zero dictionaries is the empty
21dictionary, and the sum of a single dictionary is a copy of itself.
22
23
24**PARAMETERS**
25
26
27| Name  | Description | Default Value |
28| :------------- | :------------- | :------------- |
29| <a id="dicts.add-dictionaries"></a>dictionaries |  Zero or more dictionaries to be added.   |  none |
30| <a id="dicts.add-kwargs"></a>kwargs |  Additional dictionary passed as keyword args.   |  none |
31
32**RETURNS**
33
34A new `dict` that has all the entries of the given dictionaries.
35
36
37<a id="dicts.omit"></a>
38
39## dicts.omit
40
41<pre>
42dicts.omit(<a href="#dicts.omit-dictionary">dictionary</a>, <a href="#dicts.omit-keys">keys</a>)
43</pre>
44
45Returns a new `dict` that has all the entries of `dictionary` with keys not in `keys`.
46
47**PARAMETERS**
48
49
50| Name  | Description | Default Value |
51| :------------- | :------------- | :------------- |
52| <a id="dicts.omit-dictionary"></a>dictionary |  A `dict`.   |  none |
53| <a id="dicts.omit-keys"></a>keys |  A sequence.   |  none |
54
55**RETURNS**
56
57A new `dict` that has all the entries of `dictionary` with keys not in `keys`.
58
59
60<a id="dicts.pick"></a>
61
62## dicts.pick
63
64<pre>
65dicts.pick(<a href="#dicts.pick-dictionary">dictionary</a>, <a href="#dicts.pick-keys">keys</a>)
66</pre>
67
68Returns a new `dict` that has all the entries of `dictionary` with keys in `keys`.
69
70**PARAMETERS**
71
72
73| Name  | Description | Default Value |
74| :------------- | :------------- | :------------- |
75| <a id="dicts.pick-dictionary"></a>dictionary |  A `dict`.   |  none |
76| <a id="dicts.pick-keys"></a>keys |  A sequence.   |  none |
77
78**RETURNS**
79
80A new `dict` that has all the entries of `dictionary` with keys in `keys`.
81
82
83