class_docstr: Defines a parameter for a flow.
  
  Parameters must be instantiated as class variables in flow classes, e.g.
  ```
  class MyFlow(FlowSpec):
      param = Parameter('myparam')
  ```
  in this case, the parameter is specified on the command line as
  ```
  python myflow.py run --myparam=5
  ```
  and its value is accessible through a read-only artifact like this:
  ```
  print(self.param == 5)
  ```
  Note that the user-visible parameter name, `myparam` above, can be
  different from the artifact name, `param` above.
  
  The parameter value is converted to a Python type based on the `type`
  argument or to match the type of `default`, if it is set.
  
  Parameters
  ----------
  name : str
      User-visible parameter name.
  default : str or float or int or bool or `JSONType` or a function.
      Default value for the parameter. Use a special `JSONType` class to
      indicate that the value must be a valid JSON object. A function
      implies that the parameter corresponds to a *deploy-time parameter*.
      The type of the default value is used as the parameter `type`.
  type : Type, default: None
      If `default` is not specified, define the parameter type. Specify
      one of `str`, `float`, `int`, `bool`, or `JSONType`. If None, defaults
      to the type of `default` or `str` if none specified.
  help : str, optional
      Help text to show in `run --help`.
  required : bool, default: False
      Require that the user specified a value for the parameter.
      `required=True` implies that the `default` is not used.
  show_default : bool, default: True
      If True, show the default value in the help text.
class_docstr_tok: ["Defines","a","parameter","for","a","flow",".","Parameters","must","be","instantiated","as","class","variables","in","flow","classes",",","e.g",".","``","`","class","MyFlow","(","FlowSpec",")",":","param","=","Parameter","(","'myparam","'",")","``","`","in","this","case",",","the","parameter","is","specified","on","the","command","line","as","``","`","python","myflow.py","run","--","myparam=5","``","`","and","its","value","is","accessible","through","a","read-only","artifact","like","this",":","``","`","print","(","self.param","==","5",")","``","`","Note","that","the","user-visible","parameter","name",",","`","myparam","`","above",",","can","be","different","from","the","artifact","name",",","`","param","`","above",".","The","parameter","value","is","converted","to","a","Python","type","based","on","the","`","type","`","argument","or","to","match","the","type","of","`","default","`",",","if","it","is","set",".","Parameters","--","--","--","--","--","name",":","str","User-visible","parameter","name",".","default",":","str","or","float","or","int","or","bool","or","`","JSONType","`","or","a","function",".","Default","value","for","the","parameter",".","Use","a","special","`","JSONType","`","class","to","indicate","that","the","value","must","be","a","valid","JSON","object",".","A","function","implies","that","the","parameter","corresponds","to","a","*","deploy-time","parameter","*",".","The","type","of","the","default","value","is","used","as","the","parameter","`","type","`",".","type",":","Type",",","default",":","None","If","`","default","`","is","not","specified",",","define","the","parameter","type",".","Specify","one","of","`","str","`",",","`","float","`",",","`","int","`",",","`","bool","`",",","or","`","JSONType","`",".","If","None",",","defaults","to","the","type","of","`","default","`","or","`","str","`","if","none","specified",".","help",":","str",",","optional","Help","text","to","show","in","`","run","--","help","`",".","required",":","bool",",","default",":","False","Require","that","the","user","specified","a","value","for","the","parameter",".","`","required=True","`","implies","that","the","`","default","`","is","not","used",".","show_default",":","bool",",","default",":","True","If","True",",","show","the","default","value","in","the","help","text","."]
code: def __init__(
      self,
      name: str,
      default: Optional[
          Union[
              str,
              float,
              int,
              bool,
              Dict[str, Any],
              Callable[
                  [], Union[str, float, int, bool, Dict[str, Any]]
              ],
          ]
      ] = None,
      type: Optional[
          Union[
              Type[str],
              Type[float],
              Type[int],
              Type[bool],
              JSONTypeClass,
          ]
      ] = None,
      help: Optional[str] = None,
      required: bool = False,
      show_default: bool = True,
      **kwargs: Dict[str, Any],
  ):
      self.name = name
      self.kwargs = kwargs
      for k, v in {
          "default": default,
          "type": type,
          "help": help,
          "required": required,
          "show_default": show_default,
      }.items():
          if v is not None:
              self.kwargs[k] = v
  
      # TODO: check that the type is one of the supported types
      param_type = self.kwargs["type"] = self._get_type(kwargs)
      reserved_params = [
          "params",
          "with",
          "max-num-splits",
          "max-workers",
          "tag",
          "run-id-file",
          "namespace",
      ]
  
      if self.name in reserved_params:
          raise MetaflowException(
              "Parameter name '%s' is a reserved "
              "word. Please use a different "
              "name for your parameter." % (name)
          )
  
      # make sure the user is not trying to pass a function in one of the
      # fields that don't support function-values yet
      for field in ("show_default", "separator", "required"):
          if callable(kwargs.get(field)):
              raise MetaflowException(
                  "Parameter *%s*: Field '%s' cannot "
                  "have a function as its value" % (name, field)
              )
  
      # default can be defined as a function
      default_field = self.kwargs.get("default")
      if callable(default_field) and not isinstance(
          default_field, DeployTimeField
      ):
          self.kwargs["default"] = DeployTimeField(
              name,
              param_type,
              "default",
              self.kwargs["default"],
              return_str=True,
          )
  
      # note that separator doesn't work with DeployTimeFields unless you
      # specify type=str
      self.separator = self.kwargs.pop("separator", None)
      if self.separator and not self.is_string_type:
          raise MetaflowException(
              "Parameter *%s*: Separator is only allowed "
              "for string parameters." % name
          )
      parameters.append(self)
  
imports: import json
  from typing import Any, Callable, Dict, NamedTuple, Optional, Type, Union
  from metaflow._vendor import click
  from .util import get_username, is_stringish
  from .exception import ParameterFieldFailed, ParameterFieldTypeMismatch, MetaflowException
label_desc: Use image node_id 1 to create a new Parameter object from inherited base classes: object with example: obj = Parameter(name, default, type, help, required, show_default)