Decorate services
164083
public function beforeCompile(): void
	{
		// Skip if it's not CLI mode
		if (!$this->cliMode) return;

		$builder = $this->getContainerBuilder();

		// Lookup for Symfony Console Application
		$application = $builder->getDefinitionByType('Symfony\Component\Console\Application');

		// Register helpers
		$connectionHelper = $this->prefix('@connectionHelper');
		$application->addSetup(new Statement('$service->getHelperSet()->set(?, ?)', [$connectionHelper, 'db']));
	}
1161668
private static Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> decorator(
            Method method, Class<?> clazz,
            Function<Service<HttpRequest, HttpResponse>,
                    ? extends Service<HttpRequest, HttpResponse>> initialDecorator) {

        final List<DecoratorAndOrder> decorators = collectDecorators(clazz, method);

        Function<Service<HttpRequest, HttpResponse>,
                ? extends Service<HttpRequest, HttpResponse>> decorator = initialDecorator;
        for (int i = decorators.size() - 1; i >= 0; i--) {
            final DecoratorAndOrder d = decorators.get(i);
            decorator = decorator.andThen(d.decorator());
        }
        return decorator;
    }
602318
private function prepareService()
    {
        /**
         * If CommodeCommonServiceProvider is not loaded yet, load it
         * and mark as registered in GhostServices
         */
        if (!($bound = $this->app->bound(ServiceShortCuts::CORE_INITIALIZED))) {
            $this->services(['LaravelCommode\Common\CommodeCommonServiceProvider']);
        }

        $withGhostServiceDo = function (GhostServices $appServices) use ($bound) {
            /**
             * If CommodeCommonServiceProvider is not loaded yet, load it
             * and mark as registered in GhostServices
             */
            if (!$bound) {
                $appServices->register('LaravelCommode\Common\CommodeCommonServiceProvider');
            }

            /**
             * Get and register service providers in ServiceManager
             */
            $services = $appServices->differUnique($this->uses(), true);

            /**
             * Register service proviers in laravel app
             * differing from already used ones
             */
            $this->services(array_diff($services, array_keys($this->app->getLoadedProviders())));

            /**
             * Mark current service as registered
             */
            $appServices->register(get_class($this));
        };

        $this->with(ServiceShortCuts::GHOST_SERVICE, $withGhostServiceDo);

        return $this;
    }
124082
def autobuild_decorate(func, caller):
    
    evaldict = dict(_call_=caller, _func_=func)
    fun = AutobuildFunctionMaker.create(
        func, "return _call_(_func_, %(shortsignature)s)",
        evaldict, __wrapped__=func)
    if hasattr(func, '__qualname__'):
        fun.__qualname__ = func.__qualname__
    return fun
739989
public void install(Map<String, Pair<Service, Persistence>> services) {
        for (Spec spec: _specifications) {
            if (spec.service.equals(GLOBAL_ALL_SERVICES)) {
                for (Map.Entry<String, Pair<Service, Persistence>> service: services.entrySet()) {
                    try {
                        if (spec.milestone == null) {
                            if (service.getValue().first instanceof Service.Extendable) {
                                ((Service.Extendable)service.getValue().first).setFilter((Service.Filter)spec.augment);
                            }
                        } else {
                            ServiceMilestone.attach(service.getValue().first, spec.milestone, (ServiceMilestone.Evaluation)spec.augment);
                        }
                    } catch (Exception x) {
                        _logger.log(Level.WARNING, service.getKey(), x);
                    }
                }
            } else if (spec.service.equals(MODULE_ALL_SERVICES)) {
                for (Map.Entry<String, Pair<Service, Persistence>> service: services.entrySet()) {
                    try {
                        if (spec.milestone == null) {
                            if (service.getKey().startsWith(_module + '/') && service.getValue().first instanceof Service.Extendable) {
                                ((Service.Extendable)service.getValue().first).setFilter((Service.Filter)spec.augment);
                            }
                        } else {
                            ServiceMilestone.attach(service.getValue().first, spec.milestone, (ServiceMilestone.Evaluation)spec.augment);
                        }
                    } catch (Exception x) {
                        _logger.log(Level.WARNING, service.getKey(), x);
                    }
                }
            } else if (spec.service.indexOf('/') > -1) {
                try {
                    if (spec.milestone == null) {
                        ((Service.Extendable)services.get(spec.service).first).setFilter((Service.Filter)spec.augment);
                    } else {
                        ServiceMilestone.attach(services.get(spec.service).first, spec.milestone, (ServiceMilestone.Evaluation)spec.augment);
                    }
                } catch (Exception x) {
                    _logger.log(Level.WARNING, spec.service, x);
                }
            } else {
                try {
                    if (spec.milestone == null) {
                        ((Service.Extendable)services.get(_module + '/' + spec.service).first).setFilter((Service.Filter)spec.augment);
                    } else {
                        ServiceMilestone.attach(services.get(_module + '/' + spec.service).first, spec.milestone, (ServiceMilestone.Evaluation)spec.augment);
                    }
                } catch (Exception x) {
                    _logger.log(Level.WARNING, spec.service, x);
                }
            }
        }

        _specifications.clear();
        _module = null;
    }
480077
@SuppressWarnings("unchecked")
  private Repository<Entity> decorateRepository(
      Repository<Entity> repository, DecoratorConfiguration configuration) {
    Map<String, Map<String, Object>> parameterMap = getParameterMap(configuration);
    List<DecoratorParameters> decoratorParameters =
        configuration.getDecoratorParameters().collect(toList());
    for (DecoratorParameters decoratorParam : decoratorParameters) {
      DynamicRepositoryDecoratorFactory factory =
          factories.get(decoratorParam.getDecorator().getId());
      if (factory != null) {
        repository =
            factory.createDecoratedRepository(repository, parameterMap.get(factory.getId()));
      }
    }
    return repository;
  }
5606
function onServices() {
  //debug('onServices');
  var numServices = Object.keys(this.services).length;
  if (!this.properties.tethering && numServices > 0) {
    //debug('update servicesCache');
    _servicesCache = this.services;
  }
}
1176365
function decorate (fn) {
  return async function (...args) {
    try {
      return fn.call(this, ...args);
    } catch (err) {
      this.logger && this.logger.error(err.message);
      throw err;
    }
  };
}
971986
def _decorate_fun(self, fun):
        """"""

        msg = "Function %s is deprecated" % fun.__name__
        if self.extra:
            msg += "; %s" % self.extra

        def wrapped(*args, **kwargs):
            warnings.warn(msg, category=DeprecationWarning)
            return fun(*args, **kwargs)

        wrapped.__name__ = fun.__name__
        wrapped.__dict__ = fun.__dict__
        wrapped.__doc__ = self._update_doc(fun.__doc__)

        return wrapped
259027
@Override
    protected L addService(L service, ServiceProperties props) {
        L decorated = decorator.apply(service, props);
        if (decorated != null) {
            listenerSupport.addListener(decorated);
        }
        return decorated;
    }
191405
def pass_service(*names):
    
    def decorator(f):
        @functools.wraps(f)
        def wrapper(*args, **kwargs):
            for name in names:
                kwargs[name] = service_proxy(name)
            return f(*args, **kwargs)
        return wrapper
    return decorator
1239300
def decorate(templates, path_info, details, locals)
      templates.each do |t|
        t.locals = locals
      end
    end
922420
def _decorate(self, atype, n, o):
        
        typemap = {"function": "functions",
                   "classobj": "classes",
                   "staticmethod": "methods",
                   "type": "classes"}
        from acorn.logging.decoration import decorate_obj
        try:
            otype = typemap[atype]
            decorate_obj(self.shell.user_ns, n, o, otype)
            #Also create a log in the database for this execution; this allows a
            #user to track the changes they make in prototyping function and
            #class definitions.
            self._logdef(n, o, otype)
            msg.okay("Auto-decorated {}: {}.".format(n, o))
        except:
            msg.err("Error auto-decorating {}: {}.".format(n, o))
            raise
308941
function()
    {
        var _this = this;

        _(api.services).each(function(service, key) {
            _this._addService(service);
        });
    }
1308967
private void decorate(final DistributionSet distributionSet, final String caption, final String style1,
            final String style2) {
        final VaadinMessageSource i18n = SpringContextHelper.getBean(VaadinMessageSource.class);
        final VerticalLayout layout = new VerticalLayout();
        // Display distribution set name
        layout.addComponent(SPUIComponentProvider.createNameValueLabel(i18n.getMessage("label.dist.details.name"),
                distributionSet.getName(), distributionSet.getVersion()));

        /* Module info */
        distributionSet.getModules()
                .forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module)));

        layout.setSizeFull();
        layout.setMargin(false);
        layout.setSpacing(false);

        setContent(layout);
        // Decorate specific
        setCaption(caption);
        addStyleName(style1);
        addStyleName(style2);
        addStyleName("small");
        setImmediate(false);
    }
194208
def decorate(self, fun):
        """"""
        @wraps(fun)
        def _decorated(*args, **kwargs):
            # Push the config, run the function and pop it afterwards.
            self.push_config()
            try:
                return fun(*args, **kwargs)
            finally:
                self.pop_config()
        return _decorated
1046784
@SuppressWarnings("unchecked")
    private static Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> newDecorator(Decorator decorator) {
        return service -> service.decorate(getInstance(decorator, DecoratingServiceFunction.class));
    }