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

Unexpected token kind tk.OP when __all__ contains non str literals; noqa does not help #313

OJFord opened this issue May 10, 2018 · 4 comments


Copy link

@OJFord OJFord commented May 10, 2018

With an __all__ like:

from .other import __all__ as other_all
from .other import *

__all__ = (

I see:

WARNING: Error in file path/to/ Unexpected token kind in  __all__: tk.OP.
That means pydocstyle cannot decide which definitions are
public. Variable __all__ should be present at most once in
each file, in form
`__all__ = ('a_public_function', 'APublicClass', ...)`.
More info on __all__: ')

Thinking the 'present at most once' was a clue, I changed to using from . import other and *other.__all__, but got the same error.

Either of these seems to work as Python, but it cannot be ignored with # noqa.

@shacharoo shacharoo self-assigned this Jun 6, 2018
@Nurdok Nurdok added this to In progress in Pydocstyle 2.2.0 Jun 6, 2018
@Nurdok Nurdok assigned Nurdok and unassigned shacharoo Jun 6, 2018

This comment has been minimized.

Copy link

@shacharoo shacharoo commented Jun 6, 2018

This will be solved by #297 .


This comment has been minimized.

Copy link

@OJFord OJFord commented Jun 16, 2018

@shacharoo Will it? - the error persists even with a module docstring.

I would have thought that resolving #297 will just mean that if there's no docstring it complains about that; then either way still chokes on non-trivial __all__s when it attempts to parse the rest of the file.


This comment has been minimized.

Copy link

@shacharoo shacharoo commented Jun 16, 2018

@OJFord - @Nurdok and I discussed it and we're gonna change the all parsing to be best-effort. If the parsing of all fails we will just assume that every "public looking" function / class will be checked (just like it is now:

def is_public(self):


This comment has been minimized.

Copy link

@Nurdok Nurdok commented Oct 14, 2018

Fixed by #320.

@Nurdok Nurdok closed this Oct 14, 2018
Pydocstyle 2.2.0 automation moved this from In progress to Done Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.