(docstring)
return "\n".join(trimmed)
trim function from PEP-257
trim function from PEP-257
trim function from PEP - 257
def trim(docstring):
    # Copyright 2015: Mirantis Inc.
    # All Rights Reserved.
    #
    #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    #    not use this file except in compliance with the License. You may obtain
    #    a copy of the License at
    #
    #         http://www.apache.org/licenses/LICENSE-2.0
    #
    #    Unless required by applicable law or agreed to in writing, software
    #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    #    License for the specific language governing permissions and limitations
    #    under the License.

    """trim function from PEP-257"""
    if not docstring:
        return ""
    # Convert tabs to spaces (following the normal Python rules)
    # and split into a list of lines:
    lines = docstring.expandtabs().splitlines()
    # Determine minimum indentation (first line doesn't count):
    indent = sys.maxsize
    for line in lines[1:]:
        stripped = line.lstrip()
        if stripped:
            indent = min(indent, len(line) - len(stripped))
    # Remove indentation (first line is special):
    trimmed = [lines[0].strip()]
    if indent < sys.maxsize:
        for line in lines[1:]:
            trimmed.append(line[indent:].rstrip())
    # Strip off trailing and leading blank lines:
    while trimmed and not trimmed[-1]:
        trimmed.pop()
    while trimmed and not trimmed[0]:
        trimmed.pop(0)

    # Current code/unittests expects a line return at
    # end of multiline docstrings
    # workaround expected behavior from unittests
    if "\n" in docstring:
        trimmed.append("")

    # Return a single string:
    return "\n".join(trimmed)
def trim ( docstring ) : # Copyright 2015: Mirantis Inc. # All Rights Reserved. # #    Licensed under the Apache License, Version 2.0 (the "License"); you may #    not use this file except in compliance with the License. You may obtain #    a copy of the License at # #         http://www.apache.org/licenses/LICENSE-2.0 # #    Unless required by applicable law or agreed to in writing, software #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #    License for the specific language governing permissions and limitations #    under the License. if not docstring : return "" # Convert tabs to spaces (following the normal Python rules) # and split into a list of lines: lines = docstring . expandtabs ( ) . splitlines ( ) # Determine minimum indentation (first line doesn't count): indent = sys . maxsize for line in lines [ 1 : ] : stripped = line . lstrip ( ) if stripped : indent = min ( indent , len ( line ) - len ( stripped ) ) # Remove indentation (first line is special): trimmed = [ lines [ 0 ] . strip ( ) ] if indent < sys . maxsize : for line in lines [ 1 : ] : trimmed . append ( line [ indent : ] . rstrip ( ) ) # Strip off trailing and leading blank lines: while trimmed and not trimmed [ - 1 ] : trimmed . pop ( ) while trimmed and not trimmed [ 0 ] : trimmed . pop ( 0 ) # Current code/unittests expects a line return at # end of multiline docstrings # workaround expected behavior from unittests if "\n" in docstring : trimmed . append ( "" ) # Return a single string: return "\n" . join ( trimmed )