<commit_before><% title "Usage stats for #{@project} on #{@project.platform_name} - Libraries.io" %>
<% description "Required version breakdown across #{number_to_human(@total)} open source repositories that depend on #{@project} on #{@project.platform_name}" %>
<% content_for :meta, render_meta(@project) %>

<h1>
  <%= fa_icon 'bar-chart' %>
  Usage stats for <%= link_to @project, project_path(@project.to_param) %>
</h1>

<% if @all_counts.any? %>
  <% cache ['usage', @project.id, 'v2'], expires_in: usage_cache_length(@total).week, race_condition_ttl: 1.minute do %>
    <table id="q-graph">
        <caption>Required version breakdown across <%= number_to_human(@total) %> open source repositories</caption>
        <tbody>
        <% max_height = 400 %>
        <% @counts.each_with_index do |(requirement, count), index| %>
          <% percentage = count.to_f/@total*100 %>

          <tr class="qtr" style='left:<%= index*60 %>px; <% if index == @counts.length - 1 %>border-right:none;<% end %>'>
              <th scope="row">
                <% if requirement.length > 10 %>
                  <span class='tip' title='<%= requirement %>'><%= truncate(requirement, length: 10) %></span>
                <% else %>
                  <%= requirement %>
                <% end %>
              </th>
              <td class="bar" style='height:<%= (percentage/@highest_percentage.to_f*max_height).round %>px; background-color: <%= colours[index] %>;'>
                <p>
                  <a href='<%= url_for(params.permit(:name, :platform).merge(requirements: requirement)) %>' class='tip' title="<%= number_to_human(count) %> <%= "repo".pluralize(count) %> specifies this version">
                    <%= percentage.round(2) %>%
                  </a>
                </p>
              </td>
          </tr>
        <% end %>
        </tbody>
    </table>
  <% end %>
  <hr>
  <div class="row">
    <div class="col-sm-8">
      <h4>
        GitHub Repositories that depend on <%= link_to @project, project_path(@project.to_param) %>
        <% if params[:requirements].present? %>
          <code><%= params[:requirements] %></code>
        <% end %>
      </h4>

      <%= render @repos, cache: true %>
      <%= will_paginate @repos, page_links: false %>
    </div>
    <div class="col-sm-4">
      <%= render 'adsense/banner' %>

      <h4>
        <%= fa_icon 'link' %>
        Filter by requirement kind
      </h4>
      <ul class='filter'>
        <% @kinds.sort_by{|k,v| -v}.each do |kind, count| %>
          <% next unless kind.present? %>
          <% active = kind == params[:kind] %>
          <li class='<%= 'active' if active %>'>
            <% if active %>
              <%= link_to kind, url_for(params.permit(:name, :platform, :requirements).merge(kind: nil, page: nil)) %>
            <% else %>
              <%= link_to kind, url_for(params.permit(:name, :platform, :requirements).merge(kind: kind)) %>
              <small><%= number_to_human(count) %></small>
            <% end %>
          </li>
        <% end %>
      </ul>

      <h4>
        <%= fa_icon 'arrows-h' %>
        Filter by required version range
      </h4>
      <ul class='filter'>
        <% sort_by_semver_range(40).each do |requirements,count| %>
          <% next unless requirements.present? %>
          <% active = requirements == params[:requirements] %>
          <li class='<%= 'active' if active %>'>
            <% if active %>
              <%= link_to requirements, url_for(params.permit(:name, :platform, :kind).merge(requirements: nil, page: nil)) %>
            <% else %>
              <%= link_to requirements, url_for(params.permit(:name, :platform, :kind).merge(requirements: requirements)) %>
              <small><%= number_to_human(count) %></small>
            <% end %>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
<% else %>
  No dependent repositories found.
<% end %><commit_msg>Show more filterable requirements in sidebar<commit_after><% title "Usage stats for #{@project} on #{@project.platform_name} - Libraries.io" %>
<% description "Required version breakdown across #{number_to_human(@total)} open source repositories that depend on #{@project} on #{@project.platform_name}" %>
<% content_for :meta, render_meta(@project) %>

