<commit_before><!--!
       changes   - a list of diff items, each being a dict containing informations about
                   changes for one file:
                     .href         - link for the title (optional)
                     .title        - tooltip for the title link (optional)
                     .comments     - annotation for the change (optional)
                     .new and .old - information about the files being diffed
                       .path         - path of the file
                       .rev          - rev of the file (for 'sidebyside')
                       .shortrev     - abbreviated form of rev of the file (for 'inline')
                       .href         - link to the full file (optional)
                     .props        - a list of property changes
                       .name         - name of the property
                       .diff         - rendered difference
                       .old          - old value of the property
                       .new          - new value for the property
                       (both .old and .new have .name, .value and .rendered properties)
                     .diffs        - a sequence of list of blocks
                     
                       Each block being a dict:
                       .type         - one of 'unmod', 'add', 'rem' or 'mod'
                       .base and .changed - informations about lines from old and new content
                         .lines              - the lines
                         .offset             - position within the file

                     .diffs_title  - a sequence of titles for the list of blocks
                                     Note: integrate this into .diffs for 0.12 or 0.13.

       diff      - dict specifying diff style and options
                     .style     - can be 'sidebyside' (4 columns) or 'inline' (3 columns)
                     .options   - contexlines, various ignore...

       longcol  - "long" column header; e.g. 'Revision' or 'File' or '' (for 'sidebyside')
       shortcol - "short" column header: e.g. 'r' or '' (for 'inline')
       no_id    - skip generation of id attributes in h2 headings

-->
<div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      class="diff">

  <ul py:if="any([item.diffs or item.props for item in changes])" class="entries">
    <py:for each="idx, item in enumerate(changes)">
      <li py:if="item.diffs or item.props or 'comments' in item" class="entry" py:with="comments = item.get('comments')">
        <h2 id="${not no_id and 'file%s' % idx or None}" py:choose="">
          <a py:when="item.new.path" title="${item.get('title', item.new.get('title'))}"
             href="${item.get('href', item.new.get('href'))}">$item.new.path</a>
          <py:otherwise>&nbsp;</py:otherwise>
        </h2>
        <pre py:if="comments">$comments</pre>
        <ul py:if="item.props" class="props">
          <py:for each="prop in item.props" py:choose="">
            <py:when test="prop.diff">$prop.diff</py:when>
            <py:with vars="one = prop.old or prop.new;
                           both = prop.old and prop.new;
                           action = both and 'changed from ' or not prop.old and 'set' or 'deleted'">
              <li py:when="one">
                Property <strong py:attrs="one.rendered and one.rendered.name_attributes">
                  ${one.rendered and one.rendered.name or prop.name}</strong> $action
                <py:def function="render_property(prop)">
                  <py:choose>
                    <py:when test="prop.rendered">$prop.rendered.content</py:when>
                    <em py:when="istext(prop.value)"><tt>$prop.value</tt></em>
                    <py:otherwise>$prop.value</py:otherwise>
                  </py:choose>
                </py:def>
                <py:if test="prop.old and prop.new">${render_property(prop.old)}</py:if>
                <py:if test="prop.new"> to ${render_property(prop.new)}</py:if><commit_msg>trunk: fix `'comments' in item` bug introduced in r7880, as `item` can be `None` depending on the diff options selected (the list of changes itself is not compacted in order to preserve the indexes used in links). Closes #8105.<commit_after><!--!
       changes   - a list of diff items, each being a dict containing informations about
                   changes for one file:
                     .href         - link for the title (optional)
                     .title        - tooltip for the title link (optional)
                     .comments     - annotation for the change (optional)
                     .new and .old - information about the files being diffed
                       .path         - path of the file
                       .rev          - rev of the file (for 'sidebyside')
                       .shortrev     - abbreviated form of rev of the file (for 'inline')
                       .href         - link to the full file (optional)
                     .props        - a list of property changes
                       .name         - name of the property
                       .diff         - rendered difference
                       .old          - old value of the property
                       .new          - new value for the property
                       (both .old and .new have .name, .value and .rendered properties)
                     .diffs        - a sequence of list of blocks
                     
                       Each block being a dict:
                       .type         - one of 'unmod', 'add', 'rem' or 'mod'
                       .base and .changed - informations about lines from old and new content
                         .lines              - the lines
                         .offset             - position within the file

                     .diffs_title  - a sequence of titles for the list of blocks
                                     Note: integrate this into .diffs for 0.12 or 0.13.

       diff      - dict specifying diff style and options
                     .style     - can be 'sidebyside' (4 columns) or 'inline' (3 columns)
                     .options   - contexlines, various ignore...

       longcol  - "long" column header; e.g. 'Revision' or 'File' or '' (for 'sidebyside')
       shortcol - "short" column header: e.g. 'r' or '' (for 'inline')
       no_id    - skip generation of id attributes in h2 headings

-->
<div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      class="diff">

  <ul py:if="any([item.diffs or item.props for item in changes])" class="entries">
    <py:for each="idx, item in enumerate(changes)">
      <li py:if="item and (item.diffs or item.props or 'comments' in item)" class="entry" py:with="comments = item.get('comments')">
        <h2 id="${not no_id and 'file%s' % idx or None}" py:choose="">
          <a py:when="item.new.path" title="${item.get('title', item.new.get('title'))}"
             href="${item.get('href', item.new.get('href'))}">$item.new.path</a>
          <py:otherwise>&nbsp;</py:otherwise>
        </h2>
        <pre py:if="comments">$comments</pre>
        <ul py:if="item.props" class="props">
          <py:for each="prop in item.props" py:choose="">
            <py:when test="prop.diff">$prop.diff</py:when>
            <py:with vars="one = prop.old or prop.new;
                           both = prop.old and prop.new;
                           action = both and 'changed from ' or not prop.old and 'set' or 'deleted'">
              <li py:when="one">
                Property <strong py:attrs="one.rendered and one.rendered.name_attributes">
                  ${one.rendered and one.rendered.name or prop.name}</strong> $action
                <py:def function="render_property(prop)">
                  <py:choose>
                    <py:when test="prop.rendered">$prop.rendered.content</py:when>
                    <em py:when="istext(prop.value)"><tt>$prop.value</tt></em>
                    <py:otherwise>$prop.value</py:otherwise>
                  </py:choose>
                </py:def>
                <py:if test="prop.old and prop.new">${render_property(prop.old)}</py:if>
                <py:if test="prop.new"> to ${render_property(prop.new)}</py:if>
{'fraction_non_alphanumeric': 0.11888611210282042, 'fraction_numerical': 0.005950255861002023, 'mean_word_length': 1.4739476008242567, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '492447', 'n_tokens_mistral': 2331, 'n_tokens_neox': 2163, 'n_words': 699}