# coding: utf-8 """ Helper for formatting exception messages. Exports the following items: - unwrap() """ from __future__ import unicode_literals, division, absolute_import, print_function import re import textwrap def unwrap(string, *params): """ Takes a multi-line string and does the following: - dedents - converts newlines with text before and after into a single line - strips leading and trailing whitespace :param string: The string to format :param *params: Params to interpolate into the string :return: The formatted string """ output = textwrap.dedent(string) # Unwrap lines, taking into account bulleted lists, ordered lists and # underlines consisting of = signs if output.find('\n') != -1: output = re.sub('(?<=\\S)\n(?=[^ \n\t\\d\\*\\-=])', ' ', output) if params: output = output % params output = output.strip() return output
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
_perf | Folder | 0755 |
|
|
__init__.py | File | 209 B | 0644 |
|
_elliptic_curve.py | File | 9.2 KB | 0644 |
|
_errors.py | File | 967 B | 0644 |
|
_ffi.py | File | 738 B | 0644 |
|
_inet.py | File | 4.55 KB | 0644 |
|
_int.py | File | 4.51 KB | 0644 |
|
_iri.py | File | 8.43 KB | 0644 |
|
_ordereddict.py | File | 4.43 KB | 0644 |
|
_teletex_codec.py | File | 4.93 KB | 0644 |
|
_types.py | File | 939 B | 0644 |
|
algos.py | File | 33.3 KB | 0644 |
|
cms.py | File | 24.53 KB | 0644 |
|
core.py | File | 153.57 KB | 0644 |
|
crl.py | File | 15.73 KB | 0644 |
|
csr.py | File | 2.09 KB | 0644 |
|
keys.py | File | 34.36 KB | 0644 |
|
ocsp.py | File | 17.38 KB | 0644 |
|
parser.py | File | 8.93 KB | 0644 |
|
pdf.py | File | 2.2 KB | 0644 |
|
pem.py | File | 6 KB | 0644 |
|
pkcs12.py | File | 4.46 KB | 0644 |
|
tsp.py | File | 7.64 KB | 0644 |
|
util.py | File | 17.62 KB | 0644 |
|
version.py | File | 154 B | 0644 |
|
x509.py | File | 90.14 KB | 0644 |
|