<h1>
  <%= fa_icon 'bar-chart' %>
  Usage stats for <%= link_to @project, project_path(@project.to_param) %>
</h1>

<% if @all_counts.any? %>
  <% cache ['usage', @project.id, 'v2'], expires_in: usage_cache_length(@total).week, race_condition_ttl: 1.minute do %>
    <table id="q-graph">
        <caption>Required version breakdown across <%= number_to_human(@total) %> open source repositories</caption>
        <tbody>
        <% max_height = 400 %>
        <% @counts.each_with_index do |(requirement, count), index| %>
          <% percentage = count.to_f/@total*100 %>

          <tr class="qtr" style='left:<%= index*60 %>px; <% if index == @counts.length - 1 %>border-right:none;<% end %>'>
              <th scope="row">
                <% if requirement.length > 10 %>
                  <span class='tip' title='<%= requirement %>'><%= truncate(requirement, length: 10) %></span>
                <% else %>
                  <%= requirement %>
                <% end %>
              </th>
              <td class="bar" style='height:<%= (percentage/@highest_percentage.to_f*max_height).round %>px; background-color: <%= colours[index] %>;'>
                <p>
                  <a href='<%= url_for(params.permit(:name, :platform).merge(requirements: requirement)) %>' class='tip' title="<%= number_to_human(count) %> <%= "repo".pluralize(count) %> specifies this version">
                    <%= percentage.round(2) %>%
                  </a>
                </p>
              </td>
          </tr>
        <% end %>
        </tbody>
    </table>
  <% end %>
  <hr>
  <div class="row">
    <div class="col-sm-8">
      <h4>
        GitHub Repositories that depend on <%= link_to @project, project_path(@project.to_param) %>
        <% if params[:requirements].present? %>
          <code><%= params[:requirements] %></code>
        <% end %>
      </h4>

      <%= render @repos, cache: true %>
      <%= will_paginate @repos, page_links: false %>
    </div>
    <div class="col-sm-4">
      <%= render 'adsense/banner' %>

      <h4>
        <%= fa_icon 'link' %>
        Filter by requirement kind
      </h4>
      <ul class='filter'>
        <% @kinds.sort_by{|k,v| -v}.each do |kind, count| %>
          <% next unless kind.present? %>
          <% active = kind == params[:kind] %>
          <li class='<%= 'active' if active %>'>
            <% if active %>
              <%= link_to kind, url_for(params.permit(:name, :platform, :requirements).merge(kind: nil, page: nil)) %>
            <% else %>
              <%= link_to kind, url_for(params.permit(:name, :platform, :requirements).merge(kind: kind)) %>
              <small><%= number_to_human(count) %></small>
            <% end %>
          </li>
        <% end %>
      </ul>

      <h4>
        <%= fa_icon 'arrows-h' %>
        Filter by required version range
      </h4>
      <ul class='filter'>
        <% sort_by_semver_range(60).each do |requirements,count| %>
          <% next unless requirements.present? %>
          <% active = requirements == params[:requirements] %>
          <li class='<%= 'active' if active %>'>
            <% if active %>
              <%= link_to requirements, url_for(params.permit(:name, :platform, :kind).merge(requirements: nil, page: nil)) %>
            <% else %>
              <%= link_to requirements, url_for(params.permit(:name, :platform, :kind).merge(requirements: requirements)) %>
              <small><%= number_to_human(count) %></small>
            <% end %>
          </li>
        <% end %>
      </ul>
    </div>
  </div>
<% else %>
  No dependent repositories found.
<% end %>
{'fraction_non_alphanumeric': 0.18278346605991658, 'fraction_numerical': 0.0070787511060548605, 'mean_word_length': 2.2532894736842106, 'pattern_counts': {'":': 0, '<': 219, '<?xml version=': 0, '>': 221, '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': '1993566', 'n_tokens_mistral': 2689, 'n_tokens_neox': 2364, 'n_words': 537}