zope.event-4.4/0000755000076500000240000000000013355660051013345 5ustar macstaff00000000000000zope.event-4.4/bootstrap.py0000644000076500000240000001644213355660050015742 0ustar macstaff00000000000000############################################################################## # # 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. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. """ import os import shutil import sys import tempfile from optparse import OptionParser __version__ = '2015-07-01' # See zc.buildout's changelog if this version is up to date. tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') usage = '''\ [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] Bootstraps a buildout-based project. Simply run this script in a directory containing a buildout.cfg, using the Python that you want bin/buildout to use. Note that by using --find-links to point to local resources, you can keep this script from going over the network. ''' parser = OptionParser(usage=usage) parser.add_option("--version", action="store_true", default=False, help=("Return bootstrap.py version.")) parser.add_option("-t", "--accept-buildout-test-releases", dest='accept_buildout_test_releases', action="store_true", default=False, help=("Normally, if you do not specify a --version, the " "bootstrap script and buildout gets the newest " "*final* versions of zc.buildout and its recipes and " "extensions for you. If you use this flag, " "bootstrap and buildout will get the newest releases " "even if they are alphas or betas.")) parser.add_option("-c", "--config-file", help=("Specify the path to the buildout configuration " "file to be used.")) parser.add_option("-f", "--find-links", help=("Specify a URL to search for buildout releases")) parser.add_option("--allow-site-packages", action="store_true", default=False, help=("Let bootstrap.py use existing site packages")) parser.add_option("--buildout-version", help="Use a specific zc.buildout version") parser.add_option("--setuptools-version", help="Use a specific setuptools version") parser.add_option("--setuptools-to-dir", help=("Allow for re-use of existing directory of " "setuptools versions")) options, args = parser.parse_args() if options.version: print("bootstrap.py version %s" % __version__) sys.exit(0) ###################################################################### # load/install setuptools try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen ez = {} if os.path.exists('ez_setup.py'): exec(open('ez_setup.py').read(), ez) else: exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) if not options.allow_site_packages: # ez_setup imports site, which adds site packages # this will remove them from the path to ensure that incompatible versions # of setuptools are not in the path import site # inside a virtualenv, there is no 'getsitepackages'. # We can't remove these reliably if hasattr(site, 'getsitepackages'): for sitepackage_path in site.getsitepackages(): # Strip all site-packages directories from sys.path that # are not sys.prefix; this is because on Windows # sys.prefix is a site-package directory. if sitepackage_path != sys.prefix: sys.path[:] = [x for x in sys.path if sitepackage_path not in x] setup_args = dict(to_dir=tmpeggs, download_delay=0) if options.setuptools_version is not None: setup_args['version'] = options.setuptools_version if options.setuptools_to_dir is not None: setup_args['to_dir'] = options.setuptools_to_dir ez['use_setuptools'](**setup_args) import setuptools import pkg_resources # This does not (always?) update the default working set. We will # do it. for path in sys.path: if path not in pkg_resources.working_set.entries: pkg_resources.working_set.add_entry(path) ###################################################################### # Install buildout ws = pkg_resources.working_set setuptools_path = ws.find( pkg_resources.Requirement.parse('setuptools')).location # Fix sys.path here as easy_install.pth added before PYTHONPATH cmd = [sys.executable, '-c', 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path + 'from setuptools.command.easy_install import main; main()', '-mZqNxd', tmpeggs] find_links = os.environ.get( 'bootstrap-testing-find-links', options.find_links or ('http://downloads.buildout.org/' if options.accept_buildout_test_releases else None) ) if find_links: cmd.extend(['-f', find_links]) requirement = 'zc.buildout' version = options.buildout_version if version is None and not options.accept_buildout_test_releases: # Figure out the most recent final version of zc.buildout. import setuptools.package_index _final_parts = '*final-', '*final' def _final_version(parsed_version): try: return not parsed_version.is_prerelease except AttributeError: # Older setuptools for part in parsed_version: if (part[:1] == '*') and (part not in _final_parts): return False return True index = setuptools.package_index.PackageIndex( search_path=[setuptools_path]) if find_links: index.add_find_links((find_links,)) req = pkg_resources.Requirement.parse(requirement) if index.obtain(req) is not None: best = [] bestv = None for dist in index[req.project_name]: distv = dist.parsed_version if _final_version(distv): if bestv is None or distv > bestv: best = [dist] bestv = distv elif distv == bestv: best.append(dist) if best: best.sort() version = best[-1].version if version: requirement = '=='.join((requirement, version)) cmd.append(requirement) import subprocess if subprocess.call(cmd) != 0: raise Exception( "Failed to execute command:\n%s" % repr(cmd)[1:-1]) ###################################################################### # Import and run buildout ws.add_entry(tmpeggs) ws.require(requirement) import zc.buildout.buildout if not [a for a in args if '=' not in a]: args.append('bootstrap') # if -c was provided, we push it back into args for buildout' main function if options.config_file is not None: args[0:0] = ['-c', options.config_file] zc.buildout.buildout.main(args) shutil.rmtree(tmpeggs) zope.event-4.4/PKG-INFO0000644000076500000240000001165713355660051014454 0ustar macstaff00000000000000Metadata-Version: 2.1 Name: zope.event Version: 4.4 Summary: Very basic event publishing system Home-page: http://github.com/zopefoundation/zope.event Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: ======================= ``zope.event`` README ======================= .. image:: https://img.shields.io/pypi/v/zope.event.svg :target: https://pypi.python.org/pypi/zope.event/ :alt: Latest Version .. image:: https://travis-ci.org/zopefoundation/zope.event.svg?branch=master :target: https://travis-ci.org/zopefoundation/zope.event .. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest :target: http://zopeevent.readthedocs.org/en/latest/ :alt: Documentation Status The ``zope.event`` package provides a simple event system, including: - An event publishing API, intended for use by applications which are unaware of any subscribers to their events. - A very simple event-dispatching system on which more sophisticated event dispatching systems can be built. For example, a type-based event dispatching system that builds on ``zope.event`` can be found in ``zope.component``. Please see http://zopeevent.readthedocs.io/ for the documentation. ========================== ``zope.event`` Changelog ========================== 4.4 (2018-10-05) ================ - Add support for Python 3.7 4.3.0 (2017-07-25) ================== - Add support for Python 3.6. - Drop support for Python 3.3. 4.2.0 (2016-02-17) ================== - Add support for Python 3.5. - Drop support for Python 2.6 and 3.2. 4.1.0 (2015-10-18) ================== - Require 100% branch (as well as statement) coverage. - Add a simple class-based handler implementation. 4.0.3 (2014-03-19) ================== - Add support for Python 3.4. - Update ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. - Add support for jython 2.7. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. 4.0.0 (2012-05-16) ================== - Automate build of Sphinx HTML docs and running doctest snippets via tox. - Drop explicit support for Python 2.4 / 2.5 / 3.1. - Add support for PyPy. 3.5.2 (2012-03-30) ================== - This release is the last which will maintain support for Python 2.4 / Python 2.5. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.5.1 (2011-08-04) ================== - Add Sphinx documentation. 3.5.0 (2010-05-01) ================== - Add change log to ``long-description``. - Add support for Python 3.x. 3.4.1 (2009-03-03) ================== - A few minor cleanups. 3.4.0 (2007-07-14) ================== - Initial release as a separate project. Keywords: event framework dispatch subscribe publish Platform: UNKNOWN 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 :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: Jython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope3 Classifier: Topic :: Software Development :: Libraries :: Python Modules Provides-Extra: test Provides-Extra: docs zope.event-4.4/COPYRIGHT.txt0000644000076500000240000000004013355660050015447 0ustar macstaff00000000000000Zope Foundation and Contributorszope.event-4.4/buildout.cfg0000644000076500000240000000014013355660050015647 0ustar macstaff00000000000000[buildout] develop = . parts = test [test] recipe = zc.recipe.testrunner eggs = zope.event zope.event-4.4/MANIFEST.in0000644000076500000240000000057113355660050015105 0ustar macstaff00000000000000include *.rst include *.txt include .travis.yml include .coveragerc include tox.ini include bootstrap.py include buildout.cfg recursive-include docs *.rst *.py Makefile make.bat recursive-include docs/_static * recursive-include src * global-exclude *.dll global-exclude *.pyc global-exclude *.pyo global-exclude *.so global-exclude *.class recursive-exclude docs/_build * zope.event-4.4/.coveragerc0000644000076500000240000000020613355660050015463 0ustar macstaff00000000000000[run] source = zope.event [report] exclude_lines = pragma: no cover if __name__ == '__main__': raise NotImplementedError zope.event-4.4/docs/0000755000076500000240000000000013355660051014275 5ustar macstaff00000000000000zope.event-4.4/docs/index.rst0000644000076500000240000000174213355660050016141 0ustar macstaff00000000000000================================= :mod:`zope.event` Documentation ================================= This package provides a simple event system on which application-specific event systems can be built. For example, a type-based event dispatching system that builds on `zope.interface `_ can be found in `zope.component `_. A simpler system is distributed with this package and is described in :doc:`classhandler`. Application code can generate events without being concerned about the event-processing frameworks that might handle the events. Events are objects that represent something happening in a system. They are used to extend processing by providing processing plug points. Contents: .. toctree:: :maxdepth: 2 usage theory api classhandler hacking ==================== Indices and tables ==================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` zope.event-4.4/docs/theory.rst0000644000076500000240000000075513355660050016347 0ustar macstaff00000000000000.. _theory-docs: Theory of Operation =================== .. note:: This section explains both why an application or framework might publish events, and various ways the integrator might configure the subscribers to achieve different goals. Outline ------- - Events as decoupling mechanism. - Injecting policy into reusable applications. - Extending frameworks. - Event dispatch strategies - Type-based dispatch, as used in ZCA - Attribute-based / key-based dispatch zope.event-4.4/docs/Makefile0000644000076500000240000000607413355660050015743 0ustar macstaff00000000000000# 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) . .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest 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 " 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 " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @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." 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/zopeevent.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopeevent.qhc" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." 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." zope.event-4.4/docs/conf.py0000644000076500000240000001537413355660050015605 0ustar macstaff00000000000000# -*- coding: utf-8 -*- # # zope.event documentation build configuration file, created by # sphinx-quickstart on Fri Apr 16 17:22:42 2010. # # 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, pkg_resources # 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.append(os.path.abspath('.')) sys.path.append(os.path.abspath('../src')) rqmt = pkg_resources.require('zope.event')[0] # -- General configuration ----------------------------------------------------- # 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.coverage', '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' # The master toctree document. master_doc = 'index' # General information about the project. project = u'zope.event' copyright = u'2010-2018, Zope Foundation and 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 = '%s.%s' % tuple(map(int, rqmt.version.split('.')[:2])) # The full version, including alpha/beta/rc tags. release = rqmt.version # 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 documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = ['_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. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. html_theme = 'default' # 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_use_modindex = 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, 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 = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'zopeeventdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'zopeevent.tex', u'zope.event Documentation', u'Zope Foundation and 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 # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'https://docs.python.org/': None } autodoc_default_flags = ['members', 'show-inheritance'] autodoc_member_order = 'bysource' autoclass_content = 'both' zope.event-4.4/docs/hacking.rst0000644000076500000240000002055013355660050016434 0ustar macstaff00000000000000Hacking on :mod:`zope.event` ============================ Getting the Code ################ The main repository for :mod:`zope.event` is in the Zope Foundation Github repository: https://github.com/zopefoundation/zope.event You can get a read-only checkout from there: .. code-block:: sh $ git clone https://github.com/zopefoundation/zope.event.git or fork it and get a writeable checkout of your fork: .. code-block:: sh $ git clone git@github.com/jrandom/zope.event.git The project also mirrors the trunk from the Github repository as a Bazaar branch on Launchpad: https://code.launchpad.net/zope.event You can branch the trunk from there using Bazaar: .. code-block:: sh $ bzr branch lp:zope.event Working in a ``virtualenv`` ########################### Installing ---------- If you use the ``virtualenv`` package to create lightweight Python development environments, you can run the tests using nothing more than the ``python`` binary in a virtualenv. First, create a scratch environment: .. code-block:: sh $ /path/to/virtualenv --no-site-packages /tmp/hack-zope.event Next, get this package registered as a "development egg" in the environment: .. code-block:: sh $ /tmp/hack-zope.event/bin/python setup.py develop Running the tests ----------------- Then, you canrun the tests using the build-in ``setuptools`` testrunner: .. code-block:: sh $ /tmp/hack-zope.event/bin/python setup.py test running test ... test_empty (zope.event.tests.Test_notify) ... ok test_not_empty (zope.event.tests.Test_notify) ... ok ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK If you have the :mod:`nose` package installed in the virtualenv, you can use its testrunner too: .. code-block:: sh $ /tmp/hack-zope.event/bin/easy_install nose ... $ /tmp/hack-zope.event/bin/python setup.py nosetests running nosetests ... ---------------------------------------------------------------------- Ran 3 tests in 0.011s OK or: .. code-block:: sh $ /tmp/hack-zope.event/bin/nosetests ... ---------------------------------------------------------------------- Ran 3 tests in 0.011s OK If you have the :mod:`coverage` pacakge installed in the virtualenv, you can see how well the tests cover the code: .. code-block:: sh $ /tmp/hack-zope.event/bin/easy_install nose coverage ... $ /tmp/hack-zope.event/bin/python setup.py nosetests \ --with coverage --cover-package=zope.event running nosetests ... Name Stmts Exec Cover Missing ------------------------------------------ zope.event 5 5 100% ---------------------------------------------------------------------- Ran 3 tests in 0.019s OK Building the documentation -------------------------- :mod:`zope.event` uses the nifty :mod:`Sphinx` documentation system for building its docs. Using the same virtualenv you set up to run the tests, you can build the docs: .. code-block:: sh $ /tmp/hack-zope.event/bin/easy_install Sphinx ... $ cd docs $ PATH=/tmp/hack-zope.event/bin:$PATH make html sphinx-build -b html -d _build/doctrees . _build/html ... build succeeded. Build finished. The HTML pages are in _build/html. You can also test the code snippets in the documentation: .. code-block:: sh $ PATH=/tmp/hack-zope.event/bin:$PATH make doctest sphinx-build -b doctest -d _build/doctrees . _build/doctest ... running tests... Document: index --------------- 1 items passed all tests: 17 tests in default 17 tests in 1 items. 17 passed and 0 failed. Test passed. Doctest summary =============== 17 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the \ results in _build/doctest/output.txt. Using :mod:`zc.buildout` ######################## Setting up the buildout ----------------------- :mod:`zope.event` ships with its own :file:`buildout.cfg` file and :file:`bootstrap.py` for setting up a development buildout: .. code-block:: sh $ /path/to/python2.6 bootstrap.py ... Generated script '.../bin/buildout' $ bin/buildout Develop: '/home/jrandom/projects/Zope/zope.event/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'. Running the tests ----------------- You can now run the tests: .. code-block:: sh $ bin/test --all Running zope.testing.testrunner.layer.UnitTests tests: Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Ran 2 tests with 0 failures and 0 errors in 0.000 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds. 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.event` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The ``py26``, ``py27``, ``py33``, ``py34``, and ``pypy`` environments builds a ``virtualenv`` with the corresponding interpreter, installs :mod:`zope.event` and dependencies, and runs the tests via ``python setup.py -q test -q``. - The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.event`, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement and branch coverage. - The ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.event`, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets. This example requires that you have a working ``python2.6`` on your path, as well as installing ``tox``: .. code-block:: sh $ tox -e py26 GLOB sdist-make: .../zope.event/setup.py py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip py26 runtests: commands[0] ... ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK ___________________________________ summary ____________________________________ py26: commands succeeded congratulations :) Running ``tox`` with no arguments runs all the configured environments, including building the docs and testing their snippets: .. code-block:: sh $ tox GLOB sdist-make: .../zope.event/setup.py py26 sdist-reinst: .../zope.event/.tox/dist/zope.event-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 17 tests 0 failures in tests 0 failures in setup code 0 failures in cleanup code build succeeded. ___________________________________ summary ____________________________________ py26: commands succeeded py27: commands succeeded py32: commands succeeded pypy: commands succeeded coverage: commands succeeded docs: commands succeeded congratulations :) Contributing to :mod:`zope.event` ################################# Submitting a Bug Report ----------------------- :mod:`zope.event` tracks its bugs on Github: https://github.com/zopefoundation/zope.event/issues Please submit bug reports and feature requests there. Sharing Your Changes -------------------- .. note:: Please ensure that all tests are passing before you submit your code. If possible, your submission should include new tests for new features or bug fixes, although it is possible that you may have tested your new code by updating existing tests. If have made a change you would like to share, the best route is to fork the Githb 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.event/pulls If you branched the code from Launchpad using Bazaar, you have another option: you can "push" your branch to Launchpad: .. code-block:: sh $ bzr push lp:~jrandom/zope.event/cool_feature After pushing your branch, you can link it to a bug report on Github, or request that the maintainers merge your branch using the Launchpad "merge request" feature. zope.event-4.4/docs/_static/0000755000076500000240000000000013355660051015723 5ustar macstaff00000000000000zope.event-4.4/docs/_static/.gitignore0000644000076500000240000000000013355660050017700 0ustar macstaff00000000000000zope.event-4.4/docs/usage.rst0000644000076500000240000000560013355660050016133 0ustar macstaff00000000000000.. _usage-docs: ========================= Using :mod:`zope.event` ========================= .. py:module:: zope.event At its core, :mod:`zope.event` simply consists of two things: a list of subscribers (callable objects), and an API function (:func:`~.zope.event.notify`) that invokes those subscribers in order. .. testsetup:: import zope.event old_subscribers = zope.event.subscribers[:] del zope.event.subscribers[:] Notifications ============= Alerting subscribers that an event has occurred is referred to as "notifying them", or sometimes "sending them the event." The package provides a :func:`~.zope.event.notify` function, which is used to notify subscribers that something has happened: .. doctest:: >>> class MyEvent(object): ... pass >>> event = MyEvent() >>> zope.event.notify(event) The notify function is called with a single object, which we call an event. Any object will do: .. doctest:: >>> zope.event.notify(None) >>> zope.event.notify(42) Our subscriber list is currently empty, so nothing happened in response to these notifications. Subscribers =========== A *subscriber* is a callable object that takes one argument, an object that we call the *event*. Application code can manage subscriptions by manipulating the list that ``zope.event`` maintains. This list starts out empty. .. doctest:: >>> import zope.event >>> zope.event.subscribers [] .. note:: Users of higher-level event frameworks will not typically need to modify *this* subscriber list directly. Generally, such event (or application) frameworks will provide more sophisticated subscription mechanisms that build on this simple mechanism. The frameworks will install subscribers that then distribute the event to other subscribers based on event types or data. A simple framework that is based on the class hierarchy is distributed with this package and described in :doc:`classhandler`. A higher-level event framework is distributed with :mod:`zope.component`. For information on using :mod:`zope.event` together with :mod:`zope.component`, see `zope.component's documentation `_. Trivial Subscribers ------------------- As mentioned above, subscribers are simply callable objects that are added to the subscriptions list: .. doctest:: >>> def f(event): ... print 'got:', event >>> zope.event.subscribers.append(f) >>> zope.event.notify(42) got: 42 >>> def g(event): ... print 'also got:', event >>> zope.event.subscribers.append(g) >>> zope.event.notify(42) got: 42 also got: 42 To unsubscribe, simply remove a subscriber from the list: .. doctest:: >>> zope.event.subscribers.remove(f) >>> zope.event.notify(42) also got: 42 >>> zope.event.subscribers.remove(g) >>> zope.event.notify(42) .. testcleanup:: zope.event.subscribers[:] = old_subscribers zope.event-4.4/docs/make.bat0000644000076500000240000000600513355660050015702 0ustar macstaff00000000000000@ECHO OFF REM Command file for Sphinx documentation set SPHINXBUILD=sphinx-build set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% ) 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. 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. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 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 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "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. goto end ) if "%1" == "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\zopeevent.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopeevent.ghc goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "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. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end zope.event-4.4/docs/classhandler.rst0000644000076500000240000000030313355660050017465 0ustar macstaff00000000000000============================ Class-based event handlers ============================ .. automodule:: zope.event.classhandler :no-members: .. autofunction:: handler(event_class, [handler]) zope.event-4.4/docs/api.rst0000644000076500000240000000042013355660050015573 0ustar macstaff00000000000000.. _api-docs: ================================= :mod:`zope.event` API Reference ================================= The package exports the following API symbols. Data ==== .. autodata:: zope.event.subscribers Functions ========= .. autofunction:: zope.event.notify zope.event-4.4/setup.py0000644000076500000240000000550413355660050015062 0ustar macstaff00000000000000############################################################################## # # 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.event package """ import os from setuptools import setup, find_packages def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: return f.read() setup( name='zope.event', version='4.4', url='http://github.com/zopefoundation/zope.event', license='ZPL 2.1', description='Very basic event publishing system', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', long_description=( read('README.rst') + '\n' + read('CHANGES.rst') ), keywords="event framework dispatch subscribe publish", 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 :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: Jython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: Zope3", "Topic :: Software Development :: Libraries :: Python Modules", ], packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['zope',], include_package_data=True, install_requires=['setuptools'], zip_safe=False, test_suite='zope.event.tests.test_suite', extras_require={ 'docs': [ 'Sphinx', ], 'test': [ 'zope.testrunner', ], }, ) zope.event-4.4/.gitignore0000644000076500000240000000033013355660050015330 0ustar macstaff00000000000000*$py.class *.pyc __pycache__ ./.installed.cfg ./bin ./eggs ./develop-eggs ./parts *.egg-info .tox build docs/_build .coverage .coverage.* htmlcov nosetests.xml coverage.xml .installed.cfg bin develop-eggs eggs parts zope.event-4.4/tox.ini0000644000076500000240000000151513355660050014661 0ustar macstaff00000000000000[tox] envlist = # Jython 2.7b1 support pending fix for Jython incompat. w/ pip's vendored-in # requests -> html5 libraries. See # https://github.com/html5lib/html5lib-python/pull/150 # py27,py33,py34,pypy,pypy3,jython,coverage,docs py27,py34,py35,py36,py37,pypy,pypy3,coverage,docs [testenv] commands = coverage run -m zope.testrunner --test-path=src [] deps = .[test] coverage setenv = COVERAGE_FILE=.coverage.{envname} [testenv:coverage] setenv = COVERAGE_FILE=.coverage skip_install = true commands = coverage erase coverage combine coverage report coverage html coverage xml [testenv:docs] basepython = python2.7 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 deps = Sphinx zope.event-4.4/setup.cfg0000644000076500000240000000046313355660051015171 0ustar macstaff00000000000000[nosetests] nocapture = 1 cover-package = zope.event cover-erase = 1 cover-branches = 1 cover-min-percentage = 100 with-doctest = 0 where = src [aliases] dev = develop easy_install zope.event[testing] docs = easy_install zope.event[docs] [bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 zope.event-4.4/README.rst0000644000076500000240000000177413355660050015044 0ustar macstaff00000000000000======================= ``zope.event`` README ======================= .. image:: https://img.shields.io/pypi/v/zope.event.svg :target: https://pypi.python.org/pypi/zope.event/ :alt: Latest Version .. image:: https://travis-ci.org/zopefoundation/zope.event.svg?branch=master :target: https://travis-ci.org/zopefoundation/zope.event .. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest :target: http://zopeevent.readthedocs.org/en/latest/ :alt: Documentation Status The ``zope.event`` package provides a simple event system, including: - An event publishing API, intended for use by applications which are unaware of any subscribers to their events. - A very simple event-dispatching system on which more sophisticated event dispatching systems can be built. For example, a type-based event dispatching system that builds on ``zope.event`` can be found in ``zope.component``. Please see http://zopeevent.readthedocs.io/ for the documentation. zope.event-4.4/LICENSE.txt0000644000076500000240000000402613355660050015171 0ustar macstaff00000000000000Zope 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. zope.event-4.4/CHANGES.rst0000644000076500000240000000323313355660050015147 0ustar macstaff00000000000000========================== ``zope.event`` Changelog ========================== 4.4 (2018-10-05) ================ - Add support for Python 3.7 4.3.0 (2017-07-25) ================== - Add support for Python 3.6. - Drop support for Python 3.3. 4.2.0 (2016-02-17) ================== - Add support for Python 3.5. - Drop support for Python 2.6 and 3.2. 4.1.0 (2015-10-18) ================== - Require 100% branch (as well as statement) coverage. - Add a simple class-based handler implementation. 4.0.3 (2014-03-19) ================== - Add support for Python 3.4. - Update ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. - Add support for jython 2.7. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. 4.0.0 (2012-05-16) ================== - Automate build of Sphinx HTML docs and running doctest snippets via tox. - Drop explicit support for Python 2.4 / 2.5 / 3.1. - Add support for PyPy. 3.5.2 (2012-03-30) ================== - This release is the last which will maintain support for Python 2.4 / Python 2.5. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.5.1 (2011-08-04) ================== - Add Sphinx documentation. 3.5.0 (2010-05-01) ================== - Add change log to ``long-description``. - Add support for Python 3.x. 3.4.1 (2009-03-03) ================== - A few minor cleanups. 3.4.0 (2007-07-14) ================== - Initial release as a separate project. zope.event-4.4/.travis.yml0000644000076500000240000000072213355660050015456 0ustar macstaff00000000000000language: python sudo: false python: - 2.7 - 3.4 - 3.5 - 3.6 - pypy - pypy3 matrix: include: - python: "3.7" dist: xenial sudo: true script: - coverage run -m zope.testrunner --test-path=src after_success: - coveralls notifications: email: false install: - pip install -U pip setuptools - pip install -U coveralls coverage - pip install -U -e ".[test]" cache: pip before_cache: - rm -f $HOME/.cache/pip/log/debug.log zope.event-4.4/src/0000755000076500000240000000000013355660051014134 5ustar macstaff00000000000000zope.event-4.4/src/zope.event.egg-info/0000755000076500000240000000000013355660051017723 5ustar macstaff00000000000000zope.event-4.4/src/zope.event.egg-info/PKG-INFO0000644000076500000240000001165713355660051021032 0ustar macstaff00000000000000Metadata-Version: 2.1 Name: zope.event Version: 4.4 Summary: Very basic event publishing system Home-page: http://github.com/zopefoundation/zope.event Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: ======================= ``zope.event`` README ======================= .. image:: https://img.shields.io/pypi/v/zope.event.svg :target: https://pypi.python.org/pypi/zope.event/ :alt: Latest Version .. image:: https://travis-ci.org/zopefoundation/zope.event.svg?branch=master :target: https://travis-ci.org/zopefoundation/zope.event .. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest :target: http://zopeevent.readthedocs.org/en/latest/ :alt: Documentation Status The ``zope.event`` package provides a simple event system, including: - An event publishing API, intended for use by applications which are unaware of any subscribers to their events. - A very simple event-dispatching system on which more sophisticated event dispatching systems can be built. For example, a type-based event dispatching system that builds on ``zope.event`` can be found in ``zope.component``. Please see http://zopeevent.readthedocs.io/ for the documentation. ========================== ``zope.event`` Changelog ========================== 4.4 (2018-10-05) ================ - Add support for Python 3.7 4.3.0 (2017-07-25) ================== - Add support for Python 3.6. - Drop support for Python 3.3. 4.2.0 (2016-02-17) ================== - Add support for Python 3.5. - Drop support for Python 2.6 and 3.2. 4.1.0 (2015-10-18) ================== - Require 100% branch (as well as statement) coverage. - Add a simple class-based handler implementation. 4.0.3 (2014-03-19) ================== - Add support for Python 3.4. - Update ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ================== - Flesh out PyPI Trove classifiers. - Add support for jython 2.7. 4.0.1 (2012-11-21) ================== - Add support for Python 3.3. 4.0.0 (2012-05-16) ================== - Automate build of Sphinx HTML docs and running doctest snippets via tox. - Drop explicit support for Python 2.4 / 2.5 / 3.1. - Add support for PyPy. 3.5.2 (2012-03-30) ================== - This release is the last which will maintain support for Python 2.4 / Python 2.5. - Add support for continuous integration using ``tox`` and ``jenkins``. - Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). 3.5.1 (2011-08-04) ================== - Add Sphinx documentation. 3.5.0 (2010-05-01) ================== - Add change log to ``long-description``. - Add support for Python 3.x. 3.4.1 (2009-03-03) ================== - A few minor cleanups. 3.4.0 (2007-07-14) ================== - Initial release as a separate project. Keywords: event framework dispatch subscribe publish Platform: UNKNOWN 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 :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: Jython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope3 Classifier: Topic :: Software Development :: Libraries :: Python Modules Provides-Extra: test Provides-Extra: docs zope.event-4.4/src/zope.event.egg-info/not-zip-safe0000644000076500000240000000000113355660051022151 0ustar macstaff00000000000000 zope.event-4.4/src/zope.event.egg-info/namespace_packages.txt0000644000076500000240000000000513355660051024251 0ustar macstaff00000000000000zope zope.event-4.4/src/zope.event.egg-info/SOURCES.txt0000644000076500000240000000125713355660051021614 0ustar macstaff00000000000000.coveragerc .gitignore .travis.yml CHANGES.rst COPYRIGHT.txt LICENSE.txt MANIFEST.in README.rst bootstrap.py buildout.cfg setup.cfg setup.py tox.ini docs/Makefile docs/api.rst docs/classhandler.rst docs/conf.py docs/hacking.rst docs/index.rst docs/make.bat docs/theory.rst docs/usage.rst docs/_static/.gitignore src/zope/__init__.py src/zope.event.egg-info/PKG-INFO src/zope.event.egg-info/SOURCES.txt src/zope.event.egg-info/dependency_links.txt src/zope.event.egg-info/namespace_packages.txt src/zope.event.egg-info/not-zip-safe src/zope.event.egg-info/requires.txt src/zope.event.egg-info/top_level.txt src/zope/event/__init__.py src/zope/event/classhandler.py src/zope/event/tests.pyzope.event-4.4/src/zope.event.egg-info/requires.txt0000644000076500000240000000006213355660051022321 0ustar macstaff00000000000000setuptools [docs] Sphinx [test] zope.testrunner zope.event-4.4/src/zope.event.egg-info/top_level.txt0000644000076500000240000000000513355660051022450 0ustar macstaff00000000000000zope zope.event-4.4/src/zope.event.egg-info/dependency_links.txt0000644000076500000240000000000113355660051023771 0ustar macstaff00000000000000 zope.event-4.4/src/zope/0000755000076500000240000000000013355660051015111 5ustar macstaff00000000000000zope.event-4.4/src/zope/__init__.py0000644000076500000240000000011313355660050017214 0ustar macstaff00000000000000__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover zope.event-4.4/src/zope/event/0000755000076500000240000000000013355660051016232 5ustar macstaff00000000000000zope.event-4.4/src/zope/event/classhandler.py0000644000076500000240000000343013355660050021246 0ustar macstaff00000000000000"""Class-based event handlers A light-weight event-handler framework based on event classes. Handlers are registered for event classes: >>> import zope.event.classhandler >>> class MyEvent(object): ... def __repr__(self): ... return self.__class__.__name__ >>> def handler1(event): ... print("handler1 %r" % event) >>> zope.event.classhandler.handler(MyEvent, handler1) Descriptor syntax: >>> @zope.event.classhandler.handler(MyEvent) ... def handler2(event): ... print("handler2 %r" % event) >>> class MySubEvent(MyEvent): ... pass >>> @zope.event.classhandler.handler(MySubEvent) ... def handler3(event): ... print("handler3 %r" % event) Subscribers are called in class method-resolution order, so only new-style event classes are supported, and then by order of registry. >>> import zope.event >>> zope.event.notify(MySubEvent()) handler3 MySubEvent handler1 MySubEvent handler2 MySubEvent """ import zope.event __all__ = [ 'handler', ] registry = {} def handler(event_class, handler_=None, _decorator=False): """ Define an event handler for a (new-style) class. This can be called with a class and a handler, or with just a class and the result used as a handler decorator. """ if handler_ is None: return lambda func: handler(event_class, func, True) if not registry: zope.event.subscribers.append(dispatch) if event_class not in registry: registry[event_class] = [handler_] else: registry[event_class].append(handler_) if _decorator: return handler def dispatch(event): for event_class in event.__class__.__mro__: for handler in registry.get(event_class, ()): handler(event) zope.event-4.4/src/zope/event/__init__.py0000644000076500000240000000216513355660050020346 0ustar macstaff00000000000000############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """ Base event system implementation """ #: Applications may register for notification of events by appending a #: callable to the ``subscribers`` list. #: #: Each subscriber takes a single argument, which is the event object #: being published. #: #: Exceptions raised by subscribers will be propagated *without* running #: any remaining subscribers. subscribers = [] def notify(event): """ Notify all subscribers of ``event``. """ for subscriber in subscribers: subscriber(event) zope.event-4.4/src/zope/event/tests.py0000644000076500000240000000351713355660050017753 0ustar macstaff00000000000000############################################################################## # # Copyright (c) 2004 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 event system """ import doctest import unittest class Test_notify(unittest.TestCase): def setUp(self): from zope.event import subscribers self._old_subscribers = subscribers[:] subscribers[:] = [] def tearDown(self): from zope.event import subscribers subscribers[:] = self._old_subscribers def _callFUT(self, event): from zope.event import notify notify(event) def test_empty(self): event = object() self._callFUT(event) def test_not_empty(self): from zope.event import subscribers dummy = [] subscribers.append(dummy.append) event = object() self._callFUT(event) self.assertEqual(dummy, [event]) def setUpClassHandlers(test): import zope.event test.globs['old_subs'] = zope.event.subscribers def tearDownClassHandlers(test): import zope.event zope.event.subscribers = test.globs['old_subs'] def test_suite(): return unittest.TestSuite(( unittest.defaultTestLoader.loadTestsFromName(__name__), doctest.DocTestSuite( 'zope.event.classhandler', setUp=setUpClassHandlers, tearDown=tearDownClassHandlers) ))