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

    This metaclass adds a `{feature}` method for every feature
    defined on the Feature enum.
193289
def add_single_feature_methods(cls):
    
    # 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
876385
protected PyFeatureCallGenerator newFeatureCallGenerator(IExtraLanguageGeneratorContext context, IAppendable it) {
		return new PyFeatureCallGenerator(context, (ExtraLanguageAppendable) it);
	}
1315060
def add(options = {})
      self.options = options

      raise(ArgumentError, 'Mandatory param :name missing') unless options[:name]

      if options[:feature]
        features << options
        SafetyCone::ViewHelpers.add_method(options[:feature])
      else
        paths[make_key] = options
      end
    end
1242791
def as_view(cls, *args, **kwargs):
        
        initkwargs = cls.get_initkwargs(*args, **kwargs)
        return super(WizardView, cls).as_view(**initkwargs)
952150
def wrap_with(wrapper_cls):
    
    def wrapper(func):
        annotate(func, 'wrapper', [{'wrapper': wrapper_cls}])
        return activate(func)
    return wrapper
1257195
def add_metaclass(metaclass):
    """"""
    def wrapper(cls):
        orig_vars = cls.__dict__.copy()
        orig_vars.pop('__dict__', None)
        orig_vars.pop('__weakref__', None)
        return metaclass(cls.__name__, cls.__bases__, orig_vars)
    return wrapper
350444
def method_missing(method, *args, &block)
      return super unless method =~ /^find_(all_|last_|or_(initialize_|create_))?by_/

      result = object_class.send(method, *args, &block)
      options = args.extract_options!

      if method =~ /^find_all/
        decorate_collection(result, options)
      else
        decorate(result, options)
      end
    end
268787
def no_type_check_decorator(decorator):
    

    @functools.wraps(decorator)
    def wrapped_decorator(*args, **kwds):
        func = decorator(*args, **kwds)
        func = no_type_check(func)
        return func

    return wrapped_decorator
387083
protected static void addFeatureThenClear(StringBuilder rawFeature, List<Integer> featureVector, FeatureMap featureMap)
    {
        int id = featureMap.idOf(rawFeature.toString());
        if (id != -1)
        {
            featureVector.add(id);
        }
        rawFeature.setLength(0);
    }
145583
def with_wrapper(self, wrapper=None, name=None):
        
        name = name or '{}_custom_wrapper'.format(self.name)
        return self.__class__(self.data, name=name, wrapper=wrapper)
83623
def _create_single_feature_method(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
285990
def decorate_method(wrapped):
    
    def wrapper(self):
        lines = Lines()
        if hasattr(self.model, wrapped.__name__):
            print('            . %s' % wrapped.__name__)
            lines.add(1, method_header(wrapped.__name__, nogil=True))
            for line in wrapped(self):
                lines.add(2, line)
        return lines
    functools.update_wrapper(wrapper, wrapped)
    wrapper.__doc__ = 'Lines of model method %s.' % wrapped.__name__
    return property(wrapper)
1354718
def decorate_set_on_listener(prototype):
    
    # noinspection PyDictCreation,PyProtectedMember
    def add_annotation(method):
        method._event_info = {}
        method._event_info['name'] = method.__name__
        method._event_info['prototype'] = prototype
        return method

    return add_annotation
80008
function decorators() {
  for (var _len3 = arguments.length, funcs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
    funcs[_key3] = arguments[_key3];
  }

  return function (key, value, descriptor) {
    var elementDescriptor;

    if (!descriptor) {
      elementDescriptor = key;
    } else {
      elementDescriptor = {
        key: key,
        descriptor: descriptor,
        value: value
      };
    }

    var ret = funcs.reduceRight(function (a, b) {
      return b.call(this, a);
    }, elementDescriptor);
    return ret && ret.descriptor;
  };
}
1117928
def method_missing(symbol, *args)
      self.class.new(@components.map { |enum|enum.send(symbol, *args) })
    end
1182867
def add_new_repr_method(cls):
    

    if isinstance(cls.__repr__, WrapperDescriptorType):
        cls.__repr__ = lambda self: f"<{self.__class__.__name__}, id={hex(id(self))}>"
    else:
        # Keep the user-defined __repr__ method
        pass
756430
def as_view(url=None, methods=None, view_class=ActionsView, name=None, url_rules=None, **kwargs):
    
    def decorator(f):
        if url is not None:
            f = expose(url, methods=methods)(f)

        clsdict = {"name": name or f.__name__,
                   "actions": getattr(f, "actions", None),
                   "url_rules": url_rules or getattr(f, "urls", None)}

        if isinstance(f, WithActionsDecorator):
            f = f.func
        clsdict['func'] = f

        def constructor(self, **ctorkwargs):
            for k, v in kwargs.items():
                if k not in ctorkwargs or ctorkwargs[k] is None:
                    ctorkwargs[k] = v
            view_class.__init__(self, func=f, **ctorkwargs)

        clsdict["__init__"] = constructor
        return type(f.__name__, (view_class,), clsdict)

    return decorator