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

Commit f702d3e

Browse files
Zac-HDhumitos
andauthored
Fix _Opt deprecation warnings (#313)
* Fix _Opt deprecation warnings * Update extension.py --------- Co-authored-by: Manuel Kaufmann <[email protected]>
1 parent a2f83db commit f702d3e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

hoverxref/extension.py

+6-5
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] = opt.default if hasattr(opt, "default") else opt[0]
6868

6969
for attr in dir(app.config):
7070
if attr.startswith('hoverxref_'):
@@ -264,7 +264,8 @@ def setup_theme(app, exception):
264264
"""
265265
css_file = None
266266
theme = app.config.html_theme
267-
default, rebuild, types = app.config.values.get('hoverxref_modal_class')
267+
opt = app.config.values['hoverxref_modal_class']
268+
default = opt.default if hasattr(opt, "default") else opt[0]
268269
if theme == 'sphinx_material':
269270
if app.config.hoverxref_modal_class == default:
270271
app.config.hoverxref_modal_class = 'md-typeset'
@@ -296,8 +297,8 @@ def setup_assets_policy(app, exception):
296297

297298
def deprecated_configs_warning(app, exception):
298299
"""Log warning message if old configs are used."""
299-
default, rebuild, types = app.config.values.get('hoverxref_tooltip_api_host')
300-
if app.config.hoverxref_tooltip_api_host != default:
300+
opt = app.config.values['hoverxref_tooltip_api_host']
301+
if app.config.hoverxref_tooltip_api_host != (opt.default if hasattr(opt, "default") else opt[0]):
301302
message = '"hoverxref_tooltip_api_host" is deprecated and replaced by "hoverxref_api_host".'
302303
logger.warning(message)
303304
app.config.hoverxref_api_host = app.config.hoverxref_tooltip_api_host

0 commit comments

Comments
 (0)