def __init__(
        self, *contents: cirq.OP_TREE, strategy: cirq.InsertStrategy = InsertStrategy.EARLIEST
    ) -> None:
        """Initializes a circuit.

        Args:
            contents: The initial list of moments and operations defining the
                circuit. You can also pass in operations, lists of operations,
                or generally anything meeting the `cirq.OP_TREE` contract.
                Non-moment entries will be inserted according to the specified
                insertion strategy.
            strategy: When initializing the circuit with operations and moments
                from `contents`, this determines how the operations are packed
                together. This option does not affect later insertions into the
                circuit.
        """
        self._placement_cache: _PlacementCache | None = _PlacementCache()
        self._moments: list[cirq.Moment] = []

        # Implementation note: the following cached properties are set lazily and then
        # invalidated and reset to None in `self._mutated()`, which is called any time
        # `self._moments` is changed.
        self._all_qubits: frozenset[cirq.Qid] | None = None
        self._frozen: cirq.FrozenCircuit | None = None
        self._is_measurement: bool | None = None
        self._is_parameterized: bool | None = None
        self._parameter_names: AbstractSet[str] | None = None
        if not contents:
            return
        flattened_contents = tuple(ops.flatten_to_ops_or_moments(contents))
        if all(isinstance(c, Moment) for c in flattened_contents):
            self._placement_cache = None
            self._moments[:] = cast(Iterable[Moment], flattened_contents)
            return
        with _compat.block_overlapping_deprecation('.*'):
            if strategy == InsertStrategy.EARLIEST:
                self._load_contents_with_earliest_strategy(flattened_contents)
            else:
                self.append(flattened_contents, strategy=strategy)
Initializes a circuit.

        Args:
            contents: The initial list of moments and operations defining the
                circuit. You can also pass in operations, lists of operations,
                or generally anything meeting the `cirq.OP_TREE` contract.
                Non-moment entries will be inserted according to the specified
                insertion strategy.
            strategy: When initializing the circuit with operations and moments
                from `contents`, this determines how the operations are packed
                together. This option does not affect later insertions into the
                circuit.
        
cirq-core/cirq/circuits/circuit.py