class_docstr: Inspects a given class and collects information about its instance
  methods.
  
  Args:
      cls (Type): The class to inspect.
docstr: Returns the type hint representation of an object.
docstr_tok: ["Returns","the","type","hint","representation","of","an","object","."]
code: def type_repr(self, obj: Any) -> str:
      r"""Returns the type hint representation of an object."""
  
      def _get_name(name: str, module: str) -> str:
          return name if name in self._globals else f"{module}.{name}"
  
      if isinstance(obj, str):
          return obj
  
      if obj is type(None):
          return "None"
  
      if obj is ...:
          return "..."
  
      if (
          obj.__module__ == "typing"
      ):  # Special logic for `typing.*` types:
          name = obj._name
          if name is None:  # In some cases, `_name` is not populated.
              name = str(obj.__origin__).split(".")[-1]
  
          args = getattr(obj, "__args__", None)
          if args is None or len(args) == 0:
              return _get_name(name, obj.__module__)
          if all(isinstance(arg, typing.TypeVar) for arg in args):
              return _get_name(name, obj.__module__)
  
          # Convert `Union[*, None]` to `Optional[*]`.
          # This is only necessary for old Python versions, e.g. 3.8.
          # TODO Only convert to `Optional` if `Optional` is importable.
          if (
              name == "Union"
              and len(args) == 2
              and any([arg is type(None) for arg in args])
              and (
                  "Optional" in self._globals
                  or obj.__module__ in self._globals
                  or True
              )
          ):
              name = "Optional"
  
          if (
              name == "Optional"
          ):  # Remove `None` from `Optional` arguments:
              args = [
                  arg for arg in obj.__args__ if arg is not type(None)
              ]
  
          args_repr = ", ".join([self.type_repr(arg) for arg in args])
          return f"{_get_name(name, obj.__module__)}[{args_repr}]"
  
      if obj.__module__ == "builtins":
          return obj.__qualname__
  
      return _get_name(obj.__qualname__, obj.__module__)
  
imports: import inspect
  import re
  import sys
  import typing
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Type, Union
  from torch import Tensor
label_desc: Use image node_id 5 for calling the Inspector obj's underlying member method code with example usage: obj.type_repr(obj) and returns: _get_name, unknown, obj, str, str, _get_name, str, args_repr, str, obj, _get_name, _get_name