-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix undefined name: StateSamplerInfo on line 58 #4561
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
Conversation
|
Perhaps this merits adding a test as well? |
|
#4610 is the test for finding regressions on this fix. |
1534233 to
72bfa62
Compare
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
|
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
|
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( ^ ```
|
@robertwb Is this the solution you were looking for? |
|
Resolved merge conflicts. Jenkins: retest this please. |
|
No longer required. |
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