used to create merged global attributes for a new formatter
329531
static AttributeSet merge(
        AttributeSet outer,
        AttributeSet inner
    ) {

        Map<String, Object> internalsNew = new HashMap<>();
        internalsNew.putAll(inner.internals);
        internalsNew.putAll(outer.internals);
        Attributes attributesNew =
            new Attributes.Builder()
                .setAll(inner.attributes)
                .setAll(outer.attributes)
                .build();
        AttributeSet as = new AttributeSet(attributesNew, Locale.ROOT, 0, 0, null, internalsNew);
        return as.withLocale(outer.locale);

    }
1210395
private void formatAffix2Attribute(boolean isPrefix, Field fieldType,
        StringBuffer buf, int offset, int symbolSize) {
        int begin;
        begin = offset;
        if (!isPrefix) {
            begin += buf.length();
        }

        addAttribute(fieldType, begin, begin + symbolSize);
    }
875625
function mapStyleAttr(node, text, maps, id, nodeId, isComponent)
  {
    var styles = text.match(__matchStyles),
        isFullStyle = (styles && styles[0].match(__matchText) && styles.length === 1),
        mapText,
        mapValues,
        style,
        title,
        value,
        item,
        len = styles.length,
        titleMap,
        localMap,
        x = 0,
        lenn,
        i = 0;
    
    if(isFullStyle)
    {
      item = styles[0];
      if(item.match(__matchInsert))
      {
        localMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: maps.length,
            mapTextIndex: 0,
            text: item,
            maps: maps,
            mapText: [item],
            type: 'style',
            isInsert: true,
            property: 'style',
            local: node.style,
            node: node,
            isInlineStyle: true,
            isFullStyle: true,
            isPointer: isComponent
          })
          maps.push(localMap)
          localMap.mapText = [maps[(maps.length - 1)]];
      }
      else if(item.match(__matchText))
      {
        localMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: maps.length,
            mapTextIndex: 0,
            text: item,
            maps: maps,
            mapText: [item],
            type: 'style',
            property: 'style',
            listener: 'style',
            local: node.style,
            node: node,
            isInlineStyle: true,
            isFullStyle: true,
            isPointer: isComponent
          })
          maps.push(localMap)
          localMap.mapText = [maps[(maps.length - 1)]];
      }
    }
    else
    {
      for(x;x<len;x++)
      {
        if(styles[x].indexOf(':') === -1)
        {
          title = styles[x];
          value = '';
        }
        else
        {
          style = styles[x].split(':');
          title = style[0];
          value = style[1];
        }
        /* First we try to match the title */
        if(title.match(__matchInsert))
        {
          titleMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: maps.length,
            mapTextIndex: 0,
            text: title,
            maps: maps,
            mapText: [title],
            type: 'style',
            isInsert: true,
            property: 'style',
            node: node,
            local: node.style,
            isFullProp: !(value),
            isInlineStyle: true,
            isPointer: isComponent,
            isProperty: true
          })
          maps.push(titleMap)
          titleMap.mapText = [maps[(maps.length - 1)]];
        }
        else if(title.match(__matchText))
        {
          titleMap = new mapObject({
            local_id: id,
            node_id: nodeId,
            mapIndex: maps.length,
            mapTextIndex: 0,
            text: title,
            maps: maps,
            mapText: [title],
            type: 'style',
            property: 'style',
            node: node,
            local: node.style,
            isFullProp: !(value),
            isInlineStyle: true,
            isPointer: isComponent,
            isProperty: true
          })
          maps.push(titleMap)
          titleMap.mapText = [maps[(maps.length - 1)]];
        }
        else
        {
          titleMap = undefined;
        }
        /* Then we try to match the value */
        mapText = splitText(value);
        mapValues = (titleMap ? titleMap.mapValues : maps);
        lenn = mapText.length;
        i = 0;

        for(i;i<lenn;i++)
        {
          item = mapText[i];
          if(item.match(__matchInsert))
          {
            localMap = new mapObject({
              local_id: id,
              node_id: nodeId,
              mapIndex: mapValues.length,
              mapTextIndex: i,
              text: item,
              mapText: mapText,
              maps: mapValues,
              node: node,
              type: 'style',
              isInsert: true,
              property: title,
              local: node.style,
              localAttr: title,
              isInlineStyle: true,
              isPointer: isComponent,
              isPropertyValue: true
            })
            if(!titleMap)
            {
              maps.push(localMap);
              localMap.mapText = [maps[(maps.length - 1)]];
            }
            else
            {
              titleMap.mapValues.push(localMap)
            }
          }
          else if(item.match(__matchText))
          {
            localMap = new mapObject({
              local_id: id,
              node_id: nodeId,
              mapIndex: mapValues.length,
              mapTextIndex: i,
              text: item,
              mapText: mapText,
              maps: mapValues,
              node: node,
              type: 'style',
              property: title,
              listener: title,
              local: node.style,
              localAttr: title,
              isInlineStyle: true,
              isPointer: isComponent,
              isPropertyValue: true
            })
            if(!titleMap)
            {
              maps.push(localMap);
              localMap.mapText = [maps[(maps.length - 1)]];
            }
            else
            {
              titleMap.mapValues.push(localMap)
            }
          }
          else
          {
            localMap = item;
          }
          mapText[i] = localMap;
        }
        if(titleMap) titleMap.values = mapText;
      }
    }
  }
