{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T07:50:40.644453Z",
     "start_time": "2019-01-18T07:50:40.633386Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'treeroot': {'branch1': {'name': 'Node 1', 'branch1-1': {'name': 'Node 1-1'}}, 'branch2': {'name': 'Node 2', 'branch2-1': {'name': 'Node 2-1'}}}}\n"
     ]
    }
   ],
   "source": [
    "import yaml\n",
    "with open('tree.yaml') as f:\n",
    "    # use safe_load instead load\n",
    "    dataMap = yaml.safe_load(f)\n",
    "    print(dataMap)\n",
    "\n",
    "with open('newtree.yaml', \"w\") as f:\n",
    "    yaml.dump(dataMap, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T07:57:25.975212Z",
     "start_time": "2019-01-18T07:57:25.969178Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'name': 'Node 1', 'branch1-1': {'name': 'Node 1-1'}}\n",
      "branch1 Node 1\n",
      "branch2 Node 2\n"
     ]
    }
   ],
   "source": [
    "print(dataMap['treeroot']['branch1'])\n",
    "root=dataMap['treeroot']\n",
    "for k, branch in root.items():\n",
    "    print(k, branch['name'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-19T07:48:17.006801Z",
     "start_time": "2019-01-19T07:48:16.998475Z"
    }
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.append(\"..\")\n",
    "from sagas.util.str_converters import to_camel_case"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T11:40:43.664452Z",
     "start_time": "2019-01-18T11:40:43.658974Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'PeopleLine'"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "to_camel_case(\"people_line\", True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:12:02.306180Z",
     "start_time": "2019-01-18T13:12:02.249992Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "base_model Base model\n",
      "\tabstract True\n",
      "people People\n",
      "planet Planet\n",
      ".. getting people fields\n",
      "id True False\n",
      "name False False\n",
      "height False False\n",
      "mass False False\n",
      "hair_color False False\n",
      "skin_color False False\n",
      "eye_color False False\n",
      "birth_year False False\n",
      "gender False False\n",
      "planet_id False False\n",
      "url False False\n",
      "cockroachdb://maxroach@localhost:26257/bank\n"
     ]
    }
   ],
   "source": [
    "def is_true(node, attr):\n",
    "    return (attr in node) and node[attr]\n",
    "def is_primary(node):\n",
    "    return is_true(node, \"primary\")\n",
    "\n",
    "class ModelDefinitions(object):\n",
    "    def __init__(self, file_name):\n",
    "        self.models={}\n",
    "        with open(file_name) as f:\n",
    "            # use safe_load instead load\n",
    "            doc = yaml.safe_load(f)\n",
    "            self.models_root=doc['models']\n",
    "            self.database_root=doc['database']\n",
    "            for k, model in self.models_root.items():        \n",
    "                print(k, model['name'])\n",
    "                if is_true(model, 'abstract'):\n",
    "                    print(\"\\tabstract\", model['abstract'])\n",
    "                else:\n",
    "                    self.models[k]=model\n",
    "\n",
    "model_def=ModelDefinitions('model_planet.yaml')\n",
    "print(\".. getting people fields\")\n",
    "for k, fld in model_def.models['people']['fields'].items():\n",
    "    print(k, is_primary(fld), is_true(fld, 'input'))\n",
    "\n",
    "db=model_def.database_root\n",
    "print(db['url'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:04:13.850133Z",
     "start_time": "2019-01-18T13:04:13.842846Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "from .base import Base\n",
      "from sqlalchemy import Column, ForeignKey, Integer, String\n",
      "\n",
      "\n",
      "class ModelPlanet(Base):\n",
      "    \"\"\"Planet model.\"\"\"\n",
      "\n",
      "    __tablename__ = 'planet'\n",
      "\n"
     ]
    }
   ],
   "source": [
    "model_header='''\n",
    "from .base import Base\n",
    "from sqlalchemy import Column, ForeignKey, Integer, String\n",
    "\n",
    "\n",
    "class Model{cname}(Base):\n",
    "    \"\"\"{cname} model.\"\"\"\n",
    "\n",
    "    __tablename__ = '{name}'\n",
    "'''\n",
    "\n",
    "# model_name='people'\n",
    "model_name='planet'\n",
    "print(model_header.format(name=model_name, \n",
    "                          cname=to_camel_case(model_name, True),\n",
    "                          model=model_def.models[model_name]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:12:29.750822Z",
     "start_time": "2019-01-18T13:12:29.713321Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    id = Column('id', Integer, primary_key=True, doc=\"Id of the planet\")\n",
      "    name = Column('name', String,  doc=\"Name of the planet.\")\n",
      "    rotation_period = Column('rotation_period', String,  doc=\"Rotation period of the planet.\")\n",
      "    orbital_period = Column('orbital_period', String,  doc=\"Orbital period of the planet.\")\n",
      "    diameter = Column('diameter', String,  doc=\"Diameter of the planet.\")\n",
      "    climate = Column('climate', String,  doc=\"Climate period of the planet.\")\n",
      "    gravity = Column('gravity', String,  doc=\"Gravity of the planet.\")\n",
      "    terrain = Column('terrain', String,  doc=\"Terrain of the planet.\")\n",
      "    surface_water = Column('surface_water', String,  doc=\"Surface water of the planet.\")\n",
      "    population = Column('population', String,  doc=\"Population of the planet.\")\n",
      "    url = Column('url', String,  doc=\"URL of the planet in the Star Wars API.\")\n",
      "    peopleList = relationship(ModelPeople, backref='planet')\n"
     ]
    }
   ],
   "source": [
    "field_def='''{fld_name} = Column('{fld_name}', {fld_type}, {pk_part} doc=\"{field[doc]}\")'''\n",
    "rel_def='''{lname} = relationship(Model{model}, backref='{field[backref]}')'''\n",
    "field_builder=[]\n",
    "for k, fld in model_def.models[model_name]['fields'].items():\n",
    "    primary_part=\"\"\n",
    "    if is_primary(fld):\n",
    "        primary_part=\"primary_key=True,\"\n",
    "    if fld['type']==\"relation\":\n",
    "        field_builder.append(rel_def.format(\n",
    "            lname=to_camel_case(k),\n",
    "            model=to_camel_case(fld['model'], True),\n",
    "            field=fld\n",
    "            ))\n",
    "    else:\n",
    "        # print(fld['doc'])\n",
    "        field_builder.append(field_def.format(fld_name=k, \n",
    "                           fld_type=fld['type'].capitalize(),\n",
    "                           pk_part=primary_part,\n",
    "                           field=fld))\n",
    "\n",
    "print(\"    \"+\"\\n    \".join(field_builder))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:12:53.166746Z",
     "start_time": "2019-01-18T13:12:53.160372Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "from datetime import datetime\n",
      "from graphene_sqlalchemy import SQLAlchemyObjectType\n",
      "from database.base import db_session\n",
      "from database.model_planet import ModelPlanet\n",
      "import graphene\n",
      "import utils\n",
      "\n",
      "\n",
      "# Create a generic class to mutualize description of planet attributes for both queries and mutations\n",
      "class PlanetAttribute:\n",
      "\n"
     ]
    }
   ],
   "source": [
    "schema_header='''from datetime import datetime\n",
    "from graphene_sqlalchemy import SQLAlchemyObjectType\n",
    "from database.base import db_session\n",
    "from database.model_{name} import Model{cname}\n",
    "import graphene\n",
    "import utils\n",
    "\n",
    "\n",
    "# Create a generic class to mutualize description of {name} attributes for both queries and mutations\n",
    "class {cname}Attribute:\n",
    "'''\n",
    "\n",
    "print(schema_header.format(name=model_name, \n",
    "                           cname=to_camel_case(model_name, True),\n",
    "                           model=model_def.models[model_name]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:12:57.639392Z",
     "start_time": "2019-01-18T13:12:57.609195Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    name = graphene.String(description=\"Name of the planet.\")\n",
      "    rotation_period = graphene.String(description=\"Rotation period of the planet.\")\n",
      "    orbital_period = graphene.String(description=\"Orbital period of the planet.\")\n",
      "    diameter = graphene.String(description=\"Diameter of the planet.\")\n",
      "    climate = graphene.String(description=\"Climate period of the planet.\")\n",
      "    gravity = graphene.String(description=\"Gravity of the planet.\")\n",
      "    terrain = graphene.String(description=\"Terrain of the planet.\")\n",
      "    surface_water = graphene.String(description=\"Surface water of the planet.\")\n",
      "    population = graphene.String(description=\"Population of the planet.\")\n",
      "    url = graphene.String(description=\"URL of the planet in the Star Wars API.\")\n"
     ]
    }
   ],
   "source": [
    "type_map={\"string\":\"String\", \"integer\":\"Int\"}\n",
    "\n",
    "def is_input(node):\n",
    "    if 'input' in node:\n",
    "        return node['input']\n",
    "    return True\n",
    "def get_graphql_type(fld_name, fld_type):\n",
    "    if fld_name.endswith('_id'):\n",
    "        return \"ID\"\n",
    "    return type_map[fld_type]\n",
    "\n",
    "field_def='''{fld_name} = graphene.{fld_type}(description=\"{field[doc]}\")'''\n",
    "field_builder=[]\n",
    "for k, fld in model_def.models[model_name]['fields'].items():\n",
    "    if fld['type']==\"relation\":\n",
    "        pass\n",
    "    elif is_input(fld):        \n",
    "        field_builder.append(field_def.format(fld_name=k, \n",
    "                           fld_type=get_graphql_type(k,fld['type']),\n",
    "                           field=fld))\n",
    "\n",
    "print(\"    \"+\"\\n    \".join(field_builder))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:13:05.615489Z",
     "start_time": "2019-01-18T13:13:05.604304Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "class Planet(SQLAlchemyObjectType):\n",
      "    \"\"\"Planet node.\"\"\"\n",
      "\n",
      "    class Meta:\n",
      "        model = ModelPlanet\n",
      "        interfaces = (graphene.relay.Node,)\n",
      "\n",
      "###\n",
      "class CreatePlanetInput(graphene.InputObjectType, PlanetAttribute):\n",
      "    \"\"\"Arguments to create a planet.\"\"\"\n",
      "    pass\n",
      "\n",
      "\n",
      "class CreatePlanet(graphene.Mutation):\n",
      "    \"\"\"Mutation to create a planet.\"\"\"\n",
      "    planet = graphene.Field(lambda: Planet, description=\"Planet created by this mutation.\")\n",
      "\n",
      "    class Arguments:\n",
      "        input = CreatePlanetInput(required=True)\n",
      "\n",
      "    def mutate(self, info, input):\n",
      "        data = utils.input_to_dictionary(input)\n",
      "        data['created'] = str(datetime.utcnow())\n",
      "        data['edited'] = str(datetime.utcnow())\n",
      "\n",
      "        planet = ModelPlanet(**data)\n",
      "        db_session.add(planet)\n",
      "        db_session.commit()\n",
      "\n",
      "        return CreatePlanet(planet=planet)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "creator_def='''\n",
    "class {model[name]}(SQLAlchemyObjectType):\n",
    "    \"\"\"{model[name]} node.\"\"\"\n",
    "\n",
    "    class Meta:\n",
    "        model = Model{model[name]}\n",
    "        interfaces = (graphene.relay.Node,)\n",
    "\n",
    "###\n",
    "class Create{model[name]}Input(graphene.InputObjectType, {model[name]}Attribute):\n",
    "    \"\"\"Arguments to create a {name}.\"\"\"\n",
    "    pass\n",
    "\n",
    "\n",
    "class Create{model[name]}(graphene.Mutation):\n",
    "    \"\"\"Mutation to create a {name}.\"\"\"\n",
    "    {name} = graphene.Field(lambda: {model[name]}, description=\"{model[name]} created by this mutation.\")\n",
    "\n",
    "    class Arguments:\n",
    "        input = Create{model[name]}Input(required=True)\n",
    "\n",
    "    def mutate(self, info, input):\n",
    "        data = utils.input_to_dictionary(input)\n",
    "        data['created'] = str(datetime.utcnow())\n",
    "        data['edited'] = str(datetime.utcnow())\n",
    "\n",
    "        {name} = Model{model[name]}(**data)\n",
    "        db_session.add({name})\n",
    "        db_session.commit()\n",
    "\n",
    "        return Create{model[name]}({name}={name})\n",
    "'''\n",
    "print(creator_def.format(name=model_name, \n",
    "                         cname=to_camel_case(model_name, True),\n",
    "                         model=model_def.models[model_name]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:13:10.216178Z",
     "start_time": "2019-01-18T13:13:10.208408Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "class UpdatePlanetInput(graphene.InputObjectType, PlanetAttribute):\n",
      "    \"\"\"Arguments to update a planet.\"\"\"\n",
      "    id = graphene.ID(required=True, description=\"Global Id of the planet.\")\n",
      "\n",
      "\n",
      "class UpdatePlanet(graphene.Mutation):\n",
      "    \"\"\"Update a planet.\"\"\"\n",
      "    planet = graphene.Field(lambda: Planet, description=\"Planet updated by this mutation.\")\n",
      "\n",
      "    class Arguments:\n",
      "        input = UpdatePlanetInput(required=True)\n",
      "\n",
      "    def mutate(self, info, input):\n",
      "        data = utils.input_to_dictionary(input)\n",
      "        data['edited'] = str(datetime.utcnow())\n",
      "\n",
      "        planet = db_session.query(ModelPlanet).filter_by(id=data['id'])\n",
      "        planet.update(data)\n",
      "        db_session.commit()\n",
      "        planet = db_session.query(ModelPlanet).filter_by(id=data['id']).first()\n",
      "\n",
      "        return UpdatePlanet(planet=planet)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "updater_def='''\n",
    "class Update{model[name]}Input(graphene.InputObjectType, {model[name]}Attribute):\n",
    "    \"\"\"Arguments to update a {name}.\"\"\"\n",
    "    id = graphene.ID(required=True, description=\"Global Id of the {name}.\")\n",
    "\n",
    "\n",
    "class Update{model[name]}(graphene.Mutation):\n",
    "    \"\"\"Update a {name}.\"\"\"\n",
    "    {name} = graphene.Field(lambda: {model[name]}, description=\"{model[name]} updated by this mutation.\")\n",
    "\n",
    "    class Arguments:\n",
    "        input = Update{model[name]}Input(required=True)\n",
    "\n",
    "    def mutate(self, info, input):\n",
    "        data = utils.input_to_dictionary(input)\n",
    "        data['edited'] = str(datetime.utcnow())\n",
    "\n",
    "        {name} = db_session.query(Model{model[name]}).filter_by(id=data['id'])\n",
    "        {name}.update(data)\n",
    "        db_session.commit()\n",
    "        {name} = db_session.query(Model{model[name]}).filter_by(id=data['id']).first()\n",
    "\n",
    "        return Update{model[name]}({name}={name})\n",
    "'''\n",
    "print(updater_def.format(name=model_name, \n",
    "                         cname=to_camel_case(model_name, True),\n",
    "                         model=model_def.models[model_name]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T13:13:15.362530Z",
     "start_time": "2019-01-18T13:13:15.336137Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "from graphene_sqlalchemy import SQLAlchemyConnectionField\n",
      "import graphene\n",
      "import schema_people\n",
      "import schema_planet\n",
      "\n",
      "class Query(graphene.ObjectType):\n",
      "    \"\"\"Nodes which can be queried by this API.\"\"\"\n",
      "    node = graphene.relay.Node.Field()\n",
      "    # People\n",
      "    people = graphene.relay.Node.Field(schema_people.People)\n",
      "    peopleList = SQLAlchemyConnectionField(schema_people.People)\n",
      "    # Planet\n",
      "    planet = graphene.relay.Node.Field(schema_planet.Planet)\n",
      "    planetList = SQLAlchemyConnectionField(schema_planet.Planet)\n",
      "\n",
      "class Mutation(graphene.ObjectType):\n",
      "    \"\"\"Mutations which can be performed by this API.\"\"\"\n",
      "    # People mutation\n",
      "    createPeople = schema_people.CreatePeople.Field()\n",
      "    updatePeople = schema_people.UpdatePeople.Field()\n",
      "    # Planet mutation\n",
      "    createPlanet = schema_planet.CreatePlanet.Field()\n",
      "    updatePlanet = schema_planet.UpdatePlanet.Field()\n",
      "schema = graphene.Schema(query=Query, mutation=Mutation)\n"
     ]
    }
   ],
   "source": [
    "## schema.py\n",
    "lines=[]\n",
    "lines.append('''from graphene_sqlalchemy import SQLAlchemyConnectionField\n",
    "import graphene''')\n",
    "for mo in model_def.models:\n",
    "    lines.append(\"import schema_{}\".format(mo))\n",
    "\n",
    "## queries\n",
    "lines.append('''\n",
    "class Query(graphene.ObjectType):\n",
    "    \"\"\"Nodes which can be queried by this API.\"\"\"\n",
    "    node = graphene.relay.Node.Field()''')\n",
    "for mo in model_def.models:\n",
    "    lines.append('''    # {cname}\n",
    "    {name} = graphene.relay.Node.Field(schema_{name}.{cname})\n",
    "    {name}List = SQLAlchemyConnectionField(schema_{name}.{cname})'''.format(\n",
    "        name=mo, cname=mo.capitalize()))\n",
    "## mutations\n",
    "lines.append('''\n",
    "class Mutation(graphene.ObjectType):\n",
    "    \"\"\"Mutations which can be performed by this API.\"\"\"''')\n",
    "for mo in model_def.models:\n",
    "    lines.append('''    # {cname} mutation\n",
    "    create{cname} = schema_{name}.Create{cname}.Field()\n",
    "    update{cname} = schema_{name}.Update{cname}.Field()'''.format(\n",
    "        name=mo, cname=mo.capitalize()))\n",
    "\n",
    "lines.append(\"schema = graphene.Schema(query=Query, mutation=Mutation)\")\n",
    "print(\"\\n\".join(lines))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-18T11:25:30.754991Z",
     "start_time": "2019-01-18T11:25:30.741393Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "from ast import literal_eval\n",
      "from database import base\n",
      "import logging\n",
      "import sys\n",
      "from database.model_people import ModelPeople\n",
      "from database.model_planet import ModelPlanet\n",
      "\n",
      "# Load logging configuration\n",
      "log = logging.getLogger(__name__)\n",
      "logging.basicConfig(\n",
      "    stream=sys.stdout,\n",
      "    level=logging.INFO,\n",
      "    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n",
      "\n",
      "\n",
      "if __name__ == '__main__':\n",
      "    #+ remove all tables\n",
      "    base.Base.metadata.drop_all(base.engine)\n",
      "\n",
      "    log.info('Create database {}'.format(base.db_name))\n",
      "    base.Base.metadata.create_all(base.engine)\n",
      "    log.info('Insert People data in database')\n",
      "    with open('database/data/people.json', 'r') as file:\n",
      "        data = literal_eval(file.read())\n",
      "        for record in data:\n",
      "            people = ModelPeople(**record)\n",
      "            base.db_session.add(people)\n",
      "        base.db_session.commit()\n",
      "    log.info('Insert Planet data in database')\n",
      "    with open('database/data/planet.json', 'r') as file:\n",
      "        data = literal_eval(file.read())\n",
      "        for record in data:\n",
      "            planet = ModelPlanet(**record)\n",
      "            base.db_session.add(planet)\n",
      "        base.db_session.commit()\n"
     ]
    }
   ],
   "source": [
    "## setup.py\n",
    "lines=[]\n",
    "lines.append('''from ast import literal_eval\n",
    "from database import base\n",
    "import logging\n",
    "import sys''')\n",
    "for mo in model_def.models:\n",
    "    lines.append(\"from database.model_{} import Model{}\".format(mo, mo.capitalize()))\n",
    "lines.append('''\n",
    "# Load logging configuration\n",
    "log = logging.getLogger(__name__)\n",
    "logging.basicConfig(\n",
    "    stream=sys.stdout,\n",
    "    level=logging.INFO,\n",
    "    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    #+ remove all tables\n",
    "    base.Base.metadata.drop_all(base.engine)\n",
    "\n",
    "    log.info('Create database {}'.format(base.db_name))\n",
    "    base.Base.metadata.create_all(base.engine)''')    \n",
    "for mo in model_def.models:\n",
    "    lines.append('''    log.info('Insert {cname} data in database')\n",
    "    with open('database/data/{name}.json', 'r') as file:\n",
    "        data = literal_eval(file.read())\n",
    "        for record in data:\n",
    "            {name} = Model{cname}(**record)\n",
    "            base.db_session.add({name})\n",
    "        base.db_session.commit()'''.format(\n",
    "        name=mo, cname=mo.capitalize()))\n",
    "\n",
    "print(\"\\n\".join(lines))    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
