<commit_before>{% macro amount(d) %}
  {{- d < 0 ? '(' }}${{ d | abs | number_format(2, '.', ',') }}{{ d < 0 ? ')' -}}
{% endmacro %}

{% macro format_discount(item) %}
  {%- import _self as scat -%}
  {%- if item.discount_type == 'percentage' -%}
    {{ item.discount|number_format(0) }}% off
  {%- endif -%}
  {%- if item.discount_type == 'additional_percentage' -%}
    +{{ item.discount|number_format(0) }}% off
  {%- endif -%}
  {%- if item.discount_type == 'relative' -%}
    {{ scat.amount(item.discount) }} off
  {%- endif -%}
  {%- if item.discount_type == 'fixed' -%}
    {{ scat.amount(item.discount) }}
  {%- endif -%}
{% endmacro %}

{% macro format_txn_status(status) %}
  {%- if status == 'new' -%}
    <span class="text-default">New</span>
  {%- elseif status == 'filled' -%}
    <span class="text-default">Filled</span>
  {%- elseif status == 'paid' -%}
    <span class="text-danger">Paid</span>
  {%- elseif status == 'processing' -%}
    <span class="text-danger">Processing</span>
  {%- elseif status == 'shipped' -%}
    <span class="text-success">Shipped</span>
  {%- elseif status == 'complete' -%}
    <span class="text-success">Complete</span>
  {%- elseif status == 'template' -%}
    Template
  {%- else -%}
    <span class="text-danger">Unknown</span>
  {%- endif -%}
{% endmacro %}

{% macro file_upload(dest) %}
<style>
#droptarget {
  position: absolute;
  z-index: 100000;
  top: 0; left; 0;
  height: 100%;
  width: 100%;
  background: rgba(0,0,0,0.6);
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#droptarget h1 {
  color: #fff;
  font-size: 6em;
  max-width: 50%;
}
#droptarget, #droptarget * {
  pointer-events: none;
}
</style>
<div id="droptarget" style="display:none">
  <h1>Drop file(s) to upload.</h1>
</div>
<script>
  let dropArea= document.currentScript.parentNode

  let preventDefaults= (ev) => {
    ev.preventDefault()
    ev.stopPropagation()
  }

  ['dragenter', 'dragleave', 'dragend','dragover', 'drop']
  .forEach(eventName => {
    dropArea.addEventListener(eventName, preventDefaults)
  })

  let handleEnter= (ev) => {
    document.getElementById('droptarget').style.display= 'flex'
  }
  ['dragenter', 'dragover'].forEach(eventName => {
    dropArea.addEventListener(eventName, handleEnter)
  })

  let handleExit= (ev) => {
    document.getElementById('droptarget').style.display= 'none'
  }
  ['dragleave', 'dragend'].forEach(eventName => {
    dropArea.addEventListener(eventName, handleExit)
  })

  dropArea.addEventListener('drop', (ev) => {
    let dt= ev.dataTransfer
    let files= dt.files;

    document.getElementById('droptarget').style.display= 'none'<commit_msg>Test drag type explicitly so we get text/uri-list<commit_after>{% macro amount(d) %}
  {{- d < 0 ? '(' }}${{ d | abs | number_format(2, '.', ',') }}{{ d < 0 ? ')' -}}
{% endmacro %}

{% macro format_discount(item) %}
  {%- import _self as scat -%}
  {%- if item.discount_type == 'percentage' -%}
    {{ item.discount|number_format(0) }}% off
  {%- endif -%}
  {%- if item.discount_type == 'additional_percentage' -%}
    +{{ item.discount|number_format(0) }}% off
  {%- endif -%}
  {%- if item.discount_type == 'relative' -%}
    {{ scat.amount(item.discount) }} off
  {%- endif -%}
  {%- if item.discount_type == 'fixed' -%}
    {{ scat.amount(item.discount) }}
  {%- endif -%}
{% endmacro %}

{% macro format_txn_status(status) %}
  {%- if status == 'new' -%}
    <span class="text-default">New</span>
  {%- elseif status == 'filled' -%}
    <span class="text-default">Filled</span>
  {%- elseif status == 'paid' -%}
    <span class="text-danger">Paid</span>
  {%- elseif status == 'processing' -%}
    <span class="text-danger">Processing</span>
  {%- elseif status == 'shipped' -%}
    <span class="text-success">Shipped</span>
  {%- elseif status == 'complete' -%}
    <span class="text-success">Complete</span>
  {%- elseif status == 'template' -%}
    Template
  {%- else -%}
    <span class="text-danger">Unknown</span>
  {%- endif -%}
{% endmacro %}

{% macro file_upload(dest) %}
<style>
#droptarget {
  position: absolute;
  z-index: 100000;
  top: 0; left; 0;
  height: 100%;
  width: 100%;
  background: rgba(0,0,0,0.6);
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#droptarget h1 {
  color: #fff;
  font-size: 6em;
  max-width: 50%;
}
#droptarget, #droptarget * {
  pointer-events: none;
}
</style>
<div id="droptarget" style="display:none">
  <h1>Drop file(s) to upload.</h1>
</div>
<script>
  let dropArea= document.currentScript.parentNode

  let preventDefaults= (ev) => {
    if (ev.dataTransfer.files.length ||
        ev.dataTransfer.types.includes('text/uri-list'))
    {
      ev.preventDefault()
      ev.stopPropagation()
    }
  }

  ['dragenter', 'dragleave', 'dragend','dragover', 'drop']
  .forEach(eventName => {
    dropArea.addEventListener(eventName, preventDefaults)
  })

  let handleEnter= (ev) => {
    document.getElementById('droptarget').style.display= 'flex'
  }
  ['dragenter', 'dragover'].forEach(eventName => {
    dropArea.addEventListener(eventName, handleEnter)
  })

  let handleExit= (ev) => {
    document.getElementById('droptarget').style.display= 'none'
  }
  ['dragleave', 'dragend'].forEach(eventName => {
    dropArea.addEventListener(eventName, handleExit)
  })

  dropArea.addEventListener('drop', (ev) => {
    let dt= ev.dataTransfer
    let files= dt.files;

    document.getElementById('droptarget').style.display= 'none'
{'fraction_non_alphanumeric': 0.20474723681826418, 'fraction_numerical': 0.011596303678202573, 'mean_word_length': 3.6, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2432102', 'n_tokens_mistral': 2120, 'n_tokens_neox': 1991, 'n_words': 359}