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 _get_type(self, kwargs):
      default_type = str
  
      default = kwargs.get("default")
      if default is not None and not callable(default):
          default_type = type(default)
  
      return kwargs.get("type", default_type)
  
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 4 for calling the Parameter obj's underlying member method code with example usage: obj._get_type(kwargs) and returns: kwargs