chrome/installer/mac/signing/model.py
def make_enum(class_name, options):
    """Makes a new class type for an enum.

    Args:
        class_name: Name of the new type to make.
        options: A dictionary of enum options to use. The keys will become
            attributes on the class, and the values will be wrapped in a tuple
            so that the options can be joined together.

    Returns:
        A new class for the enum.
    """
    attrs = {}

    @classmethod
    def valid(cls, opts_to_check):
        """Tests if the specified |opts_to_check| are valid.

        Args:
            options: Iterable of option strings.

        Returns:
            True if all the options are valid, False if otherwise.
        """
        if opts_to_check is None:
            return True
        valid_values = options.values()
        return all([option in valid_values for option in opts_to_check])

    attrs['valid'] = valid

    for name, value in options.items():
        assert type(name) is str
        assert type(value) is str
        attrs[name] = (value,)

    return type(class_name, (object,), attrs)
Makes a new class type for an enum.

    Args:
        class_name: Name of the new type to make.
        options: A dictionary of enum options to use. The keys will become
            attributes on the class, and the values will be wrapped in a tuple
            so that the options can be joined together.

    Returns:
        A new class for the enum.
    
Makes a new class type for an enum.
Makes a new class type for an enum .
def make_enum(class_name, options):
    attrs = {}
    @classmethod
    def valid(cls, opts_to_check):
        if opts_to_check is None:
            return True
        valid_values = options.values()
        return all([option in valid_values for option in opts_to_check])
    attrs['valid'] = valid
    for name, value in options.items():
        assert type(name) is str
        assert type(value) is str
        attrs[name] = (value,)
    return type(class_name, (object,), attrs)
def make_enum ( class_name , options ) : attrs = { } @ classmethod def valid ( cls , opts_to_check ) : """Tests if the specified |opts_to_check| are valid.

        Args:
            options: Iterable of option strings.

        Returns:
            True if all the options are valid, False if otherwise.
        """ if opts_to_check is None : return True valid_values = options . values ( ) return all ( [ option in valid_values for option in opts_to_check ] ) attrs [ 'valid' ] = valid for name , value in options . items ( ) : assert type ( name ) is str assert type ( value ) is str attrs [ name ] = ( value , ) return type ( class_name , ( object , ) , attrs )
Makes a new class type for an enum.
Makes a new class type for an enum .
"""Makes a new class type for an enum.

    Args:
        class_name: Name of the new type to make.
        options: A dictionary of enum options to use. The keys will become
            attributes on the class, and the values will be wrapped in a tuple
            so that the options can be joined together.

    Returns:
        A new class for the enum.
    """ """Tests if the specified |opts_to_check| are valid.

        Args:
            options: Iterable of option strings.

        Returns:
            True if all the options are valid, False if otherwise.
        """
A new class for the enum.
A new class for the enum .
class_name
Name of the new type to make.
Name of the new type to make .
options
A dictionary of enum options to use. The keys will become
attributes on the class, and the values will be wrapped in a tuple
so that the options can be joined together.
A dictionary of enum options to use . The keys will become attributes on the class and the values will be wrapped in a tuple so that the options can be joined together .