aboutsummaryrefslogtreecommitdiffstats
path: root/nbs/config.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'nbs/config.ipynb')
-rw-r--r--nbs/config.ipynb39
1 files changed, 10 insertions, 29 deletions
diff --git a/nbs/config.ipynb b/nbs/config.ipynb
index 9b0be34..d942807 100644
--- a/nbs/config.ipynb
+++ b/nbs/config.ipynb
@@ -103,31 +103,6 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "89f6f072",
- "metadata": {},
- "outputs": [],
- "source": [
- "#| export\n",
- "def config_dir(curdir:str|Path='.')->Path|None:\n",
- " return p.parent if config_path(curdir) is not None else None"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "73f36540",
- "metadata": {},
- "outputs": [],
- "source": [
- "with TemporaryDirectory() as tmp:\n",
- " p = Path(tmp)/'pyproject.toml'\n",
- " p.touch()\n",
- " test.equal(config_dir(tmp), Path(tmp))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
"id": "0948469f",
"metadata": {},
"outputs": [],
@@ -171,7 +146,7 @@
"source": [
"#| export\n",
"@patch\n",
- "def default(cls:Config, base_dir:Path)->Config:\n",
+ "def default(cls:type[Config], base_dir:Path)->Config:\n",
" return cls(**config_defaults(base_dir))"
]
},
@@ -184,7 +159,7 @@
"source": [
"#| export\n",
"@patch\n",
- "def empty(cls:Config)->Config:\n",
+ "def empty(cls:type[Config])->Config:\n",
" return cls(**{f.name:None for f in dataclasses.fields(cls)})"
]
},
@@ -208,7 +183,7 @@
"source": [
"#| export\n",
"@patch\n",
- "def from_dict(cls:Config, d:dict, base_dir:Path)->Config:\n",
+ "def from_dict(cls:type[Config], d:dict, base_dir:Path)->Config:\n",
" d = config_defaults(base_dir) | d\n",
" fields = {f.name for f in dataclasses.fields(cls)}\n",
" extra = d.keys() - fields\n",
@@ -340,7 +315,13 @@
]
}
],
- "metadata": {},
+ "metadata": {
+ "kernelspec": {
+ "display_name": "python3",
+ "language": "python",
+ "name": "python3"
+ }
+ },
"nbformat": 4,
"nbformat_minor": 5
}