ValOrRangeOrList

class glotaran.cli.commands.util.ValOrRangeOrList[source]

Bases: click.types.ParamType

Attributes Summary

envvar_list_splitter

if a list of this type is expected and the value is pulled from a string environment variable, this is what splits it up.

is_composite

name

the descriptive name of this type

Methods Summary

convert

Converts the value.

fail

Helper method to fail with an invalid value message.

get_metavar

Returns the metavar default for this param if it provides one.

get_missing_message

Optionally might return extra information about a missing parameter.

split_envvar_value

Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

Methods Documentation

convert(value, param, ctx)[source]

Converts the value. This is not invoked for values that are None (the missing value).

envvar_list_splitter = None

if a list of this type is expected and the value is pulled from a string environment variable, this is what splits it up. None means any whitespace. For all parameters the general rule is that whitespace splits them up. The exception are paths and files which are split by os.path.pathsep by default (“:” on Unix and “;” on Windows).

fail(message, param=None, ctx=None)

Helper method to fail with an invalid value message.

get_metavar(param)

Returns the metavar default for this param if it provides one.

get_missing_message(param)

Optionally might return extra information about a missing parameter.

New in version 2.0.

is_composite = False
name = 'number or range or list'

the descriptive name of this type

split_envvar_value(rv)

Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

If the splitter is set to None, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included.