{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#default_exp core.script" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#export\n", "from local.core.foundation import *\n", "from local.core.utils import *\n", "from local.core.imports import *\n", "from local.test import *\n", "\n", "from argparse import ArgumentParser" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from local.notebook.showdoc import show_doc" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#export\n", "_all_ = ['Param']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## call_parse" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#export\n", "def _param_pre(self): return '--' if self.opt else ''\n", "def _param_kwargs(self): return {k:v for k,v in self.__dict__.items() if v is not None and k!='opt'}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#export\n", "mk_class('Param', help=None, type=None, opt=True, action=None, nargs=None, const=None, choices=None, required=None,\n", " pre=property(_param_pre), kwargs=property(_param_kwargs),\n", " doc=\"A parameter in a function used in `anno_parser` or `call_parse`\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "
class
Param
[source]Param
(**\\*`args`**, **\\*\\*`kwargs`**)\n",
"\n",
"A parameter in a function used in [`anno_parser`](/script.html#anno_parser) or [`call_parse`](/script.html#call_parse)"
],
"text/plain": [
"