script
module fastcore.script in fastcore
Classes
builtins.object
Param
Param
class Param(builtins.object)
| Param(help='', type=None, opt=True, action=None, nargs=None, const=None, choices=None, required=None, default=None)
|
| A parameter in a function used in `anno_parser` or `call_parse`
|
| Methods defined here:
|
|
Param.__init__
|
| __init__(self, help='', type=None, opt=True, action=None, nargs=None, const=None, choices=None, required=None, default=None)
| Initialize self. See help(type(self)) for accurate signature.
|
|
Param.__repr__
|
| __repr__(self)
| Return repr(self).
|
|
Param.set_default
|
| set_default(self, d)
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| kwargs
|
| pre
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
Functions
anno_parser
anno_parser(func, prog: str = None)
Look at params (annotated with `Param`) in func and return an `ArgumentParser`
args_from_prog
args_from_prog(func, prog)
Extract args from `prog`
bool_arg
bool_arg(v)
Use as `type` for `Param` to get `bool` behavior
call_parse
call_parse(func=None, nested=False)
Decorator to create a simple CLI from `func` using `anno_parser`
clean_type_str
clean_type_str(x: str)
# %% ../nbs/08_script.ipynb 18
store_false
store_false()
Placeholder to pass to `Param` for `store_false` action
store_true
store_true()
Placeholder to pass to `Param` for `store_true` action