UniCoreFW

from_pairs()

Converts a list of [key, value] pairs into an object.

Implementation

Args: pairs: List of key-value pairs. Returns: Object with the given key-value pairs.

Example

from_pairs([["a", 1], ["b", 2]]) == {"a": 1, "b": 2}

Expected output: True

Source Code

def from_pairs(pairs: List[Tuple[K, V]]) -> Dict[K, V]: return {k: v for k, v in pairs}