Form the name of a factory method/field given a resource key.
439756
String factoryName(String key) {
        return Stream.of(key.split("[\\.-]"))
                .skip(2)
                .map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1))
                .collect(Collectors.joining(""));
    }
292170
def construct(self, mapping: dict, **kwargs):
        
        assert '__type__' not in kwargs and '__args__' not in kwargs
        mapping = {**mapping, **kwargs}
        factory_fqdn = mapping.pop('__type__')
        factory = self.load_name(factory_fqdn)
        args = mapping.pop('__args__', [])
        return factory(*args, **mapping)
430292
def get_factory_kwargs(self):
        
        params = dict()

        exclude = self.derive_exclude()
        exclude += self.derive_readonly()

        if self.fields:
            fields = list(self.fields)
            for ex in exclude:
                if ex in fields:
                    fields.remove(ex)

            params['fields'] = fields

        if exclude:
            params['exclude'] = exclude

        return params
25665
public static IModel<String> newResourceModel(final String resourceBundleKey)
	{
		return newResourceModel(ResourceBundleKey.builder().key(resourceBundleKey).build());
	}
10918
def load_factory(name, directory, configuration=None):
    
    for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT):
        if entry_point.name == name:
            factory_class = entry_point.load(require=False)
            return factory_class(directory, configuration)

    raise KeyError
363162
def load(config, opt):
        """"""
        ctx = Context(opt)
        seed_map = py_resources()
        seed_keys = sorted(set([m[0] for m in seed_map]), key=resource_sort)
        for config_key in seed_keys:
            if config_key not in config:
                continue
            for resource_config in config[config_key]:
                mod = find_model(config_key, resource_config, seed_map)
                if not mod:
                    LOG.warning("unable to find mod for %s", resource_config)
                    continue

                ctx.add(mod(resource_config, opt))

        for config_key in config.keys():
            if config_key != 'pgp_keys' and \
               config_key not in seed_keys:
                LOG.warning("missing model for %s", config_key)

        return filtered_context(ctx)
958398
def cache_key_name(cls, *args):
        """"""
        if cls.KEY_FIELDS != ():
            if len(args) != len(cls.KEY_FIELDS):
                raise TypeError(
                    "cache_key_name() takes exactly {} arguments ({} given)".format(len(cls.KEY_FIELDS), len(args))
                )
            # pylint: disable=unicode-builtin
            return 'configuration/{}/current/{}'.format(cls.__name__, ','.join(six.text_type(arg) for arg in args))
        else:
            return 'configuration/{}/current'.format(cls.__name__)
278803
def get_perm_name(cls, resource, method):
        

        return '%s_%s_%s' % (
            cls.PREFIX,
            cls._get_resource_name(resource),
            method.lower())
1336878
def get_service service_key, *args
      service_factories.fetch(service_key).call *args

    rescue KeyError
      raise UnknownServiceError.new("Cannot locate factory for '#{service_key}' - please check your configuration")

    rescue NoMethodError => err
      if err.message =~ /undefined method `call'/
        raise UncallableFactoryError.new("The factory registered for '#{service_key}' did not respond to #call")
      else
        raise
      end
    end
119869
def _build_resource_from_properties(obj, filter_fields):
    
    partial = {}
    for filter_field in filter_fields:
        api_field = obj._PROPERTY_TO_API_FIELD.get(filter_field)
        if api_field is None and filter_field not in obj._properties:
            raise ValueError("No property %s" % filter_field)
        elif api_field is not None:
            partial[api_field] = obj._properties.get(api_field)
        else:
            # allows properties that are not defined in the library
            # and properties that have the same name as API resource key
            partial[filter_field] = obj._properties[filter_field]

    return partial
36638
public void withGeneratedName()
    {
        if (key.getAnnotation() != null) {
            if (key.getAnnotation() instanceof Named) {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), ((Named) key.getAnnotation()).value()));
            }
            else {
                as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotation().annotationType().getSimpleName()));
            }
        }
        else if (key.getAnnotationType() != null) {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType(), key.getAnnotationType().getSimpleName()));
        }
        else {
            as(factory -> factory.generatedNameOf(key.getTypeLiteral().getRawType()));
        }
    }
827522
def _create_value(self, data, name, spec):
        

        field = getattr(self, 'create_' + name, None)
        if field:
            # this factory has a special creator function for this field
            return field(data, name, spec)
        value = data.get(name)
        return spec.fields[name].clean(value)
1363074
function(model, name) {
                if (!model.resource) {
                    return;
                }

                var resource = model.resource.replace(/\/+$/, "");
                if (name === "findAll" || name === "create") {
                    return resource;
                } else {
                    return resource + "/{" + model.id + "}";
                }
            }
426413
def get_factory_kwargs(self):
        
        kwargs = {}
        kwargs.update({
            'can_delete': self.can_delete,
            'extra': self.extra,
            'exclude': self.exclude,
            'fields': self.fields,
            'formfield_callback': self.formfield_callback,
            'fk_name': self.fk_name,
        })
        if self.formset_class:
            kwargs['formset'] = self.formset_class

        if self.child_form:
            kwargs['form'] = self.child_form
        return kwargs
214787
def _build_model_factories(store):
    """"""

    result = {}

    for schemaname in store:

        schema = None

        try:
            schema = store[schemaname]['schema']
        except KeyError:
            schemata_log("No schema found for ", schemaname, lvl=critical, exc=True)

        try:
            result[schemaname] = warmongo.model_factory(schema)
        except Exception as e:
            schemata_log("Could not create factory for schema ", schemaname, schema, lvl=critical, exc=True)

    return result
1237266
function(name, factory) {
                        if (_.isUndefined(factory)) {
                            factory = name;
                            name = undefined;
                        }

                        if (factory && factory.__clazz && factory.__clazz.__isSubclazzOf('/InjectorJS/Factories/Abstract')) {
                            return this.__setPropertyValue(['factory', factory.getName()], factory);
                        }

                        var fields = _.isString(name) ? name.split('.') : name || [];

                        return this.__setPropertyValue(['factory'].concat(fields), factory);
                    }
82854
def create(self, name, *args, **kwargs):
        
        resource_name = self._resource_name(name)
        log.info(
            "Creating {} '{}'...".format(self._model_name, resource_name))
        resource = self.collection.create(*args, name=resource_name, **kwargs)
        self._ids.add(resource.id)
        return resource