File size: 480 Bytes
2a3480c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | """Deterministic reference repair; verification fixture only."""
from pathlib import Path
path = Path('/workspace/repo/src/pyromat/__init__.py')
source = path.read_text()
assert '\ndef get(' not in source
source += '''
def get(idstr):
try:
return dat.data[idstr]
except KeyError:
utility.print_error('No substance named ' + str(idstr) + ' was found.')
raise utility.PMParamError('Invalid substance ID: ' + str(idstr))
'''
path.write_text(source)
|