NameError: name 'token' is not defined #142

Closed
jquast opened this Issue Oct 10, 2015 · 2 comments

Projects

None yet

2 participants

@jquast
jquast commented Oct 10, 2015

From latest release,

Traceback (most recent call last):
  File "/Users/docker/Code/telnetlib3/.tox/sa/bin/prospector", line 11, in <module>
    sys.exit(main())
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/prospector/run.py", line 143, in main
    prospector.execute()
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/prospector/run.py", line 52, in execute
    messages += tool.run(found_files)
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/prospector/tools/pep257/__init__.py", line 42, in run
    code_file,
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/pep257.py", line 1313, in check_source
    module = parse(StringIO(source), filename)
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/pep257.py", line 259, in __call__
    return self.parse_module()
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/pep257.py", line 409, in parse_module
    children = list(self.parse_definitions(Module, all=True))
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/pep257.py", line 343, in parse_definitions
    self.parse_all()
  File "/Users/docker/Code/telnetlib3/.tox/sa/lib/python3.4/site-packages/pep257.py", line 392, in parse_all
    kind = token.tok_name[self.current.kind]
NameError: name 'token' is not defined

File content that reproduces,

"""
telnetlib3: a Telnet Protocol implemented in python.

Requires Python 3.3 or 3.4. and the 'asyncio' module
(to be distributed with python3.4). See the README file
for details.
"""
__author__ = "Jeffrey Quast"
__url__ = u'https://github.com/jquast/telnetlib3/'
__copyright__ = "Copyright 2013"
__credits__ = ["Jim Storch", "Wijnand Modderman-Lenstra"]
__license__ = 'ISC'

from .server import *
from .client import *
from .telsh import *
from .telopt import *
from .slc import *
from .conio import *

__all__ = (server.__all__ +
           client.__all__ +
           telsh.__all__ +
           telopt.__all__ +
           slc.__all__ +
           conio.__all__)

Suggest TTD resolution by coverage.

@Nurdok Nurdok added a commit to Nurdok/pydocstyle that referenced this issue Oct 10, 2015
@Nurdok Nurdok Fixed the creation of an AllError when there is an unexpected token
as per #142
b55c834
@Nurdok
Member
Nurdok commented Oct 12, 2015

This is fixed is #143. Note that this file will cause an AllError to be raised - the NameError was raised while creating the message for the AllError. pep257 can't determine the value of __all__ in this context.

@Nurdok Nurdok closed this Oct 12, 2015
@jquast
jquast commented Oct 19, 2015

I'm using a tuple, if pep257 cannot determine it, it probably shouldn't recommend that I do what I'm already doing, still a bug as superfluous reporting IMO

@phlax phlax added a commit to phlax/pootle that referenced this issue Nov 28, 2015
@phlax phlax Pinning pep257 due to bug e3d9709
@phlax phlax added a commit to phlax/pootle that referenced this issue Nov 28, 2015
@phlax phlax Pinning pep257 due to bug be3f90d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment