<commit_before>'use babel';

import { execFile } from 'child_process';
import { format } from 'util';
import { filter } from 'fuzzaldrin';

export default class Provider {
  constructor() {
    let self = this;
    self.selector = '.source.yaml';
    self.disableForSelector = '.source.yaml .comment';
    self.modules = [];
    self.directives = [];
    self.loop_directives = [];
    execFile(__dirname + '/parse_ansible.py', {maxBuffer: 5*1024*1024}, function (err, stdout) {
      if (err) {
        if (err.message.match(/No module named ['"]?ansible/)) {
          atom.notifications.addWarning(
            'autocomplete-ansible unable to import ansible.', {
              detail: 'Install ansible using pip.',
              dismissable: true
            }
          );
        } else {
          atom.notifications.addError(
            'autocomplete-python traceback output:', {
              detail: err.message,
              dismissable: true
            }
          );
        }
        throw err;
      }
      let ansibleData = JSON.parse(stdout);
      self.modules = ansibleData.modules.map(function (elm) {
        return {
          text: elm.module,
          type: 'function',<commit_msg>make compatible with ansible language package<commit_after>'use babel';

import { execFile } from 'child_process';
import { format } from 'util';
import { filter } from 'fuzzaldrin';

export default class Provider {
  constructor() {
    let self = this;
    self.selector = '.source.yaml', '.source.ansible';
    self.disableForSelector = '.source.yaml .comment', '.source.ansible .comment';
    self.modules = [];
    self.directives = [];
    self.loop_directives = [];
    execFile(__dirname + '/parse_ansible.py', {maxBuffer: 5*1024*1024}, function (err, stdout) {
      if (err) {
        if (err.message.match(/No module named ['"]?ansible/)) {
          atom.notifications.addWarning(
            'autocomplete-ansible unable to import ansible.', {
              detail: 'Install ansible using pip.',
              dismissable: true
            }
          );
        } else {
          atom.notifications.addError(
            'autocomplete-python traceback output:', {
              detail: err.message,
              dismissable: true
            }
          );
        }
        throw err;
      }
      let ansibleData = JSON.parse(stdout);
      self.modules = ansibleData.modules.map(function (elm) {
        return {
          text: elm.module,
          type: 'function',
{'fraction_non_alphanumeric': 0.12535042050460551, 'fraction_numerical': 0.007208650380456548, 'mean_word_length': 2.046341463414634, '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': '2044881', 'n_tokens_mistral': 715, 'n_tokens_neox': 694, 'n_words': 165}