Skip to content

Hide certain implementation specific classes/variables#1684

Merged
lzchen merged 7 commits intoopen-telemetry:mainfrom
lzchen:ele
Mar 10, 2021
Merged

Hide certain implementation specific classes/variables#1684
lzchen merged 7 commits intoopen-telemetry:mainfrom
lzchen:ele

Conversation

@lzchen
Copy link
Copy Markdown
Contributor

@lzchen lzchen commented Mar 9, 2021

Fixes #1640

@lzchen lzchen requested review from a team, ocelotl and owais and removed request for a team March 9, 2021 18:54
Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

LGTM


@abstractmethod
def attach(self, context: Context) -> object:
"""Sets the current `Context` object. Returns a
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why remove the documentation? It is very possible that this documentation applies for all implementations of this abstract method.

Also this:

from abc import ABC, abstractmethod
from inspect import getdoc


class Parent(ABC):
    @abstractmethod
    def method(self):
        """
        The documentation for method
        """


class Child(Parent):

    def method(self):
        pass


print(getdoc(Child().method))
The documentation for method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since _RuntimeContext is used internally, we do not expect anyone to inherit it and implement a context on their own. As well, since we are hiding the class via protected, the documentation will not show up in readthedocs anyways.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still nice to have for us so if you mouse a call site, IDEs will show the docstring

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I added to both.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I still think it would be convenient to keep the documentation since there will be classes that will inherit from this one, but this is pretty much a nit, so approving.

@lzchen lzchen closed this Mar 10, 2021
@lzchen lzchen reopened this Mar 10, 2021
@lzchen lzchen merged commit c81fd5e into open-telemetry:main Mar 10, 2021
@lzchen lzchen deleted the ele branch March 10, 2021 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider hiding implementation elements

5 participants