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.

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

Class to parse file extension parameters.

OptionalBoolParameter(*args, **kwargs)

Class to parse optional bool parameters.

OptionalChoiceParameter(*args, **kwargs)

Class to parse optional choice parameters.

OptionalDictParameter(*args, **kwargs)

Class to parse optional dict parameters.

OptionalFloatParameter(*args, **kwargs)

Class to parse optional float parameters.

OptionalIntParameter(*args, **kwargs)

Class to parse optional int parameters.

OptionalListParameter(*args, **kwargs)

Class to parse optional list parameters.

OptionalNumericalParameter(*args, **kwargs)

Class to parse optional numerical parameters.

OptionalParameter(*args, **kwargs)

Mixin to make a parameter class optional.

OptionalPathParameter(*args, **kwargs)

Class to parse optional path parameters.

OptionalRatioParameter(*args, **kwargs)

Class to parse optional ratio parameters.

OptionalStrParameter(*args, **kwargs)

Class to parse optional str parameters.

OptionalTupleParameter(*args, **kwargs)

Class to parse optional tuple parameters.

PathParameter(*args[, absolute, create, exists])

Class to parse file path parameters.

RatioParameter(*args[, left_op, right_op])

Class to parse ratio parameters.

Exceptions

OptionalParameterTypeWarning

Warning class for OptionalParameter with wrong type.

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

Bases: luigi.parameter.BoolParameter

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

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: luigi.parameter.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: luigi_tools.parameter.OptionalParameter, luigi_tools.parameter.BoolParameter

Class to parse optional bool parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of bool

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.ChoiceParameter

Class to parse optional choice parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of str

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.DictParameter

Class to parse optional dict parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of luigi.freezing.FrozenOrderedDict

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.FloatParameter

Class to parse optional float parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of float

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.IntParameter

Class to parse optional int parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of int

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.ListParameter

Class to parse optional list parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of tuple

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.NumericalParameter

Class to parse optional numerical parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of float

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

Bases: object

Mixin to make a parameter class optional.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

normalize(x)

Normalize the given value if it is not None.

parse(x)

Parse the given value if it is not an empty string and not equal to 'null'.

serialize(x)

Parse the given value if the value is not None else return an empty string.

exception luigi_tools.parameter.OptionalParameterTypeWarning

Bases: UserWarning

Warning class for OptionalParameter with wrong type.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

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

Bases: luigi_tools.parameter.OptionalParameter, luigi_tools.parameter.PathParameter

Class to parse optional path parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

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

Bases: luigi_tools.parameter.OptionalParameter, luigi_tools.parameter.RatioParameter

Class to parse optional ratio parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of float

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.Parameter

Class to parse optional str parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of str

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

Bases: luigi_tools.parameter.OptionalParameter, luigi.parameter.TupleParameter

Class to parse optional tuple parameters.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

expected_type

alias of tuple

class luigi_tools.parameter.PathParameter(*args, absolute=False, create=False, exists=False, **kwargs)

Bases: luigi.parameter.Parameter

Class to parse file path parameters.

Parameters
  • absolute (bool) – the given path is converted to an absolute path.

  • create (bool) – a folder is automatically created to the given path.

  • exists (bool) – raise a ValueError if the path does not exist.

Moved to luigi

This feature was moved to the luigi package and will be available after the version 3.0.3. It will be deprecated in a future version.

The moved version dropped the create parameter as it was confusing for users that may use it instead of using a target.

normalize(x)

Normalize the given value to a pathlib.Path object.

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

Bases: luigi.parameter.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.