-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Ability to silence more than one target found for cross-reference warning #3866
Comments
+1. I will add new filter to |
I think this actually is a bigger issue... I think the issue is the auto-linking for int, string, and, float types in Info field lists. I tried to scale this down to one case which can be seen below: In one rst file:
In another rst file:
|
Thank you for quick response. reproduced! |
I think what would really help is the ability to just not make these links. For us it does not make sense and the links are not relevent. E.g. a link will link to a class in a different class in a different module that does not relate to the orginal link in anyway. We just need it to tell the data type instead. |
Here's a quick workaround to put in
|
@tliron thanks and sorry for the wait but while testing it out I get the error |
You will also need this:
|
Ah thanks.
|
Fix #3866: suppress pydomain ref warning
I understand that the feature requested was specifically to silence the warning, but I think some of us would like to turn off the feature entirely. To be honest, it's hard for me to imagine the use case for this feature. For those who want to turn off the feature, my patch would work. But it seems like this should be part of Sphinx. |
See sphinx-doc/sphinx#3866 for more information
Hi, I tried the workaround mentioned in #3866 (comment), but now I get another error:
See https://travis-ci.org/tornadoweb/tornado/jobs/291144347#L1444 Any guidance on this? |
@pitrou Is that related with this issue? And did you mean that is a bug of Sphinx? Thanks, |
@tk0miya, yes this is related, since I tried the workaround mentioned here after I got bitten by this issue. |
I came across this issue because I deliberately had created a "canonical path" for user import in my project, which obviously created the 'more than one target found' warning. I ended up adapting @tliron's response to override class MyPythonDomain(PythonDomain):
def find_obj(self, env, modname, classname, name, type, searchmode=0):
"""Ensures an object always resolves to the desired module if defined there."""
orig_matches = PythonDomain.find_obj(self, env, modname, classname, name, type, searchmode)
matches = []
for match in orig_matches:
match_name = match[0]
desired_name = _desired_base_module + '.' + name.strip('.')
if match_name == desired_name:
matches.append(match)
break
if matches:
return matches
else:
return orig_matches
def setup(sphinx):
"""Use MyPythonDomain in place of PythonDomain"""
sphinx.override_domain(MyPythonDomain) |
Summary: our config objects are being added to the index twice, once in the modules docs, once in the config docs. This change removes the config doc verions from the index. Long term we likely want to merge these, but for now, this will do. based on discussion here: sphinx-doc/sphinx#3866 Pull Request resolved: #165 Reviewed By: bethebunny Differential Revision: D13553706 Pulled By: m3rlin45 fbshipit-source-id: 62a23cce983e3e3a10a8169c990b9af9c12278bd
Sphinx attempts to create cross-references for attribute and variable names... sphinx-doc/sphinx#2549 sphinx-doc/sphinx#3866 This results in numerous warnings of the form... WARNING: more than one target found for cross-reference 'digest' Adapting a patch from the tickets above. Sphinx deprecated override_domain(), so using add_domain() instead... https://www.sphinx-doc.org/en/2.0/extdev/appapi.html#sphinx.application.Sphinx.override_domain
The @tliron patch needs a slight modification to work for Sphinx 3.4.3. In case someone finds this issue in google recently (like me), here it is: from sphinx.domains.python import PythonDomain
class PatchedPythonDomain(PythonDomain):
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
if 'refspecific' in node:
del node['refspecific']
return super(PatchedPythonDomain, self).resolve_xref(
env, fromdocname, builder, typ, target, node, contnode)
def setup(sphinx):
sphinx.add_domain(PatchedPythonDomain, override=True) |
Thank you! |
Subject: Feature request to extend the
suppress_warnings
functionProblem
A project that I work with currently has 1000+ warning from duplicate cross references.
WARNING: more than one target found for cross-reference 'float'
while e may be able to fix this later, it would be great if we can silence them in the mean time.Procedure to reproduce the problem
Create duplicate cross references.
Error logs / results
Expected results
The error should not appear.
Reproducible project / your project
https://developer.blender.org/diffusion/B/browse/master/doc/python_api/sphinx_doc_gen.py
Environment info
The text was updated successfully, but these errors were encountered: