<commit_before>/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */

(function () {
  "use strict";

  var _ = X._;

  require("../ext/administrative_route");

  X.datasourceRoute = X.Route.create({
    handle: function (xtr) {
      var method = xtr.get("method"),
        data = xtr.get("json");


      if (method === "POST") {
        if (data.lookup) {
          delete data.lookup;
          this.lookup(xtr, data);
        }
      } else if (method === "GET") {
        this.fetch.apply(this, arguments);
      } else {
        X.warn("could not handle datasource related request, %@, %@".f(method, xtr.get("path")));
        xtr.close();
      }
    },
    fetch: function (xtr, id) {
      //X.debug("fetch: ", id);
      if (id) {
        X.warn("wtf am I supposed to do with that? '%@'".f(id));
        xtr.close();
      } else {
        if (!X.activeServices) {
          xtr.error({isError: true, reason: "Invalid request."});
          return;
        }
        var d = X.activeServices.get("datasources");
        //X.debug("datasources: ", _.values(d));
        xtr.write(_.values(d)).close();
      }
    },
    lookup: function (xtr, data) {
      X.debug("lookup: ", data);
    },
    handles: "/datasource /datasources /datasource/:id".w(),
    className: "X.datasourceRoute"
  });

  //X.datasourceRoute = X.AdministrativeRoute.create({
  //  clientModel: "datasource",
  //  model: function () {
  //    return X.proxyCache.model("Datasource");
  //  }.property()
  //});

  //X.datasourceRoute = X.AdministrativeRoute.create({
  //  update: function (xtr, id) {
  //    X.debug("datasource: my update handler was called: %@, %@".f(xtr.get("path"), id));
  //    X.debug(xtr.get("data"));
  //    xtr.close();
  //  },<commit_msg>issue #19151: cleanup<commit_after>/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
regexp:true, undef:true, strict:true, trailing:true, white:true */
/*global X:true */

(function () {
  "use strict";

  var _ = X._;

  require("../ext/administrative_route");

  X.datasourceRoute = X.Route.create({
    handle: function (xtr) {
      var method = xtr.get("method"),
        data = xtr.get("json");
      if (method === "POST") {
        if (data.lookup) {
          delete data.lookup;
          this.lookup(xtr, data);
        }
      } else if (method === "GET") {
        this.fetch.apply(this, arguments);
      } else {
        X.warn("could not handle datasource related request, %@, %@".f(method, xtr.get("path")));
        xtr.close();
      }
    },
    fetch: function (xtr, id) {
      //X.debug("fetch: ", id);
      if (id) {
        X.warn("what am I supposed to do with that? '%@'".f(id));
        xtr.close();
      } else {
        if (!X.activeServices) {
          xtr.error({isError: true, reason: "Invalid request."});
          return;
        }
        var d = X.activeServices.get("datasources");
        //X.debug("datasources: ", _.values(d));
        xtr.write(_.values(d)).close();
      }
    },
    lookup: function (xtr, data) {
      X.debug("lookup: ", data);
    },
    handles: "/datasource /datasources /datasource/:id".w(),
    className: "X.datasourceRoute"
  });

  //X.datasourceRoute = X.AdministrativeRoute.create({
  //  clientModel: "datasource",
  //  model: function () {
  //    return X.proxyCache.model("Datasource");
  //  }.property()
  //});

  //X.datasourceRoute = X.AdministrativeRoute.create({
  //  update: function (xtr, id) {
  //    X.debug("datasource: my update handler was called: %@, %@".f(xtr.get("path"), id));
  //    X.debug(xtr.get("data"));
  //    xtr.close();
  //  },
{'fraction_non_alphanumeric': 0.19562351700500924, 'fraction_numerical': 0.0018455048774057474, 'mean_word_length': 2.3724444444444446, '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': '6684837', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1300, 'n_words': 256}