<commit_before>var get = Ember.get, set = Ember.set;

Ember.State = Ember.Object.extend({
  isState: true,
  parentState: null,
  start: null,

  init: function() {
    var states = get(this, 'states'), foundStates;

    // As a convenience, loop over the properties
    // of this state and look for any that are other
    // Ember.State instances or classes, and move them
    // to the `states` hash. This avoids having to
    // create an explicit separate hash.

    if (!states) {
      states = {};
      for (var name in this) {
        if (name === "constructor") { continue; }

        var value = this[name];
        if (!value) { continue; }

        if (Ember.State.detect(value)) {
          value = value.create();
        }

        if (value.isState) {
          foundStates = true;

          set(value, 'parentState', this);
          set(value, 'name', (get(this, 'name') || '') + '.' + name);

          states[name] = value;
        }
      }

      if (foundStates) { set(this, 'states', states); }
    }

    set(this, 'routes', {});
  },

  enter: Ember.K,
  exit: Ember.K
});<commit_msg>Give states: hashes the same API as raw create calls to Ember.State<commit_after>var get = Ember.get, set = Ember.set;

Ember.State = Ember.Object.extend({
  isState: true,
  parentState: null,
  start: null,

  init: function() {
    var states = get(this, 'states'), foundStates;

    // As a convenience, loop over the properties
    // of this state and look for any that are other
    // Ember.State instances or classes, and move them
    // to the `states` hash. This avoids having to
    // create an explicit separate hash.

    if (!states) {
      states = {};
      for (var name in this) {
        if (name === "constructor") { continue; }
        value = this.setupChild(this[name]);

        if (value) {
          foundStates = true;
          states[name] = value;
        }
      }

      if (foundStates) { set(this, 'states', states); }
    } else {
      for (var name in states) {
        this.setupChild(states[name]);
      }
    }

    set(this, 'routes', {});
  },

  setupChild: function(value) {
    if (!value) { return false; }

    if (Ember.State.detect(value)) {
      value = value.create();
    }

    if (value.isState) {
      set(value, 'parentState', this);
      set(value, 'name', (get(this, 'name') || '') + '.' + name);
      return value;
    }

    return false;
  },

  enter: Ember.K,
  exit: Ember.K
});
{'fraction_non_alphanumeric': 0.14732142857142858, 'fraction_numerical': 0.0, 'mean_word_length': 2.1683804627249357, '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': '2628705', 'n_tokens_mistral': 793, 'n_tokens_neox': 769, 'n_words': 234}