Adds a _catch_all_ attribute to each class. Also, adds a placeholder
        attribute for the construction of union members of void type.
12800
def _generate_union_class_vars(self, data_type):
        
        lineno = self.lineno
        if data_type.catch_all_field:
            self.emit("_catch_all = '%s'" % data_type.catch_all_field.name)
        elif not data_type.parent_type:
            self.emit('_catch_all = None')

        # Generate stubs for class variables so that IDEs like PyCharms have an
        # easier time detecting their existence.
        for field in data_type.fields:
            if is_void_type(field.data_type):
                field_name = fmt_var(field.name)
                self.emit('# Attribute is overwritten below the class definition')
                self.emit('{} = None'.format(field_name))

        if lineno != self.lineno:
            self.emit()
875580
private void addAttribute(Rule rule, String newAttribute, List<String> xmlLines) {
    List<Integer> linesToModify = new ArrayList<>();
    String currentRuleId = null;
    Pattern pattern = Pattern.compile(".*id=[\"'](.*?)[\"'].*");
    String expectedSubId = ((AbstractPatternRule) rule).getSubId();
    int lineCount = 0;
    int subRuleCount = 0;
    int modifyCount = 0;
    boolean inRuleGroup = false;
    for (String xmlLine : xmlLines) {
      if (xmlLine.contains("<rulegroup")) {
        subRuleCount = 0;
        inRuleGroup = true;
      } else if (xmlLine.contains("</rulegroup>")) {
        subRuleCount = 0;
        inRuleGroup = false;
      } else if ((xmlLine.contains("<rule ")||xmlLine.contains("<rule>")) && inRuleGroup) {
        subRuleCount++;
      }
      Matcher m = pattern.matcher(xmlLine);
      if (m.matches()) {
        currentRuleId = m.group(1);
      }
      if (xmlLine.contains("type=\"incorrect\"") || xmlLine.contains("type='incorrect'")) {
        if (currentRuleId != null && !currentRuleId.equals(rule.getId())) {
          lineCount++;
          continue;
        }
        if (!inRuleGroup) {
          subRuleCount = 1;
        }
        if (!expectedSubId.equals("0") && !expectedSubId.equals(String.valueOf(subRuleCount))) {
          lineCount++;
          continue;
        }
        linesToModify.add(lineCount);
        break;
      }
      lineCount++;
    }
    for (Integer s : linesToModify) {
      String newLine = xmlLines.get(s).replaceFirst("type=[\"']incorrect[\"']", newAttribute);
      xmlLines.set(s, newLine);
      addedCorrectionsCount++;
      modifyCount++;
    }
    if (modifyCount == 0) {
      System.err.println("No line modified: " + rule + "[" + expectedSubId + "]");
    }
  }
583072
public synchronized void putAll(Map<? extends String, ? extends XAttribute> t) {
		try {
			XAttributeMap map = deserialize();
			map.putAll(t);
			serialize(map);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
72091
def _make_attr_tuple_class(cls_name, attr_names):
    
    attr_class_name = "{}Attributes".format(cls_name)
    attr_class_template = [
        "class {}(tuple):".format(attr_class_name),
        "    __slots__ = ()",
    ]
    if attr_names:
        for i, attr_name in enumerate(attr_names):
            attr_class_template.append(
                _tuple_property_pat.format(index=i, attr_name=attr_name)
            )
    else:
        attr_class_template.append("    pass")
    globs = {"_attrs_itemgetter": itemgetter, "_attrs_property": property}
    eval(compile("\n".join(attr_class_template), "", "exec"), globs)

    return globs[attr_class_name]
953368
protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
        List<? extends TypeMirror> exceptions = member.getThrownTypes();
        if (!exceptions.isEmpty()) {
            CharSequence indent = makeSpace(indentSize + 1 - 7);
            htmltree.addContent(DocletConstants.NL);
            htmltree.addContent(indent);
            htmltree.addContent("throws ");
            indent = makeSpace(indentSize + 1);
            Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
            htmltree.addContent(link);
            for(int i = 1; i < exceptions.size(); i++) {
                htmltree.addContent(",");
                htmltree.addContent(DocletConstants.NL);
                htmltree.addContent(indent);
                Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
                        exceptions.get(i)));
                htmltree.addContent(exceptionLink);
            }
        }
    }
