def _create_single_feature_method(feature):
    """Return a function that will detect a single feature.

    Args:
        feature (enum): A specific feature defined as a member of
            :class:`~enums.Feature.Type`.

    Returns:
        function: A helper function to detect just that feature.
    """
    # Define the function properties.
    fx_name = feature.name.lower()
    if "detection" in fx_name:
        fx_doc = "Perform {0}.".format(fx_name.replace("_", " "))
    else:
        fx_doc = "Return {desc} information.".format(desc=fx_name.replace("_", " "))

    # Provide a complete docstring with argument and return value
    # information.
    fx_doc += """

    Args:
        image (:class:`~.{module}.types.Image`): The image to analyze.
        max_results (int):
            Number of results to return, does not apply for
            TEXT_DETECTION, DOCUMENT_TEXT_DETECTION, or CROP_HINTS.
        retry (int): Number of retries to do before giving up.
        timeout (int): Number of seconds before timing out.
        kwargs (dict): Additional properties to be set on the
            :class:`~.{module}.types.AnnotateImageRequest`.

    Returns:
        :class:`~.{module}.types.AnnotateImageResponse`: The API response.
    """

    # Get the actual feature value to send.
    feature_value = {"type": feature}

    # Define the function to be returned.
    def inner(self, image, max_results=None, retry=None, timeout=None, **kwargs):
        """Return a single feature annotation for the given image.

        Intended for use with functools.partial, to create the particular
        single-feature methods.
        """
        copied_features = feature_value.copy()
        if max_results is not None:
            copied_features["max_results"] = max_results
        request = dict(image=image, features=[copied_features], **kwargs)
        response = self.annotate_image(request, retry=retry, timeout=timeout)
        return response

    # Set the appropriate function metadata.
    inner.__name__ = fx_name
    inner.__doc__ = fx_doc

    # Return the final function.
    return inner
def _create_single_feature_method ( feature ) : fx_name = feature . name . lower ( ) if "detection" in fx_name : fx_doc = "Perform {0}." . format ( fx_name . replace ( "_" , " " ) ) else : fx_doc = "Return {desc} information." . format ( desc = fx_name . replace ( "_" , " " ) ) fx_doc += """
    Args:
        image (:class:`~.{module}.types.Image`): The image to analyze.
        max_results (int):
            Number of results to return, does not apply for
            TEXT_DETECTION, DOCUMENT_TEXT_DETECTION, or CROP_HINTS.
        retry (int): Number of retries to do before giving up.
        timeout (int): Number of seconds before timing out.
        kwargs (dict): Additional properties to be set on the
            :class:`~.{module}.types.AnnotateImageRequest`.
    Returns:
        :class:`~.{module}.types.AnnotateImageResponse`: The API response.
    """ feature_value = { "type" : feature } def inner ( self , image , max_results = None , retry = None , timeout = None , ** kwargs ) : copied_features = feature_value . copy ( ) if max_results is not None : copied_features [ "max_results" ] = max_results request = dict ( image = image , features = [ copied_features ] , ** kwargs ) response = self . annotate_image ( request , retry = retry , timeout = timeout ) return response inner . __name__ = fx_name inner . __doc__ = fx_doc return inner
Return a function that will detect a single feature.

    Args:
        feature (enum): A specific feature defined as a member of
            :class:`~enums.Feature.Type`.

    Returns:
        function: A helper function to detect just that feature.