-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BEAM-2241] Renames some python classes and functions that were unnecessarily public #3036
Conversation
R: @aaltay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @chamikaramj. This is great.
Given the size and pending release, adding another reviewer might be useful.
@@ -72,7 +72,9 @@ def MakeXyzs(v): | |||
|
|||
|
|||
class CoderRegistry(object): | |||
"""A coder registry for typehint/coder associations.""" | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
register_coder
coder is public, this class is not internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted this update.
@@ -58,7 +60,9 @@ class AuthenticationException(retry.PermanentException): | |||
|
|||
|
|||
class GCEMetadataCredentials(OAuth2Credentials): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be just renamed to _ GCEMetadataCredentials
all users of it should be in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -31,7 +31,9 @@ | |||
|
|||
|
|||
class CellCommitState(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not look like there is much public interfaces in this file. Should we add __all__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an empty all so that methods here will not be imported by an import *.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like lint was crashing due to this change (empty all tag) for some reason. So had to revert this.
@@ -36,7 +36,9 @@ | |||
|
|||
|
|||
class MetricKey(object): | |||
"""Key used to identify instance of metric cell. | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just update the comment at the top of the file that says Internal classes for Metrics API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top level comment should be enough. Updated.
@@ -72,7 +77,9 @@ def __init__(self, do_fn, method_name): | |||
|
|||
|
|||
class DoFnSignature(object): | |||
"""Represents the signature of a given ``DoFn`` object. | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would not these be useful for an implementer of a new runner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comment from DoFnSignature, DoFnInvoker, and implementations of DoFnInvoker.
@@ -533,6 +550,7 @@ def counter_for(self, aggregator): | |||
|
|||
# TODO(robertwb): Replace core.DoFnContext with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sb2nov - Unrelated to PR. Is this another opportunity for removing backward compatibility code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll look into it.
@@ -15,7 +15,9 @@ | |||
# limitations under the License. | |||
# | |||
|
|||
"""Dataflow client utility functions.""" | |||
""" For internal use only. No backwards compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it enough to just add this comment here and not add the same comment to individual classes in this file?
For example iobase.py only comment is added to the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from classes. Top level comment should be enough.
R: @sb2nov |
@@ -97,7 +98,9 @@ def get_estimated_size_and_observables(self, value, nested=False): | |||
|
|||
|
|||
class SimpleCoderImpl(CoderImpl): | |||
"""Subclass of CoderImpl implementing stream methods using encode/decode.""" | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to check if the DocString still renders correctly as I thought the first line acted as a summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the thinking was that if the class should not be used by users, it might be good to have this as a summary. Also, I generated a doc using pydoc and this doesn't seem to be being rendered in a special way at least for that tool.
…lic. Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes). Marks some of the modules as experimental.
e6f90ec
to
bba46a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. PTAL.
@@ -72,7 +72,9 @@ def MakeXyzs(v): | |||
|
|||
|
|||
class CoderRegistry(object): | |||
"""A coder registry for typehint/coder associations.""" | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted this update.
@@ -58,7 +60,9 @@ class AuthenticationException(retry.PermanentException): | |||
|
|||
|
|||
class GCEMetadataCredentials(OAuth2Credentials): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -31,7 +31,9 @@ | |||
|
|||
|
|||
class CellCommitState(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an empty all so that methods here will not be imported by an import *.
@@ -36,7 +36,9 @@ | |||
|
|||
|
|||
class MetricKey(object): | |||
"""Key used to identify instance of metric cell. | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top level comment should be enough. Updated.
@@ -72,7 +77,9 @@ def __init__(self, do_fn, method_name): | |||
|
|||
|
|||
class DoFnSignature(object): | |||
"""Represents the signature of a given ``DoFn`` object. | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comment from DoFnSignature, DoFnInvoker, and implementations of DoFnInvoker.
@@ -15,7 +15,9 @@ | |||
# limitations under the License. | |||
# | |||
|
|||
"""Dataflow client utility functions.""" | |||
""" For internal use only. No backwards compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from classes. Top level comment should be enough.
@@ -97,7 +98,9 @@ def get_estimated_size_and_observables(self, value, nested=False): | |||
|
|||
|
|||
class SimpleCoderImpl(CoderImpl): | |||
"""Subclass of CoderImpl implementing stream methods using encode/decode.""" | |||
"""For internal use only; no backwards-compatibility guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the thinking was that if the class should not be used by users, it might be good to have this as a summary. Also, I generated a doc using pydoc and this doesn't seem to be being rendered in a special way at least for that tool.
LGTM (assuming the tests will pass). |
LGTM |
… unnecessarily public. Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes). Marks some of the modules as experimental.
Adds a note to documentation of classes that are public but should be only used internally by the SDK (non-user facing classes).
Marks some of the modules as experimental.
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
[BEAM-<Jira issue #>] Description of pull request
mvn clean verify
.<Jira issue #>
in the title with the actual Jira issuenumber, if there is one.
Individual Contributor License Agreement.