Inserts any necessary separators and whitespace before a name. Also
adjusts the stack to expect the name's value.
545482
private void beforeName() throws IOException {
    int context = peek();
    if (context == NONEMPTY_OBJECT) { // first in object
      out.write(',');
    } else if (context != EMPTY_OBJECT) { // not in an object!
      throw new IllegalStateException("Nesting problem.");
    }
    newline();
    replaceTop(DANGLING_NAME);
  }
217697
private void beforeName() throws IOException {
    int context = peekScope();
    if (context == NONEMPTY_OBJECT) { // first in object
      sink.writeByte(',');
    } else if (context != EMPTY_OBJECT) { // not in an object!
      throw new IllegalStateException("Nesting problem.");
    }
    newline();
    replaceTop(DANGLING_NAME);
  }
1126044
function getName(name, width, separator) {

        // handle empty separator as no separator
        if (typeof separator === 'undefined') {
            separator = '';
        }

        if (name) {
            return separator + name;
        } else {
            return separator + width;
        }
    }
590137
def add(self, name, value):
        ''''''
        normalized_name = normalize_name(name, self._normalize_overrides)
        self._map[normalized_name].append(value)
555892
private static void appendToSentence(StringBuilder buf, String[] names) {
        for (int i=0; i<names.length; i++) {
            if (i > 0) {
                if (i + 1 >= names.length) {
                    buf.append(" or ");
                } else {
                    buf.append(", ");
                }
            }
            buf.append('"');
            buf.append(names[i]);
            buf.append('"');
        }
    }
729901
public void addChange(String name, Enum<?> before, Enum<?> after) {
        String beforeStr = before != null ? before.name() : null;
        String afterStr = after != null ? after.name() : null;
        addChange(name, beforeStr, afterStr);
    }
626721
def set_name(self, name):
        

        if len(name) > 6:
            raise ArgumentError("Name must be at most 6 characters long", name=name)

        if len(name) < 6:
            name += ' '*(6 - len(name))

        self.name = name
868415
public CommandOption<T> setting(String name) {

		Assert.notNullOrEmptyTrimmed(name, "Missing setting name");

		name = StringUtils.trim(name);
		String compare = StringUtils.sanitizeWhitespace(name);
		Assert.isTrue(name.equals(compare), "Setting name can not contain whitespace characters!");

		setting = name;
		return this;
	}
1322946
protected void beforeMarkup() {
        int soFar = stack[depth];
        if ((soFar & WROTE_DATA) == 0 // no data in this scope
                && (depth > 0 || soFar != 0)) {
            try {
                writeNewLine(depth);
                if (depth > 0 && getIndent().length() > 0) {
                    afterMarkup(); // indentation was written
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
991489
public void writeNameValuePair(String name, String value) throws IOException
   {
      internalWriteNameValuePair(name, escapeString(value));
   }
1028005
function (parsedName) {
      parsedName.name = parsedName.name.replace(/\./g, '_');
      if (parsedName.name === 'basic') {
        parsedName.name = '';
      }
    }
694454
protected void beforeEndElement() {
        if (depth > 0 && stack[depth] == WROTE_MARKUP) { // but not data
            try {
                writeNewLine(depth - 1);
            } catch (Exception ignored) {
                ignored.printStackTrace();
            }
        }
    }
196752
def add_previous_name(self, name):
        
        self._ensure_field('name', {})
        self.obj['name'].setdefault('previous_names', []).append(name)
1088863
def rename(self, name):
        
        if name is None:
            raise Exception("name (%s) not-valid" % (name,))
        self.prefix, self.name = splitPrefix(name)
571589
def _prepend_schema_name(self, message):
        
        if self._name:
            message = "{0!r} {1!s}".format(self._name, message)
        return message
1163253
protected void beforeEndElement() {
        final Set<StackState> state = scopeState.getFirst();
        // but not data
        if (depth > 0
                && state.contains(StackState.WROTE_MARKUP)
                && !state.contains(StackState.WROTE_DATA)) {
            final String indent = this.getIndent(depth - 1, indentSize);
            final Characters indentEvent = xmlEventFactory.createCharacters(indent);
            try {
                wrappedWriter.add(indentEvent);
            } catch (XMLStreamException e) {
                // Ignore exceptions caused by indentation
            }
        }
    }
384356
def prepend_name_scope(name, import_scope):
  """"""
  # Based on tensorflow/python/framework/ops.py implementation.
  if import_scope:
    try:
      str_to_replace = r"([\^]|loc:@|^)(.*)"
      return re.sub(str_to_replace, r"\1" + import_scope + r"/\2",
                    tf.compat.as_str_any(name))
    except TypeError as e:
      # If the name is not of a type we can process, simply return it.
      logging.warning(e)
      return name
  else:
    return name