original_docstring: Given stringified value, convert into python object.
docstring: Given stringified value, convert into python object.
docstring_tokens: Given stringified value convert into python object .
code: def parse_value(type_: object, raw_value: str) -> Any:
      """Given stringified value, convert into python object."""
      if isinstance(type_, type):
          return type_(raw_value)
  
      if not hasattr(type_, "__origin__"):
          raise TypeError(type_)
  
      origin = getattr(type_, "__origin__")
      args = getattr(type_, "__args__")
  
      if origin is not Union:
          raise NameError(type_)
  
      # Optional[~]
      # Union optimizes types so length 0~1 is impossible
      if len(args) != 2 or args[-1] is not type(None):  # noqa: E721
          raise NameError(type_)
  
      if raw_value == "null":
          return None
  
      return args[0](raw_value)
code_tokens: def parse_value ( type_ : object , raw_value : str ) -> Any : if isinstance ( type_ , type ) : return type_ ( raw_value ) if not hasattr ( type_ , "__origin__" ) : raise TypeError ( type_ ) origin = getattr ( type_ , "__origin__" ) args = getattr ( type_ , "__args__" ) if origin is not Union : raise NameError ( type_ ) if len ( args ) != 2 or args [ - 1 ] is not type ( None ) : raise NameError ( type_ ) if raw_value == "null" : return None return args [ 0 ] ( raw_value )
short_docstring: Given stringified value, convert into python object.
short_docstring_tokens: Given stringified value convert into python object .
comment: """Given stringified value, convert into python object."""$SEP$# Optional[~]$SEP$# Union optimizes types so length 0~1 is impossible$SEP$# noqa: E721