224676
function(attrs, attributeBlocks){
    if (attributeBlocks.length) {
      if (attrs.length) {
        var val = this.attrs(attrs);
        attributeBlocks.unshift(val);
      }
      if (attributeBlocks.length > 1) {
        this.bufferExpression(this.runtime('attrs') + '(' + this.runtime('merge') + '([' + attributeBlocks.join(',') + ']), ' + stringify(this.terse) + ')');
      } else {
        this.bufferExpression(this.runtime('attrs') + '(' + attributeBlocks[0] + ', ' + stringify(this.terse) + ')');
      }
    } else if (attrs.length) {
      this.attrs(attrs, true);
    }
  }
1070919
function  {
  var data = {};

  init();

  if (cache.defaultTranslation[defaultLocale]) {
    return cache.defaultTranslation[defaultLocale];
  }

  assertReactElements(reactElements);

  // Load i18n content.
  loadCldr(defaultLocale);

  // Set default locale.
  Globalize.locale(defaultLocale);

  // Have react to render all passed components, therefore the formatters in
  // use will be created in Globalize.cache.
  _reactElements(reactElements).forEach(function(reactElement) {
    React.renderToString(reactElement);
  });

  data[Globalize.cldr.attributes.bundle] = Globalize.cldr.get("globalize-messages/{bundle}");

  return cache.defaultTranslation[defaultLocale] = data;
}
413329
def _formatter_self(name, value):
    
    __mname = value.__module__
    if __mname != '__main__':
        return '%s = <%s.%s object at 0x%x>' \
            % (name, __mname, value.__class__.__name__, id(value))
    else:
        return '%s = <%s object at 0x%x>' \
            % (name, value.__class__.__name__, id(value))
513853
protected void initFormatters(Element root, CmsXmlContentDefinition contentDefinition) {

        // reading the include resources common for all formatters
        Iterator<Element> itFormatter = CmsXmlGenericWrapper.elementIterator(root, APPINFO_FORMATTER);
        while (itFormatter.hasNext()) {
            // iterate all "formatter" elements in the "formatters" node
            Element element = itFormatter.next();
            String type = element.attributeValue(APPINFO_ATTR_TYPE);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(type)) {
                // if not set use "*" as default for type
                type = CmsFormatterBean.WILDCARD_TYPE;
            }
            String jspRootPath = element.attributeValue(APPINFO_ATTR_URI);
            String minWidthStr = element.attributeValue(APPINFO_ATTR_MINWIDTH);
            String maxWidthStr = element.attributeValue(APPINFO_ATTR_MAXWIDTH);
            String preview = element.attributeValue(APPINFO_ATTR_PREVIEW);
            String searchContent = element.attributeValue(APPINFO_ATTR_SEARCHCONTENT);
            m_formatters.add(
                new CmsFormatterBean(
                    type,
                    jspRootPath,
                    minWidthStr,
                    maxWidthStr,
                    preview,
                    searchContent,
                    contentDefinition.getSchemaLocation()));
        }
    }
165456
def merge(attrs)
      # deep clone of attrs
      h = to_hash

      # merge in-place
      h.deep_merge!(attrs.to_hash, overwrite_arrays: true, merge_nil_values: true)

      self.class.new(h)
    end
523062
def _merge_user_attrs(self, attrs_backend, attrs_out, backend_name):
        
        for attr in attrs_backend:
            if attr in self.attributes.backend_attributes[backend_name]:
                attrid = self.attributes.backend_attributes[backend_name][attr]
                if attrid not in attrs_out:
                    attrs_out[attrid] = attrs_backend[attr]
108766
def formatter_factory(show_defaults=True):
    """"""
    def get_help_string(self, action):
        lhelp = action.help
        if isinstance(show_defaults, (list, tuple)):
            if "-" + action.dest in show_defaults:
                return lhelp
        if '%(default)' not in action.help:
            if action.default is not argparse.SUPPRESS:
                defaulting_nargs = [argparse.OPTIONAL, argparse.ZERO_OR_MORE]
                if action.option_strings or action.nargs in defaulting_nargs:
                    lhelp += ' (default: %(default)s)'
        return lhelp

    def default_help_string(self, action):
        return action.help
    if show_defaults is True:
        ARPIFormatter._get_help_string = classmethod(get_help_string)
    else:
        ARPIFormatter._get_help_string = classmethod(default_help_string)
    return ARPIFormatter
545143
function (meshes, applyWorldTransform) {

        if (! meshes.length) {
            return;
        }

        var templateMesh = meshes[0];
        var templateGeo = templateMesh.geometry;
        var material = templateMesh.material;

        var geometry = new Geometry({
            dynamic: false
        });
        geometry.boundingBox = new BoundingBox();

        var attributeNames = templateGeo.getEnabledAttributes();

        for (var i = 0; i < attributeNames.length; i++) {
            var name = attributeNames[i];
            var attr = templateGeo.attributes[name];
            // Extend custom attributes
            if (!geometry.attributes[name]) {
                geometry.attributes[name] = attr.clone(false);
            }
        }

        var inverseTransposeMatrix = mat4.create();
        // Initialize the array data and merge bounding box
        var nVertex = 0;
        var nFace = 0;
        for (var k = 0; k < meshes.length; k++) {
            var currentGeo = meshes[k].geometry;
            if (currentGeo.boundingBox) {
                currentGeo.boundingBox.applyTransform(applyWorldTransform ? meshes[k].worldTransform : meshes[k].localTransform);
                geometry.boundingBox.union(currentGeo.boundingBox);
            }
            nVertex += currentGeo.vertexCount;
            nFace += currentGeo.triangleCount;
        }
        for (var n = 0; n < attributeNames.length; n++) {
            var name = attributeNames[n];
            var attrib = geometry.attributes[name];
            attrib.init(nVertex);
        }
        if (nVertex >= 0xffff) {
            geometry.indices = new Uint32Array(nFace * 3);
        }
        else {
            geometry.indices = new Uint16Array(nFace * 3);
        }

        var vertexOffset = 0;
        var indicesOffset = 0;
        var useIndices = templateGeo.isUseIndices();

        for (var mm = 0; mm < meshes.length; mm++) {
            var mesh = meshes[mm];
            var currentGeo = mesh.geometry;

            var nVertex = currentGeo.vertexCount;

            var matrix = applyWorldTransform ? mesh.worldTransform.array : mesh.localTransform.array;
            mat4.invert(inverseTransposeMatrix, matrix);
            mat4.transpose(inverseTransposeMatrix, inverseTransposeMatrix);

            for (var nn = 0; nn < attributeNames.length; nn++) {
                var name = attributeNames[nn];
                var currentAttr = currentGeo.attributes[name];
                var targetAttr = geometry.attributes[name];
                // Skip the unused attributes;
                if (!currentAttr.value.length) {
                    continue;
                }
                var len = currentAttr.value.length;
                var size = currentAttr.size;
                var offset = vertexOffset * size;
                var count = len / size;
                for (var i = 0; i < len; i++) {
                    targetAttr.value[offset + i] = currentAttr.value[i];
                }
                // Transform position, normal and tangent
                if (name === 'position') {
                    vec3.forEach(targetAttr.value, size, offset, count, vec3.transformMat4, matrix);
                }
                else if (name === 'normal' || name === 'tangent') {
                    vec3.forEach(targetAttr.value, size, offset, count, vec3.transformMat4, inverseTransposeMatrix);
                }
            }

            if (useIndices) {
                var len = currentGeo.indices.length;
                for (var i = 0; i < len; i++) {
                    geometry.indices[i + indicesOffset] = currentGeo.indices[i] + vertexOffset;
                }
                indicesOffset += len;
            }

            vertexOffset += nVertex;
        }

        return new Mesh({
            material: material,
            geometry: geometry
        });
    }
