<commit_before>import { assign, defaults, partialRight, isFunction } from "lodash";
import React, { PropTypes } from "react";
import LineSegment from "./line-segment";
import LineHelpers from "./helper-methods";
import ClipPath from "../helpers/clip-path";
import Domain from "../../helpers/domain";
import Data from "../../helpers/data";
import {
  PropTypes as CustomPropTypes, Helpers, Events, VictoryTransition, VictoryLabel,
  VictoryContainer
} from "victory-core";

const fallbackProps = {
  props: {
    height: 300,
    width: 450,
    clipHeight: 300,
    clipWidth: 450
  },
  style: {
    data: {
      fill: "none",
      opacity: 1,
      strokeWidth: 2,
      stroke: "#252525"
    },
    labels: {
      fill: "#252525",
      fontFamily: "'Gill Sans', 'Gill Sans MT', 'Ser­avek', 'Trebuchet MS', sans-serif",
      fontSize: 14,
      letterSpacing: "0.04em",
      padding: 10,
      strokeWidth: 0,
      stroke: "transparent",
      textAnchor: "start"
    }
  }
};

export default class VictoryLine extends React.Component {
  static role = "line";

  static defaultTransitions = {
    onExit: {
      duration: 500,
      before: (datum) => ({ y: datum.y })
    },
    onEnter: {
      duration: 500,
      before: () => ({ y: null }),
      after: (datum) => ({ y: datum.y })
    }
  };

  static propTypes = {
    /**
     * The animate prop specifies props for VictoryAnimation to use. The animate prop should
     * also be used to specify enter and exit transition configurations with the `onExit`
     * and `onEnter` namespaces respectively.
     * @examples {duration: 500, onEnd: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
     */
    animate: PropTypes.object,
    /**<commit_msg>move logic to defaultTransition<commit_after>import { assign, defaults, partialRight, isFunction, min, max, filter } from "lodash";
import React, { PropTypes } from "react";
import LineSegment from "./line-segment";
import LineHelpers from "./helper-methods";
import ClipPath from "../helpers/clip-path";
import Domain from "../../helpers/domain";
import Data from "../../helpers/data";
import {
  PropTypes as CustomPropTypes, Helpers, Events, VictoryTransition, VictoryLabel,
  VictoryContainer
} from "victory-core";

const fallbackProps = {
  props: {
    height: 300,
    width: 450,
    clipHeight: 300,
    clipWidth: 450
  },
  style: {
    data: {
      fill: "none",
      opacity: 1,
      strokeWidth: 2,
      stroke: "#252525"
    },
    labels: {
      fill: "#252525",
      fontFamily: "'Gill Sans', 'Gill Sans MT', 'Ser­avek', 'Trebuchet MS', sans-serif",
      fontSize: 14,
      letterSpacing: "0.04em",
      padding: 10,
      strokeWidth: 0,
      stroke: "transparent",
      textAnchor: "start"
    }
  }
};

export default class VictoryLine extends React.Component {
  static role = "line";

  static defaultTransitions = {
    onExit: {
      duration: 500,
      before: (datum) => ({ y: datum.y }),
      beforeClipPathWidth: (data, child, exitingNodes) => {
        const filterExit = filter(data, (datum) => { return !exitingNodes[datum.x]; });
        const xVals = filterExit.map((datum) => {
          return child.type.getBaseProps(child.props).all.data.scale.x(datum.x);
        });
        const clipPath = min(xVals) + max(xVals);

        return clipPath;
      }
    },
    onEnter: {
      duration: 500,
      before: () => ({ y: null }),
      after: (datum) => ({ y: datum.y }),
      beforeClipPathWidth: (data, child, enteringNodes) => {
        const filterEnter = filter(data, (datum) => { return !enteringNodes[datum.x]; });
        const xVals = filterEnter.map((datum) => {
          return child.type.getBaseProps(child.props).all.data.scale.x(datum.x);
        });
        const clipPath = min(xVals) + max(xVals);

        return clipPath;

      },
      afterClipPathWidth: (data, child) => {
        const xVals = data.map((datum) => {
          return child.type.getBaseProps(child.props).all.data.scale.x(datum.x);
        });
        const clipPath = min(xVals) + max(xVals);

        return clipPath;
      }
    }
  };

  static propTypes = {
    /**
     * The animate prop specifies props for VictoryAnimation to use. The animate prop should
     * also be used to specify enter and exit transition configurations with the `onExit`
     * and `onEnter` namespaces respectively.
     * @examples {duration: 500, onEnd: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
     */
    animate: PropTypes.object,
    /**
{'fraction_non_alphanumeric': 0.14690265486725665, 'fraction_numerical': 0.02079646017699115, 'mean_word_length': 2.690612244897959, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3510033', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1409, 'n_words': 384}