cloup.constraints._support

Classes summary

BoundConstraintSpec(constraint, params)

A NamedTuple storing a Constraint and the names of the parameters if has check.

BoundConstraint(constraint, params)

Internal utility NamedTuple that represents a Constraint bound to a collection of Parameter instances.

ConstraintMixin(*args[, constraints, …])

Provides support to constraints.

Functions Summary

constraint(constr, params)

Registers a constraint.

Contents

class cloup.constraints._support.BoundConstraintSpec[source]

Bases: typing.NamedTuple

A NamedTuple storing a Constraint and the names of the parameters if has check.

Parameters
constraint :Constraint
params :Sequence[str]
cloup.constraints._support.constraint(constr: cloup.constraints._core.Constraint, params: Iterable[str])[source]

Registers a constraint.

Parameters
class cloup.constraints._support.BoundConstraint[source]

Bases: typing.NamedTuple

Internal utility NamedTuple that represents a Constraint bound to a collection of Parameter instances. Note: this is not a subclass of Constraint.

Parameters
constraint :Constraint
params :Sequence[Parameter]
check_consistency(self)[source]
check_values(self, ctx: click.Context)[source]
get_help_record(self, ctx: click.Context)Optional[Tuple[str, str]][source]
class cloup.constraints._support.ConstraintMixin(*args, constraints: Sequence[BoundConstraintSpec] = (), show_constraints: bool = False, **kwargs)[source]

Provides support to constraints.

Parameters
parse_args(self, ctx, args)[source]
get_param_by_name(self, name: str)click.Parameter[source]
get_params_by_name(self, names: Iterable[str])List[Parameter][source]
format_constraints(self, ctx, formatter)None[source]
format_help(self, ctx, formatter: click.HelpFormatter)None[source]