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

Closed
OJFord opened this issue May 10, 2018 · 4 comments
Assignees

Comments

@OJFord
Copy link

@OJFord OJFord commented May 10, 2018

With an __all__ like:

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

__all__ = (
    *other_all,
    'something',
)

I see:

WARNING: Error in file path/to/__init__.py: 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__: http://stackoverflow.com/q/44834/. ')

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
@shacharoo

This comment has been minimized.

Copy link
Member

@shacharoo shacharoo commented Jun 6, 2018

This will be solved by #297 .

@OJFord

This comment has been minimized.

Copy link
Author

@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.

@shacharoo

This comment has been minimized.

Copy link
Member

@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):
)

@Nurdok

This comment has been minimized.

Copy link
Member

@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
Projects
3 participants
You can’t perform that action at this time.