<commit_before>'use strict';

const path = require('path');
const promisify = require('promisify-node');
const fs = promisify('fs');
const childProcessPromise = require('child-process-promise');

/* https://github.com/nodejs/node/issues/8044#issuecomment-247518992 */
const F_OK = (fs.constants === undefined ? fs : fs.constants).F_OK;

const fileNotExists = Symbol('file does not exist');

/*
 * Would be cool to figure out how to make input/input streams later.
 */

const process = function (input, output) {
    /*
     * Remove output file first so we can validate success later by
     * checking for existence.
     */
    return fs.unlink(output).catch(ex => fs.access(output, F_OK).catch(ex => fileNotExists).then(o => o === fileNotExists ? undefined : Promise.reject(ex))).then(() => childProcessPromise.spawn('blender', ['-b', '-P', path.join(__dirname, 'export-scene-as-babylonjs.py')], {
	env: Object.assign({}, process.env, {
	    /*
	     * Cannot figure out the proper way to pass arguments to
	     * python scripts invoked via Blender. So, for now, will
	     * just use environment variables.
	     */
	    NODEJS_BABYLONJS_BLENDER_INPUT: input,
	    NODEJS_BABYLONJS_BLENDER_OUTPUT: output,
	}),
    })).then(results => fs.access(output, F_OK).catch(ex => {throw new Error(`Blender did not emit ${output}`)}).catch(ex => {
	console.error(results.stdout);
	console.error(results.stderr);
	return Promise.reject(ex);
    }));
};

module.exports = process;<commit_msg>Clean out unnecessary F_OK use.<commit_after>'use strict';

const path = require('path');
const promisify = require('promisify-node');
const fs = promisify('fs');
const childProcessPromise = require('child-process-promise');

const fileNotExists = Symbol('file does not exist');

/*
 * Would be cool to figure out how to make input/input streams later.
 */

const process = function (input, output) {
    /*
     * Remove output file first so we can validate success later by
     * checking for existence.
     */
    return fs.unlink(output).catch(ex => fs.access(output).catch(ex => fileNotExists).then(o => o === fileNotExists ? undefined : Promise.reject(ex))).then(() => childProcessPromise.spawn('blender', ['-b', '-P', path.join(__dirname, 'export-scene-as-babylonjs.py')], {
	env: Object.assign({}, process.env, {
	    /*
	     * Cannot figure out the proper way to pass arguments to
	     * python scripts invoked via Blender. So, for now, will
	     * just use environment variables.
	     */
	    NODEJS_BABYLONJS_BLENDER_INPUT: input,
	    NODEJS_BABYLONJS_BLENDER_OUTPUT: output,
	}),
    })).then(results => fs.access(output).catch(ex => {throw new Error(`Blender did not emit ${output}`)}).catch(ex => {
	console.error(results.stdout);
	console.error(results.stderr);
	return Promise.reject(ex);
    }));
};

module.exports = process;
{'fraction_non_alphanumeric': 0.1506172839506173, 'fraction_numerical': 0.004585537918871252, 'mean_word_length': 3.984182776801406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '3965226', 'n_tokens_mistral': 898, 'n_tokens_neox': 867, 'n_words': 232}