<commit_before>import { shapesToPaths, preparePaths } from './svg/normalize'
import { getProperty, setProperty } from './svg/utils'
import pathParser from './path/parser'
import pathEncoder from './path/encoder'
import warpTransform from './warp/transform'
import warpInterpolate from './warp/interpolate'
import * as interpolate from './path/interpolate'

const deltaFunction = points => interpolate.euclideanDistance(points.slice(0, 2))

export default class Warp
{
	constructor(element, curveType='q')
	{
		this.element = element

		shapesToPaths(this.element)
		preparePaths(this.element, curveType)

		const pathElements = element.querySelectorAll('path')

		this.paths = [].map.call(pathElements, function(element)
		{
			const pathString = getProperty(element, 'd')
			const data = pathParser(pathString)

			return { element, data }
		})
	}

	transform(transformer)
	{
		for(let path of this.paths)
		{
			path.data = warpTransform(path.data, transformer)
			const pathString = pathEncoder(path.data)

			setProperty(path.element, 'd', pathString)
		}
	}

	interpolate(threshold)
	{
		let didWork = false

		for(let path of this.paths)
		{
			path.data = warpInterpolate(path.data, threshold, deltaFunction)
			const pathString = pathEncoder(path.data)

			setProperty(path.element, 'd', pathString)
		}

		return didWork
	}

	extrapolate(threshold)
	{
		return false
	}

	preInterpolate(transformer, threshold)
	{
		return false
	}

	preExtrapolate(transformer, threshold)
	{<commit_msg>Fixed return value for interpolate method<commit_after>import { shapesToPaths, preparePaths } from './svg/normalize'
import { getProperty, setProperty } from './svg/utils'
import pathParser from './path/parser'
import pathEncoder from './path/encoder'
import warpTransform from './warp/transform'
import warpInterpolate from './warp/interpolate'
import * as interpolate from './path/interpolate'

export default class Warp
{
	constructor(element, curveType='q')
	{
		this.element = element

		shapesToPaths(this.element)
		preparePaths(this.element, curveType)

		const pathElements = element.querySelectorAll('path')

		this.paths = [].map.call(pathElements, function(element)
		{
			const pathString = getProperty(element, 'd')
			const data = pathParser(pathString)

			return { element, data }
		})
	}

	transform(transformer)
	{
		for(let path of this.paths)
		{
			path.data = warpTransform(path.data, transformer)
			const pathString = pathEncoder(path.data)

			setProperty(path.element, 'd', pathString)
		}
	}

	interpolate(threshold)
	{
		let didWork = false

		const deltaFunction = function(points)
		{
			const delta = interpolate.euclideanDistance(points.slice(0, 2))
			didWork = didWork || (delta > threshold)

			return delta
		}

		for(let path of this.paths)
		{
			path.data = warpInterpolate(path.data, threshold, deltaFunction)
			const pathString = pathEncoder(path.data)

			setProperty(path.element, 'd', pathString)
		}

		return didWork
	}

	extrapolate(threshold)
	{
		return false
	}

	preInterpolate(transformer, threshold)
	{
		return false
	}

	preExtrapolate(transformer, threshold)
	{
{'fraction_non_alphanumeric': 0.11268057784911717, 'fraction_numerical': 0.0012841091492776886, 'mean_word_length': 4.326495726495726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2036461', 'n_tokens_mistral': 1103, 'n_tokens_neox': 974, 'n_words': 225}