CyberAlphaWolf

Server : Apache
System : Linux 182.49.167.72.host.secureserver.net 4.18.0-553.92.1.el8_10.x86_64 #1 SMP Wed Jan 14 06:31:58 EST 2026 x86_64
User : kikai ( 1014)
PHP Version : 8.3.30
Disable Function : NONE
Directory :  /var/opt/nydus/ops/oscrypto/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/opt/nydus/ops/oscrypto/_errors.py
# coding: utf-8

"""
Helper for formatting exception messages. Exports the following items:

 - pretty_message()
"""

from __future__ import unicode_literals, division, absolute_import, print_function

import re
import textwrap


__all__ = [
    'pretty_message',
]


def pretty_message(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

XYZEAZ - Cyber Alpha Wolf © All Rights Reserved