Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

NameError: name 'token' is not defined #142

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

NameError: name 'token' is not defined #142

jquast opened this issue Oct 10, 2015 · 2 comments

Comments

@jquast
Copy link

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
Copy link
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.

@jquast
Copy link
Author

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 added a commit to phlax/pootle that referenced this issue Nov 28, 2015
phlax added a commit to phlax/pootle that referenced this issue Nov 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants