<commit_before>var YAML = require("js-yaml");

// Extract environment variables for this handler.
var {baseName, environment, projectID, fullName, skyBucket} = process.env;

// Access the Panda Sky helpers.
var AWS = require("aws-sdk");
var {async, s3, response} = require("panda-sky")(AWS);

// Use the S3 helper to get functions to access the App's datastore.
var {get, put, del} = s3("foobar");

// Handlers
var API = {};

API[`${fullName}-discovery-get`] = async( function*(data, context, callback) {
  // Instantiate new s3 helper to target deployment "src" bucket.
  var get = s3(`${environment}-${projectID}`).get;
  var description = YAML.safeLoad( yield( get("api.yaml")));
  return callback( null, description);
});

API[`${fullName}-greeting-get`] = async( function*(data, context, callback) {
  var message, name;
  name = data.name || "World";
  message = `<h1>Hello, ${name}!</h1>`;
  message += "<p>Seeing this page indicates a successful deployment of your test API with Panda Sky!</p>";
  return callback(null, message);
});

exports.handler = function (event, context, callback) {
  try {
    return API[context.functionName](event, context, callback);
  } catch (e) {
    return callback(e);
  }
};
<commit_msg>Updated demo according to latest changes<commit_after>var YAML = require("js-yaml");

// Extract environment variables for this handler.
var {baseName, environment, projectID, fullName, skyBucket} = process.env;

// Access the Panda Sky helpers.
var AWS = require("aws-sdk");
var {async, s3, response} = require("panda-sky")(AWS);

// Use the S3 helper to get functions to access the App's datastore.
var {get, put, del} = s3("foobar");

// Handlers
var API = {};

API[`${fullName}-discovery-get`] = async( function*(data, context, callback) {
  // Instantiate new s3 helper to target deployment "src" bucket.
  var get = s3(`${environment}-${projectID}`).get;
  var description = YAML.safeLoad( yield( get("api.yaml")));
  return callback( null, description);
});

API[`${fullName}-greeting-get`] = async( function*(data, context, callback) {
  var message, name;
  name = data.name || "World";
  message = `<h1>Hello, ${name}!</h1>`;
  message += "<p>Seeing this page indicates a successful deployment of your test API with Panda Sky!</p>";
  return callback(null, {body: message});
});

exports.handler = function (event, context, callback) {
  try {
    return API[context.functionName](event, context, callback);
  } catch (e) {
    return callback(e);
  }
};

{'fraction_non_alphanumeric': 0.16472945891783566, 'fraction_numerical': 0.0056112224448897794, 'mean_word_length': 4.534368070953437, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2581371', 'n_tokens_mistral': 803, 'n_tokens_neox': 792, 'n_words': 248}