prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Document hydra.utils.{get_class,get_method}
  Users would benefit from documentation for the following:
  [`hydra.utils.get_class`](https://github.com/facebookresearch/hydra/blob/1cbe86ebecbeb134a3f2041120d57447a7394314/hydra/utils.py#L21)
  [`hydra.utils.get_method`](https://github.com/facebookresearch/hydra/blob/1cbe86ebecbeb134a3f2041120d57447a7394314/hydra/utils.py#L32)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `hydra/utils.py`
  Content:
  ```
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 
  3 import logging.config
  4 import os
  5 from pathlib import Path
  6 from typing import Any, Callable
  7 
  8 import hydra._internal.instantiate._instantiate2
  9 import hydra.types
  10 from hydra._internal.utils import _locate
  11 from hydra.core.hydra_config import HydraConfig
  12 
  13 log = logging.getLogger(__name__)
  14 
  15 # Instantiation related symbols
  16 instantiate = hydra._internal.instantiate._instantiate2.instantiate
  17 call = instantiate
  18 ConvertMode = hydra.types.ConvertMode
  19 
  20 
  21 def get_class(path: str) -> type:
  22     try:
  23         cls = _locate(path)
  24         if not isinstance(cls, type):
  25             raise ValueError(
  26                 f"Located non-class of type '{type(cls).__name__}'"
  27                 + f" while loading '{path}'"
  28             )
  29         return cls
  30     except Exception as e:
  31         log.error(f"Error initializing class at {path}: {e}")
  32         raise e
  33 
  34 
  35 def get_method(path: str) -> Callable[..., Any]:
  36     try:
  37         obj = _locate(path)
  38         if not callable(obj):
  39             raise ValueError(
  40                 f"Located non-callable of type '{type(obj).__name__}'"
  41                 + f" while loading '{path}'"
  42             )
  43         cl: Callable[..., Any] = obj
  44         return cl
  45     except Exception as e:
  46         log.error(f"Error getting callable at {path} : {e}")
  47         raise e
  48 
  49 
  50 # Alias for get_method
  51 get_static_method = get_method
  52 
  53 
  54 def get_original_cwd() -> str:
  55     """
  56     :return: the original working directory the Hydra application was launched from
  57     """
  58     if not HydraConfig.initialized():
  59         raise ValueError(
  60             "get_original_cwd() must only be used after HydraConfig is initialized"
  61         )
  62     ret = HydraConfig.get().runtime.cwd
  63     assert ret is not None and isinstance(ret, str)
  64     return ret
  65 
  66 
  67 def to_absolute_path(path: str) -> str:
  68     """
  69     converts the specified path to be absolute path.
  70     if the input path is relative, it's interpreted as relative to the original working directory
  71     if it's absolute, it's returned as is
  72     :param path: path to convert
  73     :return:
  74     """
  75     p = Path(path)
  76     if not HydraConfig.initialized():
  77         base = Path(os.getcwd())
  78     else:
  79         base = Path(get_original_cwd())
  80     if p.is_absolute():
  81         ret = p
  82     else:
  83         ret = base / p
  84     return str(ret)
  85
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/hydra/utils.py b/hydra/utils.py
  --- a/hydra/utils.py
  +++ b/hydra/utils.py
  @@ -19,6 +19,14 @@
   
   
   def get_class(path: str) -> type:
  +    """
  +    Look up a class based on a dotpath.
  +    Fails if the path does not point to a class.
  +
  +    >>> import my_module
  +    >>> from hydra.utils import get_class
  +    >>> assert get_class("my_module.MyClass") is my_module.MyClass
  +    """
       try:
           cls = _locate(path)
           if not isinstance(cls, type):
  @@ -28,11 +36,19 @@
               )
           return cls
       except Exception as e:
  -        log.error(f"Error initializing class at {path}: {e}")
  +        log.error(f"Error getting class at {path}: {e}")
           raise e
   
   
   def get_method(path: str) -> Callable[..., Any]:
  +    """
  +    Look up a callable based on a dotpath.
  +    Fails if the path does not point to a callable object.
  +
  +    >>> import my_module
  +    >>> from hydra.utils import get_method
  +    >>> assert get_method("my_module.my_function") is my_module.my_function
  +    """
       try:
           obj = _locate(path)
           if not callable(obj):
  @@ -51,6 +67,22 @@
   get_static_method = get_method
   
   
  +def get_object(path: str) -> Any:
  +    """
  +    Look up a callable based on a dotpath.
  +
  +    >>> import my_module
  +    >>> from hydra.utils import get_object
  +    >>> assert get_object("my_module.my_object") is my_module.my_object
  +    """
  +    try:
  +        obj = _locate(path)
  +        return obj
  +    except Exception as e:
  +        log.error(f"Error getting object at {path} : {e}")
  +        raise e
  +
  +
   def get_original_cwd() -> str:
       """
       :return: the original working directory the Hydra application was launched from
  
verification_info: {"golden_diff": "diff --git a/hydra/utils.py b/hydra/utils.py\n--- a/hydra/utils.py\n+++ b/hydra/utils.py\n@@ -19,6 +19,14 @@\n \n \n def get_class(path: str) -> type:\n+    \"\"\"\n+    Look up a class based on a dotpath.\n+    Fails if the path does not point to a class.\n+\n+    >>> import my_module\n+    >>> from hydra.utils import get_class\n+    >>> assert get_class(\"my_module.MyClass\") is my_module.MyClass\n+    \"\"\"\n     try:\n         cls = _locate(path)\n         if not isinstance(cls, type):\n@@ -28,11 +36,19 @@\n             )\n         return cls\n     except Exception as e:\n-        log.error(f\"Error initializing class at {path}: {e}\")\n+        log.error(f\"Error getting class at {path}: {e}\")\n         raise e\n \n \n def get_method(path: str) -> Callable[..., Any]:\n+    \"\"\"\n+    Look up a callable based on a dotpath.\n+    Fails if the path does not point to a callable object.\n+\n+    >>> import my_module\n+    >>> from hydra.utils import get_method\n+    >>> assert get_method(\"my_module.my_function\") is my_module.my_function\n+    \"\"\"\n     try:\n         obj = _locate(path)\n         if not callable(obj):\n@@ -51,6 +67,22 @@\n get_static_method = get_method\n \n \n+def get_object(path: str) -> Any:\n+    \"\"\"\n+    Look up a callable based on a dotpath.\n+\n+    >>> import my_module\n+    >>> from hydra.utils import get_object\n+    >>> assert get_object(\"my_module.my_object\") is my_module.my_object\n+    \"\"\"\n+    try:\n+        obj = _locate(path)\n+        return obj\n+    except Exception as e:\n+        log.error(f\"Error getting object at {path} : {e}\")\n+        raise e\n+\n+\n def get_original_cwd() -> str:\n     \"\"\"\n     :return: the original working directory the Hydra application was launched from\n", "issue": "Document hydra.utils.{get_class,get_method}\nUsers would benefit from documentation for the following:\r\n[`hydra.utils.get_class`](https://github.com/facebookresearch/hydra/blob/1cbe86ebecbeb134a3f2041120d57447a7394314/hydra/utils.py#L21)\r\n[`hydra.utils.get_method`](https://github.com/facebookresearch/hydra/blob/1cbe86ebecbeb134a3f2041120d57447a7394314/hydra/utils.py#L32)\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging.config\nimport os\nfrom pathlib import Path\nfrom typing import Any, Callable\n\nimport hydra._internal.instantiate._instantiate2\nimport hydra.types\nfrom hydra._internal.utils import _locate\nfrom hydra.core.hydra_config import HydraConfig\n\nlog = logging.getLogger(__name__)\n\n# Instantiation related symbols\ninstantiate = hydra._internal.instantiate._instantiate2.instantiate\ncall = instantiate\nConvertMode = hydra.types.ConvertMode\n\n\ndef get_class(path: str) -> type:\n    try:\n        cls = _locate(path)\n        if not isinstance(cls, type):\n            raise ValueError(\n                f\"Located non-class of type '{type(cls).__name__}'\"\n                + f\" while loading '{path}'\"\n            )\n        return cls\n    except Exception as e:\n        log.error(f\"Error initializing class at {path}: {e}\")\n        raise e\n\n\ndef get_method(path: str) -> Callable[..., Any]:\n    try:\n        obj = _locate(path)\n        if not callable(obj):\n            raise ValueError(\n                f\"Located non-callable of type '{type(obj).__name__}'\"\n                + f\" while loading '{path}'\"\n            )\n        cl: Callable[..., Any] = obj\n        return cl\n    except Exception as e:\n        log.error(f\"Error getting callable at {path} : {e}\")\n        raise e\n\n\n# Alias for get_method\nget_static_method = get_method\n\n\ndef get_original_cwd() -> str:\n    \"\"\"\n    :return: the original working directory the Hydra application was launched from\n    \"\"\"\n    if not HydraConfig.initialized():\n        raise ValueError(\n            \"get_original_cwd() must only be used after HydraConfig is initialized\"\n        )\n    ret = HydraConfig.get().runtime.cwd\n    assert ret is not None and isinstance(ret, str)\n    return ret\n\n\ndef to_absolute_path(path: str) -> str:\n    \"\"\"\n    converts the specified path to be absolute path.\n    if the input path is relative, it's interpreted as relative to the original working directory\n    if it's absolute, it's returned as is\n    :param path: path to convert\n    :return:\n    \"\"\"\n    p = Path(path)\n    if not HydraConfig.initialized():\n        base = Path(os.getcwd())\n    else:\n        base = Path(get_original_cwd())\n    if p.is_absolute():\n        ret = p\n    else:\n        ret = base / p\n    return str(ret)\n", "path": "hydra/utils.py"}], "after_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging.config\nimport os\nfrom pathlib import Path\nfrom typing import Any, Callable\n\nimport hydra._internal.instantiate._instantiate2\nimport hydra.types\nfrom hydra._internal.utils import _locate\nfrom hydra.core.hydra_config import HydraConfig\n\nlog = logging.getLogger(__name__)\n\n# Instantiation related symbols\ninstantiate = hydra._internal.instantiate._instantiate2.instantiate\ncall = instantiate\nConvertMode = hydra.types.ConvertMode\n\n\ndef get_class(path: str) -> type:\n    \"\"\"\n    Look up a class based on a dotpath.\n    Fails if the path does not point to a class.\n\n    >>> import my_module\n    >>> from hydra.utils import get_class\n    >>> assert get_class(\"my_module.MyClass\") is my_module.MyClass\n    \"\"\"\n    try:\n        cls = _locate(path)\n        if not isinstance(cls, type):\n            raise ValueError(\n                f\"Located non-class of type '{type(cls).__name__}'\"\n                + f\" while loading '{path}'\"\n            )\n        return cls\n    except Exception as e:\n        log.error(f\"Error getting class at {path}: {e}\")\n        raise e\n\n\ndef get_method(path: str) -> Callable[..., Any]:\n    \"\"\"\n    Look up a callable based on a dotpath.\n    Fails if the path does not point to a callable object.\n\n    >>> import my_module\n    >>> from hydra.utils import get_method\n    >>> assert get_method(\"my_module.my_function\") is my_module.my_function\n    \"\"\"\n    try:\n        obj = _locate(path)\n        if not callable(obj):\n            raise ValueError(\n                f\"Located non-callable of type '{type(obj).__name__}'\"\n                + f\" while loading '{path}'\"\n            )\n        cl: Callable[..., Any] = obj\n        return cl\n    except Exception as e:\n        log.error(f\"Error getting callable at {path} : {e}\")\n        raise e\n\n\n# Alias for get_method\nget_static_method = get_method\n\n\ndef get_object(path: str) -> Any:\n    \"\"\"\n    Look up a callable based on a dotpath.\n\n    >>> import my_module\n    >>> from hydra.utils import get_object\n    >>> assert get_object(\"my_module.my_object\") is my_module.my_object\n    \"\"\"\n    try:\n        obj = _locate(path)\n        return obj\n    except Exception as e:\n        log.error(f\"Error getting object at {path} : {e}\")\n        raise e\n\n\ndef get_original_cwd() -> str:\n    \"\"\"\n    :return: the original working directory the Hydra application was launched from\n    \"\"\"\n    if not HydraConfig.initialized():\n        raise ValueError(\n            \"get_original_cwd() must only be used after HydraConfig is initialized\"\n        )\n    ret = HydraConfig.get().runtime.cwd\n    assert ret is not None and isinstance(ret, str)\n    return ret\n\n\ndef to_absolute_path(path: str) -> str:\n    \"\"\"\n    converts the specified path to be absolute path.\n    if the input path is relative, it's interpreted as relative to the original working directory\n    if it's absolute, it's returned as is\n    :param path: path to convert\n    :return:\n    \"\"\"\n    p = Path(path)\n    if not HydraConfig.initialized():\n        base = Path(os.getcwd())\n    else:\n        base = Path(get_original_cwd())\n    if p.is_absolute():\n        ret = p\n    else:\n        ret = base / p\n    return str(ret)\n", "path": "hydra/utils.py"}]}