@hep.over('<STR_LIT>', '<STR_LIT>')<EOL>@utils.for_each_value<EOL>def documents(self, key, value):
def _is_hidden(value):<EOL><INDENT>return '<STR_LIT>' in [val.upper() for val in value] or None<EOL><DEDENT>def _is_figure(value):<EOL><INDENT>figures_extensions = ['<STR_LIT>']<EOL>return value.get('<STR_LIT:f>') in figures_extensions<EOL><DEDENT>def _is_fulltext(value):<EOL><INDENT>return value.get('<STR_LIT:d>', '<STR_LIT>').lower() == '<STR_LIT>' or None<EOL><DEDENT>def _get_index_and_caption(value):<EOL><INDENT>match = re.compile(r'<STR_LIT>').match(value)<EOL>if match:<EOL><INDENT>return match.group(<NUM_LIT:1>), match.group(<NUM_LIT:2>)<EOL><DEDENT><DEDENT>def _get_key(value):<EOL><INDENT>fname = value.get('<STR_LIT:n>', '<STR_LIT>')<EOL>extension = value.get('<STR_LIT:f>', '<STR_LIT>')<EOL>if fname.endswith(extension):<EOL><INDENT>return fname<EOL><DEDENT>return fname + extension<EOL><DEDENT>def _get_source(value):<EOL><INDENT>source = value.get('<STR_LIT:t>', '<STR_LIT>')<EOL>if source in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>source = None<EOL><DEDENT>elif source.lower() == '<STR_LIT>':<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>return source<EOL><DEDENT>figures = self.get('<STR_LIT>', [])<EOL>is_context = value.get('<STR_LIT:f>', '<STR_LIT>').endswith('<STR_LIT>')<EOL>if is_context:<EOL><INDENT>return<EOL><DEDENT>if _is_figure(value):<EOL><INDENT>index, caption = _get_index_and_caption(value.get('<STR_LIT:d>', '<STR_LIT>'))<EOL>figures.append({<EOL>'<STR_LIT:key>': _get_key(value),<EOL>'<STR_LIT>': caption,<EOL>'<STR_LIT:url>': afs_url(value.get('<STR_LIT:a>')),<EOL>'<STR_LIT>': index,<EOL>'<STR_LIT:source>': '<STR_LIT>',  <EOL>})<EOL>self['<STR_LIT>'] = figures<EOL><DEDENT>else:<EOL><INDENT>return {<EOL>'<STR_LIT:description>': value.get('<STR_LIT:d>') if not _is_fulltext(value) else None,<EOL>'<STR_LIT:key>': _get_key(value),<EOL>'<STR_LIT>': _is_fulltext(value),<EOL>'<STR_LIT>': _is_hidden(force_list(value.get('<STR_LIT:o>'))),<EOL>'<STR_LIT:url>': afs_url(value.get('<STR_LIT:a>')),<EOL>'<STR_LIT:source>': _get_source(value),<EOL>}<EOL><DEDENT>
Populate the ``documents`` key.

    Also populates the ``figures`` key through side effects.