132354
def _generate_union_class_symbol_creators(self, data_type):
        
        class_name = fmt_class(data_type.name)
        lineno = self.lineno
        for field in data_type.fields:
            if is_void_type(field.data_type):
                field_name = fmt_func(field.name)
                self.emit("{0}.{1} = {0}('{1}')".format(class_name, field_name))
        if lineno != self.lineno:
            self.emit()
221480
def add_error(attribute, message)
    @errors[attribute] ||= []
    @errors[attribute] = @errors[attribute] << message unless @errors[attribute].include? message
    @errors
  end
241481
function(connection, collection, attrName, attrDef, cb) {
      log.debug('addAttribute: ' + collection + ', attrName:', attrName);
      
      return connections[connection].addAttribute(collection, attrName, attrDef, cb);
    }
369088
def _add_attrs(self):
        ''''''
        for attr in self.template_attrs:
            attr_value = self._get_template_attr(attr)

            if not attr_value:
                continue

            attr, attr_value = self._transform_key_value(
                attr,
                attr_value,
                self.attr_map
            )
            self.templ_dict[attr] = attr_value
1023926
def _onInstanceAttribute(self, name, line, pos, absPosition, level):
        """"""
        # Instance attributes may appear in member functions only so we already
        # have a function on the stack of objects. To get the class object one
        # more step is required so we -1 here.
        attributes = self.objectsStack[level - 1].instanceAttributes
        for item in attributes:
            if item.name == name:
                return
        attributes.append(InstanceAttribute(name, line, pos, absPosition))
648982
public synchronized void putAll(Map<? extends String, ? extends XAttribute> t) {
		if(t.size() > 0) {
			if(backingStore == null) {
				try {
					backingStore = backingStoreClass.newInstance();
				} catch (Exception e) {
					// Fuckup
					e.printStackTrace();
				}
			}
			backingStore.putAll(t);
		}
	}
1262622
def append!(errors, attr, key, val)
      return unless val.present?

      errors ||= {}
      errors[attr] ||= {}
      errors[attr][key] = val
    end
613194
def _setAttributeNS(self, namespaceURI, qualifiedName, value):
        '''
        
        '''
        self.node.setAttributeNS(namespaceURI, qualifiedName, value)
534613
def populate_class_members(self, element_cls, prop_name):
        
        super(ZeroOrOne, self).populate_class_members(element_cls, prop_name)
        self._add_getter()
        self._add_creator()
        self._add_inserter()
        self._add_adder()
        self._add_get_or_adder()
        self._add_remover()
470778
def add_to_class(self, cls, name):
        '''
        
        '''
        self._name = name
        self._container_model_class = cls
        setattr(cls, name, FieldDescriptor(self))
        self._bound = True
955407
private static void addAttribute(Element element, Set<Attr> attributes, Object value) {
		Attr attr = (Attr) value;
		if (!attributes.add(attr)) {
			throw new TemplateException("Invalid element |%s|. It has both static attribute |%s| and attribute operator.", element, attr.getName());
		}
	}
610406
def _update_attrs(nobj, oobj, exceptions=None, acornext=False):
    
    success = True
    if (acornext and hasattr(oobj, "__acornext__")
        and oobj.__acornext__ is not None): # pragma: no cover
        target = oobj.__acornext__
    else:
        target = oobj
        
    for a, v in _get_members(target):
        if hasattr(nobj, a):
            #We don't want to overwrite something that acorn has already done.
            continue
        if a in ["__class__", "__code__", "__closure__"]:# pragma: no cover
            #These attributes are not writeable by design.
            continue
        
        if exceptions is None or a not in exceptions:
            try:
                setattr(nobj, a, v)
            except TypeError:# pragma: no cover
                #Some of the built-in types have __class__ attributes (for
                #example) that we can't set on a function type. This catches
                #that case and any others.
                emsg = "_update_attrs (type): {}.{} => {}"
                msg.err(emsg.format(nobj, a, target), 2)
                pass
            except AttributeError:# pragma: no cover
                #Probably a read-only attribute that we are trying to set. Just
                #ignore it.
                emsg = "_update_attrs (attr): {}.{} => {}"
                msg.err(emsg.format(nobj, a, target), 2)
                pass
            except ValueError:# pragma: no cover
                emsg = "_update_attrs (value): {}.{} => {}"
                msg.err(emsg.format(nobj, a, target), 2)
                success = False

    return success