This function is called after everything else has been
recomposed, and allows the template to set remaining
values that may be based on some other property that
depends on recomposition.
977234
public void compose(StylesheetRoot sroot) 
    throws javax.xml.transform.TransformerException
  {
    super.compose(sroot);
    java.util.Vector vnames = sroot.getComposeState().getVariableNames();
    if(null != m_matchPattern)
      m_matchPattern.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize());
    if(null != m_use)
      m_use.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize());
  }
235474
function( elem, options, callback ) {
		var old = {};

		// Remember the old values, and insert the new ones
		for ( var name in options ) {
			old[ name ] = elem.style[ name ];
			elem.style[ name ] = options[ name ];
		}

		callback.call( elem );

		// Revert the old values
		for ( var name in options ) {
			elem.style[ name ] = old[ name ];
		}
	}
1125858
function() {
    // Delete everything.
    if (this.getInput('ELSE')) {
      this.removeInput('ELSE');
    }
    var i = 1;
    while (this.getInput('IF' + i)) {
      this.removeInput('IF' + i);
      this.removeInput('DO' + i);
      i++;
    }
    // Rebuild block.
    for (var i = 1; i <= this.elseifCount_; i++) {
      this.appendValueInput('IF' + i)
          .setCheck('Boolean')
          .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
      this.appendStatementInput('DO' + i)
          .appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
    }
    if (this.elseCount_) {
      this.appendStatementInput('ELSE')
          .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
    }
  }
437990
def merge(cls, *others):
        
        for other in others:
            for k, v in other:
                setattr(cls, k, BoundValue(cls, k, v.value))
1321446
public void compose(StylesheetRoot sroot) throws TransformerException
  {
    super.compose(sroot);
    
    // Call compose on each param no matter if this is apply-templates 
    // or call templates.
    int length = getParamElemCount();
    for (int i = 0; i < length; i++) 
    {
      ElemWithParam ewp = getParamElem(i);
      ewp.compose(sroot);
    }
    
	if ((null != m_templateName) && (null == m_template)) {
		m_template =
			this.getStylesheetRoot().getTemplateComposed(m_templateName);

		if (null == m_template) {
			String themsg =
				XSLMessages.createMessage(
					XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR,
					new Object[] { m_templateName });

			throw new TransformerException(themsg, this);
			//"Could not find template named: '"+templateName+"'");
		}
    
      length = getParamElemCount();
      for (int i = 0; i < length; i++) 
      {
        ElemWithParam ewp = getParamElem(i);
        ewp.m_index = -1;
        // Find the position of the param in the template being called, 
        // and set the index of the param slot.
        int etePos = 0;
        for (ElemTemplateElement ete = m_template.getFirstChildElem(); 
             null != ete; ete = ete.getNextSiblingElem()) 
        {
          if(ete.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE)
          {
            ElemParam ep = (ElemParam)ete;
            if(ep.getName().equals(ewp.getName()))
            {
              ewp.m_index = etePos;
            }
          }
          else
            break;
          etePos++;
        }
        
      }
    }
  }
60965
function() {
        this.setChildren(this.get('inputs').concat(this.get('children') || []));

        var ancestor = this.get('parent.parent');
        if(ancestor) {
          ancestor.setChildren(this.get('outputs').concat(ancestor.get('children') || []));
        }
        this.set('_additionalsIncluded', true);
      }
3910
function(obj, options){
    var changed = {}, key, value;
    options || (options = {});
    options.reset = true;
    obj = (obj && obj.isModel && obj.attributes) || obj || {};
    options.previousAttributes = _.clone(this.attributes);

    // Any unset previously existing values will be set back to default
    _.each(this.defaults, function(val, key){
      if(!obj.hasOwnProperty(key)){ obj[key] = val; }
    }, this);

    // Iterate over the Model's attributes:
    // - If the property is the `idAttribute`, skip.
    // - If the properties are already the same, skip
    // - If the property is currently undefined and being changed, assign
    // - If the property is a `Model`, `Collection`, or `ComputedProperty`, reset it.
    // - If the passed object has the property, set it to the new value.
    // - If the Model has a default value for this property, set it back to default.
    // - Otherwise, unset the attribute.
    for(key in this.attributes){
      value = this.attributes[key];
      if(value === obj[key]){ continue; }
      else if(_.isUndefined(value) && !_.isUndefined(obj[key])){ changed[key] = obj[key]; }
      else if (value.isComponent){ continue; }
      else if (value.isCollection || value.isModel || value.isComputedProperty){
        value.reset((obj[key] || []), {silent: true});
        if(value.isCollection) changed[key] = value.previousModels;
        else if(value.isModel && value.isComputedProperty) changed[key] = value.cache.model.changedAttributes();
        else if(value.isModel) changed[key] = value.changedAttributes();
      }
      else if (obj.hasOwnProperty(key)){ changed[key] = obj[key]; }
      else{
        changed[key] = undefined;
        this.unset(key, {silent: true});
      }
    }

    // Any new values will be set to on the model
    _.each(obj, function(val, key){
      if(_.isUndefined(changed[key])){ changed[key] = val; }
    });

    // Reset our model
    obj = this.set(obj, _.extend({}, options, {silent: true, reset: false}));

    // Trigger custom reset event
    this.changed = changed;
    if (!options.silent){ this.trigger('reset', this, options); }

    // Return new values
    return obj;
  }
506185
private function setTemplate()
    {
        $this->template = $this->formHelper->getConfig($this->getTemplate(), $this->getTemplate());
    }
1059784
def on_before_transform_template(self, template_dict):
        

        try:
            global_section = Globals(template_dict)
        except InvalidGlobalsSectionException as ex:
            raise InvalidDocumentException([ex])

        # For each resource in template, try and merge with Globals if necessary
        template = SamTemplate(template_dict)
        for logicalId, resource in template.iterate():
            resource.properties = global_section.merge(resource.type, resource.properties)
            template.set(logicalId, resource)

        # Remove the Globals section from template if necessary
        Globals.del_section(template_dict)
154754
public void recalculateMeta() {
        data.yDataType = null;
        data.xDataTypes.clear();
        for(Record r : values()) {
            updateMeta(r);
        }
    }
55759
protected function recalculateTotal(): void
    {
        $this->total = $this->itemsTotal + $this->adjustmentsTotal;

        if ($this->total < 0) {
            $this->total = 0;
        }
    }
485623
@Override
    public void afterPropertiesSet() throws Exception {
        this.transactionTemplate = new TransactionTemplate(this.transactionManager);
        this.transactionTemplate.setPropagationBehavior(
                TransactionTemplate.PROPAGATION_REQUIRES_NEW);
        this.transactionTemplate.setReadOnly(true);
        this.transactionTemplate.afterPropertiesSet();

        this.runDatabaseTests();
        if (LOG.isDebugEnabled()) LOG.debug(this.toString());
    }
1101671
def update(self, other):
        
        if isinstance(other, Properties):
            other = other.defined
        for n, v in other.items():
            self.set(n, v)
        return self
506201
protected function postProcessing(): void
    {
        if (isset($this->value)) {
            $this->value = array_map(function ($item) {
                if (ctype_digit($item)) {
                    return intval($item);
                } else {
                    return $item;
                }
            }, $this->value);
        }
    }
898323
public void afterPropertiesSet() {
		connector = ConnectorFactory.create(olmConnectorPropertyFile, connectorName);
		connector.setResponseManager(olmAckManger);
		connector.setErrorManager(errorManager);
		connector.configure();
	}
