Skip to content

Instantly share code, notes, and snippets.

@indigoviolet
Created May 13, 2020 18:45
Show Gist options
  • Save indigoviolet/175556625b9e21748fe2d2be6500a1bb to your computer and use it in GitHub Desktop.
Save indigoviolet/175556625b9e21748fe2d2be6500a1bb to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2020-05-13T18:36:59.324704Z",
"iopub.status.busy": "2020-05-13T18:36:59.324421Z",
"iopub.status.idle": "2020-05-13T18:36:59.373440Z",
"shell.execute_reply": "2020-05-13T18:36:59.372779Z",
"shell.execute_reply.started": "2020-05-13T18:36:59.324676Z"
}
},
"outputs": [],
"source": [
"%reload_ext autoreload\n",
"%autoreload 2\n",
"%matplotlib inline\n",
"\n",
"from IPython.core.interactiveshell import InteractiveShell\n",
"InteractiveShell.ast_node_interactivity = \"all\"\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"execution": {
"iopub.execute_input": "2020-05-13T18:37:21.420118Z",
"iopub.status.busy": "2020-05-13T18:37:21.419838Z",
"iopub.status.idle": "2020-05-13T18:37:21.434117Z",
"shell.execute_reply": "2020-05-13T18:37:21.433489Z",
"shell.execute_reply.started": "2020-05-13T18:37:21.420094Z"
}
},
"outputs": [],
"source": [
"from typing import Tuple as TTuple\n",
"x: TTuple[int, int] = (2, 2)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"execution": {
"iopub.execute_input": "2020-05-13T18:37:02.468479Z",
"iopub.status.busy": "2020-05-13T18:37:02.468220Z",
"iopub.status.idle": "2020-05-13T18:37:02.485729Z",
"shell.execute_reply": "2020-05-13T18:37:02.484505Z",
"shell.execute_reply.started": "2020-05-13T18:37:02.468453Z"
}
},
"outputs": [
{
"ename": "TypeError",
"evalue": "'type' object is not subscriptable",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-9-06343fc4e594>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mfastcore\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTuple\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mTuple\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: 'type' object is not subscriptable"
]
}
],
"source": [
"from fastcore.utils import Tuple\n",
"\n",
"x: Tuple[int, int] = (2, 2)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"execution": {
"iopub.execute_input": "2020-05-13T18:37:03.753635Z",
"iopub.status.busy": "2020-05-13T18:37:03.753363Z",
"iopub.status.idle": "2020-05-13T18:37:03.880605Z",
"shell.execute_reply": "2020-05-13T18:37:03.879893Z",
"shell.execute_reply.started": "2020-05-13T18:37:03.753608Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"'/home/venky/fastcore/fastcore/utils.py'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mfa39696\u001b[35m N \u001b[34m 2 weeks ago \u001b[32mSylva..\u001b[mRelease\u001b[31m HEAD -> master, origin/master, origin/HEAD"
]
}
],
"source": [
"import inspect\n",
"inspect.getsourcefile(Tuple)\n",
"! cd /home/venky/fastcore && git log -1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment