datalad_next.constraints.formats

Constraints for particular formats or protocols

class datalad_next.constraints.formats.EnsureJSON[source]

Bases: Constraint

Ensures that string is JSON formatted and can be deserialized.

short_description()[source]

This method is deprecated. Use input_synopsis instead

class datalad_next.constraints.formats.EnsureParsedURL(required: list | None = None, forbidden: list | None = None, match: str | None = None)[source]

Bases: EnsureURL

Like EnsureURL, but returns a parsed URL

class datalad_next.constraints.formats.EnsureURL(required: list | None = None, forbidden: list | None = None, match: str | None = None)[source]

Bases: Constraint

Ensures that a string is a valid URL with a select set of components

and/or:

  • does not contain certain components

  • matches a particular regular expression

Given that a large variety of strings are also a valid URL, a typical use of this constraint would involve using a required=['scheme'] setting.

All URL attribute names supported by urllib.parse.urlparse() are also supported here: scheme, netloc, path, params, query, fragment, username, password, hostname, port.

short_description()[source]

This method is deprecated. Use input_synopsis instead