def next()

in src/stepfunctions/steps/states.py [0:0]


    def next(self, next_step):
        """
        Specify the next state or chain to transition to.

        Args:
            next_step (State or Chain): Next state or chain to transition to.

        Returns:
            State or Chain: Next state or chain that will be transitioned to.
        """
        if self.type in ('Succeed', 'Fail'):
            raise ValueError('Unexpected State instance `{step}`, State type `{state_type}` does not support method `next`.'.format(step=next_step, state_type=self.type))

        # By design, Choice states do not have the Next field. When used in a chain, the subsequent step becomes the
        # default choice that executes if none of the specified rules match.
        # See language spec for more info: https://states-language.net/spec.html#choice-state
        if self.type is 'Choice':
            if self.default is not None:
                logger.warning(f'Chaining Choice state: Overwriting {self.state_id}\'s current default_choice ({self.default.state_id}) with {next_step.state_id}')
            self.default_choice(next_step)
            return self.default

        self.next_step = next_step
        return self.next_step