Server IP : 195.201.23.43 / Your IP : 13.58.173.156 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/zope/hookable/ |
Upload File : |
############################################################################## # # Copyright (c) 2003 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Hookable object support """ import os import platform _PYPY = platform.python_implementation() in ('PyPy', 'Jython') _PURE_PYTHON = os.environ.get('PURE_PYTHON', _PYPY) class _py_hookable(object): __slots__ = ('_original', '_implementation') def __init__(self, *args, **kw): if not args and 'implementation' in kw: args = (kw.pop('implementation'),) if kw: raise TypeError('Unknown keyword arguments') if len(args) != 1: raise TypeError('Exactly one argument required') self._original = self._implementation = args[0] @property def original(self): return self._original @property def implementation(self): return self._implementation @property def __doc__(self): return self._original.__doc__ @property def __dict__(self): return getattr(self._original, '__dict__', {}) @property def __bases__(self): return getattr(self._original, '__bases__', ()) def sethook(self, new_callable): old, self._implementation = self._implementation, new_callable return old def reset(self): self._implementation = self._original def __call__(self, *args, **kw): return self._implementation(*args, **kw) try: from zope.hookable._zope_hookable import hookable as _c_hookable except ImportError: # pragma: no cover _c_hookable = None if _PURE_PYTHON or _c_hookable is None: # pragma: no cover hookable = _py_hookable else: hookable = _c_hookablePrivate