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

pydocstyle fails on "raise X from Y" #196

Closed
Nurdok opened this Issue Jul 2, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@Nurdok
Copy link
Member

Nurdok commented Jul 2, 2016

The reason is that the "from" keyword triggers a "from X import Y" parsing, which fails.

C:\Users\rachum\code\testing_grounds>cat example.py
raise RuntimeError() from None
C:\Users\rachum\code\testing_grounds>python example.py  # this syntax is legal in Python 3
Traceback (most recent call last):
  File "example.py", line 1, in <module>
    raise RuntimeError() from None
RuntimeError

C:\Users\rachum\code\testing_grounds>pydocstyle example.py
Traceback (most recent call last):
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\rachum\AppData\Local\Programs\Python\Python35-32\Scripts\pydocstyle.exe\__main__.py", line 9, in <module>
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 1745, in main
    sys.exit(run_pydocstyle(use_pep257))
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 1360, in run_pydocstyle
    errors.extend(check((filename,), select=checked_codes))
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 1297, in check
    for error in PEP257Checker().check_source(source, filename):
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 1398, in check_source
    module = parse(StringIO(source), filename)
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 276, in __call__
    return self.parse_module()
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 429, in parse_module
    children = list(self.parse_definitions(Module, all=True))
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 376, in parse_definitions
    self.parse_from_import_statement()
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 510, in parse_from_import_statement
    is_future_import = self._parse_from_import_source()
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 525, in _parse_from_import_source
    self.check_current(value='import')
  File "c:\users\rachum\appdata\local\programs\python\python35-32\lib\site-packages\pydocstyle.py", line 501, in check_current
    assert kind_valid and value_valid, msg
AssertionError:
Unexpected token at line 2:

In file: example.py

Got kind tk.ENDMARKER
Got value
@blueyed

This comment has been minimized.

Copy link

blueyed commented Sep 5, 2016

Should this be on the 1.1.0 milestone? (https://github.com/PyCQA/pydocstyle/milestone/4)

Any progress / insights on this one?

@Nurdok

This comment has been minimized.

Copy link
Member

Nurdok commented Sep 5, 2016

This is solved in #200 and it will definitely be in the next release - still working on the PR though. Hopefully it will be done this week.

@Nurdok Nurdok added this to the pydocstyle 1.1.0 milestone Sep 5, 2016

@Nurdok Nurdok closed this in #200 Sep 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment