(self, *key_value_pairs)
Args:
          key_value_pairs (:obj:`list` of :obj:`tuple`): each tuple is a
            key-value pair to form a dict from.
            Every key and value gets wrapped with ``ensure_conversion``
Args:
          key_value_pairs (:obj:`list` of :obj:`tuple`): each tuple is a
            key-value pair to form a dict from.
            Every key and value gets wrapped with ``ensure_conversion``
Args : key_value_pairs ( : obj : list of : obj : tuple ) : each tuple is a key - value pair to form a dict from . Every key and value gets wrapped with ensure_conversion
def __init__(self, *key_value_pairs):
        """
        Args:
          key_value_pairs (:obj:`list` of :obj:`tuple`): each tuple is a
            key-value pair to form a dict from.
            Every key and value gets wrapped with ``ensure_conversion``
        """
        super().__init__()
        pairs = []
        condition_to_item_pairs = None
        for pair in key_value_pairs:
            pair = tuple(self.ensure_conversion(item_) for item_ in pair)
            conditions = [
                item_.condition
                for item_ in pair
                if isinstance(item_, OptionalCollectionItem)
            ]
            condition = (
                (
                    And(conditions[0], conditions[1])
                    if len(conditions) == 2
                    else conditions[0]
                )
                if conditions
                else None
            )
            if condition is not None:
                pair = tuple(
                    item_.conversion
                    if isinstance(item_, OptionalCollectionItem)
                    else item_
                    for item_ in pair
                )

            if condition_to_item_pairs is None:
                if condition:
                    condition_to_item_pairs = [
                        (None, pair_) for pair_ in pairs
                    ]
                    pairs = None
                    condition_to_item_pairs.append((condition, pair))
                else:
                    pairs.append(pair)
            else:
                condition_to_item_pairs.append((condition, pair))

        self.key_value_pairs = pairs
        self.condition_to_item_pairs = condition_to_item_pairs
def __init__ ( self , * key_value_pairs ) : super ( ) . __init__ ( ) pairs = [ ] condition_to_item_pairs = None for pair in key_value_pairs : pair = tuple ( self . ensure_conversion ( item_ ) for item_ in pair ) conditions = [ item_ . condition for item_ in pair if isinstance ( item_ , OptionalCollectionItem ) ] condition = ( ( And ( conditions [ 0 ] , conditions [ 1 ] ) if len ( conditions ) == 2 else conditions [ 0 ] ) if conditions else None ) if condition is not None : pair = tuple ( item_ . conversion if isinstance ( item_ , OptionalCollectionItem ) else item_ for item_ in pair ) if condition_to_item_pairs is None : if condition : condition_to_item_pairs = [ ( None , pair_ ) for pair_ in pairs ] pairs = None condition_to_item_pairs . append ( ( condition , pair ) ) else : pairs . append ( pair ) else : condition_to_item_pairs . append ( ( condition , pair ) ) self . key_value_pairs = pairs self . condition_to_item_pairs = condition_to_item_pairs