Skip to content

Commit 2a7adb4

Browse files
Fix import order and enhance matplotlib mock for rcParams handling
1 parent 5b9a3af commit 2a7adb4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from codecs import open
2020
from datetime import datetime
2121
from sphinx.ext import autodoc
22+
from unittest.mock import MagicMock
2223

2324

2425
class MockedClassDocumenter(autodoc.ClassDocumenter):
@@ -51,18 +52,19 @@ def add_line(self, line: str, source: str, *lineno: int) -> None:
5152
'tqdm', 'print_color', 'jinja2', 'graphviz', 'PIL', 'tenacity', 'joblib'
5253
]
5354

54-
# Custom mock for matplotlib to handle rcParams assignment
55-
from unittest.mock import MagicMock
5655

56+
# Custom mock for matplotlib to handle rcParams assignment
5757
class MockRcParams(dict):
5858
"""Mock rcParams that behaves like a dict and supports item assignment."""
5959
def __setitem__(self, key, value):
6060
super().__setitem__(key, value)
6161

62+
6263
class MockMatplotlib(MagicMock):
6364
"""Mock matplotlib with properly configured rcParams."""
6465
rcParams = MockRcParams()
65-
66+
67+
6668
sys.modules['matplotlib'] = MockMatplotlib()
6769
sys.modules['matplotlib.pyplot'] = MagicMock()
6870

0 commit comments

Comments
 (0)