openfl.interface.tutorial
Tutorial module.
- class openfl.interface.tutorial.IntRange(min: float | None = None, max: float | None = None, min_open: bool = False, max_open: bool = False, clamp: bool = False)
Restrict an
click.INTvalue to a range of accepted values. See ranges.If
minormaxare not passed, any value is accepted in that direction. Ifmin_openormax_openare enabled, the corresponding boundary is not included in the range.If
clampis enabled, a value outside the range is clamped to the boundary instead of failing.Changed in version 8.0: Added the
min_openandmax_openparameters.- name: str = 'integer range'
the descriptive name of this type
- openfl.interface.tutorial.check_call(*popenargs, **kwargs)
Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call([“ls”, “-l”])
- openfl.interface.tutorial.getLogger(name=None)
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
- openfl.interface.tutorial.group(name: str | Callable[[...], Any] | None = None, cls: Type[GrpType] | None = None, **attrs: Any) Group | Callable[[Callable[[...], Any]], Group | GrpType]
Creates a new
Groupwith a function as callback. This works otherwise the same ascommand()just that the cls parameter is set toGroup.Changed in version 8.1: This decorator can be applied without parentheses.
- openfl.interface.tutorial.option(*param_decls: str, cls: Type[Option] | None = None, **attrs: Any) Callable[[FC], FC]
Attaches an option to the command. All positional arguments are passed as parameter declarations to
Option; all keyword arguments are forwarded unchanged (exceptcls). This is equivalent to creating anOptioninstance manually and attaching it to theCommand.paramslist.For the default option class, refer to
OptionandParameterfor descriptions of parameters.- Parameters:
cls – the option class to instantiate. This defaults to
Option.param_decls – Passed as positional arguments to the constructor of
cls.attrs – Passed as keyword arguments to the constructor of
cls.
- openfl.interface.tutorial.pass_context(f: t.Callable[te.Concatenate[Context, P], R]) t.Callable[P, R]
Marks a callback as wanting to receive the current context object as first argument.