class_docstr: This class shall serve as a representation of a parameter.
      
docstr: Add constraints (validator) specifications and a docstring for
  a parameter.
  
  Parameters
  ----------
  constraints : callable
    A functor that takes any input value, performs checks or type
    conversions and finally returns a value that is appropriate for a
    parameter or raises an exception. This will also be used to set up
    the ``type`` functionality of argparse.add_argument.
  doc : str
    Documentation about the purpose of this parameter.
  args : tuple or None
    Any additional positional args for argparser.add_argument. This is
    most useful for assigned multiple alternative argument names or
    create positional arguments.
  **kwargs :
    Any additional keyword args for argparser.add_argument.
  
  Examples
  --------
  Ensure a parameter is a float
  >>> from datalad.support.param import Parameter
  >>> from datalad.support.constraints import (EnsureFloat, EnsureRange,
  ...                              AltConstraints, Constraints)
  >>> C = Parameter(constraints=EnsureFloat())
  
  Ensure a parameter is of type float or None:
  >>> C = Parameter(constraints=AltConstraints(EnsureFloat(), None))
  
  Ensure a parameter is None or of type float and lies in the inclusive
  range (7.0,44.0):
  >>> C = Parameter(
  ...         AltConstraints(
  ...             Constraints(EnsureFloat(),
  ...                         EnsureRange(min=7.0, max=44.0)),
  ...             None))
docstr_tok: ["Add","constraints","(","validator",")","specifications","and","a","docstring","for","a","parameter",".","Parameters","--","--","--","--","--","constraints",":","callable","A","functor","that","takes","any","input","value",",","performs","checks","or","type","conversions","and","finally","returns","a","value","that","is","appropriate","for","a","parameter","or","raises","an","exception",".","This","will","also","be","used","to","set","up","the","``","type","``","functionality","of","argparse.add_argument",".","doc",":","str","Documentation","about","the","purpose","of","this","parameter",".","args",":","tuple","or","None","Any","additional","positional","args","for","argparser.add_argument",".","This","is","most","useful","for","assigned","multiple","alternative","argument","names","or","create","positional","arguments",".","*","*","kwargs",":","Any","additional","keyword","args","for","argparser.add_argument",".","Examples","--","--","--","--","Ensure","a","parameter","is","a","float",">",">",">","from","datalad.support.param","import","Parameter",">",">",">","from","datalad.support.constraints","import","(","EnsureFloat",",","EnsureRange",",","...","AltConstraints",",","Constraints",")",">",">",">","C","=","Parameter","(","constraints=EnsureFloat","(",")",")","Ensure","a","parameter","is","of","type","float","or","None",":",">",">",">","C","=","Parameter","(","constraints=AltConstraints","(","EnsureFloat","(",")",",","None",")",")","Ensure","a","parameter","is","None","or","of","type","float","and","lies","in","the","inclusive","range","(","7.0,44.0",")",":",">",">",">","C","=","Parameter","(","...","AltConstraints","(","...","Constraints","(","EnsureFloat","(",")",",","...","EnsureRange","(","min=7.0",",","max=44.0",")",")",",","...","None",")",")"]
code: def __init__(self, constraints=None, doc=None, args=None, **kwargs):
      """Add constraints (validator) specifications and a docstring for
      a parameter.
  
      Parameters
      ----------
      constraints : callable
        A functor that takes any input value, performs checks or type
        conversions and finally returns a value that is appropriate for a
        parameter or raises an exception. This will also be used to set up
        the ``type`` functionality of argparse.add_argument.
      doc : str
        Documentation about the purpose of this parameter.
      args : tuple or None
        Any additional positional args for argparser.add_argument. This is
        most useful for assigned multiple alternative argument names or
        create positional arguments.
      **kwargs :
        Any additional keyword args for argparser.add_argument.
  
      Examples
      --------
      Ensure a parameter is a float
      >>> from datalad.support.param import Parameter
      >>> from datalad.support.constraints import (EnsureFloat, EnsureRange,
      ...                              AltConstraints, Constraints)
      >>> C = Parameter(constraints=EnsureFloat())
  
      Ensure a parameter is of type float or None:
      >>> C = Parameter(constraints=AltConstraints(EnsureFloat(), None))
  
      Ensure a parameter is None or of type float and lies in the inclusive
      range (7.0,44.0):
      >>> C = Parameter(
      ...         AltConstraints(
      ...             Constraints(EnsureFloat(),
      ...                         EnsureRange(min=7.0, max=44.0)),
      ...             None))
      """
      self.constraints = expand_constraint_spec(constraints)
      self._doc = doc
      self.cmd_args = args
  
      # Verify that no mistyped kwargs present
      unknown_args = set(kwargs).difference(self._KNOWN_ARGS)
      if unknown_args:
          raise ValueError(
              "Detected unknown argument(s) for the Parameter: %s.  Known are: %s"
              % (", ".join(unknown_args), ", ".join(self._KNOWN_ARGS))
          )
      self.cmd_kwargs = kwargs
  
file_path: datalad/datalad/support/param.py
imports: import re
  import textwrap
  import argparse
  from datalad.utils import getargspec
  from .constraints import expand_constraint_spec
label_desc: Use image node_id 1 to create a new Parameter object from inherited base classes: object with example: obj = Parameter(constraints, doc, args)