def __init__(self, linear_dict: value.LinearDict[UnitPauliStringT] | None = None):
        """Construct a PauliSum from a linear dictionary.

        Note, the preferred method of constructing PauliSum objects is either implicitly
        or via the `from_pauli_strings` function.

        Args:
            linear_dict: Set of  (`cirq.Qid`, `cirq.Pauli`) tuples to construct the sum
                from.

        Raises:
            ValueError: If structure of `linear_dict` contains tuples other than the
                form (`cirq.Qid`, `cirq.Pauli`).
        """
        if linear_dict is None:
            linear_dict = value.LinearDict()
        if not _is_linear_dict_of_unit_pauli_string(linear_dict):
            raise ValueError(
                "PauliSum constructor takes a LinearDict[UnitPauliStringT]. "
                "Consider using PauliSum.from_pauli_strings() or adding and "
                "subtracting PauliStrings"
            )
        self._linear_dict = linear_dict
Construct a PauliSum from a linear dictionary.

        Note, the preferred method of constructing PauliSum objects is either implicitly
        or via the `from_pauli_strings` function.

        Args:
            linear_dict: Set of  (`cirq.Qid`, `cirq.Pauli`) tuples to construct the sum
                from.

        Raises:
            ValueError: If structure of `linear_dict` contains tuples other than the
                form (`cirq.Qid`, `cirq.Pauli`).
        
cirq-core/cirq/ops/linear_combinations.py