Custom decorator intended for :class:`~vision.helpers.VisionHelpers`.

    This metaclass adds a `{feature}` method for every feature
    defined on the Feature enum.

def add_single_feature_methods(cls):
    """Custom decorator intended for :class:`~vision.helpers.VisionHelpers`.

    This metaclass adds a `{feature}` method for every feature
    defined on the Feature enum.
    """
    # Sanity check: This only makes sense if we are building the GAPIC
    # subclass and have enums already attached.
    if not hasattr(cls, "enums"):
        return cls

    # Add each single-feature method to the class.
    for feature in cls.enums.Feature.Type:
        # Sanity check: Do not make a method for the falsy feature.
        if feature.name == "TYPE_UNSPECIFIED":
            continue

        # Assign the appropriate metadata to the function.
        detect = _create_single_feature_method(feature)

        # Assign a qualified name to the function, and perform module
        # replacement on the docstring.
        detect.__qualname__ = "{cls}.{name}".format(
            cls=cls.__name__, name=detect.__name__
        )
        detect.__doc__ = detect.__doc__.format(module=cls.__module__)

        # Place the function on the class being created.
        setattr(cls, detect.__name__, detect)

    # Done; return the class.
    return cls