def __init__(self, keep_swap_permutations: bool = True):
        """Decomposes permutation gates.

        Args:
            keep_swap_permutations: Whether or not to except
                SwapPermutationGate.
        """
        if keep_swap_permutations:
            self.no_decomp = lambda op: (
                not all(
                    [
                        isinstance(op, ops.GateOperation),
                        isinstance(op.gate, PermutationGate),
                        not isinstance(op.gate, SwapPermutationGate),
                    ]
                )
            )
        else:
            self.no_decomp = lambda op: (
                not all([isinstance(op, ops.GateOperation), isinstance(op.gate, PermutationGate)])
            )
Decomposes permutation gates.

        Args:
            keep_swap_permutations: Whether or not to except
                SwapPermutationGate.
        
cirq-core/cirq/contrib/acquaintance/permutation.py