PHP 7.4.33
Preview: hookable.py Size: 1.29 KB
//usr/lib/python3/dist-packages/zope/component/hookable.py
##############################################################################
#
# Copyright (c) 2009 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.
#
##############################################################################
""" This module supplies a pure-Python version of zope.hookable.hookable.
"""
class hookable(object):
    __slots__ = ('__original', '__implementation')

    original = property(lambda self: self.__original,)
    implementation = property(lambda self: self.__implementation,)

    def __init__(self, implementation):
        self.__original = self.__implementation = implementation

    def sethook(self, newimplementation):
        old, self.__implementation = self.__implementation, newimplementation
        return old

    def reset(self):
        self.__implementation = self.__original

    def __call__(self, *args, **kw):
        return self.__implementation(*args, **kw)

Directory Contents

Dirs: 3 × Files: 21
Name Size Perms Modified Actions
testfiles DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
tests DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
444 B lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.20 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
2.04 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.71 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
2.67 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.29 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
4.18 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
4.25 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
16.28 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.12 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
2.05 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
2.14 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
3.54 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.18 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.23 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
4.09 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
19.94 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
8.83 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
962 B lrw-r--r-- 2016-08-26 07:39:24
Edit Download
1.87 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
2.68 KB lrw-r--r-- 2016-08-26 07:39:24
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).