Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loader: replace trim_docstring with builtin
The `trim_docstring` function can be replaced by a builtin function from the `inspect` module: `cleandoc`. See also: https://docs.python.org/2/library/inspect.html#inspect.cleandoc This: ``` inspect.cleandoc(func.__doc__ or '').splitlines() ``` Is functionnaly similar to this: ``` trim_docstring(func.__doc__) ``` It's even better, since the original function used to keep initial indent and empty multi-line between non-empty lines. Since it was used in one place only, it is safe to assume it can be replaced without loss for the project by the builtin `inspect.cleandoc` function. Example: ``` >>> data = """First line is not empty ... Second line is direct after it. ... ... Last line. ... ... """ >>> inspect.cleandoc(data).splitlines() ['First line is not empty', 'Second line is direct after it.', '', 'Last line.'] >>> trim_docstring(data) ['First line is not empty', ' Second line is direct after it.', '', ' Last line.'] ```
- Loading branch information