Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def look_for_hdl(citation_elements):
"""Looks for handle identifiers in the misc txt of the citation elements
When finding an hdl, creates a new HDL element.
@param citation_elements: (list) elements to process
"""
for el in list(citation_elements):
matched_hdl = re_hdl.finditer(el['misc_txt'])
for match in reversed(list(matched_hdl)):
hdl_el = {'type': 'HDL',
'hdl_id': match.group('hdl_id'),
'misc_txt': el['misc_txt'][match.end():]}
el['misc_txt'] = el['misc_txt'][0:match.start()]
citation_elements.insert(citation_elements.index(el) + 1, hdl_el)