aboutsummaryrefslogtreecommitdiffstats
path: root/nbs/core.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'nbs/core.ipynb')
-rw-r--r--nbs/core.ipynb120
1 files changed, 69 insertions, 51 deletions
diff --git a/nbs/core.ipynb b/nbs/core.ipynb
index 6e050ae..cfa4f53 100644
--- a/nbs/core.ipynb
+++ b/nbs/core.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 130,
"id": "aed9daa9-f05d-4e25-b9a5-a74d0211ef6f",
"metadata": {},
"outputs": [],
@@ -14,7 +14,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 131,
"id": "596de171-5567-43c1-98ce-66eccc28bbe9",
"metadata": {},
"outputs": [],
@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 132,
"id": "6a2cc7f8-6c65-4a7c-890c-3cf9d1cd314e",
"metadata": {},
"outputs": [],
@@ -39,7 +39,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 133,
"id": "bbaf531f",
"metadata": {},
"outputs": [],
@@ -85,7 +85,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 134,
"id": "d9d0a18c",
"metadata": {},
"outputs": [],
@@ -96,7 +96,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 135,
"id": "ca71fdf5",
"metadata": {},
"outputs": [],
@@ -112,7 +112,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 136,
"id": "b4ca48d4",
"metadata": {},
"outputs": [],
@@ -159,7 +159,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 137,
"id": "2ffd7bcf",
"metadata": {},
"outputs": [],
@@ -174,7 +174,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 138,
"id": "a5b24f3a",
"metadata": {},
"outputs": [],
@@ -190,7 +190,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 139,
"id": "807f0146",
"metadata": {},
"outputs": [],
@@ -204,7 +204,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 140,
"id": "5b89c5d8",
"metadata": {},
"outputs": [],
@@ -216,7 +216,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 141,
"id": "170144a7",
"metadata": {},
"outputs": [],
@@ -228,7 +228,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 142,
"id": "edbe00dd",
"metadata": {},
"outputs": [],
@@ -272,7 +272,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 143,
"id": "40433e19",
"metadata": {},
"outputs": [],
@@ -289,7 +289,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 144,
"id": "ac907b7c",
"metadata": {},
"outputs": [],
@@ -299,7 +299,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 145,
"id": "40f7de66",
"metadata": {},
"outputs": [],
@@ -314,7 +314,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 146,
"id": "f115789b",
"metadata": {},
"outputs": [],
@@ -331,7 +331,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 147,
"id": "3f58f798",
"metadata": {},
"outputs": [],
@@ -341,7 +341,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 148,
"id": "2bbc9f93",
"metadata": {},
"outputs": [],
@@ -356,7 +356,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 149,
"id": "c994255e",
"metadata": {},
"outputs": [],
@@ -372,7 +372,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 150,
"id": "535b3ce2",
"metadata": {},
"outputs": [],
@@ -386,7 +386,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 151,
"id": "b42fe082",
"metadata": {},
"outputs": [],
@@ -399,7 +399,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 152,
"id": "d02bf0bc",
"metadata": {},
"outputs": [],
@@ -413,7 +413,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 153,
"id": "9eca0c79",
"metadata": {},
"outputs": [],
@@ -433,7 +433,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 154,
"id": "c4875cc0-2d87-4c87-8789-7dc950be06c6",
"metadata": {},
"outputs": [],
@@ -454,7 +454,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 155,
"id": "0e9c39c5",
"metadata": {},
"outputs": [],
@@ -472,7 +472,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 156,
"id": "056cb776",
"metadata": {},
"outputs": [],
@@ -483,7 +483,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 157,
"id": "f2c70dd3",
"metadata": {},
"outputs": [],
@@ -504,7 +504,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 158,
"id": "ac30af03",
"metadata": {},
"outputs": [],
@@ -533,7 +533,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 159,
"id": "78d61a07",
"metadata": {},
"outputs": [],
@@ -566,7 +566,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 160,
"id": "c67a3c29",
"metadata": {},
"outputs": [],
@@ -584,7 +584,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 161,
"id": "42580f8b",
"metadata": {},
"outputs": [],
@@ -603,7 +603,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 162,
"id": "404bd72f",
"metadata": {},
"outputs": [],
@@ -622,7 +622,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 163,
"id": "f5eca4e3",
"metadata": {},
"outputs": [],
@@ -633,7 +633,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 164,
"id": "3a52ddb4",
"metadata": {},
"outputs": [],
@@ -651,7 +651,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 165,
"id": "da2e0279",
"metadata": {},
"outputs": [],
@@ -662,7 +662,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 166,
"id": "d3802615",
"metadata": {},
"outputs": [],
@@ -680,7 +680,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 167,
"id": "be5a1f11",
"metadata": {},
"outputs": [],
@@ -691,7 +691,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 168,
"id": "d637ab8e",
"metadata": {},
"outputs": [],
@@ -713,7 +713,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 169,
"id": "4eb650ab",
"metadata": {},
"outputs": [],
@@ -727,7 +727,7 @@
"\n",
" `fn` must have either `self` or `cls` arguments present with a type hint.\n",
" - `self`: Created as either an instance method or property if `prop=True`.\n",
- " - `cls`: Created as a class method\n",
+ " - `cls`: Created as a class method e.g. type[MyClass]\n",
"\n",
" If `self` and `cls` is missing or `self` is missing with `prop=True`,\n",
" a ValueError is raised.\n",
@@ -736,7 +736,7 @@
" anno = inspect.get_annotations(fn)\n",
" if 'self' not in anno and prop: raise ValueError('Must have `self` argument with prop=True')\n",
" if 'self' in anno: return patch_to(anno['self'], prop=prop)(fn)\n",
- " if 'cls' in anno: return patch_to(anno['cls'], cls_method=True)(fn)\n",
+ " if 'cls' in anno: return patch_to(anno['cls'].__args__[0], cls_method=True)(fn)\n",
" raise ValueError('Must have either `self` or `cls` argument when using patch')\n",
" if fn is not None: return inner(fn) # @patch case, as opposed to @patch()\n",
" return inner"
@@ -760,7 +760,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 170,
"id": "601e27f2",
"metadata": {},
"outputs": [],
@@ -771,7 +771,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 171,
"id": "6aa1ffbc",
"metadata": {},
"outputs": [],
@@ -781,18 +781,18 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 172,
"id": "b5d14f35",
"metadata": {},
"outputs": [],
"source": [
"@patch\n",
- "def say_bye(cls:_T): return 'bye'"
+ "def say_bye(cls:type[_T]): return 'bye'"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 173,
"id": "f3ce8fe7",
"metadata": {},
"outputs": [],
@@ -802,7 +802,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 174,
"id": "0c59c003",
"metadata": {},
"outputs": [],
@@ -813,7 +813,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 175,
"id": "5fedf001",
"metadata": {},
"outputs": [],
@@ -823,7 +823,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 176,
"id": "12b62cf8-2193-4f03-b80a-46304d73896e",
"metadata": {},
"outputs": [],
@@ -832,7 +832,25 @@
]
}
],
- "metadata": {},
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.14.4"
+ }
+ },
"nbformat": 4,
"nbformat_minor": 5
}