1149712
public static Map<String, List<Object>> mergeAttributes(final Map<String, List<Object>> currentAttributes, final Map<String, List<Object>> attributesToMerge) {
        val merger = new MultivaluedAttributeMerger();

        val toModify = currentAttributes.entrySet()
            .stream()
            .map(entry -> Pair.of(entry.getKey(), CollectionUtils.toCollection(entry.getValue(), ArrayList.class)))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));

        val toMerge = attributesToMerge.entrySet()
            .stream()
            .map(entry -> Pair.of(entry.getKey(), CollectionUtils.toCollection(entry.getValue(), ArrayList.class)))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));

        LOGGER.trace("Merging current attributes [{}] with [{}]", toModify, toMerge);
        val results = merger.mergeAttributes((Map) toModify, (Map) toMerge);
        LOGGER.debug("Merged attributes with the final result as [{}]", results);
        return results;
    }
477790
private void initializeNoxViewConfig(Context context, AttributeSet attrs, int defStyleAttr,
      int defStyleRes) {
    noxConfig = new NoxConfig();
    TypedArray attributes = context.getTheme()
        .obtainStyledAttributes(attrs, R.styleable.nox, defStyleAttr, defStyleRes);
    initializeNoxItemSize(attributes);
    initializeNoxItemMargin(attributes);
    initializeNoxItemPlaceholder(attributes);
    initializeShapeConfig(attributes);
    initializeTransformationConfig(attributes);
    attributes.recycle();
  }
1191964
def MergeData(self, merge_data, raw_data=None):
    """"""
    self.FlushCache()
    if raw_data is None:
      raw_data = self.raw_data

    for k, v in iteritems(merge_data):
      # A context clause.
      if isinstance(v, dict) and k not in self.type_infos:
        if k not in self.valid_contexts:
          raise InvalidContextError("Invalid context specified: %s" % k)
        context_data = raw_data.setdefault(k, collections.OrderedDict())
        self.MergeData(v, context_data)

      else:
        # Find the descriptor for this field.
        descriptor = self.type_infos.get(k)
        if descriptor is None:
          msg = ("Missing config definition for %s. This option is likely "
                 "deprecated or renamed. Check the release notes." % k)
          if flags.FLAGS.disallow_missing_config_definitions:
            raise MissingConfigDefinitionError(msg)

        if isinstance(v, string_types):
          v = v.strip()

        # If we are already initialized and someone tries to modify a constant
        # value (e.g. via Set()), break loudly.
        if self.initialized and k in self.constants:
          raise ConstModificationError(
              "Attempting to modify constant value %s" % k)

        raw_data[k] = v
499067
def merge(self, other):
        
        other.qualify()
        for n in ('name',
                  'qname',
                  'min',
                  'max',
                  'default',
                  'type',
                  'nillable',
                  'form_qualified',):
            if getattr(self, n) is not None:
                continue
            v = getattr(other, n)
            if v is None:
                continue
            setattr(self, n, v)
492403
function (src, dest) {
            // IE has a mergeAttributes method which does exactly that. Let's use it directly.
            // Note that copying attributes with a loop on attributes and setAttributes has strange results on IE7 (for
            // example, a TR can appear as disabled)
            if (Aria.$window.document.body.mergeAttributes) {
                this.copyAttributes = function (src, dest) {
                    dest.mergeAttributes(src, false);
                };
            } else {
                this.copyAttributes = function (src, dest) {
                    // on other browsers, let's copy the attributes manually:
                    var srcAttr = src.attributes;
                    for (var i = 0, l = srcAttr.length; i < l; i++) {
                        var attr = srcAttr[i];
                        dest.setAttribute(attr.name, attr.value);
                    }
                };
            }

            this.copyAttributes(src, dest);
        }
826256
def _update_from_globals(xtag, xmlglobals, container):
    
    #We also need to perform a globals update on each of the *original* child tags
    #in the current tag being updated.
    for child in list(xtag):
        _update_from_globals(child, xmlglobals, xtag)

    #If the tag doesn't have a value that is in the global defaults
    #then we automatically copy it over.
    if "defaults" in xmlglobals:
        #Iterate over the attributes that we have default values for.
        for key in xmlglobals["defaults"]:
            if key not in xtag.attrib:
                overwrite = True
                #If the key is a limited one, then it only gets copied to
                #tags that we know can actually use the attribute.
                if key in limited:
                    overwrite = (xtag.tag in monitored and key in monitored[xtag.tag])
                if overwrite:
                    xtag.attrib[key] = xmlglobals["defaults"][key]

    #For the global tags, we just want to update using the default values
    #They aren't allowed to reference other globals.
    if container is None:
        return                
                    
    def update_tag(xtag, gtag):
        """Updates the missing attributes in xtag with those from gtag."""
        for attr, value in gtag.attr.items():
            if attr not in xtag.attrib:
                xtag.attr[attr] = value
                
    def resolve_global(xtag, xmlglobals, xtagname, gtagname, attrib, container, op, gassumed):
        """Adds the child in xmlglobals with the relevant id to the tag.

        :arg xtag: the tag with the reference to a global tag.
        :arg xmlglobals: the dictionary of global tags extracted from <global>.
        :arg tagname: the name of the global tag to look for.
        :arg attrib: the name of the attribute in 'xtag' that references the
          global tag to process.
        :arg container: for "op"=="append", the XMLElement to append the global
          tag to as a subelement.
        :arg op: one of ["append", "update"]. For "append" the global tag is appended
          as a subelement to 'container'. For "update", the attributes of the global
          tag are copied to 'xtag'.
        :arg gassumed: when True, the 'attrib' being examined is assumed to reference
          only tags in <globals>, so no 'global:' prefix is required before attributes.
        """
        if attrib not in xtag.attrib:
            return False

        result = False
        if xtag.tag == xtagname and (gassumed or "global:" in xtag.attrib[attrib]):
            #We allow a ';'-separated list of global tag names, all of
            #which are appended to the child's subelements list.
            i = -1
            for sattr in xtag.attrib[attrib].split(";"):
                gid = sattr.strip().split(":")[1] if ":" in sattr else sattr.strip()
                #Since ordering matters, if the id starts with ^, we insert it at
                #the beginning of the subelements list instead of appending
                if gid[0] == '^':
                    insert = True
                    gid = gid[1::]
                    i += 1
                else:
                    insert = False
                    
                if gtagname in xmlglobals and gid.lower() in xmlglobals[gtagname]:
                    gtag = xmlglobals[gtagname][gid.lower()]
                    if op == "append":
                        if insert:
                            container.insert(i, gtag)
                        else:
                            container.append(gtag)
                    elif op == "update":
                        update_tag(xtag, gtag)
                    result = True
                else:
                    from fortpy.msg import warn
                    wstr = 'The global tag of type <{}> for <{} {}="{}"> does not exist.'
                    warn(wstr.format(gtagname, xtagname, attrib, xtag.attrib[attrib]))

            #Overwrite the name of the tag to not have the 'global:' in it anymore.
            xtag.attrib[attrib] = xtag.attrib[attrib].replace("global:", "")

        return result
                
    #Next, we just need to check the attributes of the tag that are allowed
    #to point to global tag children.
    i = 0
    #The order of these is xtagname, gtagname, xtagattrib, container, op, gassumed
    tags = [("assignment", "value", "value", xtag, "append", False),
            ("target", "output", "compareto", container, "append", False),
            ("test", "input", "inputs", xtag, "append", True),
            ("test", "global", "globals", xtag, "append", True),
            ("test", "assignment", "assignments", xtag, "append", True),
            ("test", "mapping", "mappings", xtag, "append", True),
            ("group", "input", "inputs", xtag, "append", True),
            ("group", "global", "globals", xtag, "append", True),
            ("group", "assignment", "assignments", xtag, "append", True),
            ("group", "mapping", "mappings", xtag, "append", True)]

    while i < len(tags):
        resolve_global(xtag, xmlglobals, *tags[i])
        i += 1

    if xtag.tag in ["test", "group"]:
        _handle_ignores(xtag)

    if xtag.tag == "auto":
        _expand_autotag(xtag, container)