4405
function prepareTemplates(templates){
  var valueGeneratorsDict = {
    select: function(obj){
      var types = {
        random:function(){
          return obj.choice[Math.floor(Math.random() * obj.choice.length)];
        },
        liner: function(){
          var el = obj.choice.shift();
          obj.choice.push(el);
          return el;
        },
        random_unique: function(){
          function shuffle(o) {
            for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
            return o;
          };
          if(!obj.randomized){obj.randomized = shuffle(obj.choice.slice());}
          var el = obj.randomized.shift();
          if(el===undefined){
            log.notEnoughChoice('random_unique','choice');
            process.exit()
          }
          return el;
        }
      }
      if(!types[obj.type]){
        return log.noTemplateType('select', obj.type, Object.keys(types))
      }
      return types[obj.type]
    },
    lipsum: function(obj){
      if(!(obj.max_char_length&&obj.min_char_length)){
        return log.missingSettings('lipsum', '', ['max_char_length','mim_char_length'])
      }
      var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
      return function(){
        var chars = Math.floor(Math.random()*(obj.max_char_length-obj.min_char_length)+obj.min_char_length)
        var str = lorem.slice(0, chars)
        while(str.length < chars){
          var len = chars - str.length
          str += ' '+lorem.slice(0, len)
        }
        return str
      }
    },
    number: function(obj){
      var types = {
        random:function(){
          return Math.floor(Math.random()*(obj.max_num-obj.min_num)+obj.min_num);
        },
        incremental: function(){
          tempdata += obj.increments
          return tempdata;
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('number', obj.type, Object.keys(types))
      }
      if(obj.type == 'random' && !(obj.max_num&&obj.min_num)){
        return log.missingSettings('number', 'random', ['max_num','min_num'])
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_num&&obj.increments)){
          return log.missingSettings('number', 'incremental', ['starting_num','increments'])
        }
        var tempdata = this[obj.id] = obj.starting_num - obj.increments
      }

      return types[obj.type]
    },
    datetime: function(obj){
      var types = {
        random:function(){
          return output[obj.output_format](new Date(Math.floor(Math.random()*(max-min)+min)));
        },
        incremental: function(){
          tempdata += obj.increments
          return output[obj.output_format](new Date(tempdata));
        }
      }
      var output = {
        toString: function(d){ return d.toString(); },
        toDateString: function(d){ return d.toDateString(); },
        toISOString: function(d){ return d.toISOString(); },
        toJSON: function(d){ return d.toJSON(); },
        toGMTString: function(d){ return d.toGMTString(); },
        toLocaleDateString: function(d){ return d.toLocaleDateString(); },
        toLocaleString: function(d){ return d.toLocaleString(); },
        toLocaleTimeString: function(d){ return d.toLocaleTimeString(); },
        toTimeString: function(d){ return d.toTimeString(); },
        toUTCString: function(d){ return d.toUTCString(); },
        toYMDString:function(d){
          return d.toJSON().split('T')[0]
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('date', obj.type, Object.keys(types))
      }
      if(obj.type == 'random'){
        if(!(obj.max_datetime&&obj.min_datetime&&obj.output_format)){
          return log.missingSettings('date', 'random', ['max_datetime','min_datetime','output_format'])
        }
        var min = Date.parse(obj.min_datetime)
        var max = Date.parse(obj.max_datetime)
        if(isNaN(min)){
          return log.notParseableDatetime('min_datetime', obj.min_datetime)
        }else if(isNaN(max)){
          return log.notParseableDatetime('max_datetime', obj.max_datetime)
        }
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_datetime&&obj.increments&&obj.output_format)){
          return log.missingSettings('number', 'incremental', ['starting_datetime','increments','output_format'])
        }
        var tempdata = this[obj.id] = Date.parse(obj.starting_datetime) - obj.increments
        if(isNaN(tempdata)){
          return log.notParseableDatetime('starting_datetime', obj.starting_datetime)
        }
      }

      return types[obj.type]
    }
  }

  /*
  Recursively iterate each key in template object to find `stub_type` key.
  If the object has `stub_type` key, replace itself with corresponding
  function in valueGenerators valid
  Arg:
    - obj (Object)
  */
  function parseTemplate(obj) {
    for (var key in obj) {
      if (obj[key] !== null && typeof(obj[key])=="object") {
        if(obj[key].stub_type){
          if(!valueGeneratorsDict[obj[key].stub_type]){
            log.stubTypeNotFound(obj[key].stub_type)
          }else{
            obj[key].id = crypto.randomBytes(16).toString('hex');
            obj[key] = valueGeneratorsDict[obj[key].stub_type](obj[key])
          }
        }else{
          parseTemplate(obj[key]);
        }
      }
    }
  }

  if(templates){
    Object.keys(templates).map(function(t){
      parseTemplate(templates[t]);
    })
    return templates;
  }else{
    return [];
  }
}
1264290
def extend(self, **kwargs):
    """"""

    props = self.copy()
    props.update(kwargs)
    return TemplateData(**props)