Return space group in international table symbol and number as a string.

    If it fails, None is returned.
518854
def get_spacegroup(cell, symprec=1e-5, angle_tolerance=-1.0, symbol_type=0):
    
    _set_no_error()

    dataset = get_symmetry_dataset(cell,
                                   symprec=symprec,
                                   angle_tolerance=angle_tolerance)
    if dataset is None:
        return None

    spg_type = get_spacegroup_type(dataset['hall_number'])
    if symbol_type == 1:
        return "%s (%d)" % (spg_type['schoenflies'], dataset['number'])
    else:
        return "%s (%d)" % (spg_type['international_short'], dataset['number'])
1052057
def get_spacegroup_type(hall_number):
    
    _set_no_error()

    keys = ('number',
            'international_short',
            'international_full',
            'international',
            'schoenflies',
            'hall_symbol',
            'choice',
            'pointgroup_schoenflies',
            'pointgroup_international',
            'arithmetic_crystal_class_number',
            'arithmetic_crystal_class_symbol')
    spg_type_list = spg.spacegroup_type(hall_number)
    _set_error_message()

    if spg_type_list is not None:
        spg_type = dict(zip(keys, spg_type_list))
        for key in spg_type:
            if key != 'number' and key != 'arithmetic_crystal_class_number':
                spg_type[key] = spg_type[key].strip()
        return spg_type
    else:
        return None
1185712
def get_char(self, offset=0):
        """"""
        if not self.has_space(offset=offset):
            return ''

        return self.string[self.pos + offset]
679048
def unicodestr(s, encoding='utf-8', fallback='iso-8859-1'):
    """"""

    if isinstance(s, unicode):
        return s

    try:
        return s.decode(encoding)
    except UnicodeError:
        return s.decode(fallback)
1339500
function checkKeyframesSelectorsGroup(i) {
  const start = i;
  let l;

  if (l = checkKeyframesSelector(i)) i += l;
  else return 0;

  while (i < tokensLength) {
    const spaceBefore = checkSC(i);
    const comma = checkDelim(i + spaceBefore);
    if (!comma) break;

    const spaceAfter = checkSC(i + spaceBefore + comma);
    if (l = checkKeyframesSelector(i + spaceBefore + comma + spaceAfter)) {
      i += spaceBefore + comma + spaceAfter + l;
    } else break;
  }

  tokens[start].selectorsGroupEnd = i;

  return i - start;
}
51880
def characters(self, numberOfCharacters):
        """"""
        return self.code[self.index:self.index + numberOfCharacters]
1365340
def rest_of_string(self, offset=0):
        """"""
        if self.has_space(offset=offset):
            return self.string[self.pos + offset:]
        else:
            return ''
156070
static public String tiToString(int ti) {
        switch (ti) {
            case Connection.TRANSACTION_READ_UNCOMMITTED:
                return "TRANSACTION_READ_UNCOMMITTED";
            case Connection.TRANSACTION_READ_COMMITTED:
                return "TRANSACTION_READ_COMMITTED";
            case Connection.TRANSACTION_REPEATABLE_READ:
                return "TRANSACTION_REPEATABLE_READ";
            case Connection.TRANSACTION_SERIALIZABLE:
                return "TRANSACTION_SERIALIZABLE";
            case Connection.TRANSACTION_NONE:
                return "TRANSACTION_NONE";
        }
        return "Custom Transaction Isolation numerical value: " + ti;
    }
1938
def _symbols():
    
    global _SYMBOLS
    if _SYMBOLS is None:
        tmp = [(s, 'symbol') for s in _data()['symbol'].keys()]
        tmp += [(s, 'alpha3') for s in _data()['alpha3'].keys()]
        tmp += [(s.name, 'name') for s in _data()['alpha3'].values()]
        _SYMBOLS = sorted(
            tmp,
            key=lambda s: (len(s[0]), ord(s[0][0])),
            reverse=True)

    return _SYMBOLS
918015
private static String getSpaces(int n) {

        // avoid negative NegativeArraySizeException in case uri is missing
        n = Math.max(n, 0);
        StringBuffer result = new StringBuffer(n);
        for (; n > 0; n--) {
            result.append(' ');
        }
        return result.toString();
    }
1066581
def to_str(number):
    
    states = globals()
    for name, value in states.items():
        if number == value and name.isalpha() and name.isupper():
            return name
    return '(unknown state %d)' % number
1281803
def thousands(x):
    
    import locale
    try:
        locale.setlocale(locale.LC_ALL, "en_US.utf8")
    except Exception:
        locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
    finally:
        s = '%d' % x
        groups = []
        while s and s[-1].isdigit():
            groups.append(s[-3:])
            s = s[:-3]
        return s + ','.join(reversed(groups))
    return locale.format('%d', x, True)
1323201
def fix_international(text):
    ""
    class SmartInternational(str):
        def __new__(cls, text):
            return str.__new__(cls, text)

        def endswith(self, string):
            return super(SmartInternational, self).endswith(str(string))
    if PY3:
        return text
    out = []
    last = 0
    for match in re.finditer(r'(?<=[^\\])(?:\\x[0-9a-f]{2}|\\u[0-9a-f]{4})', text):
        start, end, group = match.start(), match.end(), match.group()
        out.append(text[last:start])
        c = group.decode('unicode_escape')
        out.append(c if ord(c) > 160 and ord(c) != 173 else group)
        last = end
    out.append(text[last:])
    return SmartInternational(''.join(out).encode('utf-8'))
1237260
private synchronized int getGroupChar(String name, int choice)
    {
        for (int i = 0; i < m_groupcount_; i ++) {
            // populating the data set of grouptable

            int startgpstrindex = getGroupLengths(i, m_groupoffsets_,
                                                  m_grouplengths_);

            // shift out to function
            int result = getGroupChar(startgpstrindex, m_grouplengths_, name,
                                      choice);
            if (result != -1) {
                return (m_groupinfo_[i * m_groupsize_] << GROUP_SHIFT_)
                         | result;
            }
        }
        return -1;
    }
138283
def detect_spaces_at_bol(text, is_bol)
      lspace = nil
      if text.empty?
        lspace = "" if is_bol
      elsif text[-1] == ?\n
        lspace = ""
      else
        rindex = text.rindex(?\n)
        if rindex
          s = text[rindex+1..-1]
          if s =~ /\A[ \t]*\z/
            lspace = s
            #text = text[0..rindex]
            text[rindex+1..-1] = ''
          end
        else
          if is_bol && text =~ /\A[ \t]*\z/
            #lspace = text
            #text = nil
            lspace = text.dup
            text[0..-1] = ''
          end
        end
      end
      return lspace
    end
939352
function handleSpaces(str, i, out) { //return int
	var found = 0;
	var orig_i = i;
	while (i < str.length && str.charAt(i) == ' ') {
		i++;
		found++;
	}
	if (found == 0 || i == str.length) return 0;
	var t = str.charAt(i);
	if (tib_top(t) == null && tib_other(t) == null) return 0;
	// found 'found' spaces between two tibetan bits; generate the same number of '_'s
	for (i = 0; i < found; i++) out += '_';
	return found;
}
302248
def str_numerator(self):
        """"""
        unit_numerator, unit = UnitByte(self.numerator).auto_no_thousands
        if unit_numerator >= 10:
            formatter = '%d'
        else:
            formatter = '%0.1f'
        return '{0} {1}'.format(locale.format(formatter, unit_numerator, grouping=False), unit)