<commit_before>import {select as d3Select, selectAll as d3SelectAll} from "d3-selection";
import {transition as d3Transition} from "d3-transition";
const d3 = {
  select: d3Select,
  selectAll: d3SelectAll,
  transition: d3Transition
};

import {constant} from "d3plus-common";
import {contrast} from "d3plus-color";
import {TextBox} from "d3plus-text";
import {default as Image} from "./Image";

/**
    @class Shape
    @desc An abstracted class for generating shapes.
*/
export default class Shape {

  constructor() {
    this._backgroundImage = constant(false);
    this._data = [];
    this._duration = 600;
    this._fill = constant("black");
    this._fontColor = (d, i) => contrast(this._fill(d, i));
    this._fontFamily = constant("Verdana");
    this._fontResize = constant(false);
    this._fontSize = constant(12);
    this._id = (d, i) => d.id !== void 0 ? d.id : i;
    this._label = constant(false);
    this._labelPadding = constant(5);
    this._on = {};
    this._opacity = constant(1);
    this._scale = constant(1);
    this._stroke = constant("black");
    this._strokeWidth = constant(0);
    this._textAnchor = constant("start");
    this._verticalAlign = constant("top");
  }

  /**
      @memberof Shape
      @desc Given a specific data point and index, returns the aesthetic properties of the shape.
      @param {Object} *data point*
      @param {Number} *index*
      @private
  */
  _aes() {
    return {};
  }

  /**
      @memberof Shape
      @desc Adds background image to each shape group.
      @param {D3Selection} *g*
      @param {Boolean} [*show* = True] Whether or not to show or remove the image.
      @private
  */
  _applyImage(g, show = true) {

    const that = this;

    g.each(function(d, i) {

      const aes = that._aes(d, i);

      const imageData = [];
      let h = 0, w = 0;

      if (show && (aes.r || aes.w && aes.h)) {
        h = aes.r ? aes.r * 2 : aes.h;
        w = aes.r ? aes.r * 2 : aes.w;
        const url = that._backgroundImage(d, i);
        if (url) imageData.push({url});
      }

      new Image()
        .data(imageData)
        .duration(that._duration)
        .height(h)<commit_msg>fixes backgroundImage for Rect class<commit_after>import {select as d3Select, selectAll as d3SelectAll} from "d3-selection";
import {transition as d3Transition} from "d3-transition";
const d3 = {
  select: d3Select,
  selectAll: d3SelectAll,
  transition: d3Transition
};

import {constant} from "d3plus-common";
import {contrast} from "d3plus-color";
import {TextBox} from "d3plus-text";
import {default as Image} from "./Image";

/**
    @class Shape
    @desc An abstracted class for generating shapes.
*/
export default class Shape {

  constructor() {
    this._backgroundImage = constant(false);
    this._data = [];
    this._duration = 600;
    this._fill = constant("black");
    this._fontColor = (d, i) => contrast(this._fill(d, i));
    this._fontFamily = constant("Verdana");
    this._fontResize = constant(false);
    this._fontSize = constant(12);
    this._id = (d, i) => d.id !== void 0 ? d.id : i;
    this._label = constant(false);
    this._labelPadding = constant(5);
    this._on = {};
    this._opacity = constant(1);
    this._scale = constant(1);
    this._stroke = constant("black");
    this._strokeWidth = constant(0);
    this._textAnchor = constant("start");
    this._verticalAlign = constant("top");
  }

  /**
      @memberof Shape
      @desc Given a specific data point and index, returns the aesthetic properties of the shape.
      @param {Object} *data point*
      @param {Number} *index*
      @private
  */
  _aes() {
    return {};
  }

  /**
      @memberof Shape
      @desc Adds background image to each shape group.
      @param {D3Selection} *g*
      @param {Boolean} [*show* = True] Whether or not to show or remove the image.
      @private
  */
  _applyImage(g, show = true) {

    const that = this;

    g.each(function(d, i) {

      const aes = that._aes(d, i);

      const imageData = [];
      let h = 0, w = 0;

      if (show && (aes.r || aes.width && aes.height)) {
        h = aes.r ? aes.r * 2 : aes.height;
        w = aes.r ? aes.r * 2 : aes.width;
        const url = that._backgroundImage(d, i);
        if (url) imageData.push({url});
      }

      new Image()
        .data(imageData)
        .duration(that._duration)
        .height(h)
{'fraction_non_alphanumeric': 0.14354285714285714, 'fraction_numerical': 0.012342857142857143, 'mean_word_length': 2.6619246861924686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5765223', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1405, 'n_words': 399}