prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Sphinx Python API docs generation broken in recent nightly CI runs
  For example: <https://github.com/microsoft/MLOS/runs/1635132574?check_suite_focus=true>
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `source/Mlos.Python/mlos/Spaces/Point.py`
  Content:
  ```
  1 #
  2 # Copyright (c) Microsoft Corporation.
  3 # Licensed under the MIT License.
  4 #
  5 import json
  6 from numbers import Number
  7 
  8 import pandas as pd
  9 from mlos.Spaces.Dimensions.Dimension import Dimension
  10 
  11 
  12 class Point:
  13     """ Models a point in a Hypergrid.
  14 
  15     """
  16     def __init__(self, **kwargs):
  17         self.dimension_value_dict = dict()
  18         for dimension_name, value in kwargs.items():
  19             self[dimension_name] = value
  20 
  21     def copy(self):
  22         return Point(**{key: value for key, value in self})
  23 
  24     def flat_copy(self):
  25         """ Creates a copy of the point but all dimension names are flattened.
  26 
  27         :return:
  28         """
  29         flat_dict = {
  30             Dimension.flatten_dimension_name(dimension_name): value
  31             for dimension_name, value in self
  32         }
  33         return Point(**flat_dict)
  34 
  35     def __eq__(self, other):
  36         if not isinstance(other, Point):
  37             return False
  38         return \
  39             all(other.get(dimension_name, None) == value for dimension_name, value in self) \
  40             and \
  41             all(self.get(dimension_name, None) == value for dimension_name, value in other)
  42 
  43     def __ne__(self, other):
  44         return not self == other
  45 
  46     def __iter__(self):
  47         for dimension_name, value in self.dimension_value_dict.items():
  48             if not isinstance(value, Point):
  49                 yield dimension_name, value
  50             else:
  51                 for sub_dimension_name, sub_dimension_value in value:
  52                     yield dimension_name + "." + sub_dimension_name, sub_dimension_value
  53 
  54     def __getattr__(self, dimension_name):
  55         if dimension_name == "__isabstractmethod__":
  56             # A sad but necessary way to deal with ABC.
  57             return False
  58         return self[dimension_name]
  59 
  60     def __setattr__(self, name, value):
  61         if name == "dimension_value_dict":
  62             self.__dict__[name] = value
  63         else:
  64             dimension_name = name
  65             subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)
  66             if subgrid_name is None:
  67                 self.dimension_value_dict[dimension_name] = value
  68             else:
  69                 point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())
  70                 point_in_subgrid[dimension_name_without_subgrid_name] = value
  71                 self.dimension_value_dict[subgrid_name] = point_in_subgrid
  72 
  73     def __getitem__(self, dimension_name):
  74         if dimension_name not in self:
  75             raise KeyError(f"This Point does not have a value along dimension: {dimension_name}")
  76         subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)
  77         if subgrid_name is None:
  78             return self.dimension_value_dict[dimension_name]
  79         return self[subgrid_name][dimension_name_without_subgrid_name]
  80 
  81     def get(self, dimension_name, default=None):
  82         try:
  83             return self[dimension_name]
  84         except KeyError:
  85             return default
  86 
  87     def __setitem__(self, dimension_name, value):
  88         subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)
  89         if subgrid_name is None:
  90             self.dimension_value_dict[dimension_name] = value
  91         else:
  92             point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())
  93             point_in_subgrid[dimension_name_without_subgrid_name] = value
  94             self.dimension_value_dict[subgrid_name] = point_in_subgrid
  95 
  96     def __contains__(self, dimension_name):
  97         subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)
  98         if subgrid_name is None:
  99             return dimension_name in self.dimension_value_dict
  100         if subgrid_name not in self.dimension_value_dict:
  101             return False
  102         return dimension_name_without_subgrid_name in self[subgrid_name]
  103 
  104     def __repr__(self):
  105         return self.__str__()
  106 
  107     def __str__(self):
  108         return str(self.to_json(indent=2))
  109 
  110     def __getstate__(self):
  111         return self.to_json()
  112 
  113     def __setstate__(self, state):
  114         temp_point = self.from_json(state)
  115         self.dimension_value_dict = temp_point.dimension_value_dict
  116 
  117     def to_json(self, indent=None):
  118         if indent is not None:
  119             return json.dumps(self.to_dict(), indent=indent)
  120         return json.dumps(self.to_dict())
  121 
  122     @classmethod
  123     def from_json(cls, json_str):
  124         coordinates = json.loads(json_str)
  125         return Point(**coordinates)
  126 
  127     def to_dict(self):
  128         return_dict = {}
  129         for param_name, value in self:
  130             if isinstance(value, Number) and int(value) == value and not isinstance(value, bool):
  131                 value = int(value)
  132             return_dict[param_name] = value
  133         return return_dict
  134 
  135     def to_dataframe(self):
  136         return pd.DataFrame({param_name: [value] for param_name, value in self})
  137 
  138     @classmethod
  139     def from_dataframe(cls, dataframe: pd.DataFrame):
  140         assert len(dataframe.index) == 1
  141         dataframe = dataframe.dropna(axis=1)
  142         dataframe_dict = dataframe.to_dict(orient='list')
  143         point_dict = {key: values[0] for key, values in dataframe_dict.items()}
  144         return Point(**point_dict)
  145
  ```
  --- 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/source/Mlos.Python/mlos/Spaces/Point.py b/source/Mlos.Python/mlos/Spaces/Point.py
  --- a/source/Mlos.Python/mlos/Spaces/Point.py
  +++ b/source/Mlos.Python/mlos/Spaces/Point.py
  @@ -55,7 +55,10 @@
           if dimension_name == "__isabstractmethod__":
               # A sad but necessary way to deal with ABC.
               return False
  -        return self[dimension_name]
  +        try:
  +            return self[dimension_name]
  +        except KeyError:
  +            raise AttributeError(f"This Point does not have a {dimension_name} attribute.")
   
       def __setattr__(self, name, value):
           if name == "dimension_value_dict":
  
verification_info: {"golden_diff": "diff --git a/source/Mlos.Python/mlos/Spaces/Point.py b/source/Mlos.Python/mlos/Spaces/Point.py\n--- a/source/Mlos.Python/mlos/Spaces/Point.py\n+++ b/source/Mlos.Python/mlos/Spaces/Point.py\n@@ -55,7 +55,10 @@\n         if dimension_name == \"__isabstractmethod__\":\r\n             # A sad but necessary way to deal with ABC.\r\n             return False\r\n-        return self[dimension_name]\r\n+        try:\r\n+            return self[dimension_name]\r\n+        except KeyError:\r\n+            raise AttributeError(f\"This Point does not have a {dimension_name} attribute.\")\r\n \r\n     def __setattr__(self, name, value):\r\n         if name == \"dimension_value_dict\":\n", "issue": "Sphinx Python API docs generation broken in recent nightly CI runs\nFor example: <https://github.com/microsoft/MLOS/runs/1635132574?check_suite_focus=true>\n", "before_files": [{"content": "#\r\n# Copyright (c) Microsoft Corporation.\r\n# Licensed under the MIT License.\r\n#\r\nimport json\r\nfrom numbers import Number\r\n\r\nimport pandas as pd\r\nfrom mlos.Spaces.Dimensions.Dimension import Dimension\r\n\r\n\r\nclass Point:\r\n    \"\"\" Models a point in a Hypergrid.\r\n\r\n    \"\"\"\r\n    def __init__(self, **kwargs):\r\n        self.dimension_value_dict = dict()\r\n        for dimension_name, value in kwargs.items():\r\n            self[dimension_name] = value\r\n\r\n    def copy(self):\r\n        return Point(**{key: value for key, value in self})\r\n\r\n    def flat_copy(self):\r\n        \"\"\" Creates a copy of the point but all dimension names are flattened.\r\n\r\n        :return:\r\n        \"\"\"\r\n        flat_dict = {\r\n            Dimension.flatten_dimension_name(dimension_name): value\r\n            for dimension_name, value in self\r\n        }\r\n        return Point(**flat_dict)\r\n\r\n    def __eq__(self, other):\r\n        if not isinstance(other, Point):\r\n            return False\r\n        return \\\r\n            all(other.get(dimension_name, None) == value for dimension_name, value in self) \\\r\n            and \\\r\n            all(self.get(dimension_name, None) == value for dimension_name, value in other)\r\n\r\n    def __ne__(self, other):\r\n        return not self == other\r\n\r\n    def __iter__(self):\r\n        for dimension_name, value in self.dimension_value_dict.items():\r\n            if not isinstance(value, Point):\r\n                yield dimension_name, value\r\n            else:\r\n                for sub_dimension_name, sub_dimension_value in value:\r\n                    yield dimension_name + \".\" + sub_dimension_name, sub_dimension_value\r\n\r\n    def __getattr__(self, dimension_name):\r\n        if dimension_name == \"__isabstractmethod__\":\r\n            # A sad but necessary way to deal with ABC.\r\n            return False\r\n        return self[dimension_name]\r\n\r\n    def __setattr__(self, name, value):\r\n        if name == \"dimension_value_dict\":\r\n            self.__dict__[name] = value\r\n        else:\r\n            dimension_name = name\r\n            subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n            if subgrid_name is None:\r\n                self.dimension_value_dict[dimension_name] = value\r\n            else:\r\n                point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())\r\n                point_in_subgrid[dimension_name_without_subgrid_name] = value\r\n                self.dimension_value_dict[subgrid_name] = point_in_subgrid\r\n\r\n    def __getitem__(self, dimension_name):\r\n        if dimension_name not in self:\r\n            raise KeyError(f\"This Point does not have a value along dimension: {dimension_name}\")\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            return self.dimension_value_dict[dimension_name]\r\n        return self[subgrid_name][dimension_name_without_subgrid_name]\r\n\r\n    def get(self, dimension_name, default=None):\r\n        try:\r\n            return self[dimension_name]\r\n        except KeyError:\r\n            return default\r\n\r\n    def __setitem__(self, dimension_name, value):\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            self.dimension_value_dict[dimension_name] = value\r\n        else:\r\n            point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())\r\n            point_in_subgrid[dimension_name_without_subgrid_name] = value\r\n            self.dimension_value_dict[subgrid_name] = point_in_subgrid\r\n\r\n    def __contains__(self, dimension_name):\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            return dimension_name in self.dimension_value_dict\r\n        if subgrid_name not in self.dimension_value_dict:\r\n            return False\r\n        return dimension_name_without_subgrid_name in self[subgrid_name]\r\n\r\n    def __repr__(self):\r\n        return self.__str__()\r\n\r\n    def __str__(self):\r\n        return str(self.to_json(indent=2))\r\n\r\n    def __getstate__(self):\r\n        return self.to_json()\r\n\r\n    def __setstate__(self, state):\r\n        temp_point = self.from_json(state)\r\n        self.dimension_value_dict = temp_point.dimension_value_dict\r\n\r\n    def to_json(self, indent=None):\r\n        if indent is not None:\r\n            return json.dumps(self.to_dict(), indent=indent)\r\n        return json.dumps(self.to_dict())\r\n\r\n    @classmethod\r\n    def from_json(cls, json_str):\r\n        coordinates = json.loads(json_str)\r\n        return Point(**coordinates)\r\n\r\n    def to_dict(self):\r\n        return_dict = {}\r\n        for param_name, value in self:\r\n            if isinstance(value, Number) and int(value) == value and not isinstance(value, bool):\r\n                value = int(value)\r\n            return_dict[param_name] = value\r\n        return return_dict\r\n\r\n    def to_dataframe(self):\r\n        return pd.DataFrame({param_name: [value] for param_name, value in self})\r\n\r\n    @classmethod\r\n    def from_dataframe(cls, dataframe: pd.DataFrame):\r\n        assert len(dataframe.index) == 1\r\n        dataframe = dataframe.dropna(axis=1)\r\n        dataframe_dict = dataframe.to_dict(orient='list')\r\n        point_dict = {key: values[0] for key, values in dataframe_dict.items()}\r\n        return Point(**point_dict)\r\n", "path": "source/Mlos.Python/mlos/Spaces/Point.py"}], "after_files": [{"content": "#\r\n# Copyright (c) Microsoft Corporation.\r\n# Licensed under the MIT License.\r\n#\r\nimport json\r\nfrom numbers import Number\r\n\r\nimport pandas as pd\r\nfrom mlos.Spaces.Dimensions.Dimension import Dimension\r\n\r\n\r\nclass Point:\r\n    \"\"\" Models a point in a Hypergrid.\r\n\r\n    \"\"\"\r\n    def __init__(self, **kwargs):\r\n        self.dimension_value_dict = dict()\r\n        for dimension_name, value in kwargs.items():\r\n            self[dimension_name] = value\r\n\r\n    def copy(self):\r\n        return Point(**{key: value for key, value in self})\r\n\r\n    def flat_copy(self):\r\n        \"\"\" Creates a copy of the point but all dimension names are flattened.\r\n\r\n        :return:\r\n        \"\"\"\r\n        flat_dict = {\r\n            Dimension.flatten_dimension_name(dimension_name): value\r\n            for dimension_name, value in self\r\n        }\r\n        return Point(**flat_dict)\r\n\r\n    def __eq__(self, other):\r\n        if not isinstance(other, Point):\r\n            return False\r\n        return \\\r\n            all(other.get(dimension_name, None) == value for dimension_name, value in self) \\\r\n            and \\\r\n            all(self.get(dimension_name, None) == value for dimension_name, value in other)\r\n\r\n    def __ne__(self, other):\r\n        return not self == other\r\n\r\n    def __iter__(self):\r\n        for dimension_name, value in self.dimension_value_dict.items():\r\n            if not isinstance(value, Point):\r\n                yield dimension_name, value\r\n            else:\r\n                for sub_dimension_name, sub_dimension_value in value:\r\n                    yield dimension_name + \".\" + sub_dimension_name, sub_dimension_value\r\n\r\n    def __getattr__(self, dimension_name):\r\n        if dimension_name == \"__isabstractmethod__\":\r\n            # A sad but necessary way to deal with ABC.\r\n            return False\r\n        try:\r\n            return self[dimension_name]\r\n        except KeyError:\r\n            raise AttributeError(f\"This Point does not have a {dimension_name} attribute.\")\r\n\r\n    def __setattr__(self, name, value):\r\n        if name == \"dimension_value_dict\":\r\n            self.__dict__[name] = value\r\n        else:\r\n            dimension_name = name\r\n            subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n            if subgrid_name is None:\r\n                self.dimension_value_dict[dimension_name] = value\r\n            else:\r\n                point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())\r\n                point_in_subgrid[dimension_name_without_subgrid_name] = value\r\n                self.dimension_value_dict[subgrid_name] = point_in_subgrid\r\n\r\n    def __getitem__(self, dimension_name):\r\n        if dimension_name not in self:\r\n            raise KeyError(f\"This Point does not have a value along dimension: {dimension_name}\")\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            return self.dimension_value_dict[dimension_name]\r\n        return self[subgrid_name][dimension_name_without_subgrid_name]\r\n\r\n    def get(self, dimension_name, default=None):\r\n        try:\r\n            return self[dimension_name]\r\n        except KeyError:\r\n            return default\r\n\r\n    def __setitem__(self, dimension_name, value):\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            self.dimension_value_dict[dimension_name] = value\r\n        else:\r\n            point_in_subgrid = self.dimension_value_dict.get(subgrid_name, Point())\r\n            point_in_subgrid[dimension_name_without_subgrid_name] = value\r\n            self.dimension_value_dict[subgrid_name] = point_in_subgrid\r\n\r\n    def __contains__(self, dimension_name):\r\n        subgrid_name, dimension_name_without_subgrid_name = Dimension.split_dimension_name(dimension_name)\r\n        if subgrid_name is None:\r\n            return dimension_name in self.dimension_value_dict\r\n        if subgrid_name not in self.dimension_value_dict:\r\n            return False\r\n        return dimension_name_without_subgrid_name in self[subgrid_name]\r\n\r\n    def __repr__(self):\r\n        return self.__str__()\r\n\r\n    def __str__(self):\r\n        return str(self.to_json(indent=2))\r\n\r\n    def __getstate__(self):\r\n        return self.to_json()\r\n\r\n    def __setstate__(self, state):\r\n        temp_point = self.from_json(state)\r\n        self.dimension_value_dict = temp_point.dimension_value_dict\r\n\r\n    def to_json(self, indent=None):\r\n        if indent is not None:\r\n            return json.dumps(self.to_dict(), indent=indent)\r\n        return json.dumps(self.to_dict())\r\n\r\n    @classmethod\r\n    def from_json(cls, json_str):\r\n        coordinates = json.loads(json_str)\r\n        return Point(**coordinates)\r\n\r\n    def to_dict(self):\r\n        return_dict = {}\r\n        for param_name, value in self:\r\n            if isinstance(value, Number) and int(value) == value and not isinstance(value, bool):\r\n                value = int(value)\r\n            return_dict[param_name] = value\r\n        return return_dict\r\n\r\n    def to_dataframe(self):\r\n        return pd.DataFrame({param_name: [value] for param_name, value in self})\r\n\r\n    @classmethod\r\n    def from_dataframe(cls, dataframe: pd.DataFrame):\r\n        assert len(dataframe.index) == 1\r\n        dataframe = dataframe.dropna(axis=1)\r\n        dataframe_dict = dataframe.to_dict(orient='list')\r\n        point_dict = {key: values[0] for key, values in dataframe_dict.items()}\r\n        return Point(**point_dict)\r\n", "path": "source/Mlos.Python/mlos/Spaces/Point.py"}]}