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

AttributeError in new for loop checking #19

Closed
dopplershift opened this issue Mar 19, 2018 · 4 comments · Fixed by wemake-services/wemake-django-template#249 or wemake-services/wemake-django-template#250

Comments

@dopplershift
Copy link
Contributor

I'm getting this error now that I updated to 1.1.0:

Traceback (most recent call last):
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/flake8/checker.py", line 648, in _run_checks
    return checker.run_checks()
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/flake8/checker.py", line 579, in run_checks
    self.run_ast_checks()
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/flake8/checker.py", line 493, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/flake8_builtins.py", line 73, in run
    for line, offset, msg, rtype in value:
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/flake8_builtins.py", line 129, in check_for_loop
    if name.id in BUILTINS:
AttributeError: 'Tuple' object has no attribute 'id'

I'm seeing this on Windows, Linux, and Mac on 2.7, 3.5, 3.6. This example code (which pulls a tuple out during iteration) is enough to trigger the error (and removing that line makes the error go away):

a = [('a', 'b'), ('c', 'd')]
for i, (x, y) in enumerate(a):
    print(i, x, y)
@gforcada
Copy link
Owner

@dopplershift thanks, I was not expecting this one :-) I will try to fix it as soon as I can, pull requests are welcome, of course.

@dhood
Copy link

dhood commented Mar 19, 2018

@dhood
Copy link

dhood commented Mar 19, 2018

For reference, the code being checked that caused our error is here (both subdirectories are checked) and I noticed that there is at least one instance of a tuple in the for loop at https://github.com/ros2/rosidl/blob/774a3cd4509f2d432b7325f60434765a9ccd5cee/rosidl_parser/test/test_parse_primitive_value_string.py#L63

@dopplershift
Copy link
Contributor Author

Fix (with test) in #20 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants