Factory method for building new CreditNote objects associated with this gateway.
551834
def build_credit_note(credit_note = {})
      case credit_note
        when CreditNote then     credit_note.gateway = self
        when Hash then        credit_note = CreditNote.new(credit_note.merge(:gateway => self))
      end
      credit_note
    end
107474
def make_factory(klass, **kwargs):
    """"""
    factory_name = '%sFactory' % klass.__name__

    class Meta:
        model = klass

    kwargs['Meta'] = Meta
    base_class = kwargs.pop('FACTORY_CLASS', base.Factory)

    factory_class = type(base.Factory).__new__(type(base.Factory), factory_name, (base_class,), kwargs)
    factory_class.__name__ = '%sFactory' % klass.__name__
    factory_class.__doc__ = 'Auto-generated factory for class %s' % klass
    return factory_class
1082797
def construct_infrastructure_factory(self, *args, **kwargs):
        
        factory_class = self.infrastructure_factory_class
        assert issubclass(factory_class, InfrastructureFactory)
        return factory_class(
            record_manager_class=self.record_manager_class,
            integer_sequenced_record_class=self.stored_event_record_class,
            sequenced_item_class=self.sequenced_item_class,
            contiguous_record_ids=self.contiguous_record_ids,
            application_name=self.name,
            pipeline_id=self.pipeline_id,
            snapshot_record_class=self.snapshot_record_class,
            *args, **kwargs
        )
1230584
def create(img_rows, img_cols, img_channels, num_classes):
    
    def instantiate(**_):
        return Net(img_rows, img_cols, img_channels, num_classes)
    return ModelFactory.generic(instantiate)
826468
public T newInstance(Map<String, Object> fields)
	{
		try
		{
			FactoryDefinition<T> bestDef = factories[0];
			int bestScore = bestDef.getScore(fields);

			for(int i=1, n=factories.length; i<n; i++)
			{
				int score = factories[i].getScore(fields);
				if(score > bestScore)
				{
					bestDef = factories[i];
					bestScore = score;
				}
			}

			return bestDef.create(fields);
		}
		catch(RuntimeException e)
		{
			throw new RuntimeException("Could not create " + type + "; " + e.getMessage(), e);
		}
	}
1036154
def create(item_type: Type[Any], constructor_args: Dict[str, Any], cause: Exception):
        
        return ObjectInstantiationException('Error while building object of type <' + get_pretty_type_str(item_type)
                                            + '> using its constructor and parsed contents : ' + str(constructor_args)
                                            + ' : \n' + str(cause.__class__) + ' ' + str(cause)
                                            ).with_traceback(cause.__traceback__)
427381
def build(self, builder):
        """"""
        params = dict(LabelOID=self.oid, OrderNumber=str(self.order_number))

        builder.start("mdsol:LabelRef", params)
        builder.end("mdsol:LabelRef")
881131
public NccFeature createDescriptor() {
		NccFeature f;
		if( unused.isEmpty() )
			f = new NccFeature(15*15);
		else
			f = unused.pop();
		return f;
	}
439034
protected final CommPortConnectionFactory createCommPortConnectionFactory()
    {
        //create new instance
        CommPortConnectionFactory factory=(CommPortConnectionFactory)ReflectionHelper.createInstance(this.commConnectionFactoryClassName);
            
        //initialize
        factory.initialize(this);
        
        return factory;
    }
1062469
def create_note(self, from_email, content):
        """"""
        if from_email is None or not isinstance(from_email, six.string_types):
            raise MissingFromEmail(from_email)

        endpoint = '/'.join((self.endpoint, self.id, 'notes'))
        add_headers = {'from': from_email, }

        return self.noteFactory.create(
            endpoint=endpoint,
            api_key=self.api_key,
            add_headers=add_headers,
            data={'content': content},
        )
405021
def _create_all_new_chains(self, converter) -> Tuple[List[Converter], List[Converter],
                                                         List[Converter], List[Converter]]:
        

        specific_chains, specific_nonstrict_chains, generic_chains, generic_nonstrict_chains = [], [], [], []

        if converter.is_generic():
            # the smaller chain : the singleton :)
            generic_chains.append(ConversionChain(initial_converters=[converter], strict_chaining=True))
        else:
            specific_chains.append(ConversionChain(initial_converters=[converter], strict_chaining=True))


        # 1) create new specific chains by adding this converter at the beginning or end of all *non-generic* ones
        # -- non-strict
        new_c_at_end_ns = []
        new_c_at_beginning_ns = []
        if not self.strict:
            # then there are non-strict chains already. Try to connect to them
            for existing_specific_nonstrict in self._specific_non_strict_conversion_chains:
                if converter.can_be_appended_to(existing_specific_nonstrict, strict=False):
                    if ConversionChain.are_worth_chaining(existing_specific_nonstrict, converter):
                        new_c_at_end_ns.append(ConversionChain.chain(existing_specific_nonstrict, converter,
                                                                     strict=False))
                if existing_specific_nonstrict.can_be_appended_to(converter, strict=False):
                    if ConversionChain.are_worth_chaining(converter, existing_specific_nonstrict):
                        new_c_at_beginning_ns.append(ConversionChain.chain(converter, existing_specific_nonstrict,
                                                                           strict=False))

        # -- strict
        new_c_at_end = []
        new_c_at_beginning = []
        for existing_specific in self._specific_conversion_chains:
            # first try *strict* mode
            if converter.can_be_appended_to(existing_specific, strict=True):
                if ConversionChain.are_worth_chaining(existing_specific, converter):
                    new_c_at_end.append(ConversionChain.chain(existing_specific, converter, strict=True))
            elif (not self.strict) and converter.can_be_appended_to(existing_specific, strict=False):
                if ConversionChain.are_worth_chaining(existing_specific, converter):
                    new_c_at_end_ns.append(ConversionChain.chain(existing_specific, converter, strict=False))

            if existing_specific.can_be_appended_to(converter, strict=True):
                if ConversionChain.are_worth_chaining(converter, existing_specific):
                    # TODO this is where when chaining a generic to a specific, we would actually have to restrict it
                    # note: but maybe we dont care since now this is checked and prevented in the convert() method
                    new_c_at_beginning.append(ConversionChain.chain(converter, existing_specific, strict=True))
            elif (not self.strict) and existing_specific.can_be_appended_to(converter, strict=False):
                if ConversionChain.are_worth_chaining(converter, existing_specific):
                    # TODO this is where when chaining a generic to a specific, we would actually have to restrict it
                    # note: but maybe we dont care since now this is checked and prevented in the convert() method
                    new_c_at_beginning_ns.append(ConversionChain.chain(converter, existing_specific, strict=False))

        # append to the right list depending on the nature of this converter
        if converter.is_generic():
            generic_chains += new_c_at_end
            generic_nonstrict_chains += new_c_at_end_ns
        else:
            specific_chains += new_c_at_end
            specific_nonstrict_chains += new_c_at_end_ns
        # common for both types
        specific_chains += new_c_at_beginning
        specific_nonstrict_chains += new_c_at_beginning_ns

        # by combining all created chains into a big one
        for a in new_c_at_end:
            for b in new_c_at_beginning:
                b_ = b.remove_first()
                if b_.can_be_appended_to(a, strict=True):
                    if ConversionChain.are_worth_chaining(a, b_):
                        specific_chains.append(ConversionChain.chain(a, b_, strict=True))
            for b in new_c_at_beginning_ns:
                b_ = b.remove_first()
                if b_.can_be_appended_to(a, strict=False):
                    if ConversionChain.are_worth_chaining(a, b_):
                        specific_nonstrict_chains.append(ConversionChain.chain(a, b_, strict=False))
        for a in new_c_at_end_ns:
            for b in (new_c_at_beginning_ns + new_c_at_beginning):
                b_ = b.remove_first()
                if b_.can_be_appended_to(a, strict=False):
                    if ConversionChain.are_worth_chaining(a, b_):
                        specific_nonstrict_chains.append(ConversionChain.chain(a, b_, strict=False))

        # by inserting this converter at the beginning of an existing *generic*
        if converter.is_generic():
            # we want to avoid chaining generic converters together
            pass
        else:
            new_c_at_beginning_generic = []
            new_c_at_beginning_generic_ns = []
            for existing_specific in self._generic_conversion_chains:
                # start with strict
                if existing_specific.can_be_appended_to(converter, strict=True):
                    if ConversionChain.are_worth_chaining(converter, existing_specific):
                        new_c_at_beginning_generic.append(ConversionChain.chain(converter, existing_specific,
                                                                                strict=True))
                elif (not self.strict) and existing_specific.can_be_appended_to(converter, strict=False):
                    if ConversionChain.are_worth_chaining(converter, existing_specific):
                        new_c_at_beginning_generic_ns.append(ConversionChain.chain(converter, existing_specific,
                                                                                   strict=False))

            for existing_specific_ns in self._generic_nonstrict_conversion_chains:
                if existing_specific_ns.can_be_appended_to(converter, strict=False):
                    if ConversionChain.are_worth_chaining(converter, existing_specific_ns):
                        new_c_at_beginning_generic_ns.append(ConversionChain.chain(converter, existing_specific_ns,
                                                                               strict=False))
            generic_chains += new_c_at_beginning_generic
            generic_nonstrict_chains += new_c_at_beginning_generic_ns

            # by combining specific and generic created chains into a big one
            for a in new_c_at_end:
                for b in new_c_at_beginning_generic:
                    b_ = b.remove_first()
                    if b_.can_be_appended_to(a, strict=True):
                        if ConversionChain.are_worth_chaining(a, b_):
                            generic_chains.append(ConversionChain.chain(a, b_, strict=True))
                for b in new_c_at_beginning_generic_ns:
                    b_ = b.remove_first()
                    if b_.can_be_appended_to(a, strict=False):
                        if ConversionChain.are_worth_chaining(a, b_):
                            generic_nonstrict_chains.append(ConversionChain.chain(a, b_, strict=False))
            for a in new_c_at_end_ns:
                for b in (new_c_at_beginning_generic_ns + new_c_at_beginning_generic):
                    b_ = b.remove_first()
                    if b_.can_be_appended_to(a, strict=False):
                        if ConversionChain.are_worth_chaining(a, b_):
                            generic_nonstrict_chains.append(ConversionChain.chain(a, b_, strict=False))

        return generic_chains, generic_nonstrict_chains, specific_chains, specific_nonstrict_chains
