<commit_before># -*- encoding: utf-8 -*-
from supriya.tools.systemtools.Enumeration import Enumeration


class Rate(Enumeration):
    r'''An enumeration of scsynth calculation rates.

    ::

        >>> from supriya.tools import synthdeftools
        >>> synthdeftools.Rate.AUDIO
        <Rate.AUDIO: 2>

    ::

        >>> synthdeftools.Rate.from_expr('demand')
        <Rate.DEMAND: 3>

    '''

    ### CLASS VARIABLES ###

    AUDIO = 2
    CONTROL = 1
    DEMAND = 3
    SCALAR = 0

    ### PUBLIC METHODS ###

    @staticmethod
    def from_collection(collection):
        r'''Gets calculation rate from a collection.

        ::

            >>> from supriya.tools import synthdeftools

        ::

            >>> collection = []
            >>> collection.append(synthdeftools.DC.ar(0))
            >>> collection.append(synthdeftools.DC.kr(1))
            >>> collection.append(2.0)
            >>> synthdeftools.Rate.from_collection(collection)
            <Rate.AUDIO: 2>

        ::
            >>> collection = []
            >>> collection.append(synthdeftools.DC.kr(1))
            >>> collection.append(2.0)
            >>> synthdeftools.Rate.from_collection(collection)
            <Rate.CONTROL: 1>

        Return calculation rate.
        '''
        rates = [
            Rate.from_input(item) for item in collection
            ]
        maximum_rate = max(rates)
        return maximum_rate

    @staticmethod
    def from_input(input_):
        from supriya.tools import synthdeftools
        prototype = (synthdeftools.OutputProxy, synthdeftools.UGen)
        if isinstance(input_, (int, float)):
            return Rate.SCALAR
        elif isinstance(input_, prototype):
            return input_.rate
        raise ValueError(input_)
<commit_msg>Added TRIGGER to Rate enumeration.<commit_after># -*- encoding: utf-8 -*-
from supriya.tools.systemtools.Enumeration import Enumeration


class Rate(Enumeration):
    r'''An enumeration of scsynth calculation rates.

    ::

        >>> from supriya.tools import synthdeftools
        >>> synthdeftools.Rate.AUDIO
        <Rate.AUDIO: 2>

    ::

        >>> synthdeftools.Rate.from_expr('demand')
        <Rate.DEMAND: 3>

    '''

    ### CLASS VARIABLES ###

    AUDIO = 2
    CONTROL = 1
    DEMAND = 3
    SCALAR = 0
    TRIGGER = 1

    ### PUBLIC METHODS ###

    @staticmethod
    def from_collection(collection):
        r'''Gets calculation rate from a collection.

        ::

            >>> from supriya.tools import synthdeftools

        ::

            >>> collection = []
            >>> collection.append(synthdeftools.DC.ar(0))
            >>> collection.append(synthdeftools.DC.kr(1))
            >>> collection.append(2.0)
            >>> synthdeftools.Rate.from_collection(collection)
            <Rate.AUDIO: 2>

        ::
            >>> collection = []
            >>> collection.append(synthdeftools.DC.kr(1))
            >>> collection.append(2.0)
            >>> synthdeftools.Rate.from_collection(collection)
            <Rate.CONTROL: 1>

        Return calculation rate.
        '''
        rates = [
            Rate.from_input(item) for item in collection
            ]
        maximum_rate = max(rates)
        return maximum_rate

    @staticmethod
    def from_input(input_):
        from supriya.tools import synthdeftools
        prototype = (synthdeftools.OutputProxy, synthdeftools.UGen)
        if isinstance(input_, (int, float)):
            return Rate.SCALAR
        elif isinstance(input_, prototype):
            return input_.rate
        raise ValueError(input_)
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.00919732441471572, 'mean_word_length': 1.9612211221122111, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7132206', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1010, 'n_words': 204}