<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import subprocess\n",
    "from functools import partial\n",
    "from utils import travis_op, appveyor_op, apply_to_all_projects\n",
    "\n",
    "v = '0.4.x'\n",
    "working_dir = '/Users/jab08/_bump_condaci'\n",
    "CONDACI_URL_START = 'https://raw.githubusercontent.com/menpo/condaci/v'\n",
    "        \n",
    "def replace_version_in_str(v, string):\n",
    "    before, after = string.split(CONDACI_URL_START)\n",
    "    before += CONDACI_URL_START\n",
    "\n",
    "    old_v, after = after.split('/', 1)\n",
    "    after = '/' + after\n",
    "    return before + v + after\n",
    "\n",
    "replace_version = partial(replace_version_in_str, v)\n",
    "appveyor_v = partial(travis_op, replace_version)\n",
    "travis_v = partial(appveyor_op, replace_version)\n",
    "\n",
    "def bump_repo(repo_dir):\n",
    "    os.chdir(repo_dir)\n",
    "    if appveyor_v(repo_dir) or travis_v(repo_dir):\n",
    "        print(subprocess.check_output(['git', 'commit', '-am', 'bump condaci to {}'.format(v)]))\n",
    "        print(subprocess.check_output(['git', 'push', 'origin', 'master']))\n",
    "    else:\n",
    "        print('{} is already up to date'.format(repo_dir))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "apply_to_all_projects(working_dir, bump_repo)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"<commit_msg>fix boolean shortcut bug in bump condaci<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import subprocess\n",
    "from functools import partial\n",
    "from utils import travis_op, appveyor_op, apply_to_all_projects\n",
    "\n",
    "v = '0.4.x'\n",
    "working_dir = '/Users/jab08/_bump_condaci'\n",
    "CONDACI_URL_START = 'https://raw.githubusercontent.com/menpo/condaci/v'\n",
    "        \n",
    "def replace_version_in_str(v, string):\n",
    "    before, after = string.split(CONDACI_URL_START)\n",
    "    before += CONDACI_URL_START\n",
    "\n",
    "    old_v, after = after.split('/', 1)\n",
    "    after = '/' + after\n",
    "    return before + v + after\n",
    "\n",
    "replace_version = partial(replace_version_in_str, v)\n",
    "travis_bump_v = partial(travis_op, replace_version)\n",
    "appveyor_bump_v = partial(appveyor_op, replace_version)\n",
    "\n",
    "def bump_repo(repo_dir):\n",
    "    os.chdir(repo_dir)\n",
    "    did_bump_appveyor = appveyor_bump_v(repo_dir)\n",
    "    did_bump_travis = travis_bump_v(repo_dir)\n",
    "    if did_bump_travis or did_bump_appveyor:\n",
    "        print(subprocess.check_output(['git', 'commit', '-am', 'bump condaci to {}'.format(v)]))\n",
    "        print(subprocess.check_output(['git', 'push', 'origin', 'master']))\n",
    "    else:\n",
    "        print('{} is already up to date'.format(repo_dir))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "apply_to_all_projects(working_dir, bump_repo)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
{'fraction_non_alphanumeric': 0.19342359767891681, 'fraction_numerical': 0.0038684719535783366, 'mean_word_length': 2.921993499458288, 'pattern_counts': {'":': 38, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5479050', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1393, 'n_words': 229}