datalad_next.constraints.Constraint
- class datalad_next.constraints.Constraint[source]
Bases:
object
Base class for value coercion/validation.
These classes are also meant to be able to generate appropriate documentation on an appropriate parameter value.
- for_dataset(dataset: DatasetParameter) Constraint [source]
Return a constraint-variant for a specific dataset context
The default implementation returns the unmodified, identical constraint. However, subclasses can implement different behaviors.
- property input_description: str
Returns full description of valid input for a constraint
Like
input_synopsis
this information is user-facing. In contrast, to the synopsis there is length/line limit. Nevertheless, the information should be presented in a compact fashion that avoids needless verbosity. If possible, a single paragraph is a good format. If multiple paragraphs are necessary, they should be separated by a single, empty line.Rendering code may indent, or rewrap the text, so no line-by-line formatting will be preserved.
If possible, the synopsis should be written in a UI/API-agnostic fashion. However, if this is impossible or leads to imprecisions or confusion, it should focus on use within Python code and with Python data types. Tailored documentation can be provided via the
WithDescription
wrapper.
- property input_synopsis: str
Returns brief, single line summary of valid input for a constraint
This information is user-facing, and to be used in any place where space is limited (tooltips, usage summaries, etc).
If possible, the synopsis should be written in a UI/API-agnostic fashion. However, if this is impossible or leads to imprecisions or confusion, it should focus on use within Python code and with Python data types. Tailored documentation can be provided via the
WithDescription
wrapper.