Return standard molecular weight
    :param ndigits: number of digits
328003
def mw(mol, ndigits=2):
    
    mol.require("Valence")
    return round(sum(a.mw() for _, a in mol.atoms_iter()), ndigits)
561496
private static double calculateMolecularWeight(List<AbstractMolecule> molecules) throws BuilderMoleculeException, CTKException, ChemistryException {
    Double result = 0.0;
    for (AbstractMolecule molecule : molecules) {
      molecule = BuilderMolecule.mergeRgroups(molecule);
      result += Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getMolecularWeight();
    }
    return result;
  }
457306
def form_b(self, n: float)->tuple:
        
        unit = 'bps'
        kilo = 1000
        mega = 1000000
        giga = 1000000000
        bps = 0

        if self.units == 'bytes' or self.units == 'B':
            unit = 'Bps'
            kilo = 8000
            mega = 8000000
            giga = 8000000000

        if n < kilo:
            bps = float(n)

        if n >= kilo and n < mega:
            unit = "K" + unit
            bps = float(n / 1024.0)

        if n >= mega and n < giga:
            unit = "M" + unit
            bps = float(n / (1024.0 * 1024.0))

        if n >= giga:
            unit = "G" + unit
            bps = float(n / (1024.0 * 1024.0 * 1024.0))

        return bps, unit
50589
private int integerDigits(double d) {
    double value = Math.abs(d);
    if(value < 10) {
      return 1;
    }
    return (int) FastMath.log10(value) + 1;
  }
607884
def human_readable_digit(number):
    

    if 0 >= number:
        return "{0:.1f} ".format(number)

    word = ["", "thousand", "million", "billion", "trillion"]
    millidx = max(0, min(len(word)-1, int(np.floor(np.log10(abs(number))/3.0))))
    return "{0:.1f} {1}".format(number/10**(3*millidx), word[millidx])
1142094
def _numbers_units(N):
    
    lst = range(1, N + 1)
    return "".join(list(map(lambda i: str(i % 10), lst)))
723531
def dim_dm(self, pars):
        
        """
        self._set_parameters(pars)
        numerator = -self.otc * np.sin(self.ang)
        result = numerator / self.denom
        result *= self.rho0
        return result
196885
def _number(text):
    '''
    
    '''
    if text.isdigit():
        return int(text)
    try:
        return float(text)
    except ValueError:
        return text
847570
def checksum(digits):
    
    s = 0
    p = len(digits) + 1
    for i in range(0, len(digits)):
        s += digits[i] * p
        p -= 1

    reminder = s % 11
    if reminder == 0 or reminder == 1:
        return 0
    else:
        return 11 - reminder
1118507
def fi_payment_reference_number(num: str):
    
    assert isinstance(num, str)
    num = STRIP_WHITESPACE.sub('', num)
    num = re.sub(r'^0+', '', num)
    assert len(num) >= 3
    weights = [7, 3, 1]
    weighed_sum = 0
    numlen = len(num)
    for j in range(numlen):
        weighed_sum += int(num[numlen - 1 - j]) * weights[j % 3]
    return num + str((10 - (weighed_sum % 10)) % 10)
441465
def com_google_fonts_check_metadata_canonical_weight_value(font_metadata):
  """"""
  first_digit = font_metadata.weight / 100
  if (font_metadata.weight % 100) != 0 or \
     (first_digit < 1 or first_digit > 9):
   yield FAIL, ("METADATA.pb: The weight is declared"
                " as {} which is not a"
                " multiple of 100"
                " between 100 and 900.").format(font_metadata.weight)
  else:
    yield PASS, "Font weight has a canonical value."
654310
def get_molecule_hash(self, mol):
        
        obmol = BabelMolAdaptor(mol).openbabel_mol
        inchi = self._inchi_labels(obmol)[2]
        return inchi
1018200
function getDigitCount(value) {
  let result;

  if (value === 0) {
    result = 1;
  } else {
    result = Math.floor(new Decimal(value).abs().log(10)
      .toNumber()) + 1;
  }

  return result;
}
26415
def precision(self, label=None):
        
        if label is None:
            return self.call("precision")
        else:
            return self.call("precision", float(label))
1048690
def regon_checksum(digits):
    
    weights_for_check_digit = [8, 9, 2, 3, 4, 5, 6, 7]
    check_digit = 0

    for i in range(0, 8):
        check_digit += weights_for_check_digit[i] * digits[i]

    check_digit %= 11

    if check_digit == 10:
        check_digit = 0

    return check_digit
304532
def get_molecule_hash(self, mol):
        
        obconv = ob.OBConversion()
        obconv.SetOutFormat(str("inchi"))
        obconv.AddOption(str("X"), ob.OBConversion.OUTOPTIONS, str("DoNotAddH"))
        inchi_text = obconv.WriteString(mol)
        match = re.search(r"InChI=(?P<inchi>.+)\n", inchi_text)
        return match.group("inchi")
361503
def to_digital(d, num):
    
    if not isinstance(num, int) or not 1 < num < 10:
        raise ValueError('digital num must between 1 and 10')

    d = int(d)
    result = []
    x = d % num
    d = d - x
    result.append(str(x))
    while d > 0:
        d = d // num
        x = d % num
        d = d - x
        result.append(str(x))
    return ''.join(result[::-1])