././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8150446 zope.hookable-6.0/0000755000076500000240000000000014507525664013017 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506104.0 zope.hookable-6.0/.coveragerc0000644000076500000240000000111314507520370015121 0ustar00jensstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code [run] source = zope.hookable # New in 5.0; required for the GHA coveralls submission. relative_files = True branch = true [paths] source = src/ .tox/*/lib/python*/site-packages/ .tox/pypy*/site-packages/ [report] show_missing = true precision = 2 exclude_lines = except ImportError: if __name__ == '__main__': pragma: no cover pragma: nocover raise AssertionError raise NotImplementedError raise unittest.Skip self.fail\( [html] directory = parts/htmlcov ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/.manylinux-install.sh0000755000076500000240000000371214507523234017116 0ustar00jensstaff#!/usr/bin/env bash # Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code set -e -x # Running inside docker # Set a cache directory for pip. This was # mounted to be the same as it is outside docker so it # can be persisted. export XDG_CACHE_HOME="/cache" # XXX: This works for macOS, where everything bind-mounted # is seen as owned by root in the container. But when the host is Linux # the actual UIDs come through to the container, triggering # pip to disable the cache when it detects that the owner doesn't match. # The below is an attempt to fix that, taken from bcrypt. It seems to work on # Github Actions. if [ -n "$GITHUB_ACTIONS" ]; then echo Adjusting pip cache permissions mkdir -p $XDG_CACHE_HOME/pip chown -R $(whoami) $XDG_CACHE_HOME fi ls -ld /cache ls -ld /cache/pip # We need some libraries because we build wheels from scratch: yum -y install libffi-devel tox_env_map() { case $1 in *"cp37"*) echo 'py37';; *"cp38"*) echo 'py38';; *"cp39"*) echo 'py39';; *"cp310"*) echo 'py310';; *"cp311"*) echo 'py311';; *"cp312"*) echo 'py312';; *) echo 'py';; esac } # Compile wheels for PYBIN in /opt/python/*/bin; do if \ [[ "${PYBIN}" == *"cp311"* ]] || \ [[ "${PYBIN}" == *"cp312"* ]] || \ [[ "${PYBIN}" == *"cp37"* ]] || \ [[ "${PYBIN}" == *"cp38"* ]] || \ [[ "${PYBIN}" == *"cp39"* ]] || \ [[ "${PYBIN}" == *"cp310"* ]] ; then "${PYBIN}/pip" install -e /io/ "${PYBIN}/pip" wheel /io/ -w wheelhouse/ if [ `uname -m` == 'aarch64' ]; then cd /io/ ${PYBIN}/pip install tox TOXENV=$(tox_env_map "${PYBIN}") ${PYBIN}/tox -e ${TOXENV} cd .. fi rm -rf /io/build /io/*.egg-info fi done # Bundle external shared libraries into the wheels for whl in wheelhouse/zope.hookable*.whl; do auditwheel repair "$whl" -w /io/wheelhouse/ done ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506104.0 zope.hookable-6.0/.manylinux.sh0000755000076500000240000000077514507520370015456 0ustar00jensstaff#!/usr/bin/env bash # Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code set -e -x # Mount the current directory as /io # Mount the pip cache directory as /cache # `pip cache` requires pip 20.1 echo Setting up caching python --version python -mpip --version LCACHE="$(dirname `python -mpip cache dir`)" echo Sharing pip cache at $LCACHE $(ls -ld $LCACHE) docker run --rm -e GITHUB_ACTIONS -v "$(pwd)":/io -v "$LCACHE:/cache" $DOCKER_IMAGE $PRE_CMD /io/.manylinux-install.sh ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506104.0 zope.hookable-6.0/.readthedocs.yaml0000644000076500000240000000123014507520370016227 0ustar00jensstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-22.04 tools: python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py # We recommend specifying your dependencies to enable reproducible builds: # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: install: - requirements: docs/requirements.txt - method: pip path: . ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/CHANGES.rst0000644000076500000240000000541214507523234014612 0ustar00jensstaff========= Changes ========= 6.0 (2023-10-05) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.12. 5.4 (2022-11-17) ================ - Add support for building arm64 wheels on macOS. 5.3 (2022-11-03) ================ - Add support for the final release of Python 3.11. 5.2 (2022-09-13) ================ - Add support for Python 3.10 and 3.11 (as of 3.11.0rc1). - Disable unsafe math optimizations in C code. See `pull request 25 `_. 5.1.0 (2021-07-20) ================== - Add support for Python 3.9. - Create Linux aarch64 wheels. 5.0.1 (2020-03-10) ================== - Stop using the setuptools ``Feature`` class, allowing this project to be built from source with newer versions of setuptools that remove that functionality. 5.0.0 (2019-11-12) ================== - Add support for Python 3.7 and 3.8. - Drop support for Python 3.4. 4.2.0 (2017-11-07) ================== - Expose the ``__doc__`` (and, where applicable, ``__bases__`` and ``__dict__``) of the hooked object. This lets Sphinx document them. See `issue 6 `_. - Respect ``PURE_PYTHON`` at runtime. At build time, always try to build the C extensions on supported platforms, but allow it to fail. See `issue 7 `_. 4.1.0 (2017-07-26) ================== - Drop support for Python 2.6, 3.2 and 3.3. - Add support for Python 3.5 and 3.6. 4.0.4 (2014-03-19) ================== - Add support for Python 3.4. 4.0.3 (2014-03-17) ================== - Update ``boostrap.py`` to version 2.2. - Fix extension compilation on Py3k. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. - Avoid building the C extension explicitly (use the "feature" indirection instead). https://bugs.launchpad.net/zope.hookable/+bug/1025470 4.0.0 (2012-06-04) ================== - Add support for PyPy. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add a pure-Python reference implementation. - Move doctests to Sphinx documentation. - Bring unit test coverage to 100%. - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Drop support for Python 2.4 / 2.5. - Remove of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. - Add Python 3 support. 3.4.1 (2009-04-05) ================== - Update for compatibility with Python 2.6 traceback formats. - Use Jython-compatible ``bootstrap.py``. 3.4.0 (2007-07-20) ================== - Initial release as a separate project. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506104.0 zope.hookable-6.0/CONTRIBUTING.md0000644000076500000240000000143714507520370015242 0ustar00jensstaff # Contributing to zopefoundation projects The projects under the zopefoundation GitHub organization are open source and welcome contributions in different forms: * bug reports * code improvements and bug fixes * documentation improvements * pull request reviews For any changes in the repository besides trivial typo fixes you are required to sign the contributor agreement. See https://www.zope.dev/developer/becoming-a-committer.html for details. Please visit our [Developer Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to contribute code changes and our [guidelines for reporting bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a bug report. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/COPYRIGHT.txt0000644000076500000240000000004014330750131015101 0ustar00jensstaffZope Foundation and Contributors././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/LICENSE.txt0000644000076500000240000000402614330750131014623 0ustar00jensstaffZope Public License (ZPL) Version 2.1 A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506104.0 zope.hookable-6.0/MANIFEST.in0000644000076500000240000000063014507520370014541 0ustar00jensstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code include *.md include *.rst include *.txt include buildout.cfg include tox.ini include appveyor.yml include .coveragerc recursive-include docs *.py recursive-include docs *.rst recursive-include docs *.txt recursive-include docs Makefile recursive-include src *.py include *.yaml include *.sh recursive-include docs *.bat ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8149755 zope.hookable-6.0/PKG-INFO0000644000076500000240000001327214507525664014121 0ustar00jensstaffMetadata-Version: 2.1 Name: zope.hookable Version: 6.0 Summary: Zope hookable Home-page: http://github.com/zopefoundation/zope.hookable Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Keywords: function hook replacement loose coupled Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope :: 3 Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=3.7 License-File: LICENSE.txt Requires-Dist: setuptools Provides-Extra: docs Requires-Dist: Sphinx; extra == "docs" Requires-Dist: sphinx_rtd_theme; extra == "docs" Provides-Extra: testing Requires-Dist: zope.testing; extra == "testing" Requires-Dist: zope.testrunner; extra == "testing" Requires-Dist: coverage; extra == "testing" Provides-Extra: test Requires-Dist: zope.testing; extra == "test" Requires-Dist: zope.testrunner; extra == "test" =============== zope.hookable =============== .. image:: https://img.shields.io/pypi/v/zope.hookable.svg :target: https://pypi.python.org/pypi/zope.hookable/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.hookable.svg :target: https://pypi.org/project/zope.hookable/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml .. image:: https://readthedocs.org/projects/zopehookable/badge/?version=latest :target: https://zopehookable.readthedocs.io/en/latest/ :alt: Documentation Status .. image:: https://coveralls.io/repos/github/zopefoundation/zope.hookable/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.hookable?branch=master This package supports the efficient creation of "hookable" objects, which are callable objects that are meant to be optionally replaced. The idea is that you create a function that does some default thing and make it hookable. Later, someone can modify what it does by calling its sethook method and changing its implementation. All users of the function, including those that imported it, will see the change. Documentation is hosted at https://zopehookable.readthedocs.io ========= Changes ========= 6.0 (2023-10-05) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.12. 5.4 (2022-11-17) ================ - Add support for building arm64 wheels on macOS. 5.3 (2022-11-03) ================ - Add support for the final release of Python 3.11. 5.2 (2022-09-13) ================ - Add support for Python 3.10 and 3.11 (as of 3.11.0rc1). - Disable unsafe math optimizations in C code. See `pull request 25 `_. 5.1.0 (2021-07-20) ================== - Add support for Python 3.9. - Create Linux aarch64 wheels. 5.0.1 (2020-03-10) ================== - Stop using the setuptools ``Feature`` class, allowing this project to be built from source with newer versions of setuptools that remove that functionality. 5.0.0 (2019-11-12) ================== - Add support for Python 3.7 and 3.8. - Drop support for Python 3.4. 4.2.0 (2017-11-07) ================== - Expose the ``__doc__`` (and, where applicable, ``__bases__`` and ``__dict__``) of the hooked object. This lets Sphinx document them. See `issue 6 `_. - Respect ``PURE_PYTHON`` at runtime. At build time, always try to build the C extensions on supported platforms, but allow it to fail. See `issue 7 `_. 4.1.0 (2017-07-26) ================== - Drop support for Python 2.6, 3.2 and 3.3. - Add support for Python 3.5 and 3.6. 4.0.4 (2014-03-19) ================== - Add support for Python 3.4. 4.0.3 (2014-03-17) ================== - Update ``boostrap.py`` to version 2.2. - Fix extension compilation on Py3k. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. - Avoid building the C extension explicitly (use the "feature" indirection instead). https://bugs.launchpad.net/zope.hookable/+bug/1025470 4.0.0 (2012-06-04) ================== - Add support for PyPy. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add a pure-Python reference implementation. - Move doctests to Sphinx documentation. - Bring unit test coverage to 100%. - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Drop support for Python 2.4 / 2.5. - Remove of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. - Add Python 3 support. 3.4.1 (2009-04-05) ================== - Update for compatibility with Python 2.6 traceback formats. - Use Jython-compatible ``bootstrap.py``. 3.4.0 (2007-07-20) ================== - Initial release as a separate project. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/README.rst0000644000076500000240000000256714330750131014477 0ustar00jensstaff=============== zope.hookable =============== .. image:: https://img.shields.io/pypi/v/zope.hookable.svg :target: https://pypi.python.org/pypi/zope.hookable/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.hookable.svg :target: https://pypi.org/project/zope.hookable/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml .. image:: https://readthedocs.org/projects/zopehookable/badge/?version=latest :target: https://zopehookable.readthedocs.io/en/latest/ :alt: Documentation Status .. image:: https://coveralls.io/repos/github/zopefoundation/zope.hookable/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.hookable?branch=master This package supports the efficient creation of "hookable" objects, which are callable objects that are meant to be optionally replaced. The idea is that you create a function that does some default thing and make it hookable. Later, someone can modify what it does by calling its sethook method and changing its implementation. All users of the function, including those that imported it, will see the change. Documentation is hosted at https://zopehookable.readthedocs.io ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/appveyor.yml0000644000076500000240000000340714507523234015402 0ustar00jensstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code environment: # Currently the builds use @mgedmin's Appveyor account. The PyPI token belongs # to zope.wheelbuilder, which is managed by @mgedmin and @dataflake. global: TWINE_USERNAME: __token__ TWINE_PASSWORD: secure: aoZC/+rvJKg8B5GMGIxd1VVAqNNBjVQeFnBhHb5CSR6SETwd7qeNIP92xgZA2hhgiZH3KVFYEID+OR7j6TTVLVZLHP3EXKP+/sccqPjs3DDgDKuGjU5iovqpJnXiTPNI1LlGqUMM7neCvljjLkcW1InVbygB5p/V1YE8Zs8PjZ8j7Ny84EalvWprAO/xB1hawCIydi1bpq0WZbw8H+IvmDYYkVa1jgSBfHhsA3/S7943QWzPCRtUPuIXziAhdMUgnhj/1N/RPXRMYoNG/Se5Kg== matrix: - python: 37-x64 - python: 38-x64 - python: 39-x64 - python: 310-x64 - python: 311-x64 - python: 312-x64 install: - "SET PYTHONVERSION=%PYTHON%" - "SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%" - ps: | $env:PYTHON = "C:\\Python${env:PYTHON}" if (-not (Test-Path $env:PYTHON)) { curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/11a389d78892cf90addac8f69433d5e22bfa422a/install_python.ps1 .\install_python.ps1 } - ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" } - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat" - python -m pip install -U pip - pip install -U setuptools wheel - pip install -U -e .[test] matrix: fast_finish: true build_script: - python -W ignore setup.py -q bdist_wheel test_script: - zope-testrunner --test-path=src artifacts: - path: 'dist\*.whl' name: wheel deploy_script: - ps: if ($env:APPVEYOR_REPO_TAG -eq $TRUE) { pip install twine; twine upload --skip-existing dist\*.whl } deploy: on ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/buildout.cfg0000644000076500000240000000013714330750131015307 0ustar00jensstaff[buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zope.hookable ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8052106 zope.hookable-6.0/docs/0000755000076500000240000000000014507525664013747 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/Makefile0000644000076500000240000001272414330750131015374 0ustar00jensstaff# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zopehookable.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopehookable.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/zopehookable" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zopehookable" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.7901404 zope.hookable-6.0/docs/_build/0000755000076500000240000000000014507525664015205 5ustar00jensstaff././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8054795 zope.hookable-6.0/docs/_build/doctest/0000755000076500000240000000000014507525664016652 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696506180.0 zope.hookable-6.0/docs/_build/doctest/output.txt0000644000076500000240000000056614507520504020746 0ustar00jensstaffResults of doctest builder run on 2023-10-05 13:43:00 ===================================================== Document: narr -------------- 1 items passed all tests: 13 tests in default 13 tests in 1 items. 13 passed and 0 failed. Test passed. Doctest summary =============== 13 tests 0 failures in tests 0 failures in setup code 0 failures in cleanup code ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1696508851.790206 zope.hookable-6.0/docs/_build/html/0000755000076500000240000000000014507525664016151 5ustar00jensstaff././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8095994 zope.hookable-6.0/docs/_build/html/_sources/0000755000076500000240000000000014507525664017773 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/_build/html/_sources/api.rst.txt0000644000076500000240000000013614330750131022073 0ustar00jensstaff:mod:`zope.hookable` API ======================== .. automodule:: zope.hookable :members: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696497133.0 zope.hookable-6.0/docs/_build/html/_sources/hacking.rst.txt0000644000076500000240000000561514507476755022764 0ustar00jensstaffHacking on :mod:`zope.hookable` ================================ Getting the Code ################ The main repository for :mod:`zope.hookable` is in the Zope Foundation Github repository: https://github.com/zopefoundation/zope.hookable You can get a read-only checkout from there: .. code-block:: sh $ git clone https://github.com/zopefoundation/zope.hookable.git or fork it and get a writeable checkout of your fork: .. code-block:: sh $ git clone git@github.com/jrandom/zope.hookable.git Using :mod:`tox` ################ Running Tests on Multiple Python Versions ----------------------------------------- `tox `_ is a Python-based test automation tool designed to run tests against multiple Python versions. It creates a ``virtualenv`` for each configured version, installs the current package and configured dependencies into each ``virtualenv``, and then runs the configured commands. :mod:`zope.hookable` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The defined Python environments build a ``virtualenv/venv``, install :mod:`zope.hookable` and dependencies, and run the tests via ``zope.testrunner`` There are environments both for with and without using the C code extension. - The ``coverage`` environment builds a ``virtualenv``, installs :mod:`zope.hookable` and dependencies, installs :mod:`coverage`, and runs the tests with coverage. - The ``docs`` environment builds a virtualenv installs :mod:`zope.hookable` and dependencies, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets. This example requires that you have a working ``python3.11`` on your path, as well as an installed ``tox``: .. code-block:: sh $ tox -e py311 Running ``tox`` with no arguments runs all the configured environments, including building the docs and testing their snippets: .. code-block:: sh $ tox To run the tests in parallel use: .. code-block:: sh $ tox -p auto To see the coverage output: .. code-block:: sh $ tox -e coverage Building the documentation -------------------------- :mod:`zope.hookable` uses the nifty :mod:`Sphinx` documentation system for building its docs. .. code-block:: sh $ tox -e docs It also tests the code snippets in the documentation. Contributing to :mod:`zope.hookable` #################################### Submitting a Bug Report ----------------------- :mod:`zope.hookable` tracks its bugs on Github: https://github.com/zopefoundation/zope.hookable/issues Please submit bug reports and feature requests there. Sharing Your Changes -------------------- If have made a change you would like to share, the best route is to fork the GitHub repository, check out your fork, make your changes on a branch in your fork, and push it. You can then submit a pull request from your branch: https://github.com/zopefoundation/zope.hookable/pulls ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/_build/html/_sources/index.rst.txt0000644000076500000240000000031414330750131022427 0ustar00jensstaff:mod:`zope.hookable` ==================== Contents: .. toctree:: :maxdepth: 2 narr api hacking Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/_build/html/_sources/narr.rst.txt0000644000076500000240000000213314330750131022263 0ustar00jensstaffHookable Object Support ======================= :mod:`zope.hookable` supports the efficient creation of hookable objects, which are callable objects that are meant to be replaced by other callables, at least optionally. The idea is to create a function that does some default thing and make it hookable. Later, someone can modify what it does by calling its sethook method and changing its implementation. All users of the function, including those that imported it, will see the change. .. doctest:: >>> from zope.hookable import hookable >>> def f41(): ... return 41 >>> f = hookable(f41) >>> f.implementation is f.original True >>> f() 41 We can replace the implementation, without replacing ``f``: this means that modules which have already imported ``f`` will see the hooked version. .. doctest:: >>> old = f.sethook(lambda: 42) >>> f.implementation is f.original False >>> old is f41 True >>> f() 42 >>> f.original() 41 >>> f.implementation() 42 We can undo the hook by calling ``reset``. .. doctest:: >>> f.reset() >>> f() 41 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/api.rst0000644000076500000240000000013614330750131015231 0ustar00jensstaff:mod:`zope.hookable` API ======================== .. automodule:: zope.hookable :members: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/docs/conf.py0000644000076500000240000001745714507523234015253 0ustar00jensstaff# -*- coding: utf-8 -*- # # zope.hookable documentation build configuration file, created by # sphinx-quickstart on Mon Jun 4 11:49:33 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.viewcode', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'zope.hookable' copyright = u'2012, Zope Foundation Contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '4.1' # The full version, including alpha/beta/rc tags. release = '4.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'zopehookabledoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'zopehookable.tex', u'zope.hookable Documentation', u'Zope Foundation Contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'zopehookable', u'zope.hookable Documentation', [u'Zope Foundation Contributors'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'zopehookable', u'zope.hookable Documentation', u'Zope Foundation Contributors', 'zopehookable', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696497133.0 zope.hookable-6.0/docs/hacking.rst0000644000076500000240000000561514507476755016122 0ustar00jensstaffHacking on :mod:`zope.hookable` ================================ Getting the Code ################ The main repository for :mod:`zope.hookable` is in the Zope Foundation Github repository: https://github.com/zopefoundation/zope.hookable You can get a read-only checkout from there: .. code-block:: sh $ git clone https://github.com/zopefoundation/zope.hookable.git or fork it and get a writeable checkout of your fork: .. code-block:: sh $ git clone git@github.com/jrandom/zope.hookable.git Using :mod:`tox` ################ Running Tests on Multiple Python Versions ----------------------------------------- `tox `_ is a Python-based test automation tool designed to run tests against multiple Python versions. It creates a ``virtualenv`` for each configured version, installs the current package and configured dependencies into each ``virtualenv``, and then runs the configured commands. :mod:`zope.hookable` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The defined Python environments build a ``virtualenv/venv``, install :mod:`zope.hookable` and dependencies, and run the tests via ``zope.testrunner`` There are environments both for with and without using the C code extension. - The ``coverage`` environment builds a ``virtualenv``, installs :mod:`zope.hookable` and dependencies, installs :mod:`coverage`, and runs the tests with coverage. - The ``docs`` environment builds a virtualenv installs :mod:`zope.hookable` and dependencies, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets. This example requires that you have a working ``python3.11`` on your path, as well as an installed ``tox``: .. code-block:: sh $ tox -e py311 Running ``tox`` with no arguments runs all the configured environments, including building the docs and testing their snippets: .. code-block:: sh $ tox To run the tests in parallel use: .. code-block:: sh $ tox -p auto To see the coverage output: .. code-block:: sh $ tox -e coverage Building the documentation -------------------------- :mod:`zope.hookable` uses the nifty :mod:`Sphinx` documentation system for building its docs. .. code-block:: sh $ tox -e docs It also tests the code snippets in the documentation. Contributing to :mod:`zope.hookable` #################################### Submitting a Bug Report ----------------------- :mod:`zope.hookable` tracks its bugs on Github: https://github.com/zopefoundation/zope.hookable/issues Please submit bug reports and feature requests there. Sharing Your Changes -------------------- If have made a change you would like to share, the best route is to fork the GitHub repository, check out your fork, make your changes on a branch in your fork, and push it. You can then submit a pull request from your branch: https://github.com/zopefoundation/zope.hookable/pulls ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/index.rst0000644000076500000240000000031414330750131015565 0ustar00jensstaff:mod:`zope.hookable` ==================== Contents: .. toctree:: :maxdepth: 2 narr api hacking Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/make.bat0000644000076500000240000001176414330750131015344 0ustar00jensstaff@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\zopehookable.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopehookable.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/docs/narr.rst0000644000076500000240000000213314330750131015421 0ustar00jensstaffHookable Object Support ======================= :mod:`zope.hookable` supports the efficient creation of hookable objects, which are callable objects that are meant to be replaced by other callables, at least optionally. The idea is to create a function that does some default thing and make it hookable. Later, someone can modify what it does by calling its sethook method and changing its implementation. All users of the function, including those that imported it, will see the change. .. doctest:: >>> from zope.hookable import hookable >>> def f41(): ... return 41 >>> f = hookable(f41) >>> f.implementation is f.original True >>> f() 41 We can replace the implementation, without replacing ``f``: this means that modules which have already imported ``f`` will see the hooked version. .. doctest:: >>> old = f.sethook(lambda: 42) >>> f.implementation is f.original False >>> old is f41 True >>> f() 42 >>> f.original() 41 >>> f.implementation() 42 We can undo the hook by calling ``reset``. .. doctest:: >>> f.reset() >>> f() 41 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/docs/requirements.txt0000644000076500000240000000005014507523234017215 0ustar00jensstaffSphinx sphinx_rtd_theme>1 docutils<0.19 ././@PaxHeader0000000000000000000000000000003100000000000010207 xustar0025 mtime=1696508851.8153 zope.hookable-6.0/setup.cfg0000644000076500000240000000077114507525664014645 0ustar00jensstaff[bdist_wheel] universal = 0 [zest.releaser] create-wheel = no [flake8] doctests = 1 [check-manifest] ignore = .editorconfig .meta.toml docs/_build/html/_sources/* docs/_build/doctest/* [isort] force_single_line = True combine_as_imports = True sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER known_third_party = docutils, pkg_resources, pytz known_zope = known_first_party = default_section = ZOPE line_length = 79 lines_after_imports = 2 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/setup.py0000644000076500000240000001105214507523234014517 0ustar00jensstaff############################################################################## # # Copyright (c) 2006 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 package is developed by the Zope Toolkit project, documented here: # http://docs.zope.org/zopetoolkit # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """Setup for zope.hookable package """ import os import platform from distutils.errors import CCompilerError from distutils.errors import DistutilsExecError from distutils.errors import DistutilsPlatformError from setuptools import Extension from setuptools import find_packages from setuptools import setup from setuptools.command.build_ext import build_ext class optional_build_ext(build_ext): """This class subclasses build_ext and allows the building of C extensions to fail. """ def run(self): try: build_ext.run(self) except DistutilsPlatformError as e: self._unavailable(e) def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, OSError) as e: self._unavailable(e) def _unavailable(self, e): print('*' * 80) print("""WARNING: An optional code optimization (C extension) could not be compiled. Optimizations for this package will not be available!""") print() print(e) print('*' * 80) def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: return f.read() codeoptimization = [ Extension( "zope.hookable._zope_hookable", [os.path.join('src', 'zope', 'hookable', "_zope_hookable.c")], ), ] is_pypy_or_jython = platform.python_implementation() in ('PyPy', 'Jython') # Jython cannot build the C optimizations, while on PyPy they are # anti-optimizations (the C extension compatibility layer is known-slow, # and defeats JIT opportunities). if is_pypy_or_jython: ext_modules = {} else: ext_modules = codeoptimization TESTS_REQUIRE = [ 'zope.testing', 'zope.testrunner', ] setup(name='zope.hookable', version='6.0', url='http://github.com/zopefoundation/zope.hookable', license='ZPL 2.1', description='Zope hookable', keywords='function hook replacement loose coupled', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', long_description=(read('README.rst') + '\n\n' + read('CHANGES.rst')), classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: Zope :: 3", "Topic :: Software Development :: Libraries :: Python Modules", ], ext_modules=ext_modules, cmdclass={ 'build_ext': optional_build_ext, }, packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['zope'], install_requires=[ 'setuptools', ], include_package_data=True, zip_safe=False, test_suite='zope.hookable.tests.test_hookable.test_suite', extras_require={ 'docs': ['Sphinx', 'sphinx_rtd_theme'], 'testing': TESTS_REQUIRE + ['coverage'], 'test': TESTS_REQUIRE, }, python_requires='>=3.7', ) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.7906766 zope.hookable-6.0/src/0000755000076500000240000000000014507525664013606 5ustar00jensstaff././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8097131 zope.hookable-6.0/src/zope/0000755000076500000240000000000014507525664014563 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/src/zope/__init__.py0000644000076500000240000000011414330750131016647 0ustar00jensstaff__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8140182 zope.hookable-6.0/src/zope/hookable/0000755000076500000240000000000014507525664016347 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1672836463.0 zope.hookable-6.0/src/zope/hookable/__init__.py0000644000076500000240000000421614355272557020464 0ustar00jensstaff############################################################################## # # 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: __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: hookable = _py_hookable else: # pragma: no cover hookable = _c_hookable ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1672836463.0 zope.hookable-6.0/src/zope/hookable/_zope_hookable.c0000644000076500000240000001640714355272557021504 0ustar00jensstaff/*############################################################################ # # 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. # ############################################################################*/ /* _zope_hookable.c Provide an efficient implementation for hookable objects */ #include "Python.h" #include "structmember.h" typedef struct { PyObject_HEAD PyObject *old; PyObject *implementation; } hookable; static int hookable_init(hookable *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"implementation", NULL}; PyObject *implementation; if (! PyArg_ParseTupleAndKeywords(args, kwds, "O:hookable", kwlist, &implementation)) return -1; Py_INCREF(implementation); Py_INCREF(implementation); Py_XDECREF(self->old); self->old = implementation; Py_XDECREF(self->implementation); self->implementation = implementation; return 0; } static int hookable_traverse(hookable *self, visitproc visit, void *arg) { if (self->implementation != NULL && visit(self->implementation, arg) < 0) return -1; if (self->old != NULL && self->old != self->implementation && visit(self->old, arg) < 0 ) return -1; return 0; } static int hookable_clear(hookable *self) { Py_XDECREF(self->old); self->old = NULL; Py_XDECREF(self->implementation); self->implementation = NULL; return 0; } static void hookable_dealloc(hookable *self) { PyObject_GC_UnTrack((PyObject *)self); Py_XDECREF(self->old); Py_XDECREF(self->implementation); Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * hookable_sethook(hookable *self, PyObject *implementation) { PyObject *old; old = self->implementation; Py_INCREF(implementation); self->implementation = implementation; if (old == NULL) { Py_INCREF(Py_None); return Py_None; } return old; } static PyObject * hookable_reset(hookable *self) { Py_XINCREF(self->old); Py_XDECREF(self->implementation); self->implementation = self->old; Py_INCREF(Py_None); return Py_None; } static struct PyMethodDef hookable_methods[] = { {"sethook", (PyCFunction)hookable_sethook, METH_O, "Set the hook implementation for the hookable object"}, {"reset", (PyCFunction)hookable_reset, METH_NOARGS, "Reset the hook to the original value"}, {NULL, NULL} /* sentinel */ }; static PyObject * hookable_call(hookable *self, PyObject *args, PyObject *kw) { if (self->implementation != NULL) return PyObject_Call(self->implementation, args, kw); PyErr_SetString(PyExc_TypeError, "Hookable has no implementation"); return NULL; } static PyObject * hookable_getattro(hookable *self, PyObject *name) { PyObject *result = NULL; const char *name_as_string; int maybe_special_name; name_as_string = PyUnicode_AsUTF8(name); if (name_as_string == NULL) { return NULL; } maybe_special_name = name_as_string[0] == '_' && name_as_string[1] == '_'; if (maybe_special_name) { /* pass through __doc__ to the original implementation */ if (strcmp("__doc__", name_as_string) == 0) { return PyObject_GetAttr(self->old, name); } /* synthesize __base__ and __dict__ if the original fails */ if (strcmp("__bases__", name_as_string) == 0) { result = PyObject_GetAttr(self->old, name); if (result == NULL) { PyErr_Clear(); result = PyTuple_New(0); } return result; } if (strcmp("__dict__", name_as_string) == 0) { result = PyObject_GetAttr(self->old, name); if (result == NULL) { PyErr_Clear(); result = PyDict_New(); } return result; } } return PyObject_GenericGetAttr((PyObject*)self, name); } static PyMemberDef hookable_members[] = { { "original", T_OBJECT_EX, offsetof(hookable, old), READONLY }, { "implementation", T_OBJECT_EX, offsetof(hookable, implementation), READONLY }, {NULL} /* Sentinel */ }; static char Hookabletype__doc__[] = "Callable objects that support being overridden" ; static PyTypeObject hookabletype = { PyVarObject_HEAD_INIT(NULL, 0) /* tp_name */ "zope.hookable." "hookable", /* tp_basicsize */ sizeof(hookable), /* tp_itemsize */ 0, /* tp_dealloc */ (destructor)&hookable_dealloc, /* tp_print */ (printfunc)0, /* tp_getattr */ (getattrfunc)0, /* tp_setattr */ (setattrfunc)0, /* tp_compare */ 0, /* tp_repr */ (reprfunc)0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ (hashfunc)0, /* tp_call */ (ternaryfunc)hookable_call, /* tp_str */ (reprfunc)0, /* tp_getattro */ (getattrofunc)hookable_getattro, /* tp_setattro */ (setattrofunc)0, /* tp_as_buffer */ 0, /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_doc */ Hookabletype__doc__, /* tp_traverse */ (traverseproc)hookable_traverse, /* tp_clear */ (inquiry)hookable_clear, /* tp_richcompare */ (richcmpfunc)0, /* tp_weaklistoffset */ (long)0, /* tp_iter */ (getiterfunc)0, /* tp_iternext */ (iternextfunc)0, /* tp_methods */ hookable_methods, /* tp_members */ hookable_members, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* internal use */ /* tp_descr_get */ (descrgetfunc)0, /* tp_descr_set */ (descrsetfunc)0, /* tp_dictoffset */ 0, /* tp_init */ (initproc)hookable_init, /* tp_alloc */ (allocfunc)0, /* tp_new */ (newfunc)0 /*PyType_GenericNew*/, /* tp_free */ 0/*PyObject_GC_Del*/, }; #define MOD_ERROR_VAL NULL #define MOD_SUCCESS_VAL(val) val #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) #define MOD_DEF(ob, name, doc, methods) \ static struct PyModuleDef moduledef = { \ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \ ob = PyModule_Create(&moduledef); static struct PyMethodDef module_methods[] = { {NULL, NULL} }; MOD_INIT(_zope_hookable) { PyObject *m; MOD_DEF(m, "_zope_hookable", "Provide an efficient implementation for hookable objects", module_methods) if (m == NULL) return MOD_ERROR_VAL; hookabletype.tp_new = PyType_GenericNew; hookabletype.tp_free = PyObject_GC_Del; if (PyType_Ready(&hookabletype) < 0) return MOD_ERROR_VAL; if (PyModule_AddObject(m, "hookable", (PyObject *)&hookabletype) < 0) return MOD_ERROR_VAL; return MOD_SUCCESS_VAL(m); } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1696508851.8144264 zope.hookable-6.0/src/zope/hookable/tests/0000755000076500000240000000000014507525664017511 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/src/zope/hookable/tests/__init__.py0000644000076500000240000000005714330750131021603 0ustar00jensstaff# This line required to prevent an empty file. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485785.0 zope.hookable-6.0/src/zope/hookable/tests/test_compile_flags.py0000644000076500000240000000241114330750131023703 0ustar00jensstaff############################################################################## # # Copyright (c) 2022 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 # ############################################################################## import struct import unittest import zope.hookable # noqa: try to load a C module for side effects class TestFloatingPoint(unittest.TestCase): def test_no_fast_math_optimization(self): # Building with -Ofast enables -ffast-math, which sets certain FPU # flags that can cause breakage elsewhere. A library such as BTrees # has no business changing global FPU flags for the entire process. zero_bits = struct.unpack("!Q", struct.pack("!d", 0.0))[0] next_up = zero_bits + 1 smallest_subnormal = struct.unpack("!d", struct.pack("!Q", next_up))[0] self.assertNotEqual(smallest_subnormal, 0.0) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1672836463.0 zope.hookable-6.0/src/zope/hookable/tests/test_hookable.py0000644000076500000240000001407514355272557022716 0ustar00jensstaff############################################################################## # # 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. # ############################################################################## """Test the hookable support Extension """ import unittest def return_foo(): return 'FOO' def return_bar(): return 'BAR' def not_called(): raise AssertionError("This should not be called") class PyHookableMixin: def _callFUT(self, *args, **kw): from zope.hookable import _py_hookable return _py_hookable(*args, **kw) class HookableMixin: def _callFUT(self, *args, **kw): from zope.hookable import _py_hookable from zope.hookable import hookable if hookable is _py_hookable: raise unittest.SkipTest("Hookable and PyHookable are the same") return hookable(*args, **kw) # pragma: no cover class PyHookableTests(PyHookableMixin, unittest.TestCase): def test_pure_python(self): from zope.hookable import _PURE_PYTHON from zope.hookable import _c_hookable from zope.hookable import _py_hookable from zope.hookable import hookable self.assertIs(hookable, _py_hookable if _PURE_PYTHON else _c_hookable) def test_before_hook(self): hooked = self._callFUT(return_foo) self.assertIs(hooked.original, return_foo) self.assertIs(hooked.implementation, return_foo) self.assertEqual(hooked(), 'FOO') def test_after_hook(self): hooked = self._callFUT(not_called) old = hooked.sethook(return_bar) self.assertIs(old, not_called) self.assertIs(hooked.original, not_called) self.assertIs(hooked.implementation, return_bar) self.assertEqual(hooked(), 'BAR') def test_after_hook_and_reset(self): hooked = self._callFUT(return_foo) old = hooked.sethook(not_called) hooked.reset() self.assertIs(old, return_foo) self.assertIs(hooked.original, return_foo) self.assertIs(hooked.implementation, return_foo) self.assertEqual(hooked(), 'FOO') def test_original_cannot_be_deleted(self): hooked = self._callFUT(not_called) with self.assertRaises((TypeError, AttributeError)): del hooked.original def test_implementation_cannot_be_deleted(self): hooked = self._callFUT(not_called) with self.assertRaises((TypeError, AttributeError)): del hooked.implementation def test_no_args(self): with self.assertRaises(TypeError): self._callFUT() def test_too_many_args(self): with self.assertRaises(TypeError): self._callFUT(not_called, not_called) def test_w_implementation_kwarg(self): hooked = self._callFUT(implementation=return_foo) self.assertIs(hooked.original, return_foo) self.assertIs(hooked.implementation, return_foo) self.assertEqual(hooked(), 'FOO') def test_w_unknown_kwarg(self): with self.assertRaises(TypeError): self._callFUT(nonesuch=42) def test_class(self): class C: pass hooked = self._callFUT(C) self.assertIsInstance(hooked(), C) hooked.sethook(return_bar) self.assertEqual(hooked(), 'BAR') class TestIssue6Py(PyHookableMixin, unittest.TestCase): # Make sphinx docs for hooked objects work. # https://github.com/zopefoundation/zope.hookable/issues/6 # We need to proxy __doc__ to the original, # and synthesize an empty __bases__ and a __dict__ attribute # if they're not present. def _check_preserves_doc(self, docs): self.assertEqual("I have some docs", docs.__doc__) hooked = self._callFUT(docs) self.assertEqual(hooked.__doc__, docs.__doc__) def test_preserves_doc_function(self): def docs(): """I have some docs""" self._check_preserves_doc(docs) def test_preserves_doc_class(self): class Docs: """I have some docs""" self._check_preserves_doc(Docs) def test_empty_bases_function(self): hooked = self._callFUT(return_foo) self.assertEqual((), hooked.__bases__) def test_empty_dict_function(self): hooked = self._callFUT(return_foo) self.assertEqual({}, hooked.__dict__) def test_bases_class(self): class C: pass self.assertEqual(C.__bases__, (object,)) hooked = self._callFUT(C) self.assertEqual(hooked.__bases__, (object,)) def test_dict_class(self): class C: pass hooked = self._callFUT(C) self.assertEqual(hooked.__dict__, C.__dict__) def test_non_string_attr_name(self): # Specifically for the C implementation, which has to deal with this hooked = self._callFUT(return_foo) with self.assertRaises(TypeError): getattr(hooked, 42) with self.assertRaises(TypeError): hooked.__getattribute__(42) def test_unicode_attribute_name(self): # Specifically for the C implementation, which has to deal with this hooked = self._callFUT(return_foo) result = hooked.__getattribute__('__bases__') self.assertEqual(result, ()) def test_short_name(self): # Specifically for the C implementation, which has to deal with this hooked = self._callFUT(return_foo) with self.assertRaises(AttributeError): hooked.__getattribute__('') class HookableTests(HookableMixin, PyHookableTests): pass class TestIssue6(HookableMixin, TestIssue6Py): pass def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1696508851.811839 zope.hookable-6.0/src/zope.hookable.egg-info/0000755000076500000240000000000014507525664020040 5ustar00jensstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/PKG-INFO0000644000076500000240000001327214507525663021141 0ustar00jensstaffMetadata-Version: 2.1 Name: zope.hookable Version: 6.0 Summary: Zope hookable Home-page: http://github.com/zopefoundation/zope.hookable Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Keywords: function hook replacement loose coupled Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope :: 3 Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=3.7 License-File: LICENSE.txt Requires-Dist: setuptools Provides-Extra: docs Requires-Dist: Sphinx; extra == "docs" Requires-Dist: sphinx_rtd_theme; extra == "docs" Provides-Extra: testing Requires-Dist: zope.testing; extra == "testing" Requires-Dist: zope.testrunner; extra == "testing" Requires-Dist: coverage; extra == "testing" Provides-Extra: test Requires-Dist: zope.testing; extra == "test" Requires-Dist: zope.testrunner; extra == "test" =============== zope.hookable =============== .. image:: https://img.shields.io/pypi/v/zope.hookable.svg :target: https://pypi.python.org/pypi/zope.hookable/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.hookable.svg :target: https://pypi.org/project/zope.hookable/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.hookable/actions/workflows/tests.yml .. image:: https://readthedocs.org/projects/zopehookable/badge/?version=latest :target: https://zopehookable.readthedocs.io/en/latest/ :alt: Documentation Status .. image:: https://coveralls.io/repos/github/zopefoundation/zope.hookable/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.hookable?branch=master This package supports the efficient creation of "hookable" objects, which are callable objects that are meant to be optionally replaced. The idea is that you create a function that does some default thing and make it hookable. Later, someone can modify what it does by calling its sethook method and changing its implementation. All users of the function, including those that imported it, will see the change. Documentation is hosted at https://zopehookable.readthedocs.io ========= Changes ========= 6.0 (2023-10-05) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.12. 5.4 (2022-11-17) ================ - Add support for building arm64 wheels on macOS. 5.3 (2022-11-03) ================ - Add support for the final release of Python 3.11. 5.2 (2022-09-13) ================ - Add support for Python 3.10 and 3.11 (as of 3.11.0rc1). - Disable unsafe math optimizations in C code. See `pull request 25 `_. 5.1.0 (2021-07-20) ================== - Add support for Python 3.9. - Create Linux aarch64 wheels. 5.0.1 (2020-03-10) ================== - Stop using the setuptools ``Feature`` class, allowing this project to be built from source with newer versions of setuptools that remove that functionality. 5.0.0 (2019-11-12) ================== - Add support for Python 3.7 and 3.8. - Drop support for Python 3.4. 4.2.0 (2017-11-07) ================== - Expose the ``__doc__`` (and, where applicable, ``__bases__`` and ``__dict__``) of the hooked object. This lets Sphinx document them. See `issue 6 `_. - Respect ``PURE_PYTHON`` at runtime. At build time, always try to build the C extensions on supported platforms, but allow it to fail. See `issue 7 `_. 4.1.0 (2017-07-26) ================== - Drop support for Python 2.6, 3.2 and 3.3. - Add support for Python 3.5 and 3.6. 4.0.4 (2014-03-19) ================== - Add support for Python 3.4. 4.0.3 (2014-03-17) ================== - Update ``boostrap.py`` to version 2.2. - Fix extension compilation on Py3k. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. - Avoid building the C extension explicitly (use the "feature" indirection instead). https://bugs.launchpad.net/zope.hookable/+bug/1025470 4.0.0 (2012-06-04) ================== - Add support for PyPy. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add a pure-Python reference implementation. - Move doctests to Sphinx documentation. - Bring unit test coverage to 100%. - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Drop support for Python 2.4 / 2.5. - Remove of 'zope.testing.doctestunit' in favor of stdlib's 'doctest. - Add Python 3 support. 3.4.1 (2009-04-05) ================== - Update for compatibility with Python 2.6 traceback formats. - Use Jython-compatible ``bootstrap.py``. 3.4.0 (2007-07-20) ================== - Initial release as a separate project. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/SOURCES.txt0000644000076500000240000000176214507525663021731 0ustar00jensstaff.coveragerc .manylinux-install.sh .manylinux.sh .readthedocs.yaml CHANGES.rst CONTRIBUTING.md COPYRIGHT.txt LICENSE.txt MANIFEST.in README.rst appveyor.yml buildout.cfg setup.cfg setup.py tox.ini docs/Makefile docs/api.rst docs/conf.py docs/hacking.rst docs/index.rst docs/make.bat docs/narr.rst docs/requirements.txt docs/_build/doctest/output.txt docs/_build/html/_sources/api.rst.txt docs/_build/html/_sources/hacking.rst.txt docs/_build/html/_sources/index.rst.txt docs/_build/html/_sources/narr.rst.txt src/zope/__init__.py src/zope.hookable.egg-info/PKG-INFO src/zope.hookable.egg-info/SOURCES.txt src/zope.hookable.egg-info/dependency_links.txt src/zope.hookable.egg-info/namespace_packages.txt src/zope.hookable.egg-info/not-zip-safe src/zope.hookable.egg-info/requires.txt src/zope.hookable.egg-info/top_level.txt src/zope/hookable/__init__.py src/zope/hookable/_zope_hookable.c src/zope/hookable/tests/__init__.py src/zope/hookable/tests/test_compile_flags.py src/zope/hookable/tests/test_hookable.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/dependency_links.txt0000644000076500000240000000000114507525663024105 0ustar00jensstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/namespace_packages.txt0000644000076500000240000000000514507525663024365 0ustar00jensstaffzope ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1667485917.0 zope.hookable-6.0/src/zope.hookable.egg-info/not-zip-safe0000644000076500000240000000000114330750335022253 0ustar00jensstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/requires.txt0000644000076500000240000000020114507525663022430 0ustar00jensstaffsetuptools [docs] Sphinx sphinx_rtd_theme [test] zope.testing zope.testrunner [testing] zope.testing zope.testrunner coverage ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696508851.0 zope.hookable-6.0/src/zope.hookable.egg-info/top_level.txt0000644000076500000240000000000514507525663022564 0ustar00jensstaffzope ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1696507548.0 zope.hookable-6.0/tox.ini0000644000076500000240000000316414507523234014325 0ustar00jensstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/c-code [tox] minversion = 4.0 envlist = lint py37,py37-pure py38,py38-pure py39,py39-pure py310,py310-pure py311,py311-pure py312,py312-pure pypy3 docs coverage [testenv] usedevelop = true deps = py37: urllib3 < 2 setenv = pure: PURE_PYTHON=1 !pure-!pypy3: PURE_PYTHON=0 py312: VIRTUALENV_PIP=23.1.2 py312: PIP_REQUIRE_VIRTUALENV=0 commands = zope-testrunner --test-path=src {posargs:-vc} sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest extras = test docs [testenv:coverage] basepython = python3 allowlist_externals = mkdir deps = coverage py37: urllib3 < 2 setenv = PURE_PYTHON=1 commands = mkdir -p {toxinidir}/parts/htmlcov coverage run -m zope.testrunner --test-path=src {posargs:-vc} coverage html -i coverage report -i -m --fail-under=100 [testenv:lint] basepython = python3 skip_install = true commands = isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py flake8 src setup.py check-manifest check-python-versions deps = check-manifest check-python-versions >= 0.19.1 wheel flake8 isort [testenv:isort-apply] basepython = python3 skip_install = true commands_pre = deps = isort commands = isort {toxinidir}/src {toxinidir}/setup.py [] [testenv:docs] basepython = python3 skip_install = false commands_pre = commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest