Fix undefined name: StateSamplerInfo on line 58#4561
Closed
cclauss wants to merge 2 commits into
Closed
Conversation
Contributor
|
Perhaps this merits adding a test as well? |
Author
|
#4610 is the test for finding regressions on this fix. |
1534233 to
72bfa62
Compare
cclauss
pushed a commit
to cclauss/beam
that referenced
this pull request
Mar 5, 2018
My sense is that __E901,E999,F821,F822,F823__ are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. The other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety. I would therefore suggest replacing __--select=E999__ with __--select=E901,E999,F822,F823__ because the codebase currently passes all of these tests and we would like to avoid any backsliding. We would also want to add __F821__ (undefined names!) to that list but work must be completed on basestring, buffer(), cmp(), file(), unicode, xrange(), and apache#4561 before that can be done. * F821: undefined name `name` * F822: undefined name `name` in `__all__` * F823: local variable `name` referenced before assignment * E901: SyntaxError or IndentationError * E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
10 tasks
Contributor
|
Though this is only a small amount of code, it seems odd to duplicate it. Is there a better common location to put it? |
1d5acbd to
48b1a9e
Compare
Author
|
Remove duplicate definition and switch to from apache_beam.runners.worker.statesampler import StateSamplerInfo. |
__StateSamplerInfo__ definition copied from https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/worker/statesampler.py#L32-L34 flake8 testing of https://github.com/apache/beam $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./sdks/python/apache_beam/runners/worker/statesampler_slow.py:54:12: F821 undefined name 'StateSamplerInfo' return StateSamplerInfo( ^ ```
Author
|
@robertwb Is this the solution you were looking for? |
Contributor
|
Resolved merge conflicts. Jenkins: retest this please. |
Author
|
No longer required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
StateSamplerInfo definition copied from https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/worker/statesampler.py#L32-L34
flake8 testing of https://github.com/apache/beam
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics