We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
exp show: failing with rich==10.0.0
```console
$ dvc exp show
dvc exp show  -v
2021-03-29 11:30:45,071 DEBUG: Check for update is disabled.
2021-03-29 11:30:46,006 ERROR: unexpected error - 'int' object has no attribute 'max_width'
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/saugat/repos/iterative/dvc/dvc/main.py", line 55, in main
    ret = cmd.run()
  File "/home/saugat/repos/iterative/dvc/dvc/command/experiments.py", line 411, in run
    measurement = table.__rich_measure__(console, SHOW_MAX_WIDTH)
  File "/home/saugat/venvs/dvc/env39/lib/python3.9/site-packages/rich/table.py", line 287, in __rich_measure__
    max_width = options.max_width
AttributeError: 'int' object has no attribute 'max_width'
------------------------------------------------------------
2021-03-29 11:30:47,022 DEBUG: Version info for developers:
DVC version: 2.0.11+f8c567 
---------------------------------
Platform: Python 3.9.2 on Linux-5.11.8-arch1-1-x86_64-with-glibc2.33
Supports: All remotes
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/sda9
Caches: local
Remotes: https
Workspace directory: ext4 on /dev/sda9
Repo: dvc, git

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
```


This is also breaking our linter ([here](https://github.com/iterative/dvc/runs/2214172187?check_suite_focus=true#step:7:250
)) and tests as well due to the change in rich's internal API that we are using:
https://github.com/iterative/dvc/blob/1a25ebe3bd2eda4c3612e408fb503d64490fb56c/dvc/utils/table.py#L59



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `dvc/utils/table.py`
Content:
```
1 from dataclasses import dataclass
2 from typing import TYPE_CHECKING, List, cast
3 
4 from rich.style import StyleType
5 from rich.table import Column as RichColumn
6 from rich.table import Table as RichTable
7 
8 if TYPE_CHECKING:
9     from rich.console import (
10         Console,
11         ConsoleOptions,
12         JustifyMethod,
13         OverflowMethod,
14         RenderableType,
15     )
16 
17 
18 @dataclass
19 class Column(RichColumn):
20     collapse: bool = False
21 
22 
23 class Table(RichTable):
24     def add_column(  # pylint: disable=arguments-differ
25         self,
26         header: "RenderableType" = "",
27         footer: "RenderableType" = "",
28         *,
29         header_style: StyleType = None,
30         footer_style: StyleType = None,
31         style: StyleType = None,
32         justify: "JustifyMethod" = "left",
33         overflow: "OverflowMethod" = "ellipsis",
34         width: int = None,
35         min_width: int = None,
36         max_width: int = None,
37         ratio: int = None,
38         no_wrap: bool = False,
39         collapse: bool = False,
40     ) -> None:
41         column = Column(  # type: ignore[call-arg]
42             _index=len(self.columns),
43             header=header,
44             footer=footer,
45             header_style=header_style or "",
46             footer_style=footer_style or "",
47             style=style or "",
48             justify=justify,
49             overflow=overflow,
50             width=width,
51             min_width=min_width,
52             max_width=max_width,
53             ratio=ratio,
54             no_wrap=no_wrap,
55             collapse=collapse,
56         )
57         self.columns.append(column)
58 
59     def _calculate_column_widths(
60         self, console: "Console", options: "ConsoleOptions"
61     ) -> List[int]:
62         """Calculate the widths of each column, including padding, not
63         including borders.
64 
65         Adjacent collapsed columns will be removed until there is only a single
66         truncated column remaining.
67         """
68         widths = super()._calculate_column_widths(console, options)
69         last_collapsed = -1
70         columns = cast(List[Column], self.columns)
71         for i in range(len(columns) - 1, -1, -1):
72             if widths[i] == 1 and columns[i].collapse:
73                 if last_collapsed >= 0:
74                     del widths[last_collapsed]
75                     del columns[last_collapsed]
76                     if self.box:
77                         options.max_width += 1
78                     for column in columns[last_collapsed:]:
79                         column._index -= 1
80                 last_collapsed = i
81                 padding = self._get_padding_width(i)
82                 if (
83                     columns[i].overflow == "ellipsis"
84                     and (sum(widths) + padding) <= options.max_width
85                 ):
86                     # Set content width to 1 (plus padding) if we can fit a
87                     # single unicode ellipsis in this column
88                     widths[i] = 1 + padding
89             else:
90                 last_collapsed = -1
91         return widths
92 
93     def _collapse_widths(  # type: ignore[override]
94         self, widths: List[int], wrapable: List[bool], max_width: int,
95     ) -> List[int]:
96         """Collapse columns right-to-left if possible to fit table into
97         max_width.
98 
99         If table is still too wide after collapsing, rich's automatic overflow
100         handling will be used.
101         """
102         columns = cast(List[Column], self.columns)
103         collapsible = [column.collapse for column in columns]
104         total_width = sum(widths)
105         excess_width = total_width - max_width
106         if any(collapsible):
107             for i in range(len(widths) - 1, -1, -1):
108                 if collapsible[i]:
109                     total_width -= widths[i]
110                     excess_width -= widths[i]
111                     widths[i] = 0
112                     if excess_width <= 0:
113                         break
114         return super()._collapse_widths(widths, wrapable, max_width)
115
```
--- 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()

