How to use the pythoms.mass_abbreviations.abbrvs.update function in pythoms

To help you get started, we’ve selected a few pythoms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github larsyunker / PythoMS / pythoms / molecule.py View on Github external
# attempt to load abbreviation dictionary from current working directory
from .mass_abbreviations import abbrvs

try:
    abbrv_spec = importlib.util.spec_from_file_location(
        'user_abbrvs',
        os.path.join(
            os.getcwd(),
            'user_mass_abbreviations.py'
        )
    )
    abbrv_module = importlib.util.module_from_spec(abbrv_spec)
    abbrv_spec.loader.exec_module(abbrv_module)
    user_abbrvs = abbrv_module.user_abbrvs
    abbrvs.update(user_abbrvs)
except FileNotFoundError:  # if it can't find the file, continue with default abbreviations
    pass


"""Mass dictionary associated with the instance"""
MASS_KEY = 'crc_mass'
mass_dict = getattr(
    mass_dictionaries,
    MASS_KEY,
)


st = ScriptTime(profile=True)

# valid start and end brackets
OPENING_BRACKETS = ['(', '{', '[']  # opening brackets