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.INT value to a range of accepted values. See ranges.

If min or max are not passed, any value is accepted in that direction. If min_open or max_open are enabled, the corresponding boundary is not included in the range.

If clamp is enabled, a value outside the range is clamped to the boundary instead of failing.

Changed in version 8.0: Added the min_open and max_open parameters.

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 Group with a function as callback. This works otherwise the same as command() just that the cls parameter is set to Group.

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 (except cls). This is equivalent to creating an Option instance manually and attaching it to the Command.params list.

For the default option class, refer to Option and Parameter for 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.