Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Searches for abbreviations predefined in mass_abbreviations.py either in the pythoms package or in the current
working directory. Any found abbreviations will be added to the current dictionary.
:param dct: incoming dictionary
:return: un-abbreviated dictionary
:rtype: dict
"""
comptemp = {}
for key in dct:
if key in abbrvs: # if a common abbreviation is found in formula
for subkey in abbrvs[key]:
try:
comptemp[subkey] += abbrvs[key][subkey] * dct[key]
except KeyError:
comptemp[subkey] = abbrvs[key][subkey] * dct[key]
else:
try:
comptemp[key] += dct[key]
except KeyError:
comptemp[key] = dct[key]
return comptemp