Skip to content

Commit 9465a23

Browse files
authored
Make code compatible with rich 11 (#1797)
1 parent 12a175d commit 9465a23

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ansiblelint/generate_docs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
from typing import Iterable
44

55
from rich import box
6-
from rich.console import render_group
6+
7+
# Remove this compatibility try-catch block once we drop support for rich < 10.7.0
8+
try:
9+
from rich.console import group
10+
except ImportError:
11+
from rich.console import render_group as group
12+
713
from rich.markdown import Markdown
814
from rich.table import Table
915

@@ -47,7 +53,7 @@ def rules_as_rst(rules: RulesCollection) -> str:
4753
return r
4854

4955

50-
@render_group()
56+
@group()
5157
def rules_as_rich(rules: RulesCollection) -> Iterable[Table]:
5258
"""Print documentation for a list of rules, returns empty string."""
5359
width = max(16, *[len(rule.id) for rule in rules])

0 commit comments

Comments
 (0)