cic-contracts/python/cic_contracts/search.py
2023-06-09 09:44:03 +01:00

17 lines
350 B
Python

# standard imports
import os
# local imports
from cic_contracts.data import data_dir
from cic_contracts.names import Name
def search(v, ext='interface', search_dir=data_dir):
if isinstance(v, Name):
v = v.value
fp = os.path.join(search_dir, v + '.' + ext)
f = open(fp, 'r')
r = f.read()
f.close()
return r.rstrip()