luigi_tools.parameter

This module provides some specific luigi parameters.

Classes

BoolParameter(*args, **kwargs)

Class to parse boolean parameters and set explicit parsing when default is True.

DataclassParameter(cls_type, *args, **kwargs)

Class to parse, serialize, and normalize nested dataclasses.

ExtParameter([default, is_global, ...])

Class to parse file extension parameters.

OptionalBoolParameter(*args, **kwargs)

Class to parse optional bool parameters.

OptionalRatioParameter(*args[, left_op, ...])

Class to parse optional ratio parameters.

RatioParameter(*args[, left_op, right_op])

Class to parse ratio parameters.

class luigi_tools.parameter.BoolParameter(*args, **kwargs)

Bases: BoolParameter

Class to parse boolean parameters and set explicit parsing when default is True.

class luigi_tools.parameter.DataclassParameter(cls_type, *args, **kwargs)

Bases: DictParameter

Class to parse, serialize, and normalize nested dataclasses.

Note: Similar to DictParameter, json serialization transforms int keys of dicts into str. The dataclass however transforms the keys into their correct type if the respective annotation is available.

normalize(value)

Normalize the given value to a dataclass initialized object.

serialize(x)

Serialize a dataclass object.

class luigi_tools.parameter.ExtParameter(default=<object object>, is_global=False, significant=True, description=None, config_path=None, positional=True, always_in_help=False, batch_method=None, visibility=ParameterVisibility.PUBLIC)

Bases: Parameter

Class to parse file extension parameters.

normalize(x)

Normalize the given value to an extension suffix without dot.

class luigi_tools.parameter.OptionalBoolParameter(*args, **kwargs)

Bases: OptionalParameterMixin, BoolParameter

Class to parse optional bool parameters.

expected_type

alias of bool

class luigi_tools.parameter.OptionalRatioParameter(*args, left_op=<built-in function le>, right_op=<built-in function le>, **kwargs)

Bases: OptionalParameterMixin, RatioParameter

Class to parse optional ratio parameters.

expected_type

alias of float

class luigi_tools.parameter.RatioParameter(*args, left_op=<built-in function le>, right_op=<built-in function le>, **kwargs)

Bases: NumericalParameter

Class to parse ratio parameters.

The argument must be a float between 0 and 1. The operators to include or exclude the boundaries can be set with ‘left_op’ and ‘right_op’ parameters. Defaults operators include the boundaries.

normalize(x)

Ensure that the value is contained in the given interval.

The parse() method is not called when the parameters are given to the constructor, but the value check is only done there. This normalize() method ensures that the interval check is made even when for arguments given to the constructor.