Skip to content

TypeError: 'NamesConsumer' object does not support indexing #120

@simobasso

Description

@simobasso

how to reproduce:

freeze

astroid==1.6.1
Django==1.11
isort==4.2.15
lazy-object-proxy==1.3.1
mccabe==0.6.1
pylint==1.8.2
pylint-django==0.8.0
pylint-plugin-utils==0.2.6
pytz==2017.3
six==1.11.0
wrapt==1.10.11

R0201.py

class Foo(object):
    def bar(self, baz):
        return 33

command

pylint --load-plugins=pylint_django  R0201.py

output

No config file found, using default configuration
************* Module R0201
C:  1, 0: Module name "R0201" doesn't conform to snake_case naming style (invalid-name)
C:  1, 0: Missing module docstring (missing-docstring)
C:  1, 0: Missing class docstring (missing-docstring)
C:  2, 4: Black listed name "bar" (blacklisted-name)
C:  2, 4: Black listed name "baz" (blacklisted-name)
C:  2, 4: Missing method docstring (missing-docstring)
W:  2,18: Unused argument 'baz' (unused-argument)
R:  2, 4: Method could be a function (no-self-use)
R:  1, 0: Too few public methods (1/2) (too-few-public-methods)
Traceback (most recent call last):
  File "~/.pyenv/versions/pylint-django-try/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/lint.py", line 1347, in __init__
    linter.check(args)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/lint.py", line 768, in check
    self._do_check(files_or_modules)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/lint.py", line 901, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/lint.py", line 980, in check_astroid_module
    walker.walk(ast_node)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint/utils.py", line 1016, in walk
    cb(astroid)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint_django/augmentations/__init__.py", line 671, in wrap_func
    with_method(orig_method, *args, **kwargs)
  File "~/.pyenv/versions/3.6.3/envs/pylint-django-try/lib/python3.6/site-packages/pylint_django/augmentations/__init__.py", line 290, in ignore_import_warnings_for_related_fields
    iterat = to_consume[0].items if PY3 else to_consume[0].iteritems

expected (as pylint 1.7.5 works)

No config file found, using default configuration
************* Module R0201
C:  1, 0: Missing module docstring (missing-docstring)
C:  1, 0: Missing class docstring (missing-docstring)
C:  2, 4: Black listed name "bar" (blacklisted-name)
C:  2, 4: Black listed name "baz" (blacklisted-name)
C:  2, 4: Missing method docstring (missing-docstring)
W:  2,18: Unused argument 'baz' (unused-argument)
W:  1, 0: Unused variable '__class__' (unused-variable)
R:  2, 4: Method could be a function (no-self-use)
R:  1, 0: Too few public methods (1/2) (too-few-public-methods)

----------------------------------------------------------------------
Your code has been rated at -20.00/10 (previous run: -20.00/10, +0.00)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions