<commit_before>// Copyright 2013 <NAME> <<EMAIL>>
//     
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

"use strict";

var child_process = require('child_process');
var fs = require('fs');
var MongoClient = require('mongodb').MongoClient;
var Tumblr = require('tumblrwks');

var Config = require('../lib/config.js');
var DrawingSVG = require('../lib/drawing_svg.js');

// The module encapsulates this.
// And we can avoid callback function 'this' problems and endless wrappers
// by using functions that refer to it directly.
var state = {
  // This will be called approximately once a day, so is fine
  run_id: (new Date).getTime()
};

var config = null;

var mongo_url = null;

var draw_something = function (url) {
  mongo_url = url;
  Config.fetch(mongo_url, receiveConfig);
};

var receiveConfig = function (c) {
  config = c;
  createDrawing();
};

var numberOfPoints = function() {
  return config.points_min
    + Math.floor(Math.random() * (config.points_max - config.points_min));
};

var createDrawing = function() {
  config.num_points = numberOfPoints();
  var drawing = new DrawingSVG(config.image_width, config.image_height,
                               config.num_points);
  drawing.draw();
  state.svg = drawing.toSVG(true,
                            'stroke: black; stroke-width: 1.25; fill: none;',
                            'stroke: #DDEEFF; stroke-width: 1; fill: none');
  rasteriseDrawing();
};

var rasterisedSVGFilepath = function () {
  return config.working_directory + '/' + state.run_id + '_svg.png';
}

var cleanup = function () {
  fs.unlink (rasterisedSVGFilepath(), function (err) {});
};

var convertArguments = function () {<commit_msg>OK, back to non-repro blue. Use a narrower line.<commit_after>// Copyright 2013 <NAME> <<EMAIL>>
//     
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

"use strict";

var child_process = require('child_process');
var fs = require('fs');
var MongoClient = require('mongodb').MongoClient;
var Tumblr = require('tumblrwks');

var Config = require('../lib/config.js');
var DrawingSVG = require('../lib/drawing_svg.js');

// The module encapsulates this.
// And we can avoid callback function 'this' problems and endless wrappers
// by using functions that refer to it directly.
var state = {
  // This will be called approximately once a day, so is fine
  run_id: (new Date).getTime()
};

var config = null;

var mongo_url = null;

var draw_something = function (url) {
  mongo_url = url;
  Config.fetch(mongo_url, receiveConfig);
};

var receiveConfig = function (c) {
  config = c;
  createDrawing();
};

var numberOfPoints = function() {
  return config.points_min
    + Math.floor(Math.random() * (config.points_max - config.points_min));
};

var createDrawing = function() {
  config.num_points = numberOfPoints();
  var drawing = new DrawingSVG(config.image_width, config.image_height,
                               config.num_points);
  drawing.draw();
  state.svg = drawing.toSVG(true,
                            'stroke: black; stroke-width: 1.25; fill: none;',
                            'stroke: #A4DDED; stroke-width: 0.25; fill: none');
  rasteriseDrawing();
};

var rasterisedSVGFilepath = function () {
  return config.working_directory + '/' + state.run_id + '_svg.png';
}

var cleanup = function () {
  fs.unlink (rasterisedSVGFilepath(), function (err) {});
};

var convertArguments = function () {
{'fraction_non_alphanumeric': 0.11933534743202417, 'fraction_numerical': 0.004531722054380665, 'mean_word_length': 3.3603010348071494, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7281125', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1341, 'n_words': 486}