Exemplo n.º 1
0
def create_multiline_string(text, maximum_line_length=120):
    def escape(t):
        return t.replace(u'"""', six.u(r'\"\"\"'))

    source_substring = u'"""\n{}"""'.format(u'\\\n'.join(
        chunkate_string(escape(text), maximum_line_length)))
    return Token(tokens.TYPE_MULTILINE_STRING, source_substring)
Exemplo n.º 2
0
def create_whitespace(source_substring):
    return Token(tokens.TYPE_WHITESPACE, source_substring)