<commit_before>'use strict'

let cli = require('heroku-cli-util')
let co = require('co')

function * run (context, heroku) {
  let app = context.app
  let addon = yield heroku.get(`/addons/${context.args.addon_name}`)

  function createAttachment (app, as, confirm) {
    return cli.action(
      `Attaching ${cli.color.addon(addon.name)}${as ? ' as ' + cli.color.attachment(as) : ''} to ${cli.color.app(app)}`,
      heroku.request({
        path: '/addon-attachments',
        method: 'POST',
        body: {
          name: as,
          app: {name: app},
          addon: {name: addon.name},
          confirm
        }
      })
    )
  }

  let attachment = yield createAttachment(app, context.flags.as, context.flags.confirm)
    .catch((err) => {
      if (!err.body || err.body.id !== 'confirmation_required') throw err
      return cli.confirmApp(app, context.flags.confirm, err.body.message)
        .then(() => createAttachment(app, context.flags.as, app))
    })
  yield cli.action(
    `Setting ${cli.color.attachment(attachment.name)} config vars and restarting ${cli.color.app(app)}`,
    {success: false},
    co(function * () {
      let releases = yield heroku.get(`/apps/${app}/releases`, {
        partial: true,<commit_msg>encode uri param (#33)<commit_after>'use strict'

let cli = require('heroku-cli-util')
let co = require('co')

function * run (context, heroku) {
  let app = context.app
  let addon = yield heroku.get(`/addons/${encodeURIComponent(context.args.addon_name)}`)

  function createAttachment (app, as, confirm) {
    return cli.action(
      `Attaching ${cli.color.addon(addon.name)}${as ? ' as ' + cli.color.attachment(as) : ''} to ${cli.color.app(app)}`,
      heroku.request({
        path: '/addon-attachments',
        method: 'POST',
        body: {
          name: as,
          app: {name: app},
          addon: {name: addon.name},
          confirm
        }
      })
    )
  }

  let attachment = yield createAttachment(app, context.flags.as, context.flags.confirm)
    .catch((err) => {
      if (!err.body || err.body.id !== 'confirmation_required') throw err
      return cli.confirmApp(app, context.flags.confirm, err.body.message)
        .then(() => createAttachment(app, context.flags.as, app))
    })
  yield cli.action(
    `Setting ${cli.color.attachment(attachment.name)} config vars and restarting ${cli.color.app(app)}`,
    {success: false},
    co(function * () {
      let releases = yield heroku.get(`/apps/${app}/releases`, {
        partial: true,
{'fraction_non_alphanumeric': 0.16567342073897498, 'fraction_numerical': 0.0007945967421533572, 'mean_word_length': 2.8036253776435047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4300159', 'n_tokens_mistral': 818, 'n_tokens_neox': 818, 'n_words': 174}