Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit 3d67c80

Browse files
authored
Fix _Opt deprecation warnings
1 parent f8947fa commit 3d67c80

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

hoverxref/extension.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ def copy_asset_files(app, exception):
6161
if exception is None: # build succeeded
6262

6363
context = {}
64-
for attr in app.config.values:
64+
for attr, opt in app.config.values.items():
6565
if attr.startswith('hoverxref_'):
6666
# First, add the default values to the context
67-
context[attr] = app.config.values[attr][0]
67+
context[attr] = getattr(opt, "default", opt[0])
6868

6969
for attr in dir(app.config):
7070
if attr.startswith('hoverxref_'):
@@ -277,7 +277,8 @@ def setup_theme(app, exception):
277277
"""
278278
css_file = None
279279
theme = app.config.html_theme
280-
default, rebuild, types = app.config.values.get('hoverxref_modal_class')
280+
opt = app.config.values['hoverxref_modal_class']
281+
default = getattr(opt, "default", opt[0])
281282
if theme == 'sphinx_material':
282283
if app.config.hoverxref_modal_class == default:
283284
app.config.hoverxref_modal_class = 'md-typeset'
@@ -309,8 +310,8 @@ def setup_assets_policy(app, exception):
309310

310311
def deprecated_configs_warning(app, exception):
311312
"""Log warning message if old configs are used."""
312-
default, rebuild, types = app.config.values.get('hoverxref_tooltip_api_host')
313-
if app.config.hoverxref_tooltip_api_host != default:
313+
opt = app.config.values['hoverxref_tooltip_api_host']
314+
if app.config.hoverxref_tooltip_api_host != getattr(opt, "default", opt[0]):
314315
message = '"hoverxref_tooltip_api_host" is deprecated and replaced by "hoverxref_api_host".'
315316
logger.warning(message)
316317
app.config.hoverxref_api_host = app.config.hoverxref_tooltip_api_host

0 commit comments

Comments
 (0)