Skip to content
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

Qualify attribute names for generated ivar #5129

Merged
merged 4 commits into from
Sep 23, 2018

Conversation

toslunar
Copy link
Contributor

Subject: Make Napoleon qualify attribute names for generated ivar

Feature or Bugfix

  • Feature

Purpose

This PR gives a partial fix of #4074. I hope this works in the most cases (an exception is the same attribute name in different classes with the same name, in python<3.3).

Detail

  • Make Napoleon apply a workaround that my team has manually done.
    For example, the Attributes items in
class A(object):
    """
    An A.

    Attributes:
        foo (int): Blah blah.
    """

will be treated as

    Attributes:
        ~module_name.A.foo (int): Blah blah.

which is converted to

    :ivar ~module_name.A.foo: Blah blah.
    :vartype ~module_name.A.foo: int

in order to avoid unintended links.

  • This PR does not break "manually fixed" lines.

Relates

@codecov
Copy link

codecov bot commented Jun 29, 2018

Codecov Report

Merging #5129 into master will decrease coverage by 0.01%.
The diff coverage is 27.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5129      +/-   ##
==========================================
- Coverage   82.31%   82.29%   -0.02%     
==========================================
  Files         297      297              
  Lines       39212    39223      +11     
  Branches     6033     6035       +2     
==========================================
+ Hits        32276    32279       +3     
- Misses       5602     5610       +8     
  Partials     1334     1334
Impacted Files Coverage Δ
sphinx/ext/napoleon/docstring.py 77.27% <27.27%> (-0.91%) ⬇️
sphinx/__init__.py 57.5% <0%> (-2.5%) ⬇️
sphinx/builders/html.py 82.73% <0%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1140e81...eb80fa6. Read the comment docs.

Copy link
Contributor

@RobRuana RobRuana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I would like to see at least one unit test that exercises the new code. Add a unit test, and I'll approve this!

@RobRuana RobRuana merged commit bd1e336 into sphinx-doc:master Sep 23, 2018
RobRuana added a commit that referenced this pull request Sep 23, 2018
@toslunar
Copy link
Contributor Author

Thank you very much for refactoring and merging this!

@toslunar toslunar deleted the napoleon-qual-ivar branch September 23, 2018 22:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants