cic-contracts/python/cic_contracts/search.py

17 lines
350 B
Python
Raw Normal View History

2023-06-09 10:44:03 +02:00
# 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()