<s> import functools <EOL> from . . import lists <EOL> from . . import documents <EOL> from . . import results <EOL> def create_reader ( note_type , body_reader ) : <EOL> def read_notes_xml_element ( element ) : <EOL> note_elements = lists . filter ( <EOL> _is_note_element , <EOL> element . find_children ( "<STR_LIT>" + note_type ) , <EOL> ) <EOL> return results . combine ( lists . map ( _read_note_element , note_elements ) ) <EOL> def _is_note_element ( element ) : <EOL> return element . attributes . get ( "<STR_LIT>" ) not in [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def _read_note_element ( element ) : <EOL> return body_reader . read_all ( element . children ) . map ( lambda body : <EOL> documents . note ( <EOL> note_type = note_type , <EOL> note_id = element . attributes [ "<STR_LIT>" ] , <EOL> body = body <EOL> ) ) <EOL> return read_notes_xml_element <EOL> create_footnotes_reader = functools . partial ( create_reader , "<STR_LIT>" ) <EOL> create_endnotes_reader = functools . partial ( create_reader , "<STR_LIT>" ) </s>
