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

enable smart_open to operate without docstrings #406

Merged
merged 1 commit into from
Jan 8, 2020
Merged

enable smart_open to operate without docstrings #406

merged 1 commit into from
Jan 8, 2020

Conversation

mpenkov
Copy link
Collaborator

@mpenkov mpenkov commented Jan 8, 2020

Motivation

Fix #396

The below command was causing a crash:

$ python -OO -c 'import smart_open'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/misha/git/smart_open/smart_open/__init__.py", line 27, in <module>
    from .smart_open_lib import open, smart_open, register_compressor
  File "/home/misha/git/smart_open/smart_open/smart_open_lib.py", line 368, in <module>
    doctools.extract_kwargs(smart_open_s3.open.__doc__),
  File "/home/misha/git/smart_open/smart_open/doctools.py", line 66, in extract_kwargs
    lines = inspect.cleandoc(docstring).split('\n')
  File "/usr/lib/python3.6/inspect.py", line 620, in cleandoc
    lines = doc.expandtabs().split('\n')
AttributeError: 'NoneType' object has no attribute 'expandtabs'

The present PR fixes the underlying issue.

Checklist

Before you create the PR, please make sure you have:

  • Picked a concise, informative and complete title
  • Clearly explained the motivation behind the PR
  • Linked to any existing issues that your PR will be solving
  • Included tests for any new functionality
  • Checked that all unit tests pass

@mpenkov mpenkov requested a review from piskvorky January 8, 2020 07:42
@mpenkov mpenkov changed the title enable smart_run to operate without docstrings enable smart_open to operate without docstrings Jan 8, 2020
Copy link
Owner

@piskvorky piskvorky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with that -00 mode or doctools workarounds, but the code itself looks fine 👍

@mpenkov mpenkov merged commit acd4581 into piskvorky:master Jan 8, 2020
@mpenkov mpenkov deleted the docstrings branch January 8, 2020 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doctools.py throws error when executing python with -OO optimization level
2 participants