Skip to content

Commit

Permalink
enable smart_run to operate without docstrings (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenkov authored Jan 8, 2020
1 parent 52d300f commit acd4581
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions smart_open/doctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def extract_kwargs(docstring):
('bar', 'str, optional', ['This parameter is the bar.'])
"""
if not docstring:
return []

lines = inspect.cleandoc(docstring).split('\n')
retval = []

Expand Down
5 changes: 4 additions & 1 deletion smart_open/smart_open_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ def open(
return decoded


open.__doc__ = open.__doc__ % {
#
# The docstring can be None if -OO was passed to the interpreter.
#
open.__doc__ = None if open.__doc__ is None else open.__doc__ % {
's3': doctools.to_docstring(
doctools.extract_kwargs(smart_open_s3.open.__doc__),
lpad=u' ',
Expand Down

0 comments on commit acd4581

Please sign in to comment.