(
        self, study_id: int, state: Optional[Union[Tuple[TrialState, ...], TrialState]] = None
    )
return len(self.get_all_trials(study_id, deepcopy=False, states=state))
Count the number of trials in a study.

        Args:
            study_id:
                ID of the study.
            state:
                Trial states to filter on. If :obj:`None`, include all states.

        Returns:
            Number of trials in the study.

        Raises:
            :exc:`KeyError`:
                If no study with the matching ``study_id`` exists.
Count the number of trials in a study.
Count the number of trials in a study .
def get_n_trials(
        self, study_id: int, state: Optional[Union[Tuple[TrialState, ...], TrialState]] = None
    ) -> int:
        """Count the number of trials in a study.

        Args:
            study_id:
                ID of the study.
            state:
                Trial states to filter on. If :obj:`None`, include all states.

        Returns:
            Number of trials in the study.

        Raises:
            :exc:`KeyError`:
                If no study with the matching ``study_id`` exists.
        """
        # TODO(hvy): Align the name and the behavior or the `state` parameter with
        # `get_all_trials`'s `states`.
        if isinstance(state, TrialState):
            state = (state,)
        return len(self.get_all_trials(study_id, deepcopy=False, states=state))
def get_n_trials ( self , study_id : int , state : Optional [ Union [ Tuple [ TrialState , ... ] , TrialState ] ] = None ) -> int : # TODO(hvy): Align the name and the behavior or the `state` parameter with # `get_all_trials`'s `states`. if isinstance ( state , TrialState ) : state = ( state , ) return len ( self . get_all_trials ( study_id , deepcopy = False , states = state ) )