<commit_before>import React from 'react';
import md5 from 'md5';


import _File from './_File';
import { Preview } from '../EditorPane/';


export default class BinaryFile extends _File {

  static defaultProps = {
    name: '.BinaryFile',
    blob: null,
    component: Preview,
    sign: null,
  };

  static defaultOptions = {
    isReadOnly: true,
    isTrashed: false,
    noBabel: false,
  }

  static visible = _File.visible.concat(
    'blob',
    'blobURL'
  );

  static watchProps = _File.watchProps.concat(
  );

  constructor(props) {
    if (props.blob && !props.blobURL) {
      const blobURL = URL.createObjectURL(props.blob);
      props = Object.assign({}, props, { blobURL });
    }

    super(props);
  }

  get blob() {
    return this.props.blob;
  }

  get blobURL() {
    return this.props.blobURL;
  }

  get hash() {
    return this.props.hash;
  }

  set(change) {
    if (change.blob && this.blobURL) {
      URL.revokeObjectURL(this.blobURL);
    }
    if (!change.blob && this.hash) {
      change.hash = this.hash;
    }
    const seed = Object.assign(this.serialize(), change);

    return new BinaryFile(seed);
  }

  async compose() {
    const serialized = this.serialize();
    if (this.sign && this.sign === this.credit) {
      const sign = Object.assign({}, this.sign, {
        timestamp: new Date().getTime(),
        hash: this.hash,
      });
      serialized.credits = JSON.stringify(
        this.credits.concat(sign)
      );
    } else {
      serialized.credits = JSON.stringify(this.credits);
    }<commit_msg>Bug fix<commit_after>import React from 'react';
import md5 from 'md5';


import _File from './_File';
import { Preview } from '../EditorPane/';


export default class BinaryFile extends _File {

  static defaultProps = {
    name: '.BinaryFile',
    blob: null,
    component: Preview,
    sign: null,
  };

  static defaultOptions = {
    isReadOnly: true,
    isTrashed: false,
    noBabel: false,
  }

  static visible = _File.visible.concat(
    'blob',
    'blobURL'
  );

  static watchProps = _File.watchProps.concat(
  );

  constructor(props) {
    if (props.blob && !props.blobURL) {
      const blobURL = URL.createObjectURL(props.blob);
      props = Object.assign({}, props, { blobURL });
    }

    super(props);
  }

  get blob() {
    return this.props.blob;
  }

  get blobURL() {
    return this.props.blobURL;
  }

  get hash() {
    return this.props.hash;
  }

  set(change) {
    if (!change.blob && this.hash) {
      change.hash = this.hash;
    }
    const seed = Object.assign(this.serialize(), change);

    return new BinaryFile(seed);
  }

  async compose() {
    const serialized = this.serialize();
    if (this.sign && this.sign === this.credit) {
      const sign = Object.assign({}, this.sign, {
        timestamp: new Date().getTime(),
        hash: this.hash,
      });
      serialized.credits = JSON.stringify(
        this.credits.concat(sign)
      );
    } else {
      serialized.credits = JSON.stringify(this.credits);
    }
{'fraction_non_alphanumeric': 0.14243225380039656, 'fraction_numerical': 0.0013218770654329147, 'mean_word_length': 2.507531865585168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4855769', 'n_tokens_mistral': 1004, 'n_tokens_neox': 971, 'n_words': 223}