Force strings to have their indexes set in environments that don't do this automatically. istanbul ignore next
338328
function forceStringCoercion(obj) {
  var i = 0, chr;
  while (chr = obj.charAt(i)) {
    obj[i++] = chr;
  }
}
1055263
function Semver(string) {
    Semver.assert(string);
    var parts = string.split('.');
    this.major = parseInt(parts[0], 10);
    this.minor = parseInt(parts[1], 10);
    this.patch = parseInt(parts[2], 10);
}
779403
def update_index(self, key, value):
        ""
        for k, v in value.items():
            if k in self.indexes:
                # A non-string index value switches it into a lazy one.
                if not isinstance(v, six.string_types):
                    self.index_defs[k]['type'] = 'lazy'
                if v not in self.indexes[k]:
                    self.indexes[k][v] = set([])
                self.indexes[k][v].add(key)
721081
def ensure_index(self, index, mappings=None, settings=None, clear=False):
        
        mappings = mappings or []
        if isinstance(mappings, dict):
            mappings = [mappings]
        exists = self.indices.exists_index(index)
        if exists and not mappings and not clear:
            return
        if exists and clear:
            self.indices.delete_index(index)
            exists = False

        if exists:
            if not mappings:
                self.indices.delete_index(index)
                self.indices.refresh()
                self.indices.create_index(index, settings)
                return

            if clear:
                for maps in mappings:
                    for key in list(maps.keys()):
                        self.indices.delete_mapping(index, doc_type=key)
                self.indices.refresh()
            if isinstance(mappings, SettingsBuilder):
                for name, data in list(mappings.mappings.items()):
                    self.indices.put_mapping(doc_type=name, mapping=data, indices=index)

            else:
                from pyes.mappings import DocumentObjectField, ObjectField

                for maps in mappings:
                    if isinstance(maps, tuple):
                        name, mapping = maps
                        self.indices.put_mapping(doc_type=name, mapping=mapping, indices=index)
                    elif isinstance(maps, dict):
                        for name, data in list(maps.items()):
                            self.indices.put_mapping(doc_type=name, mapping=maps, indices=index)
                    elif isinstance(maps, (DocumentObjectField, ObjectField)):
                        self.put_mapping(doc_type=maps.name, mapping=maps.as_dict(), indices=index)

                return

        if settings:
            if isinstance(settings, dict):
                settings = SettingsBuilder(settings, mappings)
        else:
            if isinstance(mappings, SettingsBuilder):
                settings = mappings
            else:
                settings = SettingsBuilder(mappings=mappings)
        if not exists:
            self.indices.create_index(index, settings)
            self.indices.refresh(index, timesleep=1)
635576
def set_regex(self, regex=None, reset=False):
        """"""
        if reset:
            text = ''
        else:
            text = self.finder.text().replace(' ', '').lower()

        self.proxy_model.set_filter(text)
        self.source_model.update_search_letters(text)
        self.sortByColumn(SEARCH_SCORE, Qt.AscendingOrder)

        if self.last_regex != regex:
            self.selectRow(0)
        self.last_regex = regex
118894
function getIndexOf(string, find) {
    // if regex then do it regex way
    if(XRegExp.isRegExp(find)) {
      return string.search(find);
    } else {
      // normal way
      return string.indexOf(find);
    }
  }
1295808
def __enforce_only_strings_dict(dictionary):
    '''
    
    '''
    ret = {}

    for key, value in iteritems(dictionary):
        ret[six.text_type(key)] = six.text_type(value)

    return ret
576929
@Deprecated
	private static void updateIndexWithSettingsInElasticsearch(Client client, String index, String settings) throws Exception {
		logger.trace("updateIndex([{}])", index);

		assert client != null;
		assert index != null;

		if (settings != null) {
			logger.trace("Found update settings for index [{}]: [{}]", index, settings);
			logger.debug("updating settings for index [{}]", index);
			client.admin().indices().prepareUpdateSettings(index).setSettings(settings, XContentType.JSON).get();
		}

		logger.trace("/updateIndex([{}])", index);
	}
93523
function buildLineToIndex(str) {
  var lines = str.split("\n"),
      lineToIndex = new Array(lines.length),
      index = 0;

  for (var i = 0, l = lines.length; i < l; i++) {
    lineToIndex[i] = index;
    index += lines[i].length + /* "\n".length */ 1;
  }
  return lineToIndex;
}
1076082
def flushIndexes(cls) :
		""
		con = RabaConnection(cls._raba_namespace)
		for idx in cls.getIndexes() :
			con.dropIndexByName(idx[1])
1052981
function indexOf(match) {
        var i = matches.length;
        while (i--) {
          if (matches[i] === match) {
            return i;
          }
        }

        return -1;
      }
1343482
def set( string, target_level, indent_string="    ", indent_empty_lines=False ):
    

    lines = string.splitlines()
    set_lines( lines, target_level, indent_string=indent_string, indent_empty_lines=indent_empty_lines )
    result = "\n".join(lines)
    return result
902866
function createStrings(input) {
  return new Promise((resolve, reject) => {
    try {
      if (!input) {
        return resolve(null);
      }

      const importsString = input.imports.length ? `${input.imports.join('\n')}\n\n` : '';
      const exportsString = input.exports.length ? `${input.exports.join('\n')}\n` : '';
      const indexString = `${importsString}${exportsString}`.replace('\n\n\n', '\n\n');

      return resolve(indexString.length ? indexString : null);
    } catch (e) {
      return reject(new Error(t('STRINGS_COULD_NOT_BE_CREATED')));
    }
  });
}
807234
def set_as_environment_variables(self, override=False):
        
        for k, v in self.dict().items():
            if k in os.environ and not override:
                continue
            # With Python2 on Windows, force environment variables to str to avoid
            # "TypeError: environment can only contain strings" in Python's subprocess.py.
            if PY2 and WIN:
                if isinstance(k, text_type) or isinstance(v, text_type):
                    k = k.encode('ascii')
                    v = v.encode('ascii')
            os.environ[k] = v

        return True
1087572
private void skipPromotedIndex(final DataInput in) throws IOException {
        final int size = in.readInt();
        if (size <= 0) {
            return;
        }

        FileUtils.skipBytesFully(in, size);
    }
596543
def lset(self, name, index, value):
        ""
        return self.execute_command('LSET', name, index, value)
630983
function indexer ( str, find ) {
    return ( str.indexOf( find ) > 0 ) ? str.indexOf( find ) : false;
  }