403Webshell
Server IP : 104.21.38.3  /  Your IP : 108.162.226.2
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/hamcrest/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/hamcrest/core/base_description.py
from typing import Any, Iterable

from hamcrest.core.description import Description
from hamcrest.core.helpers.hasmethod import hasmethod
from hamcrest.core.helpers.ismock import ismock

__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"


class BaseDescription(Description):
    """Base class for all :py:class:`~hamcrest.core.description.Description`
    implementations.

    """

    def append_text(self, text: str) -> Description:
        self.append(text)
        return self

    def append_description_of(self, value: Any) -> Description:
        if not ismock(value) and hasmethod(value, "describe_to"):
            value.describe_to(self)
        elif isinstance(value, str):
            self.append(repr(value))
        else:
            description = str(value)
            if description[:1] == "<" and description[-1:] == ">":
                self.append(description)
            else:
                self.append("<")
                self.append(description)
                self.append(">")
        return self

    def append_list(self, start: str, separator: str, end: str, list: Iterable[Any]) -> Description:
        separate = False

        self.append(start)
        for item in list:
            if separate:
                self.append(separator)
            self.append_description_of(item)
            separate = True
        self.append(end)
        return self

    def append(self, string: str) -> None:
        """Append the string to the description."""
        raise NotImplementedError("append")

    def append_string_in_python_syntax(self, string: str) -> None:
        self.append("'")
        for ch in string:
            self.append(character_in_python_syntax(ch))
        self.append("'")


def character_in_python_syntax(ch: str) -> str:
    if ch == "'":
        return "'"
    elif ch == "\n":
        return "\\n"
    elif ch == "\r":
        return "\\r"
    elif ch == "\t":
        return "\\t"
    else:
        return ch

Youez - 2016 - github.com/yon3zu
LinuXploit