```

diff --git a/dvc/utils/table.py b/dvc/utils/table.py
--- a/dvc/utils/table.py
+++ b/dvc/utils/table.py
@@ -69,7 +69,7 @@
         last_collapsed = -1
         columns = cast(List[Column], self.columns)
         for i in range(len(columns) - 1, -1, -1):
-            if widths[i] == 1 and columns[i].collapse:
+            if widths[i] == 0 and columns[i].collapse:
                 if last_collapsed >= 0:
                     del widths[last_collapsed]
                     del columns[last_collapsed]

{"golden_diff": "diff --git a/dvc/utils/table.py b/dvc/utils/table.py\n--- a/dvc/utils/table.py\n+++ b/dvc/utils/table.py\n@@ -69,7 +69,7 @@\n         last_collapsed = -1\n         columns = cast(List[Column], self.columns)\n         for i in range(len(columns) - 1, -1, -1):\n-            if widths[i] == 1 and columns[i].collapse:\n+            if widths[i] == 0 and columns[i].collapse:\n                 if last_collapsed >= 0:\n                     del widths[last_collapsed]\n                     del columns[last_collapsed]\n", "issue": "exp show: failing with rich==10.0.0\n```console\r\n$ dvc exp show\r\ndvc exp show  -v\r\n2021-03-29 11:30:45,071 DEBUG: Check for update is disabled.\r\n2021-03-29 11:30:46,006 ERROR: unexpected error - 'int' object has no attribute 'max_width'\r\n------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/saugat/repos/iterative/dvc/dvc/main.py\", line 55, in main\r\n    ret = cmd.run()\r\n  File \"/home/saugat/repos/iterative/dvc/dvc/command/experiments.py\", line 411, in run\r\n    measurement = table.__rich_measure__(console, SHOW_MAX_WIDTH)\r\n  File \"/home/saugat/venvs/dvc/env39/lib/python3.9/site-packages/rich/table.py\", line 287, in __rich_measure__\r\n    max_width = options.max_width\r\nAttributeError: 'int' object has no attribute 'max_width'\r\n------------------------------------------------------------\r\n2021-03-29 11:30:47,022 DEBUG: Version info for developers:\r\nDVC version: 2.0.11+f8c567 \r\n---------------------------------\r\nPlatform: Python 3.9.2 on Linux-5.11.8-arch1-1-x86_64-with-glibc2.33\r\nSupports: All remotes\r\nCache types: hardlink, symlink\r\nCache directory: ext4 on /dev/sda9\r\nCaches: local\r\nRemotes: https\r\nWorkspace directory: ext4 on /dev/sda9\r\nRepo: dvc, git\r\n\r\nHaving any troubles? Hit us up at https://dvc.org/support, we are always happy to help!\r\n```\r\n\r\n\r\nThis is also breaking our linter ([here](https://github.com/iterative/dvc/runs/2214172187?check_suite_focus=true#step:7:250\r\n)) and tests as well due to the change in rich's internal API that we are using:\r\nhttps://github.com/iterative/dvc/blob/1a25ebe3bd2eda4c3612e408fb503d64490fb56c/dvc/utils/table.py#L59\r\n\r\n\n", "before_files": [{"content": "from dataclasses import dataclass\nfrom typing import TYPE_CHECKING, List, cast\n\nfrom rich.style import StyleType\nfrom rich.table import Column as RichColumn\nfrom rich.table import Table as RichTable\n\nif TYPE_CHECKING:\n    from rich.console import (\n        Console,\n        ConsoleOptions,\n        JustifyMethod,\n        OverflowMethod,\n        RenderableType,\n    )\n\n\n@dataclass\nclass Column(RichColumn):\n    collapse: bool = False\n\n\nclass Table(RichTable):\n    def add_column(  # pylint: disable=arguments-differ\n        self,\n        header: \"RenderableType\" = \"\",\n        footer: \"RenderableType\" = \"\",\n        *,\n        header_style: StyleType = None,\n        footer_style: StyleType = None,\n        style: StyleType = None,\n        justify: \"JustifyMethod\" = \"left\",\n        overflow: \"OverflowMethod\" = \"ellipsis\",\n        width: int = None,\n        min_width: int = None,\n        max_width: int = None,\n        ratio: int = None,\n        no_wrap: bool = False,\n        collapse: bool = False,\n    ) -> None:\n        column = Column(  # type: ignore[call-arg]\n            _index=len(self.columns),\n            header=header,\n            footer=footer,\n            header_style=header_style or \"\",\n            footer_style=footer_style or \"\",\n            style=style or \"\",\n            justify=justify,\n            overflow=overflow,\n            width=width,\n            min_width=min_width,\n            max_width=max_width,\n            ratio=ratio,\n            no_wrap=no_wrap,\n            collapse=collapse,\n        )\n        self.columns.append(column)\n\n    def _calculate_column_widths(\n        self, console: \"Console\", options: \"ConsoleOptions\"\n    ) -> List[int]:\n        \"\"\"Calculate the widths of each column, including padding, not\n        including borders.\n\n        Adjacent collapsed columns will be removed until there is only a single\n        truncated column remaining.\n        \"\"\"\n        widths = super()._calculate_column_widths(console, options)\n        last_collapsed = -1\n        columns = cast(List[Column], self.columns)\n        for i in range(len(columns) - 1, -1, -1):\n            if widths[i] == 1 and columns[i].collapse:\n                if last_collapsed >= 0:\n                    del widths[last_collapsed]\n                    del columns[last_collapsed]\n                    if self.box:\n                        options.max_width += 1\n                    for column in columns[last_collapsed:]:\n                        column._index -= 1\n                last_collapsed = i\n                padding = self._get_padding_width(i)\n                if (\n                    columns[i].overflow == \"ellipsis\"\n                    and (sum(widths) + padding) <= options.max_width\n                ):\n                    # Set content width to 1 (plus padding) if we can fit a\n                    # single unicode ellipsis in this column\n                    widths[i] = 1 + padding\n            else:\n                last_collapsed = -1\n        return widths\n\n    def _collapse_widths(  # type: ignore[override]\n        self, widths: List[int], wrapable: List[bool], max_width: int,\n    ) -> List[int]:\n        \"\"\"Collapse columns right-to-left if possible to fit table into\n        max_width.\n\n        If table is still too wide after collapsing, rich's automatic overflow\n        handling will be used.\n        \"\"\"\n        columns = cast(List[Column], self.columns)\n        collapsible = [column.collapse for column in columns]\n        total_width = sum(widths)\n        excess_width = total_width - max_width\n        if any(collapsible):\n            for i in range(len(widths) - 1, -1, -1):\n                if collapsible[i]:\n                    total_width -= widths[i]\n                    excess_width -= widths[i]\n                    widths[i] = 0\n                    if excess_width <= 0:\n                        break\n        return super()._collapse_widths(widths, wrapable, max_width)\n", "path": "dvc/utils/table.py"}], "after_files": [{"content": "from dataclasses import dataclass\nfrom typing import TYPE_CHECKING, List, cast\n\nfrom rich.style import StyleType\nfrom rich.table import Column as RichColumn\nfrom rich.table import Table as RichTable\n\nif TYPE_CHECKING:\n    from rich.console import (\n        Console,\n        ConsoleOptions,\n        JustifyMethod,\n        OverflowMethod,\n        RenderableType,\n    )\n\n\n@dataclass\nclass Column(RichColumn):\n    collapse: bool = False\n\n\nclass Table(RichTable):\n    def add_column(  # pylint: disable=arguments-differ\n        self,\n        header: \"RenderableType\" = \"\",\n        footer: \"RenderableType\" = \"\",\n        *,\n        header_style: StyleType = None,\n        footer_style: StyleType = None,\n        style: StyleType = None,\n        justify: \"JustifyMethod\" = \"left\",\n        overflow: \"OverflowMethod\" = \"ellipsis\",\n        width: int = None,\n        min_width: int = None,\n        max_width: int = None,\n        ratio: int = None,\n        no_wrap: bool = False,\n        collapse: bool = False,\n    ) -> None:\n        column = Column(  # type: ignore[call-arg]\n            _index=len(self.columns),\n            header=header,\n            footer=footer,\n            header_style=header_style or \"\",\n            footer_style=footer_style or \"\",\n            style=style or \"\",\n            justify=justify,\n            overflow=overflow,\n            width=width,\n            min_width=min_width,\n            max_width=max_width,\n            ratio=ratio,\n            no_wrap=no_wrap,\n            collapse=collapse,\n        )\n        self.columns.append(column)\n\n    def _calculate_column_widths(\n        self, console: \"Console\", options: \"ConsoleOptions\"\n    ) -> List[int]:\n        \"\"\"Calculate the widths of each column, including padding, not\n        including borders.\n\n        Adjacent collapsed columns will be removed until there is only a single\n        truncated column remaining.\n        \"\"\"\n        widths = super()._calculate_column_widths(console, options)\n        last_collapsed = -1\n        columns = cast(List[Column], self.columns)\n        for i in range(len(columns) - 1, -1, -1):\n            if widths[i] == 0 and columns[i].collapse:\n                if last_collapsed >= 0:\n                    del widths[last_collapsed]\n                    del columns[last_collapsed]\n                    if self.box:\n                        options.max_width += 1\n                    for column in columns[last_collapsed:]:\n                        column._index -= 1\n                last_collapsed = i\n                padding = self._get_padding_width(i)\n                if (\n                    columns[i].overflow == \"ellipsis\"\n                    and (sum(widths) + padding) <= options.max_width\n                ):\n                    # Set content width to 1 (plus padding) if we can fit a\n                    # single unicode ellipsis in this column\n                    widths[i] = 1 + padding\n            else:\n                last_collapsed = -1\n        return widths\n\n    def _collapse_widths(  # type: ignore[override]\n        self, widths: List[int], wrapable: List[bool], max_width: int,\n    ) -> List[int]:\n        \"\"\"Collapse columns right-to-left if possible to fit table into\n        max_width.\n\n        If table is still too wide after collapsing, rich's automatic overflow\n        handling will be used.\n        \"\"\"\n        columns = cast(List[Column], self.columns)\n        collapsible = [column.collapse for column in columns]\n        total_width = sum(widths)\n        excess_width = total_width - max_width\n        if any(collapsible):\n            for i in range(len(widths) - 1, -1, -1):\n                if collapsible[i]:\n                    total_width -= widths[i]\n                    excess_width -= widths[i]\n                    widths[i] = 0\n                    if excess_width <= 0:\n                        break\n        return super()._collapse_widths(widths, wrapable, max_width)\n", "path": "dvc/utils/table.py"}]}