<commit_before>import { getShape } from '../../models/shapes'
import Machine from '../../models/Machine'
import Transform from '../../models/Transform'
import Exporter from './Exporter'

export default class CommentExporter extends Exporter {
  constructor(props) {
    super(props)
    this.indentLevel = 0
    this.startComments()
    this.commentChar = ''
  }

  export() {
    const state = this.props
    const machine = new Machine()
    const transform = new Transform()
    let instance = state.machine

    this.line('Created by Sandify')
    this.line('https://sandify.org')
    this.keyValueLine('Version', state.app.sandifyVersion)
    this.line()

    this.keyValueLine('Machine type', state.machine.rectangular ? 'Rectangular' : 'Polar')
    this.indent()
    this.optionLines(machine, instance, ['minX', 'maxX', 'minY', 'maxY'], state.machine.rectangular)
    this.optionLines(machine, instance,  ['maxRadius', 'polarStartPoint', 'polarEndPoint'], !state.machine.rectangular)
    this.dedent()

    this.keyValueLine('Content type', state.app.input)
    this.indent()

    switch (state.app.input) {
      case 'shape': // shapes
        instance = state.layers.byId[state.layers.current]
        const shape = getShape(instance)
        const options = shape.getOptions()

        this.keyValueLine('Selected Shape', shape.name)
        this.optionLines(shape, instance, Object.keys(options))
        this.optionLines(transform, instance, ['offsetX', 'offsetY'])
        this.optionLines(transform, instance, ['numLoops', 'transformMethod', 'spinEnabled'], instance.repeatEnabled)
        this.indent()
        this.optionLines(transform, instance, ['spinValue', 'spinMethod'], instance.repeatEnabled && instance.spinEnabled)
        this.indent()
        this.optionLine(transform, instance, 'spinMath', instance.repeatEnabled && instance.spinEnabled && instance.spinMethod === 'function')
        this.optionLine(transform, instance, 'spinSwitchbacks', instance.repeatEnabled && instance.spinEnabled && instance.spinMethod === 'constant')
        this.dedent()
        this.dedent()
        this.optionLine(transform, instance, 'growEnabled', instance.repeatEnabled)
        this.indent()
        this.optionLine(transform, instance, 'growValue', instance.repeatEnabled && instance.growEnabled)
        this.optionLine(transform, instance, 'growMethod', instance.repeatEnabled && instance.growEnabled)
        this.indent()
        this.optionLine(transform, instance, 'growMath', instance.repeatEnabled && instance.growEnabled && instance.growMethod === 'function')
        this.dedent()
        this.dedent()
        this.optionLine(transform, instance, 'trackEnabled', instance.repeatEnabled)
        this.indent()
        this.optionLines(transform, instance, ['trackValue', 'trackLength', 'trackNumLoops'], instance.repeatEnabled && instance.trackEnabled)
        this.optionLine(transform, instance, 'trackGrowEnabled', instance.repeatEnabled && instance.trackEnabled)
        this.indent()
        this.optionLine(transform, instance, 'trackGrow', instance.repeatEnabled && instance.trackGrowEnabled)
        this.dedent()
        this.dedent()
        break

      case 'code':
        this.keyValueLine('Input file', state.importer.fileName)
        this.keyValueLine('Zoom', state.importer.zoom)
        this.keyValueLine('Aspect ratio', state.importer.aspectRatio)
        break

      default:
        break
    }

    this.dedent()
    this.keyValueLine('Path reversed', state.exporter.reverse)
    return this.lines
  }
}
<commit_msg>modify comment exporter to support multiple layers<commit_after>import { getShape } from '../../models/shapes'
import { getLayerInfo } from '../layers/selectors'
import Machine from '../../models/Machine'
import Transform from '../../models/Transform'
import Exporter from './Exporter'

export default class CommentExporter extends Exporter {
  constructor(props) {
    super(props)
    this.indentLevel = 0
    this.startComments()
    this.commentChar = ''
  }

  export() {
    const state = this.props
    const machine = new Machine()
    const transform = new Transform()
    let instance = state.machine

    this.line('Created by Sandify')
    this.line('https://sandify.org')
    this.keyValueLine('Version', state.app.sandifyVersion)
    this.line()

    this.keyValueLine('Machine type', state.machine.rectangular ? 'Rectangular' : 'Polar')
    this.indent()
    this.optionLines(machine, instance, ['minX', 'maxX', 'minY', 'maxY'], state.machine.rectangular)
    this.optionLines(machine, instance,  ['maxRadius', 'polarStartPoint', 'polarEndPoint'], !state.machine.rectangular)
    this.dedent()

    this.keyValueLine('Content type', state.app.input)

    switch (state.app.input) {
      case 'shape': // shapes
        const layers = getLayerInfo(state)
        layers.forEach(layer => {
          const shape = getShape(layer)
          const options = shape.getOptions()

          this.line('Layer:')
          this.indent()
          this.keyValueLine('Shape', shape.name)
          this.optionLines(shape, layer, Object.keys(options))
          this.keyValueLine('Visible', layer.visible)
          this.optionLines(transform, layer, ['offsetX', 'offsetY'])
          this.optionLines(transform, layer, ['numLoops', 'transformMethod', 'spinEnabled'], layer.repeatEnabled)
          this.indent()
          this.optionLines(transform, layer, ['spinValue', 'spinMethod'], layer.repeatEnabled && layer.spinEnabled)
          this.indent()
          this.optionLine(transform, layer, 'spinMath', layer.repeatEnabled && layer.spinEnabled && layer.spinMethod === 'function')
          this.optionLine(transform, layer, 'spinSwitchbacks', layer.repeatEnabled && layer.spinEnabled && layer.spinMethod === 'constant')
          this.dedent()
          this.dedent()
          this.optionLine(transform, layer, 'growEnabled', layer.repeatEnabled)
          this.indent()
          this.optionLine(transform, layer, 'growValue', layer.repeatEnabled && layer.growEnabled)
          this.optionLine(transform, layer, 'growMethod', layer.repeatEnabled && layer.growEnabled)
          this.indent()
          this.optionLine(transform, layer, 'growMath', layer.repeatEnabled && layer.growEnabled && layer.growMethod === 'function')
          this.dedent()
          this.dedent()
          this.optionLine(transform, layer, 'trackEnabled', layer.repeatEnabled)
          this.indent()
          this.optionLines(transform, layer, ['trackValue', 'trackLength', 'trackNumLoops'], layer.repeatEnabled && layer.trackEnabled)
          this.optionLine(transform, layer, 'trackGrowEnabled', layer.repeatEnabled && layer.trackEnabled)
          this.indent()
          this.optionLine(transform, layer, 'trackGrow', layer.repeatEnabled && layer.trackGrowEnabled)
          this.dedent()
          this.dedent()
          this.dedent()
        })
        break

      case 'code':
        this.keyValueLine('Input file', state.importer.fileName)
        this.keyValueLine('Zoom', state.importer.zoom)
        this.keyValueLine('Aspect ratio', state.importer.aspectRatio)
        break

      default:
        break
    }

    this.dedent()
    this.keyValueLine('Path reversed', state.exporter.reverse)
    return this.lines
  }
}

{'fraction_non_alphanumeric': 0.13283070596298835, 'fraction_numerical': 0.00027416038382453733, 'mean_word_length': 3.2816901408450705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '3212066', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1969, 'n_words': 409}