95831
protected BindingFactory createIdeaBindings() {
		final BindingFactory factory = new BindingFactory(getClass().getName());
		for (final AbstractSubCodeBuilderFragment subFragment : this.subFragments) {
			subFragment.generateIdeaBindings(factory);
		}
		return factory;
	}
204011
def build_invoice(invoice = {})
      case invoice
        when Invoice then     invoice.gateway = self
        when Hash then        invoice = Invoice.new(invoice.merge(:gateway => self))
      end
      invoice
    end
339318
def _create(self):
        

        if 'name' in self._data:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type(), name=self.obj_name())
        else:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type())
        self.api.commit()
        return self.api.remapIds(obj_ref)
381609
private static void createFactoryInstance()
  {
    if (tc.isEntryEnabled())
      tc.entry(cclass, "createFactoryInstance");

    try
    {
      Class cls = Class.forName(MATCHING_CLASS_NAME);
      instance = (Matching) cls.newInstance();
    }
    catch (Exception e)
    {
      // No FFDC Code Needed.
      // FFDC driven by wrapper class.
      FFDC.processException(cclass,
        "com.ibm.ws.sib.matchspace.Matching.createFactoryInstance",
        e,
        "1:94:1.18");
//TODO: trace.error  
//      tc.error(cclass, "UNABLE_TO_CREATE_MATCHING_INSTANCE_CWSIH0007E", e);

      createException = e;
    }
    
    if (tc.isEntryEnabled())
      tc.exit(cclass, "createFactoryInstance");
  }
411935
def class_factory(name, base_class, class_dict):
    """"""

    def __init__(self, tcex):
        base_class.__init__(self, tcex)
        for k, v in class_dict.items():
            setattr(self, k, v)

    newclass = type(str(name), (base_class,), {'__init__': __init__})
    return newclass
422563
public Builder newCopyBuilder() {
		return new Builder(getInputFormat(), getOutputFormat(), getActivity()).locale(getLocale()).setRequiredOptions(keys);
	}