zope.deprecation-4.1.2/0000775000175000017500000000000012455234662016146 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/setup.cfg0000664000175000017500000000041712455234662017771 0ustar tseavertseaver00000000000000[nosetests] nocapture = 1 cover-package = zope.deprecation cover-erase = 1 with-doctest = 0 where = src [aliases] dev = develop easy_install zope.deprecation[testing] docs = easy_install zope.deprecation[docs] [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.deprecation-4.1.2/buildout.cfg0000664000175000017500000000014412072655562020456 0ustar tseavertseaver00000000000000[buildout] parts = test develop = . [test] recipe = zc.recipe.testrunner eggs = zope.deprecation zope.deprecation-4.1.2/PKG-INFO0000664000175000017500000001021612455234662017243 0ustar tseavertseaver00000000000000Metadata-Version: 1.1 Name: zope.deprecation Version: 4.1.2 Summary: Zope Deprecation Infrastructure Home-page: http://pypi.python.org/pypi/zope.deprecation Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: ``zope.deprecation`` ==================== .. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master :target: https://travis-ci.org/zopefoundation/zope.deprecation This package provides a simple function called ``deprecated(names, reason)`` to mark deprecated modules, classes, functions, methods and properties. Please see http://docs.zope.org/zope.deprecation/ for the documentation. ``zope.deprecation`` Changelog ============================== 4.1.2 (2015-01-13) ------------------ - Do not require a ``self`` parameter for deprecated functions. See: https://github.com/zopefoundation/zope.deprecation/pull/1 4.1.1 (2014-03-19) ------------------ - Added explicit support for Python 3.4. 4.1.0 (2013-12-20) ------------------ - Added a ``Suppressor`` context manager, allowing scoped suppression of deprecation warnings. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Added Sphinx documentation: - API docs moved from package-data README into ``docs/api.rst``. - Snippets can be tested by running 'make doctest'. - Updated support for continuous integration using ``tox`` and ``jenkins``. - 100% unit test coverage. - Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). - Removed spurious dependency on ``zope.testing``. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. 3.5.1 (2012-03-15) ------------------ - Revert a move of `README.txt` to unbreak ``zope.app.apidoc``. 3.5.0 (2011-09-05) ------------------ - Replaced doctesting with unit testing. - Python 3 compatibility. 3.4.1 (2011-06-07) ------------------ - Removed import cycle for ``__show__`` by defining it in the ``zope.deprecation.deprecation`` module. - Added support to bootstrap on Jython. - Fix ``zope.deprecation.warn()`` to make the signature identical to ``warnings.warn()`` and to check for .pyc and .pyo files. 3.4.0 (2007-07-19) ------------------ - Release 3.4 final, corresponding to Zope 3.4. 3.3.0 (2007-02-18) ------------------ - Corresponds to the version of the ``zope.deprecation`` package shipped as part of the Zope 3.3.0 release. Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope3 zope.deprecation-4.1.2/tox.ini0000664000175000017500000000172612455234515017464 0ustar tseavertseaver00000000000000[tox] envlist = # Jython support pending 2.7 support, due 2012-07-15 or so. See: # http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html # py26,py27,py32,jython,pypy,coverage py26,py27,py32,py33,py34,pypy,pypy3,coverage,docs [testenv] commands = python setup.py test -q [testenv:jython] commands = jython setup.py test -q [testenv:coverage] basepython = python2.6 commands = # The installed version messes up nose's test discovery / coverage reporting # So, we uninstall that from the environment, and then install the editable # version, before running nosetests. pip uninstall -y zope.deprecation pip install -e . nosetests --with-xunit --with-xcoverage deps = nose coverage nosexcover [testenv:docs] basepython = python2.6 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.deprecation-4.1.2/.gitignore0000664000175000017500000000017712167127737020147 0ustar tseavertseaver00000000000000*.pyc *.egg-info __pycache__ _build docs/_build .tox .coverage nosetests.xml coverage.xml .installed.cfg bin develop-eggs eggs zope.deprecation-4.1.2/setup.py0000664000175000017500000000466012455234652017665 0ustar tseavertseaver00000000000000############################################################################## # # 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.deprecation package """ import os from setuptools import setup, find_packages def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name='zope.deprecation', version='4.1.2', url='http://pypi.python.org/pypi/zope.deprecation', license='ZPL 2.1', description='Zope Deprecation Infrastructure', author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', long_description=( read('README.rst') + '\n\n' + read('CHANGES.rst') ), classifiers=[ "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: Zope3", ], package_dir = {'': 'src'}, packages=find_packages('src'), namespace_packages=['zope',], install_requires = 'setuptools', include_package_data = True, zip_safe = False, test_suite='zope.deprecation', extras_require={ 'docs': ['Sphinx'], 'testing': ['nose', 'coverage'], }, ) zope.deprecation-4.1.2/bootstrap.py0000664000175000017500000001454512455232531020537 0ustar tseavertseaver00000000000000############################################################################## # # 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 tmpeggs = tempfile.mkdtemp() 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("-v", "--version", help="use a specific zc.buildout 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("--setuptools-version", help="use a specific setuptools version") options, args = parser.parse_args() ###################################################################### # load/install setuptools try: if options.allow_site_packages: import setuptools import pkg_resources from urllib.request import urlopen except ImportError: from urllib2 import urlopen ez = {} 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(): 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 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 cmd = [sys.executable, '-c', '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]) setuptools_path = ws.find( pkg_resources.Requirement.parse('setuptools')).location requirement = 'zc.buildout' version = options.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, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 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.deprecation-4.1.2/.bzrignore0000664000175000017500000000011012072655562020141 0ustar tseavertseaver00000000000000.coverage *.egg-info __pycache__ .tox nosetests.xml coverage.xml _build zope.deprecation-4.1.2/.travis.yml0000664000175000017500000000032112455234502020244 0ustar tseavertseaver00000000000000language: python sudo: false python: - 2.6 - 2.7 - 3.2 - 3.3 - 3.4 - pypy - pypy3 install: - pip install . script: - python setup.py test -q notifications: email: false zope.deprecation-4.1.2/src/0000775000175000017500000000000012455234662016735 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/src/zope.deprecation.egg-info/0000775000175000017500000000000012455234662023700 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/src/zope.deprecation.egg-info/top_level.txt0000664000175000017500000000000512455234660026423 0ustar tseavertseaver00000000000000zope zope.deprecation-4.1.2/src/zope.deprecation.egg-info/SOURCES.txt0000664000175000017500000000370212455234662025566 0ustar tseavertseaver00000000000000.bzrignore .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/conf.py docs/hacking.rst docs/index.rst docs/make.bat docs/_build/doctest/output.txt docs/_build/doctrees/api.doctree docs/_build/doctrees/environment.pickle docs/_build/doctrees/hacking.doctree docs/_build/doctrees/index.doctree docs/_build/html/.buildinfo docs/_build/html/api.html docs/_build/html/genindex.html docs/_build/html/hacking.html docs/_build/html/index.html docs/_build/html/objects.inv docs/_build/html/search.html docs/_build/html/searchindex.js docs/_build/html/_sources/api.txt docs/_build/html/_sources/hacking.txt docs/_build/html/_sources/index.txt docs/_build/html/_static/ajax-loader.gif docs/_build/html/_static/basic.css docs/_build/html/_static/comment-bright.png docs/_build/html/_static/comment-close.png docs/_build/html/_static/comment.png docs/_build/html/_static/default.css docs/_build/html/_static/doctools.js docs/_build/html/_static/down-pressed.png docs/_build/html/_static/down.png docs/_build/html/_static/file.png docs/_build/html/_static/jquery.js docs/_build/html/_static/minus.png docs/_build/html/_static/plus.png docs/_build/html/_static/pygments.css docs/_build/html/_static/searchtools.js docs/_build/html/_static/sidebar.js docs/_build/html/_static/underscore.js docs/_build/html/_static/up-pressed.png docs/_build/html/_static/up.png docs/_build/html/_static/websupport.js src/coverage.xml src/zope/__init__.py src/zope.deprecation.egg-info/PKG-INFO src/zope.deprecation.egg-info/SOURCES.txt src/zope.deprecation.egg-info/dependency_links.txt src/zope.deprecation.egg-info/namespace_packages.txt src/zope.deprecation.egg-info/not-zip-safe src/zope.deprecation.egg-info/requires.txt src/zope.deprecation.egg-info/top_level.txt src/zope/deprecation/__init__.py src/zope/deprecation/deprecation.py src/zope/deprecation/fixture.py src/zope/deprecation/tests.pyzope.deprecation-4.1.2/src/zope.deprecation.egg-info/PKG-INFO0000664000175000017500000001021612455234660024773 0ustar tseavertseaver00000000000000Metadata-Version: 1.1 Name: zope.deprecation Version: 4.1.2 Summary: Zope Deprecation Infrastructure Home-page: http://pypi.python.org/pypi/zope.deprecation Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: ``zope.deprecation`` ==================== .. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master :target: https://travis-ci.org/zopefoundation/zope.deprecation This package provides a simple function called ``deprecated(names, reason)`` to mark deprecated modules, classes, functions, methods and properties. Please see http://docs.zope.org/zope.deprecation/ for the documentation. ``zope.deprecation`` Changelog ============================== 4.1.2 (2015-01-13) ------------------ - Do not require a ``self`` parameter for deprecated functions. See: https://github.com/zopefoundation/zope.deprecation/pull/1 4.1.1 (2014-03-19) ------------------ - Added explicit support for Python 3.4. 4.1.0 (2013-12-20) ------------------ - Added a ``Suppressor`` context manager, allowing scoped suppression of deprecation warnings. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Added Sphinx documentation: - API docs moved from package-data README into ``docs/api.rst``. - Snippets can be tested by running 'make doctest'. - Updated support for continuous integration using ``tox`` and ``jenkins``. - 100% unit test coverage. - Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). - Removed spurious dependency on ``zope.testing``. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. 3.5.1 (2012-03-15) ------------------ - Revert a move of `README.txt` to unbreak ``zope.app.apidoc``. 3.5.0 (2011-09-05) ------------------ - Replaced doctesting with unit testing. - Python 3 compatibility. 3.4.1 (2011-06-07) ------------------ - Removed import cycle for ``__show__`` by defining it in the ``zope.deprecation.deprecation`` module. - Added support to bootstrap on Jython. - Fix ``zope.deprecation.warn()`` to make the signature identical to ``warnings.warn()`` and to check for .pyc and .pyo files. 3.4.0 (2007-07-19) ------------------ - Release 3.4 final, corresponding to Zope 3.4. 3.3.0 (2007-02-18) ------------------ - Corresponds to the version of the ``zope.deprecation`` package shipped as part of the Zope 3.3.0 release. Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Framework :: Zope3 zope.deprecation-4.1.2/src/zope.deprecation.egg-info/dependency_links.txt0000664000175000017500000000000112455234660027744 0ustar tseavertseaver00000000000000 zope.deprecation-4.1.2/src/zope.deprecation.egg-info/not-zip-safe0000664000175000017500000000000112072656510026121 0ustar tseavertseaver00000000000000 zope.deprecation-4.1.2/src/zope.deprecation.egg-info/namespace_packages.txt0000664000175000017500000000000512455234660030224 0ustar tseavertseaver00000000000000zope zope.deprecation-4.1.2/src/zope.deprecation.egg-info/requires.txt0000664000175000017500000000006312455234660026275 0ustar tseavertseaver00000000000000setuptools [docs] Sphinx [testing] nose coverage zope.deprecation-4.1.2/src/coverage.xml0000664000175000017500000001357412255113771021257 0ustar tseavertseaver00000000000000 zope.deprecation-4.1.2/src/zope/0000775000175000017500000000000012455234662017712 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/src/zope/__init__.py0000664000175000017500000000007012072655562022021 0ustar tseavertseaver00000000000000__import__('pkg_resources').declare_namespace(__name__) zope.deprecation-4.1.2/src/zope/deprecation/0000775000175000017500000000000012455234662022207 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/src/zope/deprecation/__init__.py0000664000175000017500000000176612255113704024321 0ustar tseavertseaver00000000000000############################################################################## # # Copyright (c) 2005 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. # ############################################################################## """Deprecation of modules / APIs. """ __docformat__ = "reStructuredText" from zope.deprecation.deprecation import deprecated from zope.deprecation.deprecation import deprecate from zope.deprecation.deprecation import moved from zope.deprecation.deprecation import ShowSwitch from zope.deprecation.deprecation import __show__ from zope.deprecation.deprecation import Suppressor zope.deprecation-4.1.2/src/zope/deprecation/fixture.py0000664000175000017500000000003212072655562024243 0ustar tseavertseaver00000000000000# used by tests abc = 1 zope.deprecation-4.1.2/src/zope/deprecation/tests.py0000664000175000017500000004155612444603107023726 0ustar tseavertseaver00000000000000import sys import types import unittest class TestShowSwitch(unittest.TestCase): def _makeOne(self): from zope.deprecation import ShowSwitch return ShowSwitch() def test_on(self): switch = self._makeOne() switch.stack.append(False) switch.on() self.assertEqual(switch.stack, []) def test_off(self): switch = self._makeOne() switch.off() self.assertEqual(switch.stack, [False]) def test_reset(self): switch = self._makeOne() switch.stack.append(False) switch.reset() self.assertEqual(switch.stack, []) def test_call_true(self): switch = self._makeOne() self.assertEqual(switch(), True) def test_call_false(self): switch = self._makeOne() switch.stack.append(False) self.assertEqual(switch(), False) def test_repr_on(self): switch = self._makeOne() self.assertEqual(repr(switch), '') def test_repr_off(self): switch = self._makeOne() switch.stack.append(False) self.assertEqual(repr(switch), '') def test___show__global(self): from zope.deprecation import __show__ self.assertEqual(self._makeOne().__class__, __show__.__class__) class TestSuppressor(unittest.TestCase): def _makeOne(self): from zope.deprecation import Suppressor return Suppressor() def test_it(self): from zope.deprecation import __show__ self.assertEqual(__show__.stack, []) with self._makeOne(): self.assertEqual(__show__.stack, [False]) self.assertEqual(__show__.stack, []) class WarningsSetupBase(object): def setUp(self): from zope.deprecation import deprecation self.oldwarnings = deprecation.warnings self.oldshow = deprecation.__show__ self.warnings = DummyWarningsModule() self.show = DummyShow() deprecation.warnings = self.warnings deprecation.__show__ = self.show def tearDown(self): from zope.deprecation import deprecation deprecation.warnings = self.oldwarnings deprecation.__show__ = self.oldshow class TestDeprecationProxy(WarningsSetupBase, unittest.TestCase): def _getTargetClass(self): from zope.deprecation.deprecation import DeprecationProxy return DeprecationProxy def _makeOne(self, module): cls = self._getTargetClass() return cls(module) def test_deprecate_and__getattribute__string(self): tests = _getTestsModule() proxy = self._makeOne(tests) proxy.deprecate('ClassFixture', 'hello') self.assertEqual(proxy.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, [('ClassFixture: hello', DeprecationWarning, 2)]) def test_deprecate_and__getattribute__sequence(self): tests = _getTestsModule() proxy = self._makeOne(tests) proxy.deprecate(('ClassFixture', 'ClassFixture2'), 'hello') self.assertEqual(proxy.ClassFixture, ClassFixture) self.assertEqual(proxy.ClassFixture2, ClassFixture2) self.assertEqual( self.warnings.w, [('ClassFixture: hello', DeprecationWarning, 2), ('ClassFixture2: hello', DeprecationWarning, 2)] ) def test_deprecate_and__getattribute__noshow(self): tests = _getTestsModule() proxy = self._makeOne(tests) proxy.deprecate('ClassFixture', 'hello') self.show.on = False self.assertEqual(proxy.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, []) def test___getattribute____class__(self): tests = _getTestsModule() proxy = self._makeOne(tests) self.assertEqual(proxy.__class__, types.ModuleType) def test___getattribute___deprecate(self): tests = _getTestsModule() proxy = self._makeOne(tests) self.assertEqual(type(proxy.deprecate), types.MethodType) def test___getattribute__missing(self): tests = _getTestsModule() proxy = self._makeOne(tests) self.assertRaises(AttributeError, getattr, proxy, 'wontbethere') def test___setattr__owned(self): tests = _getTestsModule() proxy = self._makeOne(tests) proxy._DeprecationProxy__deprecated = {'foo':'bar'} self.assertEqual(proxy._DeprecationProxy__deprecated, {'foo':'bar'}) def test___setattr__notowned(self): tests = _getTestsModule() proxy = self._makeOne(tests) try: proxy.foo = 'bar' self.assertEqual(tests.foo, 'bar') finally: del tests.foo def test___delattr__owned(self): tests = _getTestsModule() proxy = self._makeOne(tests) del proxy._DeprecationProxy__deprecated self.assertRaises(AttributeError, getattr, proxy, '_DeprecationProxy__deprecated') def test___delattr__notowned(self): tests = _getTestsModule() proxy = self._makeOne(tests) tests.foo = 'bar' del proxy.foo self.assertRaises(AttributeError, getattr, tests, 'foo') class TestDeprecatedModule(WarningsSetupBase, unittest.TestCase): def _getTargetClass(self): from zope.deprecation.deprecation import DeprecatedModule return DeprecatedModule def _makeOne(self, module, msg): cls = self._getTargetClass() return cls(module, msg) def test___getattribute____class__(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') self.assertEqual(proxy.__class__, types.ModuleType) def test___getattribute____owned__(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') self.assertEqual(proxy._DeprecatedModule__msg, 'hello') def test___getattribute___deprecated(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') self.assertEqual(proxy.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test___getattribute__missing(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') self.assertRaises(AttributeError, getattr, proxy, 'wontbethere') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test___getattribute___noshow(self): tests = _getTestsModule() self.show.on = False proxy = self._makeOne(tests, 'hello') self.assertEqual(proxy.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, []) def test___setattr__owned(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') proxy._DeprecatedModule__msg = 'foo' self.assertEqual(proxy._DeprecatedModule__msg, 'foo') def test___setattr__notowned(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') try: proxy.foo = 'bar' self.assertEqual(tests.foo, 'bar') finally: del tests.foo def test___delattr__owned(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') del proxy._DeprecatedModule__msg self.assertRaises(AttributeError, getattr, proxy, '_DeprecatedModule__msg') def test___delattr__notowned(self): tests = _getTestsModule() proxy = self._makeOne(tests, 'hello') tests.foo = 'bar' del proxy.foo self.assertRaises(AttributeError, getattr, tests, 'foo') class TestDeprecatedGetProperty(WarningsSetupBase, unittest.TestCase): def _getTargetClass(self): from zope.deprecation.deprecation import DeprecatedGetProperty return DeprecatedGetProperty def _makeOne(self, prop, msg): cls = self._getTargetClass() return cls(prop, msg) def test___get__(self): prop = DummyProperty() proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__get__('inst', 'cls'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual(prop.cls, 'cls') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test___get__noshow(self): prop = DummyProperty() self.show.on = False proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__get__('inst', 'cls'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual(prop.cls, 'cls') self.assertEqual(self.warnings.w, []) class TestDeprecatedGetSetProperty(TestDeprecatedGetProperty): def _getTargetClass(self): from zope.deprecation.deprecation import DeprecatedGetSetProperty return DeprecatedGetSetProperty def test___set__(self): prop = DummyProperty() proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__set__('inst', 'prop'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual(prop.prop, 'prop') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test___set__noshow(self): prop = DummyProperty() self.show.on = False proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__set__('inst', 'prop'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual(prop.prop, 'prop') self.assertEqual(self.warnings.w, []) class TestDeprecatedSetGetDeleteProperty(TestDeprecatedGetSetProperty): def _getTargetClass(self): from zope.deprecation.deprecation import DeprecatedGetSetDeleteProperty return DeprecatedGetSetDeleteProperty def test___delete__(self): prop = DummyProperty() proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__delete__('inst'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test___delete__noshow(self): prop = DummyProperty() proxy = self._makeOne(prop, 'hello') self.assertEqual(proxy.__delete__('inst'), None) self.assertEqual(prop.inst, 'inst') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) class TestDeprecatedMethod(WarningsSetupBase, unittest.TestCase): def _callFUT(self, method, message): from zope.deprecation.deprecation import DeprecatedMethod return DeprecatedMethod(method, message) def fixture(self, a, b, c=1): return 'fixture' def test_it(self): result = self._callFUT(self.fixture, 'hello') self.assertEqual(result('a', 'b', c=2), 'fixture') self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)] ) def test_it_noshow(self): result = self._callFUT(self.fixture, 'hello') self.show.on = False self.assertEqual(result('a', 'b', c=2), 'fixture') self.assertEqual(self.warnings.w, []) class Test_deprecated(WarningsSetupBase, unittest.TestCase): def setUp(self): super(Test_deprecated, self).setUp() self.mod = _getTestsModule() def tearDown(self): super(Test_deprecated, self).tearDown() sys.modules['zope.deprecation.tests'] = self.mod def _callFUT(self, spec, message): from zope.deprecation.deprecation import deprecated return deprecated(spec, message) def test_string_specifier(self): self._callFUT('ClassFixture', 'hello') mod = _getTestsModule() self.assertNotEqual(mod, self.mod) self.assertEqual(mod.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, [('ClassFixture: hello', DeprecationWarning, 2)]) def test_string_specifier_sys_modules_already_mutated(self): from zope.deprecation.deprecation import DeprecationProxy mod = _getTestsModule() new = sys.modules['zope.deprecation.tests'] = DeprecationProxy(mod) self._callFUT('ClassFixture', 'hello') self.assertEqual(new.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, [('ClassFixture: hello', DeprecationWarning, 2)]) def test_function_specifier(self): result = self._callFUT(functionfixture, 'hello') self.assertNotEqual(result, functionfixture) self.assertEqual(self.warnings.w, []) result() self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) def test_module_specifier(self): mod = _getTestsModule() result = self._callFUT(mod, 'hello') self.assertEqual(self.warnings.w, []) self.assertEqual(result.ClassFixture, ClassFixture) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) def test_getproperty_specifier(self): prop = DummyGetProperty() result = self._callFUT(prop, 'hello') self.assertEqual(self.warnings.w, []) self.assertEqual(result.__get__('inst', 'cls'), None) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) def test_getsetproperty_specifier(self): prop = DummyGetSetProperty() result = self._callFUT(prop, 'hello') self.assertEqual(self.warnings.w, []) self.assertEqual(result.__set__('inst', 'prop'), None) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) def test_getsetdeleteproperty_specifier(self): prop = DummyGetSetDeleteProperty() result = self._callFUT(prop, 'hello') self.assertEqual(self.warnings.w, []) self.assertEqual(result.__delete__('inst'), None) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) class Test_deprecate(WarningsSetupBase, unittest.TestCase): def _getTargetClass(self): from zope.deprecation.deprecation import deprecate return deprecate def _makeOne(self, msg): cls = self._getTargetClass() return cls(msg) def fixture(self): return 'fixture' def test___call__(self): proxy = self._makeOne('hello') result = proxy(functionfixture) self.assertEqual(result(), None) self.assertEqual( self.warnings.w, [('hello', DeprecationWarning, 2)]) class Test_moved(WarningsSetupBase, unittest.TestCase): def setUp(self): super(Test_moved, self).setUp() def tearDown(self): super(Test_moved, self).tearDown() del _getTestsModule().__dict__['abc'] def _callFUT(self, to_location, unsupported_in): from zope.deprecation.deprecation import moved return moved(to_location, unsupported_in) def test_unsupported_None(self): self._callFUT('zope.deprecation.fixture', None) self.assertEqual( self.warnings.w, [('zope.deprecation.tests has moved to zope.deprecation.fixture.', DeprecationWarning, 3)]) def test_unsupported_not_None(self): self._callFUT('zope.deprecation.fixture', '1.3') self.assertEqual( self.warnings.w, [('zope.deprecation.tests has moved to zope.deprecation.fixture. ' 'Import of zope.deprecation.tests will become unsupported in 1.3', DeprecationWarning, 3)]) class Test_import_aliases(unittest.TestCase): def test_it(self): for name in ('deprecated', 'deprecate', 'moved', 'ShowSwitch', '__show__'): real = getattr(sys.modules['zope.deprecation.deprecation'], name) alias = getattr(sys.modules['zope.deprecation'], name) self.assertEqual(real, alias, (real, alias)) class DummyWarningsModule(object): def __init__(self): self.w = [] def warn(self, msg, type, stacklevel): self.w.append((msg, type, stacklevel)) class DummyGetProperty(object): def __get__(self, inst, cls): self.inst = inst self.cls = cls class DummyGetSetProperty(DummyGetProperty): def __set__(self, inst, prop): self.inst = inst self.prop = prop class DummyGetSetDeleteProperty(DummyGetSetProperty): def __delete__(self, inst): self.inst = inst DummyProperty = DummyGetSetDeleteProperty def _getTestsModule(): __import__('zope.deprecation.tests') return sys.modules['zope.deprecation.tests'] class DummyShow(object): def __init__(self): self.on = True def __call__(self): if self.on: return True return False class ClassFixture(object): pass class ClassFixture2(object): pass def functionfixture(): pass zope.deprecation-4.1.2/src/zope/deprecation/deprecation.py0000664000175000017500000001567712444603107025066 0ustar tseavertseaver00000000000000############################################################################## # # Copyright (c) 2005 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. # ############################################################################## """Deprecation Support This module provides utilities to ease the development of backward-compatible code. """ __docformat__ = "reStructuredText" import sys import types import warnings PY3 = sys.version_info[0] == 3 if PY3: #pragma NO COVER str_and_sequence_types = (str, list, tuple) else: #pragma NO COVER str_and_sequence_types = (basestring, list, tuple) class ShowSwitch(object): """Simple stack-based switch.""" def __init__(self): self.stack = [] def on(self): self.stack.pop() def off(self): self.stack.append(False) def reset(self): self.stack = [] def __call__(self): return self.stack == [] def __repr__(self): return '' %(self() and 'on' or 'off') # This attribute can be used to temporarly deactivate deprecation # warnings, so that backward-compatibility code can import other # backward-compatiblity components without warnings being produced. __show__ = ShowSwitch() class Suppressor(object): def __enter__(self): __show__.off() def __exit__(self, *ignored): __show__.on() ogetattr = object.__getattribute__ class DeprecationProxy(object): def __init__(self, module): self.__original_module = module self.__deprecated = {} def deprecate(self, names, message): """Deprecate the given names.""" if not isinstance(names, (tuple, list)): names = (names,) for name in names: self.__deprecated[name] = message def __getattribute__(self, name): if name == 'deprecate' or name.startswith('_DeprecationProxy__'): return ogetattr(self, name) if name == '__class__': return types.ModuleType if name in ogetattr(self, '_DeprecationProxy__deprecated'): if __show__(): warnings.warn( name + ': ' + self.__deprecated[name], DeprecationWarning, 2) return getattr(ogetattr(self, '_DeprecationProxy__original_module'), name) def __setattr__(self, name, value): if name.startswith('_DeprecationProxy__'): return object.__setattr__(self, name, value) setattr(self.__original_module, name, value) def __delattr__(self, name): if name.startswith('_DeprecationProxy__'): return object.__delattr__(self, name) delattr(self.__original_module, name) class DeprecatedModule(object): def __init__(self, module, msg): self.__original_module = module self.__msg = msg def __getattribute__(self, name): if name.startswith('_DeprecatedModule__'): return ogetattr(self, name) if name == '__class__': return types.ModuleType if __show__(): warnings.warn(self.__msg, DeprecationWarning, 2) return getattr(ogetattr(self, '_DeprecatedModule__original_module'), name) def __setattr__(self, name, value): if name.startswith('_DeprecatedModule__'): return object.__setattr__(self, name, value) setattr(self.__original_module, name, value) def __delattr__(self, name): if name.startswith('_DeprecatedModule__'): return object.__delattr__(self, name) delattr(self.__original_module, name) class DeprecatedGetProperty(object): def __init__(self, prop, message): self.message = message self.prop = prop def __get__(self, inst, klass): if __show__(): warnings.warn(self.message, DeprecationWarning, 2) return self.prop.__get__(inst, klass) class DeprecatedGetSetProperty(DeprecatedGetProperty): def __set__(self, inst, prop): if __show__(): warnings.warn(self.message, DeprecationWarning, 2) self.prop.__set__(inst, prop) class DeprecatedGetSetDeleteProperty(DeprecatedGetSetProperty): def __delete__(self, inst): if __show__(): warnings.warn(self.message, DeprecationWarning, 2) self.prop.__delete__(inst) def DeprecatedMethod(method, message): def deprecated_method(*args, **kw): if __show__(): warnings.warn(message, DeprecationWarning, 2) return method(*args, **kw) return deprecated_method def deprecated(specifier, message): """Deprecate the given names.""" # A string specifier (or list of strings) means we're called # top-level in a module and are to deprecate things inside this # module if isinstance(specifier, str_and_sequence_types): globals = sys._getframe(1).f_globals modname = globals['__name__'] if not isinstance(sys.modules[modname], DeprecationProxy): sys.modules[modname] = DeprecationProxy(sys.modules[modname]) sys.modules[modname].deprecate(specifier, message) # Anything else can mean the specifier is a function/method, # module, or just an attribute of a class elif isinstance(specifier, types.FunctionType): return DeprecatedMethod(specifier, message) elif isinstance(specifier, types.ModuleType): return DeprecatedModule(specifier, message) else: prop = specifier if hasattr(prop, '__get__') and hasattr(prop, '__set__') and \ hasattr(prop, '__delete__'): return DeprecatedGetSetDeleteProperty(prop, message) elif hasattr(prop, '__get__') and hasattr(prop, '__set__'): return DeprecatedGetSetProperty(prop, message) elif hasattr(prop, '__get__'): return DeprecatedGetProperty(prop, message) class deprecate(object): """Deprecation decorator""" def __init__(self, msg): self.msg = msg def __call__(self, func): return DeprecatedMethod(func, self.msg) def moved(to_location, unsupported_in=None): old = sys._getframe(1).f_globals['__name__'] message = '%s has moved to %s.' % (old, to_location) if unsupported_in: message += " Import of %s will become unsupported in %s" % ( old, unsupported_in) warnings.warn(message, DeprecationWarning, 3) __import__(to_location) fromdict = sys.modules[to_location].__dict__ tomod = sys.modules[old] tomod.__doc__ = message for name, v in fromdict.items(): if name not in tomod.__dict__: setattr(tomod, name, v) zope.deprecation-4.1.2/COPYRIGHT.txt0000664000175000017500000000004012072655562020252 0ustar tseavertseaver00000000000000Zope Foundation and Contributorszope.deprecation-4.1.2/CHANGES.rst0000664000175000017500000000403112455234652017745 0ustar tseavertseaver00000000000000``zope.deprecation`` Changelog ============================== 4.1.2 (2015-01-13) ------------------ - Do not require a ``self`` parameter for deprecated functions. See: https://github.com/zopefoundation/zope.deprecation/pull/1 4.1.1 (2014-03-19) ------------------ - Added explicit support for Python 3.4. 4.1.0 (2013-12-20) ------------------ - Added a ``Suppressor`` context manager, allowing scoped suppression of deprecation warnings. - Updated ``boostrap.py`` to version 2.2. 4.0.2 (2012-12-31) ------------------ - Fleshed out PyPI Trove classifiers. 4.0.1 (2012-11-21) ------------------ - Added support for Python 3.3. 4.0.0 (2012-05-16) ------------------ - Automated build of Sphinx HTML docs and running doctest snippets via tox. - Added Sphinx documentation: - API docs moved from package-data README into ``docs/api.rst``. - Snippets can be tested by running 'make doctest'. - Updated support for continuous integration using ``tox`` and ``jenkins``. - 100% unit test coverage. - Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs ``nose`` and ``coverage``). - Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). - Removed spurious dependency on ``zope.testing``. - Dropped explicit support for Python 2.4 / 2.5 / 3.1. 3.5.1 (2012-03-15) ------------------ - Revert a move of `README.txt` to unbreak ``zope.app.apidoc``. 3.5.0 (2011-09-05) ------------------ - Replaced doctesting with unit testing. - Python 3 compatibility. 3.4.1 (2011-06-07) ------------------ - Removed import cycle for ``__show__`` by defining it in the ``zope.deprecation.deprecation`` module. - Added support to bootstrap on Jython. - Fix ``zope.deprecation.warn()`` to make the signature identical to ``warnings.warn()`` and to check for .pyc and .pyo files. 3.4.0 (2007-07-19) ------------------ - Release 3.4 final, corresponding to Zope 3.4. 3.3.0 (2007-02-18) ------------------ - Corresponds to the version of the ``zope.deprecation`` package shipped as part of the Zope 3.3.0 release. zope.deprecation-4.1.2/LICENSE.txt0000664000175000017500000000402612072655562017774 0ustar tseavertseaver00000000000000Zope 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.deprecation-4.1.2/README.rst0000664000175000017500000000064612455232531017634 0ustar tseavertseaver00000000000000``zope.deprecation`` ==================== .. image:: https://travis-ci.org/zopefoundation/zope.deprecation.png?branch=master :target: https://travis-ci.org/zopefoundation/zope.deprecation This package provides a simple function called ``deprecated(names, reason)`` to mark deprecated modules, classes, functions, methods and properties. Please see http://docs.zope.org/zope.deprecation/ for the documentation. zope.deprecation-4.1.2/docs/0000775000175000017500000000000012455234662017076 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/api.rst0000664000175000017500000003255212255115214020375 0ustar tseavertseaver00000000000000:mod:`zope.deprecation` API =========================== Deprecating objects inside a module ----------------------------------- Let's start with a demonstration of deprecating any name inside a module. To demonstrate the functionality, First, let's set up an example module containing fixtures we will use: .. doctest:: >>> import os >>> import tempfile >>> import zope.deprecation >>> tmp_d = tempfile.mkdtemp('deprecation') >>> zope.deprecation.__path__.append(tmp_d) >>> doctest_ex = '''\ ... from . import deprecated ... ... def demo1(): #pragma NO COVER (used only in doctests) ... return 1 ... deprecated('demo1', 'demo1 is no more.') ... ... def demo2(): #pragma NO COVER (used only in doctests) ... return 2 ... deprecated('demo2', 'demo2 is no more.') ... ... def demo3(): #pragma NO COVER (used only in doctests) ... return 3 ... deprecated('demo3', 'demo3 is no more.') ... ... def demo4(): #pragma NO COVER (used only in doctests) ... return 4 ... def deprecatedemo4(): #pragma NO COVER (used only in doctests) ... """Demonstrate that deprecated() also works in a local scope.""" ... deprecated('demo4', 'demo4 is no more.') ... ''' >>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f: ... f.write(doctest_ex) The first argument to the ``deprecated()`` function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely. Let's now see how the deprecation warnings are displayed. .. doctest:: >>> import warnings >>> from zope.deprecation import doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo1() 1 >>> print log[0].category.__name__ DeprecationWarning >>> print log[0].message demo1: demo1 is no more. >>> import zope.deprecation.doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... zope.deprecation.doctest_ex.demo2() 2 >>> print log[0].message demo2: demo2 is no more. You can see that merely importing the affected module or one of its parents does not cause a deprecation warning. Only when we try to access the name in the module, we get a deprecation warning. On the other hand, if we import the name directly, the deprecation warning will be raised immediately. .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.deprecation.doctest_ex import demo3 >>> print log[0].message demo3: demo3 is no more. Deprecation can also happen inside a function. When we first access ``demo4``, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> len(log) 0 >>> doctest_ex.deprecatedemo4() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> print log[0].message.message #XXX oddball case: why nested? demo4: demo4 is no more. Deprecating methods and properties ---------------------------------- New let's see how properties and methods can be deprecated. We are going to use the same function as before, except that this time, we do not pass in names as first argument, but the method or attribute itself. The function then returns a wrapper that sends out a deprecation warning when the attribute or method is accessed. .. doctest:: >>> from zope.deprecation import deprecation >>> class MyComponent(object): ... foo = property(lambda self: 1) ... foo = deprecation.deprecated(foo, 'foo is no more.') ... ... bar = 2 ... ... def blah(self): ... return 3 ... blah = deprecation.deprecated(blah, 'blah() is no more.') ... ... def splat(self): ... return 4 ... ... @deprecation.deprecate("clap() is no more.") ... def clap(self): ... return 5 And here is the result: .. doctest:: >>> my = MyComponent() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.foo 1 >>> print log[0].message.message # XXX see above foo is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.bar 2 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.blah() 3 >>> print log[0].message.message # XXX see above blah() is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.splat() 4 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.clap() 5 >>> print log[0].message.message # XXX see above clap() is no more. Deprecating modules ------------------- It is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let's imagine, the ``zope.deprecation`` module used to be called ``zope.wanda`` and we'd like to retain backward compatibility: .. doctest:: >>> import sys >>> sys.modules['zope.wanda'] = deprecation.deprecated( ... zope.deprecation, 'A module called Wanda is now zope.deprecation.') Now we can import ``wanda``, but when accessing things from it, we get our deprecation message as expected: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.wanda import deprecated >>> print log[0].message.message # XXX see above A module called Wanda is now zope.deprecation. Before we move on, we should clean up: .. doctest:: >>> del deprecated >>> del sys.modules['zope.wanda'] Moving modules -------------- When a module is moved, you often want to support importing from the old location for a while, generating a deprecation warning when someone uses the old location. This can be done using the moved function. To see how this works, we'll use a helper function to create two fake modules in the zope.deprecation package. First will create a module in the "old" location that used the moved function to indicate the a module on the new location should be used: .. doctest:: >>> import os >>> created_modules = [] >>> def create_module(modules=(), **kw): #** highlightfail ... modules = dict(modules) ... modules.update(kw) ... for name, src in modules.iteritems(): ... pname = name.split('.') ... if pname[-1] == '__init__': ... os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail ... name = '.'.join(pname[:-1]) ... open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf ... created_modules.append(name) >>> create_module(old_location= ... ''' ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_location', 'version 2') ... ''') and we define the module in the new location: .. doctest:: >>> create_module(new_location= ... '''\ ... print "new module imported" ... x = 42 ... ''') Now, if we import the old location, we'll see the output of importing the old location: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_location new module imported >>> print log[0].message.message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_location has moved to zope.deprecation.new_location. Import of zope.deprecation.old_location will become unsupported in version 2 >>> zope.deprecation.old_location.x 42 Moving packages --------------- When moving packages, you need to leave placeholders for each module. Let's look at an example: .. doctest:: >>> create_module({ ... 'new_package.__init__': '''\ ... print __name__, 'imported' ... x=0 ... ''', ... 'new_package.m1': '''\ ... print __name__, 'imported' ... x=1 ... ''', ... 'new_package.m2': '''\ ... print __name__, 'imported' ... def x(): ... pass ... ''', ... 'new_package.m3': '''\ ... print __name__, 'imported' ... x=3 ... ''', ... 'old_package.__init__': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package', 'version 2') ... ''', ... 'old_package.m1': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2') ... ''', ... 'old_package.m2': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2') ... ''', ... }) Now, if we import the old modules, we'll get warnings: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package zope.deprecation.new_package imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package has moved to zope.deprecation.new_package. Import of zope.deprecation.old_package will become unsupported in version 2 >>> zope.deprecation.old_package.x 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m1 zope.deprecation.new_package.m1 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1. Import of zope.deprecation.old_package.m1 will become unsupported in version 2 >>> zope.deprecation.old_package.m1.x 1 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m2 zope.deprecation.new_package.m2 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2. Import of zope.deprecation.old_package.m2 will become unsupported in version 2 >>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x True >>> (zope.deprecation.old_package.m2.x.func_globals ... is zope.deprecation.new_package.m2.__dict__) True >>> zope.deprecation.old_package.m2.x.__module__ 'zope.deprecation.new_package.m2' We'll get an error if we try to import m3, because we didn't create a placeholder for it: .. doctest:: >>> import zope.deprecation.old_package.m3 Traceback (most recent call last): ... ImportError: No module named m3 Before we move on, let's clean up the temporary modules / packages: .. doctest:: >>> zope.deprecation.__path__.remove(tmp_d) >>> import shutil >>> shutil.rmtree(tmp_d) Temporarily turning off deprecation warnings -------------------------------------------- In some cases it is desireable to turn off the deprecation warnings for a short time. To support such a feature, the ``zope.deprecation`` package provides a :term:`context manager` class, :class:`zope.deprecation.Suppressor`. Code running inside the scope of a ``Suppressor`` will not emit deprecation warnings. .. doctest:: >>> from zope.deprecation import Suppressor >>> class Foo(object): ... bar = property(lambda self: 1) ... bar = deprecation.deprecated(bar, 'bar is no more.') ... blah = property(lambda self: 1) ... blah = deprecation.deprecated(blah, 'blah is no more.') >>> foo = Foo() >>> with Suppressor(): ... foo.blah 1 Note that no warning is emitted when ``foo.blah`` is accessed inside the suppressor's scope.: The suppressor is implemented in terms of a ``__show__`` object. One can ask for its status by calling it: .. doctest:: >>> from zope.deprecation import __show__ >>> __show__() True Inside a suppressor's scope, that status is always false: .. doctest:: >>> with Suppressor(): ... __show__() False .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... foo.bar 1 >>> print log[0].message bar is no more. If needed, your code can manage the depraction warnings manually using the ``on()`` and ``off()`` methods of the ``__show__`` object: .. doctest:: >>> __show__.off() >>> __show__() False >>> foo.blah 1 Now, you can also nest several turn-offs, so that calling ``off()`` multiple times is meaningful: .. doctest:: >>> __show__.stack [False] >>> __show__.off() >>> __show__.stack [False, False] >>> __show__.on() >>> __show__.stack [False] >>> __show__() False >>> __show__.on() >>> __show__.stack [] >>> __show__() True You can also reset ``__show__`` to ``True``: .. doctest:: >>> __show__.off() >>> __show__.off() >>> __show__() False >>> __show__.reset() >>> __show__() True Finally, you cannot call ``on()`` without having called ``off()`` before: .. doctest:: >>> __show__.on() Traceback (most recent call last): ... IndexError: pop from empty list zope.deprecation-4.1.2/docs/make.bat0000664000175000017500000001177212072655562020514 0ustar tseavertseaver00000000000000@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\zopedeprecation.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopedeprecation.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 zope.deprecation-4.1.2/docs/Makefile0000664000175000017500000001274012072655562020543 0ustar tseavertseaver00000000000000# 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/zopedeprecation.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopedeprecation.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/zopedeprecation" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zopedeprecation" @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." zope.deprecation-4.1.2/docs/conf.py0000664000175000017500000001740012072655562020400 0ustar tseavertseaver00000000000000# -*- coding: utf-8 -*- # # zope.deprecation documentation build configuration file, created by # sphinx-quickstart on Thu Apr 19 16:41:59 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.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.deprecation' 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.0' # The full version, including alpha/beta/rc tags. release = '4.0' # 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 = '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_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 = 'zopedeprecationdoc' # -- 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', 'zopedeprecation.tex', u'zope.deprecation 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', 'zopedeprecation', u'zope.deprecation 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', 'zopedeprecation', u'zope.deprecation Documentation', u'Zope Foundation Contributors', 'zopedeprecation', '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' zope.deprecation-4.1.2/docs/index.rst0000664000175000017500000000034612072655562020743 0ustar tseavertseaver00000000000000:mod:`zope.deprecation` Documentation ===================================== Contents: .. toctree:: :maxdepth: 2 api hacking Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` zope.deprecation-4.1.2/docs/_build/0000775000175000017500000000000012455234662020334 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/_build/doctest/0000775000175000017500000000000012455234662022001 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/_build/doctest/output.txt0000664000175000017500000000056412255115222024073 0ustar tseavertseaver00000000000000Results of doctest builder run on 2013-12-20 14:29:22 ===================================================== Document: api ------------- 1 items passed all tests: 92 tests in default 92 tests in 1 items. 92 passed and 0 failed. Test passed. Doctest summary =============== 92 tests 0 failures in tests 0 failures in setup code 0 failures in cleanup code zope.deprecation-4.1.2/docs/_build/doctrees/0000775000175000017500000000000012455234662022144 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/_build/doctrees/index.doctree0000664000175000017500000001361312255113001024603 0ustar tseavertseaver00000000000000cdocutils.nodes document q)q}q(U nametypesq}q(Xzope.deprecation documentationqNXindices and tablesqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUzope-deprecation-documentationqhUindices-and-tablesquUchildrenq]q(cdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX>/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/index.rstqq}qbUtagnameqUsectionq U attributesq!}q"(Udupnamesq#]q$Uclassesq%]q&Ubackrefsq']q(Uidsq)]q*haUnamesq+]q,hauUlineq-KUdocumentq.hh]q/(cdocutils.nodes title q0)q1}q2(hX%:mod:`zope.deprecation` Documentationq3hhhhhUtitleq4h!}q5(h#]q6h%]q7h']q8h)]q9h+]q:uh-Kh.hh]q;(csphinx.addnodes pending_xref q<)q=}q>(hX:mod:`zope.deprecation`q?hh1hhhU pending_xrefq@h!}qA(UreftypeqBXmodqCUrefwarnqDU reftargetqEXzope.deprecationqFU refdomainqGXpyqHh)]qIh']qJU refexplicitqKh#]qLh%]qMh+]qNUrefdocqOXindexqPUpy:classqQNU py:moduleqRNuh-Kh]qScdocutils.nodes literal qT)qU}qV(hh?h!}qW(h#]qXh%]qY(UxrefqZhHXpy-modq[eh']q\h)]q]h+]q^uhh=h]q_cdocutils.nodes Text q`Xzope.deprecationqaqb}qc(hUhhUubahUliteralqdubaubh`X Documentationqeqf}qg(hX Documentationqhhh1ubeubcdocutils.nodes paragraph qi)qj}qk(hX Contents:qlhhhhhU paragraphqmh!}qn(h#]qoh%]qph']qqh)]qrh+]qsuh-Kh.hh]qth`X Contents:quqv}qw(hhlhhjubaubcdocutils.nodes compound qx)qy}qz(hUhhhhhUcompoundq{h!}q|(h#]q}h%]q~Utoctree-wrapperqah']qh)]qh+]quh-Nh.hh]qcsphinx.addnodes toctree q)q}q(hUhhyhhhUtoctreeqh!}q(UnumberedqKU includehiddenqhhPU titlesonlyqUglobqh)]qh']qh#]qh%]qh+]qUentriesq]q(NXapiqqNXhackingqqeUhiddenqU includefilesq]q(hheUmaxdepthqKuh-Kh]qubaubeubh)q}q(hUhhhhhh h!}q(h#]qh%]qh']qh)]qhah+]qhauh-Kh.hh]q(h0)q}q(hXIndices and tablesqhhhhhh4h!}q(h#]qh%]qh']qh)]qh+]quh-Kh.hh]qh`XIndices and tablesqq}q(hhhhubaubcdocutils.nodes bullet_list q)q}q(hUhhhhhU bullet_listqh!}q(UbulletqX*h)]qh']qh#]qh%]qh+]quh-Kh.hh]q(cdocutils.nodes list_item q)q}q(hX:ref:`genindex`qhhhhhU list_itemqh!}q(h#]qh%]qh']qh)]qh+]quh-Nh.hh]qhi)q}q(hhhhhhhhmh!}q(h#]qh%]qh']qh)]qh+]quh-Kh]qh<)q}q(hhhhhhhh@h!}q(UreftypeqXrefqhDhEXgenindexqU refdomainqXstdqh)]qh']qU refexplicitqމh#]qh%]qh+]qhOhPuh-Kh]qcdocutils.nodes emphasis q)q}q(hhh!}q(h#]qh%]q(hZhXstd-refqeh']qh)]qh+]quhhh]qh`Xgenindexqq}q(hUhhubahUemphasisqubaubaubaubh)q}q(hX:ref:`modindex`qhhhhhhh!}q(h#]qh%]qh']qh)]qh+]quh-Nh.hh]qhi)q}q(hhhhhhhhmh!}q(h#]qh%]rh']rh)]rh+]ruh-Kh]rh<)r}r(hhhhhhhh@h!}r(UreftyperXrefr hDhEXmodindexr U refdomainr Xstdr h)]r h']rU refexplicitrh#]rh%]rh+]rhOhPuh-Kh]rh)r}r(hhh!}r(h#]rh%]r(hZj Xstd-refreh']rh)]rh+]ruhjh]rh`Xmodindexrr}r (hUhjubahhubaubaubaubh)r!}r"(hX:ref:`search` r#hhhhhhh!}r$(h#]r%h%]r&h']r'h)]r(h+]r)uh-Nh.hh]r*hi)r+}r,(hX :ref:`search`r-hj!hhhhmh!}r.(h#]r/h%]r0h']r1h)]r2h+]r3uh-Kh]r4h<)r5}r6(hj-hj+hhhh@h!}r7(Ureftyper8Xrefr9hDhEXsearchr:U refdomainr;Xstdr<h)]r=h']r>U refexplicitr?h#]r@h%]rAh+]rBhOhPuh-Kh]rCh)rD}rE(hj-h!}rF(h#]rGh%]rH(hZj<Xstd-refrIeh']rJh)]rKh+]rLuhj5h]rMh`XsearchrNrO}rP(hUhjDubahhubaubaubaubeubeubehUU transformerrQNU footnote_refsrR}rSUrefnamesrT}rUUsymbol_footnotesrV]rWUautofootnote_refsrX]rYUsymbol_footnote_refsrZ]r[U citationsr\]r]h.hU current_liner^NUtransform_messagesr_]r`UreporterraNUid_startrbKU autofootnotesrc]rdU citation_refsre}rfUindirect_targetsrg]rhUsettingsri(cdocutils.frontend Values rjork}rl(Ufootnote_backlinksrmKUrecord_dependenciesrnNU rfc_base_urlroUhttp://tools.ietf.org/html/rpU tracebackrqUpep_referencesrrNUstrip_commentsrsNU toc_backlinksrtUentryruU language_codervUenrwU datestamprxNU report_levelryKU _destinationrzNU halt_levelr{KU strip_classesr|Nh4NUerror_encoding_error_handlerr}Ubackslashreplacer~UdebugrNUembed_stylesheetrUoutput_encoding_error_handlerrUstrictrU sectnum_xformrKUdump_transformsrNU docinfo_xformrKUwarning_streamrNUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrUtrim_footnote_reference_spacerUenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformrU source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerU>/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/index.rstrUgettext_compactrU generatorrNUdump_internalsrNU smart_quotesrU pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrjUauto_id_prefixrUidrUdoctitle_xformrUstrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hhhhuUsubstitution_namesr}rhh.h!}r(h#]rh)]rh']rUsourcerhh%]rh+]ruU footnotesr]rUrefidsr}rub.zope.deprecation-4.1.2/docs/_build/doctrees/hacking.doctree0000664000175000017500000014623412255113001025106 0ustar tseavertseaver00000000000000cdocutils.nodes document q)q}q(U nametypesq}q(XtoxqXgetting the codeqNXsubmitting a bug reportqNX1running tests on multiple python versions via toxq NX,building the documentation using zc.buildoutq NXsharing your changesq NXhacking on zope.deprecationq NX*building the documentation in a virtualenvq NX!running the tests in a virtualenvqNX#running the tests using zc.buildoutqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUtoxqhUgetting-the-codeqhUsubmitting-a-bug-reportqh U1running-tests-on-multiple-python-versions-via-toxqh U,building-the-documentation-using-zc-buildoutqh Usharing-your-changesqh Uhacking-on-zope-deprecationqh U*building-the-documentation-in-a-virtualenvq hU!running-the-tests-in-a-virtualenvq!hU#running-the-tests-using-zc-buildoutq"uUchildrenq#]q$cdocutils.nodes section q%)q&}q'(U rawsourceq(UUparentq)hUsourceq*cdocutils.nodes reprunicode q+X@/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/hacking.rstq,q-}q.bUtagnameq/Usectionq0U attributesq1}q2(Udupnamesq3]q4Uclassesq5]q6Ubackrefsq7]q8Uidsq9]q:haUnamesq;]qhh#]q?(cdocutils.nodes title q@)qA}qB(h(X"Hacking on :mod:`zope.deprecation`qCh)h&h*h-h/UtitleqDh1}qE(h3]qFh5]qGh7]qHh9]qIh;]qJuh=Kh>hh#]qK(cdocutils.nodes Text qLX Hacking on qMqN}qO(h(X Hacking on qPh)hAubcsphinx.addnodes pending_xref qQ)qR}qS(h(X:mod:`zope.deprecation`qTh)hAh*h-h/U pending_xrefqUh1}qV(UreftypeqWXmodqXUrefwarnqYU reftargetqZXzope.deprecationq[U refdomainq\Xpyq]h9]q^h7]q_U refexplicitq`h3]qah5]qbh;]qcUrefdocqdXhackingqeUpy:classqfNU py:moduleqgNuh=Kh#]qhcdocutils.nodes literal qi)qj}qk(h(hTh1}ql(h3]qmh5]qn(Uxrefqoh]Xpy-modqpeh7]qqh9]qrh;]qsuh)hRh#]qthLXzope.deprecationquqv}qw(h(Uh)hjubah/Uliteralqxubaubeubh%)qy}qz(h(Uh)h&h*h-h/h0h1}q{(h3]q|h5]q}h7]q~h9]qhah;]qhauh=Kh>hh#]q(h@)q}q(h(XGetting the Codeqh)hyh*h-h/hDh1}q(h3]qh5]qh7]qh9]qh;]quh=Kh>hh#]qhLXGetting the Codeqq}q(h(hh)hubaubcdocutils.nodes paragraph q)q}q(h(XUThe main repository for :mod:`zope.deprecation` is in the Zope Subversion repository:qh)hyh*h-h/U paragraphqh1}q(h3]qh5]qh7]qh9]qh;]quh=Kh>hh#]q(hLXThe main repository for qq}q(h(XThe main repository for qh)hubhQ)q}q(h(X:mod:`zope.deprecation`qh)hh*h-h/hUh1}q(UreftypeqXmodqhYhZXzope.deprecationqU refdomainqXpyqh9]qh7]qU refexplicitqh3]qh5]qh;]qhdhehfNhgNuh=Kh#]qhi)q}q(h(hh1}q(h3]qh5]q(hohXpy-modqeh7]qh9]qh;]quh)hh#]qhLXzope.deprecationqq}q(h(Uh)hubah/hxubaubhLX& is in the Zope Subversion repository:qq}q(h(X& is in the Zope Subversion repository:qh)hubeubh)q}q(h(X$http://svn.zope.org/zope.deprecationqh)hyh*h-h/hh1}q(h3]qh5]qh7]qh9]qh;]quh=K h>hh#]qcdocutils.nodes reference q)q}q(h(hh1}q(UrefuriqX$http://svn.zope.org/zope.deprecationqh9]qh7]qh3]qh5]qh;]quh)hh#]qhLX$http://svn.zope.org/zope.deprecationqօq}q(h(Uh)hubah/U referencequbaubh)q}q(h(X7You can get a read-only Subversion checkout from there:qh)hyh*h-h/hh1}q(h3]qh5]qh7]qh9]qh;]quh=K h>hh#]qhLX7You can get a read-only Subversion checkout from there:q䅁q}q(h(hh)hubaubcdocutils.nodes literal_block q)q}q(h(XT$ svn checkout svn://svn.zope.org/repos/main/zope.deprecation/trunk zope.deprecationqh)hyh*h-h/U literal_blockqh1}q(UlinenosqUlanguageqXshqU xml:spaceqUpreserveqh9]qh7]qh3]qh5]qh;]quh=Kh>hh#]qhLXT$ svn checkout svn://svn.zope.org/repos/main/zope.deprecation/trunk zope.deprecationqq}q(h(Uh)hubaubh)q}q(h(XbThe project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad:qh)hyh*h-h/hh1}q(h3]qh5]rh7]rh9]rh;]ruh=Kh>hh#]rhLXbThe project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad:rr}r(h(hh)hubaubh)r}r (h(X+https://code.launchpad.net/zope.deprecationr h)hyh*h-h/hh1}r (h3]r h5]r h7]rh9]rh;]ruh=Kh>hh#]rh)r}r(h(j h1}r(UrefurirX+https://code.launchpad.net/zope.deprecationrh9]rh7]rh3]rh5]rh;]ruh)jh#]rhLX+https://code.launchpad.net/zope.deprecationrr}r(h(Uh)jubah/hubaubh)r }r!(h(X1You can branch the trunk from there using Bazaar:r"h)hyh*h-h/hh1}r#(h3]r$h5]r%h7]r&h9]r'h;]r(uh=Kh>hh#]r)hLX1You can branch the trunk from there using Bazaar:r*r+}r,(h(j"h)j ubaubh)r-}r.(h(X $ bzr branch lp:zope.deprecationr/h)hyh*h-h/hh1}r0(hhXshr1hhh9]r2h7]r3h3]r4h5]r5h;]r6uh=Kh>hh#]r7hLX $ bzr branch lp:zope.deprecationr8r9}r:(h(Uh)j-ubaubeubh%)r;}r<(h(Uh)h&h*h-h/h0h1}r=(h3]r>h5]r?h7]r@h9]rAh!ah;]rBhauh=K h>hh#]rC(h@)rD}rE(h(X%Running the tests in a ``virtualenv``rFh)j;h*h-h/hDh1}rG(h3]rHh5]rIh7]rJh9]rKh;]rLuh=K h>hh#]rM(hLXRunning the tests in a rNrO}rP(h(XRunning the tests in a rQh)jDubhi)rR}rS(h(X``virtualenv``rTh1}rU(h3]rVh5]rWh7]rXh9]rYh;]rZuh)jDh#]r[hLX virtualenvr\r]}r^(h(Uh)jRubah/hxubeubh)r_}r`(h(XIf 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:rah)j;h*h-h/hh1}rb(h3]rch5]rdh7]reh9]rfh;]rguh=K"h>hh#]rh(hLXIf you use the rirj}rk(h(XIf you use the rlh)j_ubhi)rm}rn(h(X``virtualenv``roh1}rp(h3]rqh5]rrh7]rsh9]rth;]ruuh)j_h#]rvhLX virtualenvrwrx}ry(h(Uh)jmubah/hxubhLXr package to create lightweight Python development environments, you can run the tests using nothing more than the rzr{}r|(h(Xr package to create lightweight Python development environments, you can run the tests using nothing more than the r}h)j_ubhi)r~}r(h(X ``python``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)j_h#]rhLXpythonrr}r(h(Uh)j~ubah/hxubhLX> binary in a virtualenv. First, create a scratch environment:rr}r(h(X> binary in a virtualenv. First, create a scratch environment:rh)j_ubeubh)r}r(h(XC$ /path/to/virtualenv --no-site-packages /tmp/hack-zope.deprecationrh)j;h*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=K'h>hh#]rhLXC$ /path/to/virtualenv --no-site-packages /tmp/hack-zope.deprecationrr}r(h(Uh)jubaubh)r}r(h(XLNext, get this package registered as a "development egg" in the environment:rh)j;h*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=K+h>hh#]rhLXLNext, get this package registered as a "development egg" in the environment:rr}r(h(jh)jubaubh)r}r(h(X8$ /tmp/hack-zope.deprecation/bin/python setup.py developrh)j;h*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=K.h>hh#]rhLX8$ /tmp/hack-zope.deprecation/bin/python setup.py developrr}r(h(Uh)jubaubh)r}r(h(XDFinally, run the tests using the build-in ``setuptools`` testrunner:rh)j;h*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=K2h>hh#]r(hLX*Finally, run the tests using the build-in rr}r(h(X*Finally, run the tests using the build-in rh)jubhi)r}r(h(X``setuptools``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX setuptoolsrr}r(h(Uh)jubah/hxubhLX testrunner:rr}r(h(X testrunner:rh)jubeubh)r}r(h(X$ /tmp/hack-zope.deprecation/bin/python setup.py test running test .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrh)j;h*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=K4h>hh#]rhLX$ /tmp/hack-zope.deprecation/bin/python setup.py test running test .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrr}r(h(Uh)jubaubh)r}r(h(X`If you have the :mod:`nose` package installed in the virtualenv, you can use its testrunner too:rh)j;h*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=K>h>hh#]r(hLXIf you have the rr}r(h(XIf you have the rh)jubhQ)r}r(h(X :mod:`nose`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXnoserU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=K>h#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]r h9]r h;]r uh)jh#]r hLXnoser r}r(h(Uh)jubah/hxubaubhLXE package installed in the virtualenv, you can use its testrunner too:rr}r(h(XE package installed in the virtualenv, you can use its testrunner too:rh)jubeubh)r}r(h(X$ /tmp/hack-zope.deprecation/bin/easy_install nose ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests running nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrh)j;h*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=KAh>hh#]rhLX$ /tmp/hack-zope.deprecation/bin/easy_install nose ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests running nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrr }r!(h(Uh)jubaubh)r"}r#(h(Xor:r$h)j;h*h-h/hh1}r%(h3]r&h5]r'h7]r(h9]r)h;]r*uh=KMh>hh#]r+hLXor:r,r-}r.(h(j$h)j"ubaubh)r/}r0(h(X$ /tmp/hack-zope.deprecation/bin/nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKr1h)j;h*h-h/hh1}r2(hhXshr3hhh9]r4h7]r5h3]r6h5]r7h;]r8uh=KOh>hh#]r9hLX$ /tmp/hack-zope.deprecation/bin/nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKr:r;}r<(h(Uh)j/ubaubh)r=}r>(h(XsIf you have the :mod:`coverage` pacakge installed in the virtualenv, you can see how well the tests cover the code:r?h)j;h*h-h/hh1}r@(h3]rAh5]rBh7]rCh9]rDh;]rEuh=KXh>hh#]rF(hLXIf you have the rGrH}rI(h(XIf you have the rJh)j=ubhQ)rK}rL(h(X:mod:`coverage`rMh)j=h*h-h/hUh1}rN(UreftyperOXmodrPhYhZXcoveragerQU refdomainrRXpyrSh9]rTh7]rUU refexplicitrVh3]rWh5]rXh;]rYhdhehfNhgNuh=KXh#]rZhi)r[}r\(h(jMh1}r](h3]r^h5]r_(hojSXpy-modr`eh7]rah9]rbh;]rcuh)jKh#]rdhLXcoveragererf}rg(h(Uh)j[ubah/hxubaubhLXT pacakge installed in the virtualenv, you can see how well the tests cover the code:rhri}rj(h(XT pacakge installed in the virtualenv, you can see how well the tests cover the code:rkh)j=ubeubh)rl}rm(h(X$ /tmp/hack-zope.deprecation/bin/easy_install nose coverage ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests \ --with coverage --cover-package=zope.deprecation running nosetests .................................................... Name Stmts Miss Cover Missing ------------------------------------------------------------ zope.deprecation 7 0 100% zope.deprecation.deprecation 127 0 100% zope.deprecation.fixture 1 0 100% ------------------------------------------------------------ TOTAL 135 0 100% ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrnh)j;h*h-h/hh1}ro(hhXshrphhh9]rqh7]rrh3]rsh5]rth;]ruuh=K[h>hh#]rvhLX$ /tmp/hack-zope.deprecation/bin/easy_install nose coverage ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests \ --with coverage --cover-package=zope.deprecation running nosetests .................................................... Name Stmts Miss Cover Missing ------------------------------------------------------------ zope.deprecation 7 0 100% zope.deprecation.deprecation 127 0 100% zope.deprecation.fixture 1 0 100% ------------------------------------------------------------ TOTAL 135 0 100% ---------------------------------------------------------------------- Ran 52 tests in 0.155s OKrwrx}ry(h(Uh)jlubaubeubh%)rz}r{(h(Uh)h&h*h-h/h0h1}r|(h3]r}h5]r~h7]rh9]rh ah;]rh auh=Kqh>hh#]r(h@)r}r(h(X.Building the documentation in a ``virtualenv``rh)jzh*h-h/hDh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kqh>hh#]r(hLX Building the documentation in a rr}r(h(X Building the documentation in a rh)jubhi)r}r(h(X``virtualenv``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX virtualenvrr}r(h(Uh)jubah/hxubeubh)r}r(h(X:mod:`zope.deprecation` 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:rh)jzh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Ksh>hh#]r(hQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Ksh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLX uses the nifty rr}r(h(X uses the nifty rh)jubhQ)r}r(h(X :mod:`Sphinx`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXSphinxrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Ksh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXSphinxrr}r(h(Uh)jubah/hxubaubhLX| documentation system for building its docs. Using the same virtualenv you set up to run the tests, you can build the docs:rr}r(h(X| documentation system for building its docs. Using the same virtualenv you set up to run the tests, you can build the docs:rh)jubeubh)r}r(h(X$ /tmp/hack-zope.deprecation/bin/easy_install Sphinx ... $ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html ... build succeeded.rh)jzh*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=Kwh>hh#]rhLX$ /tmp/hack-zope.deprecation/bin/easy_install Sphinx ... $ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html ... build succeeded.rr}r(h(Uh)jubaubh)r}r(h(X9You can also test the code snippets in the documentation:rh)jzh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh>hh#]rhLX9You can also test the code snippets in the documentation:rr}r(h(jh)jubaubh)r}r(h(X+$ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 89 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.rh)jzh*h-h/hh1}r(hhXshr hhh9]r h7]r h3]r h5]r h;]ruh=Kh>hh#]rhLX+$ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 89 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.rr}r(h(Uh)jubaubeubh%)r}r(h(Uh)h&h*h-h/h0h1}r(h3]rh5]rh7]rh9]rh"ah;]rhauh=Kh>hh#]r(h@)r}r(h(X+Running the tests using :mod:`zc.buildout`rh)jh*h-h/hDh1}r(h3]r h5]r!h7]r"h9]r#h;]r$uh=Kh>hh#]r%(hLXRunning the tests using r&r'}r((h(XRunning the tests using r)h)jubhQ)r*}r+(h(X:mod:`zc.buildout`r,h)jh*h-h/hUh1}r-(Ureftyper.Xmodr/hYhZX zc.buildoutr0U refdomainr1Xpyr2h9]r3h7]r4U refexplicitr5h3]r6h5]r7h;]r8hdhehfNhgNuh=Kh#]r9hi)r:}r;(h(j,h1}r<(h3]r=h5]r>(hoj2Xpy-modr?eh7]r@h9]rAh;]rBuh)j*h#]rChLX zc.buildoutrDrE}rF(h(Uh)j:ubah/hxubaubeubh)rG}rH(h(X:mod:`zope.deprecation` ships with its own :file:`buildout.cfg` file and :file:`bootstrap.py` for setting up a development buildout:rIh)jh*h-h/hh1}rJ(h3]rKh5]rLh7]rMh9]rNh;]rOuh=Kh>hh#]rP(hQ)rQ}rR(h(X:mod:`zope.deprecation`rSh)jGh*h-h/hUh1}rT(UreftyperUXmodrVhYhZXzope.deprecationrWU refdomainrXXpyrYh9]rZh7]r[U refexplicitr\h3]r]h5]r^h;]r_hdhehfNhgNuh=Kh#]r`hi)ra}rb(h(jSh1}rc(h3]rdh5]re(hojYXpy-modrfeh7]rgh9]rhh;]riuh)jQh#]rjhLXzope.deprecationrkrl}rm(h(Uh)jaubah/hxubaubhLX ships with its own rnro}rp(h(X ships with its own rqh)jGubhi)rr}rs(h(Uh1}rt(h9]ruh7]rvh3]rwh5]rxXfileryaUrolerzjyh;]r{uh)jGh#]r|hLX buildout.cfgr}r~}r(h(X buildout.cfgrh)jrubah/hxubhLX file and rr}r(h(X file and rh)jGubhi)r}r(h(Uh1}r(h9]rh7]rh3]rh5]rXfileraUrolerjh;]ruh)jGh#]rhLX bootstrap.pyrr}r(h(X bootstrap.pyrh)jubah/hxubhLX' for setting up a development buildout:rr}r(h(X' for setting up a development buildout:rh)jGubeubh)r}r(h(X$ /path/to/python2.6 bootstrap.py ... Generated script '.../bin/buildout' $ bin/buildout Develop: '/home/tseaver/projects/Zope/BTK/deprecation/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'.rh)jh*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=Kh>hh#]rhLX$ /path/to/python2.6 bootstrap.py ... Generated script '.../bin/buildout' $ bin/buildout Develop: '/home/tseaver/projects/Zope/BTK/deprecation/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'.rr}r(h(Uh)jubaubh)r}r(h(XYou can now run the tests:rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh>hh#]rhLXYou can now run the tests:rr}r(h(jh)jubaubh)r}r(h(X-$ bin/test --all Running zope.testing.testrunner.layer.UnitTests tests: Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Ran 52 tests with 0 failures and 0 errors in 0.366 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.rh)jh*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=Kh>hh#]rhLX-$ bin/test --all Running zope.testing.testrunner.layer.UnitTests tests: Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Ran 52 tests with 0 failures and 0 errors in 0.366 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.rr}r(h(Uh)jubaubeubh%)r}r(h(Uh)h&h*h-h/h0h1}r(h3]rh5]rh7]rh9]rhah;]rh auh=Kh>hh#]r(h@)r}r(h(X3Building the documentation using :mod:`zc.buildout`rh)jh*h-h/hDh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh>hh#]r(hLX!Building the documentation using rr}r(h(X!Building the documentation using rh)jubhQ)r}r(h(X:mod:`zc.buildout`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZX zc.buildoutrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLX zc.buildoutrr}r(h(Uh)jubah/hxubaubeubh)r}r(h(XThe :mod:`zope.deprecation` buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets:rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh>hh#]r(hLXThe rr}r(h(XThe rh)jubhQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationr U refdomainr Xpyr h9]r h7]r U refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hoj Xpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLXo buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets:r r!}r"(h(Xo buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets:r#h)jubeubh)r$}r%(h(X$ cd docs $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 140 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded.r&h)jh*h-h/hh1}r'(hhXshr(hhh9]r)h7]r*h3]r+h5]r,h;]r-uh=Kh>hh#]r.hLX$ cd docs $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 140 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded.r/r0}r1(h(Uh)j$ubaubeubh%)r2}r3(h(Uh)h&h*h-h/h0h1}r4(h3]r5h5]r6h7]r7h9]r8hah;]r9h auh=Kh>hh#]r:(h@)r;}r<(h(X8Running Tests on Multiple Python Versions via :mod:`tox`r=h)j2h*h-h/hDh1}r>(h3]r?h5]r@h7]rAh9]rBh;]rCuh=Kh>hh#]rD(hLX.Running Tests on Multiple Python Versions via rErF}rG(h(X.Running Tests on Multiple Python Versions via rHh)j;ubhQ)rI}rJ(h(X :mod:`tox`rKh)j;h*h-h/hUh1}rL(UreftyperMXmodrNhYhZXtoxrOU refdomainrPXpyrQh9]rRh7]rSU refexplicitrTh3]rUh5]rVh;]rWhdhehfNhgNuh=Kh#]rXhi)rY}rZ(h(jKh1}r[(h3]r\h5]r](hojQXpy-modr^eh7]r_h9]r`h;]rauh)jIh#]rbhLXtoxrcrd}re(h(Uh)jYubah/hxubaubeubh)rf}rg(h(X:`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.rhh)j2h*h-h/hh1}ri(h3]rjh5]rkh7]rlh9]rmh;]rnuh=Kh>hh#]ro(h)rp}rq(h(X'`tox `_rrh1}rs(UnamertXtoxruUrefurirvXhttp://tox.testrun.org/latest/rwh9]rxh7]ryh3]rzh5]r{h;]r|uh)jfh#]r}hLXtoxr~r}r(h(Uh)jpubah/hubcdocutils.nodes target r)r}r(h(X! rU referencedrKh)jfh/Utargetrh1}r(Urefurirjwh9]rhah7]rh3]rh5]rh;]rhauh#]rubhLXn is a Python-based test automation tool designed to run tests against multiple Python versions. It creates a rr}r(h(Xn is a Python-based test automation tool designed to run tests against multiple Python versions. It creates a rh)jfubhi)r}r(h(X``virtualenv``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jfh#]rhLX virtualenvrr}r(h(Uh)jubah/hxubhLXa for each configured version, installs the current package and configured dependencies into each rr}r(h(Xa for each configured version, installs the current package and configured dependencies into each rh)jfubhi)r}r(h(X``virtualenv``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jfh#]rhLX virtualenvrr}r(h(Uh)jubah/hxubhLX(, and then runs the configured commands.rr}r(h(X(, and then runs the configured commands.rh)jfubeubh)r}r(h(Xb:mod:`zope.deprecation` configures the following :mod:`tox` environments via its ``tox.ini`` file:rh)j2h*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh>hh#]r(hQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLX configures the following rr}r(h(X configures the following rh)jubhQ)r}r(h(X :mod:`tox`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXtoxrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXtoxrr}r(h(Uh)jubah/hxubaubhLX environments via its rr}r(h(X environments via its rh)jubhi)r}r(h(X ``tox.ini``rh1}r(h3]rh5]rh7]rh9]rh;]r uh)jh#]r hLXtox.inir r }r (h(Uh)jubah/hxubhLX file:rr}r(h(X file:rh)jubeubcdocutils.nodes bullet_list r)r}r(h(Uh)j2h*h-h/U bullet_listrh1}r(UbulletrX-h9]rh7]rh3]rh5]rh;]ruh=Kh>hh#]r(cdocutils.nodes list_item r)r}r (h(XThe ``py26`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. r!h)jh*h-h/U list_itemr"h1}r#(h3]r$h5]r%h7]r&h9]r'h;]r(uh=Nh>hh#]r)h)r*}r+(h(XThe ``py26`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``.r,h)jh*h-h/hh1}r-(h3]r.h5]r/h7]r0h9]r1h;]r2uh=Kh#]r3(hLXThe r4r5}r6(h(XThe r7h)j*ubhi)r8}r9(h(X``py26``r:h1}r;(h3]r<h5]r=h7]r>h9]r?h;]r@uh)j*h#]rAhLXpy26rBrC}rD(h(Uh)j8ubah/hxubhLX environment builds a rErF}rG(h(X environment builds a rHh)j*ubhi)rI}rJ(h(X``virtualenv``rKh1}rL(h3]rMh5]rNh7]rOh9]rPh;]rQuh)j*h#]rRhLX virtualenvrSrT}rU(h(Uh)jIubah/hxubhLX with rVrW}rX(h(X with rYh)j*ubhi)rZ}r[(h(X ``python2.6``r\h1}r](h3]r^h5]r_h7]r`h9]rah;]rbuh)j*h#]rchLX python2.6rdre}rf(h(Uh)jZubah/hxubhLX , installs rgrh}ri(h(X , installs rjh)j*ubhQ)rk}rl(h(X:mod:`zope.deprecation`rmh)j*h*h-h/hUh1}rn(UreftyperoXmodrphYhZXzope.deprecationrqU refdomainrrXpyrsh9]rth7]ruU refexplicitrvh3]rwh5]rxh;]ryhdhehfNhgNuh=Kh#]rzhi)r{}r|(h(jmh1}r}(h3]r~h5]r(hojsXpy-modreh7]rh9]rh;]ruh)jkh#]rhLXzope.deprecationrr}r(h(Uh)j{ubah/hxubaubhLX, and runs the tests via rr}r(h(X, and runs the tests via rh)j*ubhi)r}r(h(X``python setup.py test -q``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)j*h#]rhLXpython setup.py test -qrr}r(h(Uh)jubah/hxubhLX.r}r(h(X.h)j*ubeubaubj)r}r(h(XThe ``py27`` environment builds a ``virtualenv`` with ``python2.7``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. rh)jh*h-h/j"h1}r(h3]rh5]rh7]rh9]rh;]ruh=Nh>hh#]rh)r}r(h(XThe ``py27`` environment builds a ``virtualenv`` with ``python2.7``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``.rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh#]r(hLXThe rr}r(h(XThe rh)jubhi)r}r(h(X``py27``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLXpy27rr}r(h(Uh)jubah/hxubhLX environment builds a rr}r(h(X environment builds a rh)jubhi)r}r(h(X``virtualenv``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX virtualenvrr}r(h(Uh)jubah/hxubhLX with rr}r(h(X with rh)jubhi)r}r(h(X ``python2.7``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX python2.7rr}r(h(Uh)jubah/hxubhLX , installs rr}r(h(X , installs rh)jubhQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLX, and runs the tests via rr}r(h(X, and runs the tests via rh)jubhi)r}r(h(X``python setup.py test -q``r h1}r (h3]r h5]r h7]r h9]rh;]ruh)jh#]rhLXpython setup.py test -qrr}r(h(Uh)jubah/hxubhLX.r}r(h(X.h)jubeubaubj)r}r(h(XThe ``py32`` environment builds a ``virtualenv`` with ``python3.2``, installs :mod:`zope.deprecation` and dependencies, and runs the tests via ``python setup.py test -q``. rh)jh*h-h/j"h1}r(h3]rh5]rh7]rh9]rh;]ruh=Nh>hh#]rh)r }r!(h(XThe ``py32`` environment builds a ``virtualenv`` with ``python3.2``, installs :mod:`zope.deprecation` and dependencies, and runs the tests via ``python setup.py test -q``.r"h)jh*h-h/hh1}r#(h3]r$h5]r%h7]r&h9]r'h;]r(uh=Kh#]r)(hLXThe r*r+}r,(h(XThe r-h)j ubhi)r.}r/(h(X``py32``r0h1}r1(h3]r2h5]r3h7]r4h9]r5h;]r6uh)j h#]r7hLXpy32r8r9}r:(h(Uh)j.ubah/hxubhLX environment builds a r;r<}r=(h(X environment builds a r>h)j ubhi)r?}r@(h(X``virtualenv``rAh1}rB(h3]rCh5]rDh7]rEh9]rFh;]rGuh)j h#]rHhLX virtualenvrIrJ}rK(h(Uh)j?ubah/hxubhLX with rLrM}rN(h(X with rOh)j ubhi)rP}rQ(h(X ``python3.2``rRh1}rS(h3]rTh5]rUh7]rVh9]rWh;]rXuh)j h#]rYhLX python3.2rZr[}r\(h(Uh)jPubah/hxubhLX , installs r]r^}r_(h(X , installs r`h)j ubhQ)ra}rb(h(X:mod:`zope.deprecation`rch)j h*h-h/hUh1}rd(UreftypereXmodrfhYhZXzope.deprecationrgU refdomainrhXpyrih9]rjh7]rkU refexplicitrlh3]rmh5]rnh;]rohdhehfNhgNuh=Kh#]rphi)rq}rr(h(jch1}rs(h3]rth5]ru(hojiXpy-modrveh7]rwh9]rxh;]ryuh)jah#]rzhLXzope.deprecationr{r|}r}(h(Uh)jqubah/hxubaubhLX* and dependencies, and runs the tests via r~r}r(h(X* and dependencies, and runs the tests via rh)j ubhi)r}r(h(X``python setup.py test -q``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)j h#]rhLXpython setup.py test -qrr}r(h(Uh)jubah/hxubhLX.r}r(h(X.h)j ubeubaubj)r}r(h(XThe ``pypy`` environment builds a ``virtualenv`` with ``pypy``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. rh)jh*h-h/j"h1}r(h3]rh5]rh7]rh9]rh;]ruh=Nh>hh#]rh)r}r(h(XThe ``pypy`` environment builds a ``virtualenv`` with ``pypy``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``.rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh#]r(hLXThe rr}r(h(XThe rh)jubhi)r}r(h(X``pypy``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLXpypyrr}r(h(Uh)jubah/hxubhLX environment builds a rr}r(h(X environment builds a rh)jubhi)r}r(h(X``virtualenv``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX virtualenvrr}r(h(Uh)jubah/hxubhLX with rr}r(h(X with rh)jubhi)r}r(h(X``pypy``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLXpypyrr}r(h(Uh)jubah/hxubhLX , installs rr}r(h(X , installs rh)jubhQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLX, and runs the tests via rr}r(h(X, and runs the tests via rh)jubhi)r}r(h(X``python setup.py test -q``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLXpython setup.py test -qrr}r (h(Uh)jubah/hxubhLX.r }r (h(X.h)jubeubaubj)r }r (h(XThe ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement coverage. rh)jh*h-h/j"h1}r(h3]rh5]rh7]rh9]rh;]ruh=Nh>hh#]rh)r}r(h(XThe ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement coverage.rh)j h*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh#]r(hLXThe r r!}r"(h(XThe r#h)jubhi)r$}r%(h(X ``coverage``r&h1}r'(h3]r(h5]r)h7]r*h9]r+h;]r,uh)jh#]r-hLXcoverager.r/}r0(h(Uh)j$ubah/hxubhLX environment builds a r1r2}r3(h(X environment builds a r4h)jubhi)r5}r6(h(X``virtualenv``r7h1}r8(h3]r9h5]r:h7]r;h9]r<h;]r=uh)jh#]r>hLX virtualenvr?r@}rA(h(Uh)j5ubah/hxubhLX with rBrC}rD(h(X with rEh)jubhi)rF}rG(h(X ``python2.6``rHh1}rI(h3]rJh5]rKh7]rLh9]rMh;]rNuh)jh#]rOhLX python2.6rPrQ}rR(h(Uh)jFubah/hxubhLX , installs rSrT}rU(h(X , installs rVh)jubhQ)rW}rX(h(X:mod:`zope.deprecation`rYh)jh*h-h/hUh1}rZ(Ureftyper[Xmodr\hYhZXzope.deprecationr]U refdomainr^Xpyr_h9]r`h7]raU refexplicitrbh3]rch5]rdh;]rehdhehfNhgNuh=Kh#]rfhi)rg}rh(h(jYh1}ri(h3]rjh5]rk(hoj_Xpy-modrleh7]rmh9]rnh;]rouh)jWh#]rphLXzope.deprecationrqrr}rs(h(Uh)jgubah/hxubaubhLX , installs rtru}rv(h(X , installs rwh)jubhQ)rx}ry(h(X :mod:`nose`rzh)jh*h-h/hUh1}r{(Ureftyper|Xmodr}hYhZXnoser~U refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jzh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jxh#]rhLXnoserr}r(h(Uh)jubah/hxubaubhLX and rr}r(h(X and rh)jubhQ)r}r(h(X:mod:`coverage`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXcoveragerU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXcoveragerr}r(h(Uh)jubah/hxubaubhLX , and runs rr}r(h(X , and runs rh)jubhi)r}r(h(X ``nosetests``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX nosetestsrr}r(h(Uh)jubah/hxubhLX with statement coverage.rr}r(h(X with statement coverage.rh)jubeubaubj)r}r(h(XThe ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.deprecation`, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets. rh)jh*h-h/j"h1}r(h3]rh5]rh7]rh9]rh;]ruh=Nh>hh#]rh)r}r(h(XThe ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.deprecation`, installs ``Sphinx`` and dependencies, and then builds the docs and exercises the doctest snippets.rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Kh#]r(hLXThe rr}r(h(XThe rh)jubhi)r}r(h(X``docs``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLXdocsrr}r(h(Uh)jubah/hxubhLX& environment builds a virtualenv with rr}r(h(X& environment builds a virtualenv with rh)jubhi)r}r(h(X ``python2.6``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jh#]rhLX python2.6rr}r(h(Uh)jubah/hxubhLX , installs rr}r(h(X , installs rh)jubhQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(Ureftyper Xmodr hYhZXzope.deprecationr U refdomainr Xpyr h9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Kh#]rhi)r}r(h(jh1}r(h3]rh5]r(hoj Xpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr }r!(h(Uh)jubah/hxubaubhLX , installs r"r#}r$(h(X , installs r%h)jubhi)r&}r'(h(X ``Sphinx``r(h1}r)(h3]r*h5]r+h7]r,h9]r-h;]r.uh)jh#]r/hLXSphinxr0r1}r2(h(Uh)j&ubah/hxubhLXO and dependencies, and then builds the docs and exercises the doctest snippets.r3r4}r5(h(XO and dependencies, and then builds the docs and exercises the doctest snippets.r6h)jubeubaubeubh)r7}r8(h(XhThis example requires that you have a working ``python2.6`` on your path, as well as installing ``tox``:r9h)j2h*h-h/hh1}r:(h3]r;h5]r<h7]r=h9]r>h;]r?uh=Kh>hh#]r@(hLX.This example requires that you have a working rArB}rC(h(X.This example requires that you have a working rDh)j7ubhi)rE}rF(h(X ``python2.6``rGh1}rH(h3]rIh5]rJh7]rKh9]rLh;]rMuh)j7h#]rNhLX python2.6rOrP}rQ(h(Uh)jEubah/hxubhLX% on your path, as well as installing rRrS}rT(h(X% on your path, as well as installing rUh)j7ubhi)rV}rW(h(X``tox``rXh1}rY(h3]rZh5]r[h7]r\h9]r]h;]r^uh)j7h#]r_hLXtoxr`ra}rb(h(Uh)jVubah/hxubhLX:rc}rd(h(X:h)j7ubeubh)re}rf(h(X$ tox -e py26 GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] .......... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK ___________________________________ summary ____________________________________ py26: commands succeeded congratulations :)rgh)j2h*h-h/hh1}rh(hhXshrihhh9]rjh7]rkh3]rlh5]rmh;]rnuh=Kh>hh#]rohLX$ tox -e py26 GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] .......... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK ___________________________________ summary ____________________________________ py26: commands succeeded congratulations :)rprq}rr(h(Uh)jeubaubh)rs}rt(h(XRunning ``tox`` with no arguments runs all the configured environments, including building the docs and testing their snippets:ruh)j2h*h-h/hh1}rv(h3]rwh5]rxh7]ryh9]rzh;]r{uh=Kh>hh#]r|(hLXRunning r}r~}r(h(XRunning rh)jsubhi)r}r(h(X``tox``rh1}r(h3]rh5]rh7]rh9]rh;]ruh)jsh#]rhLXtoxrr}r(h(Uh)jubah/hxubhLXp with no arguments runs all the configured environments, including building the docs and testing their snippets:rr}r(h(Xp with no arguments runs all the configured environments, including building the docs and testing their snippets:rh)jsubeubh)r}r(h(X($ tox GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 89 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 :)rh)j2h*h-h/hh1}r(hhXshrhhh9]rh7]rh3]rh5]rh;]ruh=Kh>hh#]rhLX($ tox GLOB sdist-make: .../zope.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 89 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 :)rr}r(h(Uh)jubaubeubh%)r}r(h(Uh)h&h*h-h/h0h1}r(h3]rh5]rh7]rh9]rhah;]rhauh=Mh>hh#]r(h@)r}r(h(XSubmitting a Bug Reportrh)jh*h-h/hDh1}r(h3]rh5]rh7]rh9]rh;]ruh=Mh>hh#]rhLXSubmitting a Bug Reportrr}r(h(jh)jubaubh)r}r(h(X5:mod:`zope.deprecation` tracks its bugs on Launchpad:rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Mh>hh#]r(hQ)r}r(h(X:mod:`zope.deprecation`rh)jh*h-h/hUh1}r(UreftyperXmodrhYhZXzope.deprecationrU refdomainrXpyrh9]rh7]rU refexplicitrh3]rh5]rh;]rhdhehfNhgNuh=Mh#]rhi)r}r(h(jh1}r(h3]rh5]r(hojXpy-modreh7]rh9]rh;]ruh)jh#]rhLXzope.deprecationrr}r(h(Uh)jubah/hxubaubhLX tracks its bugs on Launchpad:rr}r(h(X tracks its bugs on Launchpad:rh)jubeubh)r}r(h(X+https://bugs.launchpad.net/zope.deprecationrh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]rh;]ruh=Mh>hh#]rh)r}r(h(jh1}r(UrefurirX+https://bugs.launchpad.net/zope.deprecationrh9]rh7]rh3]rh5]rh;]ruh)jh#]rhLX+https://bugs.launchpad.net/zope.deprecationrr}r(h(Uh)jubah/hubaubh)r}r(h(X5Please submit bug reports and feature requests there.rh)jh*h-h/hh1}r(h3]rh5]rh7]rh9]r h;]r uh=Mh>hh#]r hLX5Please submit bug reports and feature requests there.r r }r (h(jh)jubaubeubh%)r }r (h(Uh)h&h*h-h/h0h1}r (h3]r h5]r h7]r h9]r hah;]r h auh=M!h>hh#]r (h@)r }r (h(XSharing Your Changesr h)j h*h-h/hDh1}r (h3]r h5]r h7]r h9]r h;]r uh=M!h>hh#]r hLXSharing Your Changesr r }r (h(j h)j ubaubcdocutils.nodes note r )r }r (h(XPlease 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.r h)j h*h-h/Unoter h1}r! (h3]r" h5]r# h7]r$ h9]r% h;]r& uh=Nh>hh#]r' h)r( }r) (h(XPlease 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.r* h)j h*h-h/hh1}r+ (h3]r, h5]r- h7]r. h9]r/ h;]r0 uh=M%h#]r1 hLXPlease 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.r2 r3 }r4 (h(j* h)j( ubaubaubh)r5 }r6 (h(XIf you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file:r7 h)j h*h-h/hh1}r8 (h3]r9 h5]r: h7]r; h9]r< h;]r= uh=M*h>hh#]r> hLXIf you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file:r? r@ }rA (h(j7 h)j5 ubaubh)rB }rC (h(X0$ svn diff > zope.deprecation-cool_feature.patchrD h)j h*h-h/hh1}rE (hhXshrF hhh9]rG h7]rH h3]rI h5]rJ h;]rK uh=M.h>hh#]rL hLX0$ svn diff > zope.deprecation-cool_feature.patchrM rN }rO (h(Uh)jB ubaubh)rP }rQ (h(XOYou can then upload that patch file as an attachment to a Launchpad bug report.rR h)j h*h-h/hh1}rS (h3]rT h5]rU h7]rV h9]rW h;]rX uh=M2h>hh#]rY hLXOYou can then upload that patch file as an attachment to a Launchpad bug report.rZ r[ }r\ (h(jR h)jP ubaubh)r] }r^ (h(XxIf you branched the code from Launchpad using Bazaar, you have another option: you can "push" your branch to Launchpad:r_ h)j h*h-h/hh1}r` (h3]ra h5]rb h7]rc h9]rd h;]re uh=M5h>hh#]rf hLXxIf you branched the code from Launchpad using Bazaar, you have another option: you can "push" your branch to Launchpad:rg rh }ri (h(j_ h)j] ubaubh)rj }rk (h(X4$ bzr push lp:~tseaver/zope.deprecation/cool_featurerl h)j h*h-h/hh1}rm (hhXshrn hhh9]ro h7]rp h3]rq h5]rr h;]rs uh=M8h>hh#]rt hLX4$ bzr push lp:~tseaver/zope.deprecation/cool_featureru rv }rw (h(Uh)jj ubaubh)rx }ry (h(XAfter pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad "merge request" feature.rz h)j h*h-h/hh1}r{ (h3]r| h5]r} h7]r~ h9]r h;]r uh=M<h>hh#]r hLXAfter pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad "merge request" feature.r r }r (h(jz h)jx ubaubeubeubah(UU transformerr NU footnote_refsr }r Urefnamesr }r Usymbol_footnotesr ]r Uautofootnote_refsr ]r Usymbol_footnote_refsr ]r U citationsr ]r h>hU current_liner NUtransform_messagesr ]r Ureporterr NUid_startr KU autofootnotesr ]r U citation_refsr }r Uindirect_targetsr ]r Usettingsr (cdocutils.frontend Values r or }r (Ufootnote_backlinksr KUrecord_dependenciesr NU rfc_base_urlr Uhttp://tools.ietf.org/html/r U tracebackr Upep_referencesr NUstrip_commentsr NU toc_backlinksr Uentryr U language_coder Uenr U datestampr NU report_levelr KU _destinationr NU halt_levelr KU strip_classesr NhDNUerror_encoding_error_handlerr Ubackslashreplacer Udebugr NUembed_stylesheetr Uoutput_encoding_error_handlerr Ustrictr U sectnum_xformr KUdump_transformsr NU docinfo_xformr KUwarning_streamr NUpep_file_url_templater Upep-%04dr Uexit_status_levelr KUconfigr NUstrict_visitorr NUcloak_email_addressesr Utrim_footnote_reference_spacer Uenvr NUdump_pseudo_xmlr NUexpose_internalsr NUsectsubtitle_xformr U source_linkr NUrfc_referencesr NUoutput_encodingr Uutf-8r U source_urlr NUinput_encodingr U utf-8-sigr U_disable_configr NU id_prefixr UU tab_widthr KUerror_encodingr UUTF-8r U_sourcer U@/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/hacking.rstr Ugettext_compactr U generatorr NUdump_internalsr NU smart_quotesr U pep_base_urlr Uhttp://www.python.org/dev/peps/r Usyntax_highlightr Ulongr Uinput_encoding_error_handlerr j Uauto_id_prefixr Uidr Udoctitle_xformr Ustrip_elements_with_classesr NU _config_filesr ]r Ufile_insertion_enabledr U raw_enabledr KU dump_settingsr NubUsymbol_footnote_startr KUidsr }r (hjhj hj2h"jhh&hhyhjh!j;h jzhjuUsubstitution_namesr }r h/h>h1}r (h3]r h9]r h7]r Usourcer h-h5]r h;]r uU footnotesr ]r Urefidsr }r ub.zope.deprecation-4.1.2/docs/_build/doctrees/api.doctree0000664000175000017500000013222012255115221024247 0ustar tseavertseaver00000000000000cdocutils.nodes document q)q}q(U nametypesq}q(Xzope.deprecation apiqNXdeprecating modulesqNX"deprecating methods and propertiesqNXmoving modulesq NXmoving packagesq NX#deprecating objects inside a moduleq NX,temporarily turning off deprecation warningsq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUzope-deprecation-apiqhUdeprecating-modulesqhU"deprecating-methods-and-propertiesqh Umoving-modulesqh Umoving-packagesqh U#deprecating-objects-inside-a-moduleqh U,temporarily-turning-off-deprecation-warningsquUchildrenq]qcdocutils.nodes section q)q }q!(U rawsourceq"UUparentq#hUsourceq$cdocutils.nodes reprunicode q%X</home/tseaver/projects/Zope/Z3/zope.deprecation/docs/api.rstq&q'}q(bUtagnameq)Usectionq*U attributesq+}q,(Udupnamesq-]q.Uclassesq/]q0Ubackrefsq1]q2Uidsq3]q4haUnamesq5]q6hauUlineq7KUdocumentq8hh]q9(cdocutils.nodes title q:)q;}q<(h"X:mod:`zope.deprecation` APIq=h#h h$h'h)Utitleq>h+}q?(h-]q@h/]qAh1]qBh3]qCh5]qDuh7Kh8hh]qE(csphinx.addnodes pending_xref qF)qG}qH(h"X:mod:`zope.deprecation`qIh#h;h$h'h)U pending_xrefqJh+}qK(UreftypeqLXmodqMUrefwarnqNU reftargetqOXzope.deprecationqPU refdomainqQXpyqRh3]qSh1]qTU refexplicitqUh-]qVh/]qWh5]qXUrefdocqYXapiqZUpy:classq[NU py:moduleq\Nuh7Kh]q]cdocutils.nodes literal q^)q_}q`(h"hIh+}qa(h-]qbh/]qc(UxrefqdhRXpy-modqeeh1]qfh3]qgh5]qhuh#hGh]qicdocutils.nodes Text qjXzope.deprecationqkql}qm(h"Uh#h_ubah)UliteralqnubaubhjX APIqoqp}qq(h"X APIqrh#h;ubeubh)qs}qt(h"Uh#h h$h'h)h*h+}qu(h-]qvh/]qwh1]qxh3]qyhah5]qzh auh7Kh8hh]q{(h:)q|}q}(h"X#Deprecating objects inside a moduleq~h#hsh$h'h)h>h+}q(h-]qh/]qh1]qh3]qh5]quh7Kh8hh]qhjX#Deprecating objects inside a moduleqq}q(h"h~h#h|ubaubcdocutils.nodes paragraph q)q}q(h"XLet's start with a demonstration of deprecating any name inside a module. To demonstrate the functionality, First, let's set up an example module containing fixtures we will use:qh#hsh$h'h)U paragraphqh+}q(h-]qh/]qh1]qh3]qh5]quh7Kh8hh]qhjXLet's start with a demonstration of deprecating any name inside a module. To demonstrate the functionality, First, let's set up an example module containing fixtures we will use:qq}q(h"hh#hubaubcdocutils.nodes literal_block q)q}q(h"X>>> import os >>> import tempfile >>> import zope.deprecation >>> tmp_d = tempfile.mkdtemp('deprecation') >>> zope.deprecation.__path__.append(tmp_d) >>> doctest_ex = '''\ ... from . import deprecated ... ... def demo1(): #pragma NO COVER (used only in doctests) ... return 1 ... deprecated('demo1', 'demo1 is no more.') ... ... def demo2(): #pragma NO COVER (used only in doctests) ... return 2 ... deprecated('demo2', 'demo2 is no more.') ... ... def demo3(): #pragma NO COVER (used only in doctests) ... return 3 ... deprecated('demo3', 'demo3 is no more.') ... ... def demo4(): #pragma NO COVER (used only in doctests) ... return 4 ... def deprecatedemo4(): #pragma NO COVER (used only in doctests) ... """Demonstrate that deprecated() also works in a local scope.""" ... deprecated('demo4', 'demo4 is no more.') ... ''' >>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f: ... f.write(doctest_ex)qh#hsh$h'h)U literal_blockqh+}q(U testnodetypeqXdoctestqU xml:spaceqUpreserveqh3]qh1]qh-]qh/]qh5]qUgroupsq]qUdefaultqaUoptionsq}quh7K h8hh]qhjX>>> import os >>> import tempfile >>> import zope.deprecation >>> tmp_d = tempfile.mkdtemp('deprecation') >>> zope.deprecation.__path__.append(tmp_d) >>> doctest_ex = '''\ ... from . import deprecated ... ... def demo1(): #pragma NO COVER (used only in doctests) ... return 1 ... deprecated('demo1', 'demo1 is no more.') ... ... def demo2(): #pragma NO COVER (used only in doctests) ... return 2 ... deprecated('demo2', 'demo2 is no more.') ... ... def demo3(): #pragma NO COVER (used only in doctests) ... return 3 ... deprecated('demo3', 'demo3 is no more.') ... ... def demo4(): #pragma NO COVER (used only in doctests) ... return 4 ... def deprecatedemo4(): #pragma NO COVER (used only in doctests) ... """Demonstrate that deprecated() also works in a local scope.""" ... deprecated('demo4', 'demo4 is no more.') ... ''' >>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f: ... f.write(doctest_ex)qq}q(h"Uh#hubaubh)q}q(h"XRThe first argument to the ``deprecated()`` function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely.qh#hsh$h'h)hh+}q(h-]qh/]qh1]qh3]qh5]quh7K*h8hh]q(hjXThe first argument to the qq}q(h"XThe first argument to the qh#hubh^)q}q(h"X``deprecated()``qh+}q(h-]qh/]qh1]qh3]qh5]quh#hh]qhjX deprecated()qȅq}q(h"Uh#hubah)hnubhjX( function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely.q˅q}q(h"X( function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely.qh#hubeubh)q}q(h"X9Let's now see how the deprecation warnings are displayed.qh#hsh$h'h)hh+}q(h-]qh/]qh1]qh3]qh5]quh7K0h8hh]qhjX9Let's now see how the deprecation warnings are displayed.qمq}q(h"hh#hubaubh)q}q(h"X>>> import warnings >>> from zope.deprecation import doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo1() 1 >>> print log[0].category.__name__ DeprecationWarning >>> print log[0].message demo1: demo1 is no more. >>> import zope.deprecation.doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... zope.deprecation.doctest_ex.demo2() 2 >>> print log[0].message demo2: demo2 is no more.qh#hsh$h'h)hh+}q(U testnodetypeqXdoctestqhhh3]qh1]qh-]qh/]qh5]qUgroupsq]qhah}quh7K2h8hh]qhjX>>> import warnings >>> from zope.deprecation import doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo1() 1 >>> print log[0].category.__name__ DeprecationWarning >>> print log[0].message demo1: demo1 is no more. >>> import zope.deprecation.doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... zope.deprecation.doctest_ex.demo2() 2 >>> print log[0].message demo2: demo2 is no more.q녁q}q(h"Uh#hubaubh)q}q(h"X)You can see that merely importing the affected module or one of its parents does not cause a deprecation warning. Only when we try to access the name in the module, we get a deprecation warning. On the other hand, if we import the name directly, the deprecation warning will be raised immediately.qh#hsh$h'h)hh+}q(h-]qh/]qh1]qh3]qh5]quh7KGh8hh]qhjX)You can see that merely importing the affected module or one of its parents does not cause a deprecation warning. Only when we try to access the name in the module, we get a deprecation warning. On the other hand, if we import the name directly, the deprecation warning will be raised immediately.qq}q(h"hh#hubaubh)q}q(h"X>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.deprecation.doctest_ex import demo3 >>> print log[0].message demo3: demo3 is no more.qh#hsh$h'h)hh+}q(U testnodetypeqXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7KLh8hh]r hjX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.deprecation.doctest_ex import demo3 >>> print log[0].message demo3: demo3 is no more.r r }r (h"Uh#hubaubh)r }r(h"XDeprecation can also happen inside a function. When we first access ``demo4``, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access:rh#hsh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7KTh8hh]r(hjXEDeprecation can also happen inside a function. When we first access rr}r(h"XEDeprecation can also happen inside a function. When we first access rh#j ubh^)r}r(h"X ``demo4``rh+}r(h-]rh/]r h1]r!h3]r"h5]r#uh#j h]r$hjXdemo4r%r&}r'(h"Uh#jubah)hnubhjX, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access:r(r)}r*(h"X, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access:r+h#j ubeubh)r,}r-(h"Xm>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> len(log) 0 >>> doctest_ex.deprecatedemo4() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> print log[0].message.message #XXX oddball case: why nested? demo4: demo4 is no more.r.h#hsh$h'h)hh+}r/(U testnodetyper0Xdoctestr1hhh3]r2h1]r3h-]r4h/]r5h5]r6Ugroupsr7]r8hah}r9uh7KYh8hh]r:hjXm>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> len(log) 0 >>> doctest_ex.deprecatedemo4() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> print log[0].message.message #XXX oddball case: why nested? demo4: demo4 is no more.r;r<}r=(h"Uh#j,ubaubeubh)r>}r?(h"Uh#h h$h'h)h*h+}r@(h-]rAh/]rBh1]rCh3]rDhah5]rEhauh7Kkh8hh]rF(h:)rG}rH(h"X"Deprecating methods and propertiesrIh#j>h$h'h)h>h+}rJ(h-]rKh/]rLh1]rMh3]rNh5]rOuh7Kkh8hh]rPhjX"Deprecating methods and propertiesrQrR}rS(h"jIh#jGubaubh)rT}rU(h"XENew let's see how properties and methods can be deprecated. We are going to use the same function as before, except that this time, we do not pass in names as first argument, but the method or attribute itself. The function then returns a wrapper that sends out a deprecation warning when the attribute or method is accessed.rVh#j>h$h'h)hh+}rW(h-]rXh/]rYh1]rZh3]r[h5]r\uh7Kmh8hh]r]hjXENew let's see how properties and methods can be deprecated. We are going to use the same function as before, except that this time, we do not pass in names as first argument, but the method or attribute itself. The function then returns a wrapper that sends out a deprecation warning when the attribute or method is accessed.r^r_}r`(h"jVh#jTubaubh)ra}rb(h"X>>> from zope.deprecation import deprecation >>> class MyComponent(object): ... foo = property(lambda self: 1) ... foo = deprecation.deprecated(foo, 'foo is no more.') ... ... bar = 2 ... ... def blah(self): ... return 3 ... blah = deprecation.deprecated(blah, 'blah() is no more.') ... ... def splat(self): ... return 4 ... ... @deprecation.deprecate("clap() is no more.") ... def clap(self): ... return 5rch#j>h$h'h)hh+}rd(U testnodetypereXdoctestrfhhh3]rgh1]rhh-]rih/]rjh5]rkUgroupsrl]rmhah}rnuh7Ksh8hh]rohjX>>> from zope.deprecation import deprecation >>> class MyComponent(object): ... foo = property(lambda self: 1) ... foo = deprecation.deprecated(foo, 'foo is no more.') ... ... bar = 2 ... ... def blah(self): ... return 3 ... blah = deprecation.deprecated(blah, 'blah() is no more.') ... ... def splat(self): ... return 4 ... ... @deprecation.deprecate("clap() is no more.") ... def clap(self): ... return 5rprq}rr(h"Uh#jaubaubh)rs}rt(h"XAnd here is the result:ruh#j>h$h'h)hh+}rv(h-]rwh/]rxh1]ryh3]rzh5]r{uh7Kh8hh]r|hjXAnd here is the result:r}r~}r(h"juh#jsubaubh)r}r(h"X >>> my = MyComponent() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.foo 1 >>> print log[0].message.message # XXX see above foo is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.bar 2 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.blah() 3 >>> print log[0].message.message # XXX see above blah() is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.splat() 4 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.clap() 5 >>> print log[0].message.message # XXX see above clap() is no more.rh#j>h$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Kh8hh]rhjX >>> my = MyComponent() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.foo 1 >>> print log[0].message.message # XXX see above foo is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.bar 2 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.blah() 3 >>> print log[0].message.message # XXX see above blah() is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.splat() 4 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.clap() 5 >>> print log[0].message.message # XXX see above clap() is no more.rr}r(h"Uh#jubaubeubh)r}r(h"Uh#h h$h'h)h*h+}r(h-]rh/]rh1]rh3]rhah5]rhauh7Kh8hh]r(h:)r}r(h"XDeprecating modulesrh#jh$h'h)h>h+}r(h-]rh/]rh1]rh3]rh5]ruh7Kh8hh]rhjXDeprecating modulesrr}r(h"jh#jubaubh)r}r(h"XIt is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let's imagine, the ``zope.deprecation`` module used to be called ``zope.wanda`` and we'd like to retain backward compatibility:rh#jh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Kh8hh]r(hjXIt is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let's imagine, the rr}r(h"XIt is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let's imagine, the rh#jubh^)r}r(h"X``zope.deprecation``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jh]rhjXzope.deprecationrr}r(h"Uh#jubah)hnubhjX module used to be called rr}r(h"X module used to be called rh#jubh^)r}r(h"X``zope.wanda``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jh]rhjX zope.wandarr}r(h"Uh#jubah)hnubhjX0 and we'd like to retain backward compatibility:rr}r(h"X0 and we'd like to retain backward compatibility:rh#jubeubh)r}r(h"X>>> import sys >>> sys.modules['zope.wanda'] = deprecation.deprecated( ... zope.deprecation, 'A module called Wanda is now zope.deprecation.')rh#jh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Kh8hh]rhjX>>> import sys >>> sys.modules['zope.wanda'] = deprecation.deprecated( ... zope.deprecation, 'A module called Wanda is now zope.deprecation.')rr}r(h"Uh#jubaubh)r}r(h"XkNow we can import ``wanda``, but when accessing things from it, we get our deprecation message as expected:rh#jh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Kh8hh]r(hjXNow we can import rr}r(h"XNow we can import rh#jubh^)r}r(h"X ``wanda``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jh]rhjXwandarr}r(h"Uh#jubah)hnubhjXP, but when accessing things from it, we get our deprecation message as expected:rr}r(h"XP, but when accessing things from it, we get our deprecation message as expected:rh#jubeubh)r }r (h"X>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.wanda import deprecated >>> print log[0].message.message # XXX see above A module called Wanda is now zope.deprecation.r h#jh$h'h)hh+}r (U testnodetyper Xdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Kh8hh]rhjX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.wanda import deprecated >>> print log[0].message.message # XXX see above A module called Wanda is now zope.deprecation.rr}r(h"Uh#j ubaubh)r}r(h"X&Before we move on, we should clean up:rh#jh$h'h)hh+}r(h-]rh/]r h1]r!h3]r"h5]r#uh7Kh8hh]r$hjX&Before we move on, we should clean up:r%r&}r'(h"jh#jubaubh)r(}r)(h"X4>>> del deprecated >>> del sys.modules['zope.wanda']r*h#jh$h'h)hh+}r+(U testnodetyper,Xdoctestr-hhh3]r.h1]r/h-]r0h/]r1h5]r2Ugroupsr3]r4hah}r5uh7Kh8hh]r6hjX4>>> del deprecated >>> del sys.modules['zope.wanda']r7r8}r9(h"Uh#j(ubaubeubh)r:}r;(h"Uh#h h$h'h)h*h+}r<(h-]r=h/]r>h1]r?h3]r@hah5]rAh auh7Kh8hh]rB(h:)rC}rD(h"XMoving modulesrEh#j:h$h'h)h>h+}rF(h-]rGh/]rHh1]rIh3]rJh5]rKuh7Kh8hh]rLhjXMoving modulesrMrN}rO(h"jEh#jCubaubh)rP}rQ(h"XWhen a module is moved, you often want to support importing from the old location for a while, generating a deprecation warning when someone uses the old location. This can be done using the moved function.rRh#j:h$h'h)hh+}rS(h-]rTh/]rUh1]rVh3]rWh5]rXuh7Kh8hh]rYhjXWhen a module is moved, you often want to support importing from the old location for a while, generating a deprecation warning when someone uses the old location. This can be done using the moved function.rZr[}r\(h"jRh#jPubaubh)r]}r^(h"XTo see how this works, we'll use a helper function to create two fake modules in the zope.deprecation package. First will create a module in the "old" location that used the moved function to indicate the a module on the new location should be used:r_h#j:h$h'h)hh+}r`(h-]rah/]rbh1]rch3]rdh5]reuh7Kh8hh]rfhjXTo see how this works, we'll use a helper function to create two fake modules in the zope.deprecation package. First will create a module in the "old" location that used the moved function to indicate the a module on the new location should be used:rgrh}ri(h"j_h#j]ubaubh)rj}rk(h"X>>> import os >>> created_modules = [] >>> def create_module(modules=(), **kw): #** highlightfail ... modules = dict(modules) ... modules.update(kw) ... for name, src in modules.iteritems(): ... pname = name.split('.') ... if pname[-1] == '__init__': ... os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail ... name = '.'.join(pname[:-1]) ... open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf ... created_modules.append(name) >>> create_module(old_location= ... ''' ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_location', 'version 2') ... ''')rlh#j:h$h'h)hh+}rm(U testnodetypernXdoctestrohhh3]rph1]rqh-]rrh/]rsh5]rtUgroupsru]rvhah}rwuh7Kh8hh]rxhjX>>> import os >>> created_modules = [] >>> def create_module(modules=(), **kw): #** highlightfail ... modules = dict(modules) ... modules.update(kw) ... for name, src in modules.iteritems(): ... pname = name.split('.') ... if pname[-1] == '__init__': ... os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail ... name = '.'.join(pname[:-1]) ... open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf ... created_modules.append(name) >>> create_module(old_location= ... ''' ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_location', 'version 2') ... ''')ryrz}r{(h"Uh#jjubaubh)r|}r}(h"X-and we define the module in the new location:r~h#j:h$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Kh8hh]rhjX-and we define the module in the new location:rr}r(h"j~h#j|ubaubh)r}r(h"X\>>> create_module(new_location= ... '''\ ... print "new module imported" ... x = 42 ... ''')rh#j:h$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Kh8hh]rhjX\>>> create_module(new_location= ... '''\ ... print "new module imported" ... x = 42 ... ''')rr}r(h"Uh#jubaubh)r}r(h"XWNow, if we import the old location, we'll see the output of importing the old location:rh#j:h$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Kh8hh]rhjXWNow, if we import the old location, we'll see the output of importing the old location:rr}r(h"jh#jubaubh)r}r(h"Xz>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_location new module imported >>> print log[0].message.message ... zope.deprecation.old_location has moved to zope.deprecation.new_location. Import of zope.deprecation.old_location will become unsupported in version 2 >>> zope.deprecation.old_location.x 42rh#j:h$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhaUtestrX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_location new module imported >>> print log[0].message.message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_location has moved to zope.deprecation.new_location. Import of zope.deprecation.old_location will become unsupported in version 2 >>> zope.deprecation.old_location.x 42rh}ruh7Kh8hh]rhjXz>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_location new module imported >>> print log[0].message.message ... zope.deprecation.old_location has moved to zope.deprecation.new_location. Import of zope.deprecation.old_location will become unsupported in version 2 >>> zope.deprecation.old_location.x 42rr}r(h"Uh#jubaubeubh)r}r(h"Uh#h h$h'h)h*h+}r(h-]rh/]rh1]rh3]rhah5]rh auh7M h8hh]r(h:)r}r(h"XMoving packagesrh#jh$h'h)h>h+}r(h-]rh/]rh1]rh3]rh5]ruh7M h8hh]rhjXMoving packagesrr}r(h"jh#jubaubh)r}r(h"X`When moving packages, you need to leave placeholders for each module. Let's look at an example:rh#jh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7M h8hh]rhjX`When moving packages, you need to leave placeholders for each module. Let's look at an example:rr}r(h"jh#jubaubh)r}r(h"X>>> create_module({ ... 'new_package.__init__': '''\ ... print __name__, 'imported' ... x=0 ... ''', ... 'new_package.m1': '''\ ... print __name__, 'imported' ... x=1 ... ''', ... 'new_package.m2': '''\ ... print __name__, 'imported' ... def x(): ... pass ... ''', ... 'new_package.m3': '''\ ... print __name__, 'imported' ... x=3 ... ''', ... 'old_package.__init__': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package', 'version 2') ... ''', ... 'old_package.m1': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2') ... ''', ... 'old_package.m2': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2') ... ''', ... })rh#jh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Mh8hh]rhjX>>> create_module({ ... 'new_package.__init__': '''\ ... print __name__, 'imported' ... x=0 ... ''', ... 'new_package.m1': '''\ ... print __name__, 'imported' ... x=1 ... ''', ... 'new_package.m2': '''\ ... print __name__, 'imported' ... def x(): ... pass ... ''', ... 'new_package.m3': '''\ ... print __name__, 'imported' ... x=3 ... ''', ... 'old_package.__init__': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package', 'version 2') ... ''', ... 'old_package.m1': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2') ... ''', ... 'old_package.m2': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2') ... ''', ... })rr}r(h"Uh#jubaubh)r}r(h"X6Now, if we import the old modules, we'll get warnings:rh#jh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7M2h8hh]rhjX6Now, if we import the old modules, we'll get warnings:rr}r(h"jh#jubaubh)r}r(h"X>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package zope.deprecation.new_package imported >>> print log[0].message ... zope.deprecation.old_package has moved to zope.deprecation.new_package. Import of zope.deprecation.old_package will become unsupported in version 2 >>> zope.deprecation.old_package.x 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m1 zope.deprecation.new_package.m1 imported >>> print log[0].message ... zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1. Import of zope.deprecation.old_package.m1 will become unsupported in version 2 >>> zope.deprecation.old_package.m1.x 1 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m2 zope.deprecation.new_package.m2 imported >>> print log[0].message ... zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2. Import of zope.deprecation.old_package.m2 will become unsupported in version 2 >>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x True >>> (zope.deprecation.old_package.m2.x.func_globals ... is zope.deprecation.new_package.m2.__dict__) True >>> zope.deprecation.old_package.m2.x.__module__ 'zope.deprecation.new_package.m2'rh#jh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr ]r hajX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package zope.deprecation.new_package imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package has moved to zope.deprecation.new_package. Import of zope.deprecation.old_package will become unsupported in version 2 >>> zope.deprecation.old_package.x 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m1 zope.deprecation.new_package.m1 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1. Import of zope.deprecation.old_package.m1 will become unsupported in version 2 >>> zope.deprecation.old_package.m1.x 1 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m2 zope.deprecation.new_package.m2 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2. Import of zope.deprecation.old_package.m2 will become unsupported in version 2 >>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x True >>> (zope.deprecation.old_package.m2.x.func_globals ... is zope.deprecation.new_package.m2.__dict__) True >>> zope.deprecation.old_package.m2.x.__module__ 'zope.deprecation.new_package.m2'r h}r uh7M4h8hh]r hjX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package zope.deprecation.new_package imported >>> print log[0].message ... zope.deprecation.old_package has moved to zope.deprecation.new_package. Import of zope.deprecation.old_package will become unsupported in version 2 >>> zope.deprecation.old_package.x 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m1 zope.deprecation.new_package.m1 imported >>> print log[0].message ... zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1. Import of zope.deprecation.old_package.m1 will become unsupported in version 2 >>> zope.deprecation.old_package.m1.x 1 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m2 zope.deprecation.new_package.m2 imported >>> print log[0].message ... zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2. Import of zope.deprecation.old_package.m2 will become unsupported in version 2 >>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x True >>> (zope.deprecation.old_package.m2.x.func_globals ... is zope.deprecation.new_package.m2.__dict__) True >>> zope.deprecation.old_package.m2.x.__module__ 'zope.deprecation.new_package.m2'rr}r(h"Uh#jubaubh)r}r(h"XYWe'll get an error if we try to import m3, because we didn't create a placeholder for it:rh#jh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7M`h8hh]rhjXYWe'll get an error if we try to import m3, because we didn't create a placeholder for it:rr}r(h"jh#jubaubh)r}r(h"Xr>>> import zope.deprecation.old_package.m3 Traceback (most recent call last): ... ImportError: No module named m3r h#jh$h'h)hh+}r!(U testnodetyper"Xdoctestr#hhh3]r$h1]r%h-]r&h/]r'h5]r(Ugroupsr)]r*hah}r+uh7Mch8hh]r,hjXr>>> import zope.deprecation.old_package.m3 Traceback (most recent call last): ... ImportError: No module named m3r-r.}r/(h"Uh#jubaubh)r0}r1(h"XCBefore we move on, let's clean up the temporary modules / packages:r2h#jh$h'h)hh+}r3(h-]r4h/]r5h1]r6h3]r7h5]r8uh7Mkh8hh]r9hjXCBefore we move on, let's clean up the temporary modules / packages:r:r;}r<(h"j2h#j0ubaubh)r=}r>(h"XV>>> zope.deprecation.__path__.remove(tmp_d) >>> import shutil >>> shutil.rmtree(tmp_d)r?h#jh$h'h)hh+}r@(U testnodetyperAXdoctestrBhhh3]rCh1]rDh-]rEh/]rFh5]rGUgroupsrH]rIhah}rJuh7Mmh8hh]rKhjXV>>> zope.deprecation.__path__.remove(tmp_d) >>> import shutil >>> shutil.rmtree(tmp_d)rLrM}rN(h"Uh#j=ubaubeubh)rO}rP(h"Uh#h h$h'h)h*h+}rQ(h-]rRh/]rSh1]rTh3]rUhah5]rVh auh7Muh8hh]rW(h:)rX}rY(h"X,Temporarily turning off deprecation warningsrZh#jOh$h'h)h>h+}r[(h-]r\h/]r]h1]r^h3]r_h5]r`uh7Muh8hh]rahjX,Temporarily turning off deprecation warningsrbrc}rd(h"jZh#jXubaubh)re}rf(h"XUIn some cases it is desireable to turn off the deprecation warnings for a short time.rgh#jOh$h'h)hh+}rh(h-]rih/]rjh1]rkh3]rlh5]rmuh7Mwh8hh]rnhjXUIn some cases it is desireable to turn off the deprecation warnings for a short time.rorp}rq(h"jgh#jeubaubh)rr}rs(h"XTo support such a feature, the ``zope.deprecation`` package provides a :term:`context manager` class, :class:`zope.deprecation.Suppressor`. Code running inside the scope of a ``Suppressor`` will not emit deprecation warnings.rth#jOh$h'h)hh+}ru(h-]rvh/]rwh1]rxh3]ryh5]rzuh7Mzh8hh]r{(hjXTo support such a feature, the r|r}}r~(h"XTo support such a feature, the rh#jrubh^)r}r(h"X``zope.deprecation``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jrh]rhjXzope.deprecationrr}r(h"Uh#jubah)hnubhjX package provides a rr}r(h"X package provides a rh#jrubhF)r}r(h"X:term:`context manager`rh#jrh$h'h)hJh+}r(UreftyperXtermrhNhOXcontext managerrU refdomainrXstdrh3]rh1]rU refexplicitrh-]rh/]rh5]rhYhZuh7Mzh]rcdocutils.nodes emphasis r)r}r(h"jh+}r(h-]rh/]r(hdjXstd-termreh1]rh3]rh5]ruh#jh]rhjXcontext managerrr}r(h"Uh#jubah)UemphasisrubaubhjX class, rr}r(h"X class, rh#jrubhF)r}r(h"X$:class:`zope.deprecation.Suppressor`rh#jrh$h'h)hJh+}r(UreftyperXclassrhNhOXzope.deprecation.SuppressorrU refdomainrXpyrh3]rh1]rU refexplicitrh-]rh/]rh5]rhYhZh[Nh\Nuh7Mzh]rh^)r}r(h"jh+}r(h-]rh/]r(hdjXpy-classreh1]rh3]rh5]ruh#jh]rhjXzope.deprecation.Suppressorrr}r(h"Uh#jubah)hnubaubhjX%. Code running inside the scope of a rr}r(h"X%. Code running inside the scope of a rh#jrubh^)r}r(h"X``Suppressor``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jrh]rhjX Suppressorrr}r(h"Uh#jubah)hnubhjX$ will not emit deprecation warnings.rr}r(h"X$ will not emit deprecation warnings.rh#jrubeubh)r}r(h"XG>>> from zope.deprecation import Suppressor >>> class Foo(object): ... bar = property(lambda self: 1) ... bar = deprecation.deprecated(bar, 'bar is no more.') ... blah = property(lambda self: 1) ... blah = deprecation.deprecated(blah, 'blah is no more.') >>> foo = Foo() >>> with Suppressor(): ... foo.blah 1rh#jOh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Mh8hh]rhjXG>>> from zope.deprecation import Suppressor >>> class Foo(object): ... bar = property(lambda self: 1) ... bar = deprecation.deprecated(bar, 'bar is no more.') ... blah = property(lambda self: 1) ... blah = deprecation.deprecated(blah, 'blah is no more.') >>> foo = Foo() >>> with Suppressor(): ... foo.blah 1rr}r(h"Uh#jubaubh)r}r(h"X]Note that no warning is emitted when ``foo.blah`` is accessed inside the suppressor's scope.:rh#jOh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Mh8hh]r(hjX%Note that no warning is emitted when rr}r(h"X%Note that no warning is emitted when rh#jubh^)r}r(h"X ``foo.blah``rh+}r (h-]r h/]r h1]r h3]r h5]ruh#jh]rhjXfoo.blahrr}r(h"Uh#jubah)hnubhjX, is accessed inside the suppressor's scope.:rr}r(h"X, is accessed inside the suppressor's scope.:rh#jubeubh)r}r(h"XjThe suppressor is implemented in terms of a ``__show__`` object. One can ask for its status by calling it:rh#jOh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Mh8hh]r (hjX,The suppressor is implemented in terms of a r!r"}r#(h"X,The suppressor is implemented in terms of a r$h#jubh^)r%}r&(h"X ``__show__``r'h+}r((h-]r)h/]r*h1]r+h3]r,h5]r-uh#jh]r.hjX__show__r/r0}r1(h"Uh#j%ubah)hnubhjX2 object. One can ask for its status by calling it:r2r3}r4(h"X2 object. One can ask for its status by calling it:r5h#jubeubh)r6}r7(h"X=>>> from zope.deprecation import __show__ >>> __show__() Truer8h#jOh$h'h)hh+}r9(U testnodetyper:Xdoctestr;hhh3]r<h1]r=h-]r>h/]r?h5]r@UgroupsrA]rBhah}rCuh7Mh8hh]rDhjX=>>> from zope.deprecation import __show__ >>> __show__() TruerErF}rG(h"Uh#j6ubaubh)rH}rI(h"X9Inside a suppressor's scope, that status is always false:rJh#jOh$h'h)hh+}rK(h-]rLh/]rMh1]rNh3]rOh5]rPuh7Mh8hh]rQhjX9Inside a suppressor's scope, that status is always false:rRrS}rT(h"jJh#jHubaubh)rU}rV(h"X/>>> with Suppressor(): ... __show__() FalserWh#jOh$h'h)hh+}rX(U testnodetyperYXdoctestrZhhh3]r[h1]r\h-]r]h/]r^h5]r_Ugroupsr`]rahah}rbuh7Mh8hh]rchjX/>>> with Suppressor(): ... __show__() Falserdre}rf(h"Uh#jUubaubh)rg}rh(h"X>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... foo.bar 1 >>> print log[0].message bar is no more.rih#jOh$h'h)hh+}rj(U testnodetyperkXdoctestrlhhh3]rmh1]rnh-]roh/]rph5]rqUgroupsrr]rshah}rtuh7Mh8hh]ruhjX>>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... foo.bar 1 >>> print log[0].message bar is no more.rvrw}rx(h"Uh#jgubaubh)ry}rz(h"XIf needed, your code can manage the depraction warnings manually using the ``on()`` and ``off()`` methods of the ``__show__`` object:r{h#jOh$h'h)hh+}r|(h-]r}h/]r~h1]rh3]rh5]ruh7Mh8hh]r(hjXKIf needed, your code can manage the depraction warnings manually using the rr}r(h"XKIf needed, your code can manage the depraction warnings manually using the rh#jyubh^)r}r(h"X``on()``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jyh]rhjXon()rr}r(h"Uh#jubah)hnubhjX and rr}r(h"X and rh#jyubh^)r}r(h"X ``off()``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jyh]rhjXoff()rr}r(h"Uh#jubah)hnubhjX methods of the rr}r(h"X methods of the rh#jyubh^)r}r(h"X ``__show__``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jyh]rhjX__show__rr}r(h"Uh#jubah)hnubhjX object:rr}r(h"X object:rh#jyubeubh)r}r(h"X7>>> __show__.off() >>> __show__() False >>> foo.blah 1rh#jOh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Mh8hh]rhjX7>>> __show__.off() >>> __show__() False >>> foo.blah 1rr}r(h"Uh#jubaubh)r}r(h"XaNow, you can also nest several turn-offs, so that calling ``off()`` multiple times is meaningful:rh#jOh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Mh8hh]r(hjX:Now, you can also nest several turn-offs, so that calling rr}r(h"X:Now, you can also nest several turn-offs, so that calling rh#jubh^)r}r(h"X ``off()``rh+}r(h-]rh/]rh1]rh3]rh5]ruh#jh]rhjXoff()rr}r(h"Uh#jubah)hnubhjX multiple times is meaningful:rr}r(h"X multiple times is meaningful:rh#jubeubh)r}r(h"X>>> __show__.stack [False] >>> __show__.off() >>> __show__.stack [False, False] >>> __show__.on() >>> __show__.stack [False] >>> __show__() False >>> __show__.on() >>> __show__.stack [] >>> __show__() Truerh#jOh$h'h)hh+}r(U testnodetyperXdoctestrhhh3]rh1]rh-]rh/]rh5]rUgroupsr]rhah}ruh7Mh8hh]rhjX>>> __show__.stack [False] >>> __show__.off() >>> __show__.stack [False, False] >>> __show__.on() >>> __show__.stack [False] >>> __show__() False >>> __show__.on() >>> __show__.stack [] >>> __show__() Truerr}r(h"Uh#jubaubh)r}r(h"X,You can also reset ``__show__`` to ``True``:rh#jOh$h'h)hh+}r(h-]rh/]rh1]rh3]rh5]ruh7Mh8hh]r(hjXYou can also reset rr}r (h"XYou can also reset r h#jubh^)r }r (h"X ``__show__``r h+}r(h-]rh/]rh1]rh3]rh5]ruh#jh]rhjX__show__rr}r(h"Uh#j ubah)hnubhjX to rr}r(h"X to rh#jubh^)r}r(h"X``True``rh+}r(h-]r h/]r!h1]r"h3]r#h5]r$uh#jh]r%hjXTruer&r'}r((h"Uh#jubah)hnubhjX:r)}r*(h"X:h#jubeubh)r+}r,(h"Xd>>> __show__.off() >>> __show__.off() >>> __show__() False >>> __show__.reset() >>> __show__() Truer-h#jOh$h'h)hh+}r.(U testnodetyper/Xdoctestr0hhh3]r1h1]r2h-]r3h/]r4h5]r5Ugroupsr6]r7hah}r8uh7Mh8hh]r9hjXd>>> __show__.off() >>> __show__.off() >>> __show__() False >>> __show__.reset() >>> __show__() Truer:r;}r<(h"Uh#j+ubaubh)r=}r>(h"XIFinally, you cannot call ``on()`` without having called ``off()`` before:r?h#jOh$h'h)hh+}r@(h-]rAh/]rBh1]rCh3]rDh5]rEuh7Mh8hh]rF(hjXFinally, you cannot call rGrH}rI(h"XFinally, you cannot call rJh#j=ubh^)rK}rL(h"X``on()``rMh+}rN(h-]rOh/]rPh1]rQh3]rRh5]rSuh#j=h]rThjXon()rUrV}rW(h"Uh#jKubah)hnubhjX without having called rXrY}rZ(h"X without having called r[h#j=ubh^)r\}r](h"X ``off()``r^h+}r_(h-]r`h/]rah1]rbh3]rch5]rduh#j=h]rehjXoff()rfrg}rh(h"Uh#j\ubah)hnubhjX before:rirj}rk(h"X before:rlh#j=ubeubh)rm}rn(h"XX>>> __show__.on() Traceback (most recent call last): ... IndexError: pop from empty listroh#jOh$h'h)hh+}rp(U testnodetyperqXdoctestrrhhh3]rsh1]rth-]ruh/]rvh5]rwUgroupsrx]ryhah}rzuh7Mh8hh]r{hjXX>>> __show__.on() Traceback (most recent call last): ... IndexError: pop from empty listr|r}}r~(h"Uh#jmubaubeubeubah"UU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]rh8hU current_linerNUtransform_messagesr]rUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNh>NUerror_encoding_error_handlerrUbackslashreplacerUdebugrNUembed_stylesheetrUoutput_encoding_error_handlerrUstrictrU sectnum_xformrKUdump_transformsrNU docinfo_xformrKUwarning_streamrNUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrUtrim_footnote_reference_spacerUenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformrU source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerUhhshjhh hjuUsubstitution_namesr}rh)h8h+}r(h-]rh3]rh1]rUsourcerh'h/]rh5]ruU footnotesr]rUrefidsr}rub.zope.deprecation-4.1.2/docs/_build/doctrees/environment.pickle0000664000175000017500000003464612255115221025701 0ustar tseavertseaver00000000000000(csphinx.environment BuildEnvironment qoq}q(Udlfilesqcsphinx.util FilenameUniqDict q)qc__builtin__ set q]RqbUappq NU reread_alwaysq h]Rq Utitlesq }q (Xindexqcdocutils.nodes title q)q}q(U rawsourceqUU attributesq}q(Udupnamesq]qUclassesq]qUbackrefsq]qUnamesq]qUidsq]quUchildrenq]q (cdocutils.nodes literal q!)q"}q#(hXzope.deprecationq$h}q%(h]q&h]q'h]q(h]q)h]q*uUparentq+hh]q,cdocutils.nodes Text q-Xzope.deprecationq.q/}q0(hUh+h"ubaUtagnameq1Uliteralq2ubh-X Documentationq3q4}q5(hX Documentationq6h+hubeh1Utitleq7ubXhackingq8h)q9}q:(hUh}q;(h]qh]q?h]q@uh]qA(h-X Hacking on qBqC}qD(hX Hacking on qEh+h9ubh!)qF}qG(hXzope.deprecationqHh}qI(h]qJh]qKh]qLh]qMh]qNuh+h9h]qOh-Xzope.deprecationqPqQ}qR(hUh+hFubah1h2ubeh1h7ubXapiqSh)qT}qU(U rawsourceqVUU attributesqW}qX(UdupnamesqY]qZUclassesq[]q\Ubackrefsq]]q^Uidsq_]q`Unamesqa]qbuUchildrenqc]qd(h!)qe}qf(hVXzope.deprecationqghW}qh(hY]qih[]qjh]]qkh_]qlha]qmuUparentqnhThc]qoh-Xzope.deprecationqpqq}qr(hVUhnheubaUtagnameqsUliteralqtubh-X APIquqv}qw(hVX APIqxhnhTubehsUtitleqyubuU domaindataqz}q{(Ustdq|}q}(U anonlabelsq~}q(UmodindexqU py-modindexUqUgenindexqhUqUsearchqUsearchUquUlabelsq}q(hU py-modindexUcsphinx.locale _TranslationProxy qcsphinx.locale mygettext qU Module IndexqqhhqbqhhUhhUIndexqqhhqbqhhUhhU Search PageqqhhqbquUversionqKUobjectsq}qU progoptionsq}quUc}q(h}qhKuUpyq}q(h}qUmodulesq}qhKuUjsq}q(h}qhKuUrstq}q(h}qhKuUcppq}q(h}qhKuuU glob_toctreesqh]RqUimagesqh)qh]RqbU doctreedirqXD/home/tseaver/projects/Zope/Z3/zope.deprecation/docs/_build/doctreesqUversioning_conditionqU citationsq}qhK*UsrcdirqX4/home/tseaver/projects/Zope/Z3/zope.deprecation/docsqUconfigqcsphinx.config Config q)q}q(U source_suffixqU.rstqUtexinfo_documentsq]q(UindexqUzopedeprecationqXzope.deprecation DocumentationqXZope Foundation ContributorsqhU One line description of project.U MiscellaneoustqaU copyrightqX"2012, Zope Foundation ContributorsqUtemplates_pathq]qU _templatesqaUlatex_documentsq]q(hUzopedeprecation.texhhUmanualtqaU overridesq}qUpygments_styleqUsphinxqUexclude_patternsq]qU_buildqaUreleaseqU4.0qUprojectqXzope.deprecationqUlatex_elementsq}qUhtmlhelp_basenameqUzopedeprecationdocqUversionqhU extensionsq]q(Usphinx.ext.autodocqUsphinx.ext.doctestqUsphinx.ext.viewcodeqeUhtml_static_pathq]qU_staticqaU html_themeqUdefaultqU man_pagesq]q(Uindexqhh]qhaKtqaU master_docqhUsetupqNubUmetadataq}q(h}qh8}qhS}quUversionchangesq}qU_viewcode_modulesq}qUtoc_num_entriesq}q(hKh8K hSKuUnumbered_toctreesqh]RqU found_docsqh]q(XindexqXhackingqhSeRqU longtitlesq}r(hhh8h9hShTuU dependenciesr}rUtoctree_includesr}rh]r(XapirXhackingresU temp_datar}r Utocsr }r (hcdocutils.nodes bullet_list r )r }r(hUh}r(h]rh]rh]rh]rh]ruh]r(cdocutils.nodes list_item r)r}r(hUh}r(h]rh]rh]rh]rh]ruh+j h]r(csphinx.addnodes compact_paragraph r )r!}r"(hUh}r#(h]r$h]r%h]r&h]r'h]r(uh+jh]r)cdocutils.nodes reference r*)r+}r,(hUh}r-(U anchornamer.UUrefurir/hh]r0h]r1h]r2h]r3h]r4Uinternalr5uh+j!h]r6(h!)r7}r8(hXzope.deprecationr9h}r:(h]r;h]r<h]r=h]r>h]r?uh+j+h]r@h-Xzope.deprecationrArB}rC(hUh+j7ubah1h2ubh-X DocumentationrDrE}rF(hh6h+j+ubeh1U referencerGubah1Ucompact_paragraphrHubj )rI}rJ(hUh}rK(h]rLh]rMh]rNh]rOh]rPuh+jh]rQcsphinx.addnodes toctree rR)rS}rT(hUh}rU(UnumberedrVKUparentrWhU titlesonlyrXUglobrYh]rZh]r[h]r\h]r]U includehiddenr^Uentriesr_]r`(NjraNjrbeUhiddenrcUmaxdepthrdKU includefilesre]rf(jjeh]rguh+jIh]rhh1Utoctreeriubah1U bullet_listrjubeh1U list_itemrkubj)rl}rm(hUh}rn(h]roh]rph]rqh]rrh]rsuh+j h]rtj )ru}rv(hUh}rw(h]rxh]ryh]rzh]r{h]r|uh+jlh]r}j*)r~}r(hUh}r(U anchornamerU#indices-and-tablesrUrefurirhh]rh]rh]rh]rh]rUinternalruh+juh]rh-XIndices and tablesrr}r(hXIndices and tablesrh+j~ubah1jGubah1jHubah1jkubeh1jjubh8j )r}r(hUh}r(h]rh]rh]rh]rh]ruh]rj)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]r(j )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerUUrefurirh8h]rh]rh]rh]rh]rUinternalruh+jh]r(h-X Hacking on rr}r(hhEh+jubh!)r}r(hXzope.deprecationrh}r(h]rh]rh]rh]rh]ruh+jh]rh-Xzope.deprecationrr}r(hUh+jubah1h2ubeh1jGubah1jHubj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]r(j)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU#getting-the-coderUrefurirh8h]rh]rh]rh]rh]rUinternalruh+jh]rh-XGetting the Coderr}r(hXGetting the Coderh+jubah1jGubah1jHubah1jkubj)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU"#running-the-tests-in-a-virtualenvrUrefurir h8h]r h]r h]r h]r h]rUinternalruh+jh]r(h-XRunning the tests in a rr}r(hXRunning the tests in a rh+jubh!)r}r(hX``virtualenv``rh}r(h]rh]rh]rh]rh]ruh+jh]rh-X virtualenvrr }r!(hUh+jubah1h2ubeh1jGubah1jHubah1jkubj)r"}r#(hUh}r$(h]r%h]r&h]r'h]r(h]r)uh+jh]r*j )r+}r,(hUh}r-(h]r.h]r/h]r0h]r1h]r2uh+j"h]r3j*)r4}r5(hUh}r6(U anchornamer7U+#building-the-documentation-in-a-virtualenvr8Urefurir9h8h]r:h]r;h]r<h]r=h]r>Uinternalr?uh+j+h]r@(h-X Building the documentation in a rArB}rC(hX Building the documentation in a rDh+j4ubh!)rE}rF(hX``virtualenv``rGh}rH(h]rIh]rJh]rKh]rLh]rMuh+j4h]rNh-X virtualenvrOrP}rQ(hUh+jEubah1h2ubeh1jGubah1jHubah1jkubj)rR}rS(hUh}rT(h]rUh]rVh]rWh]rXh]rYuh+jh]rZj )r[}r\(hUh}r](h]r^h]r_h]r`h]rah]rbuh+jRh]rcj*)rd}re(hUh}rf(U anchornamergU$#running-the-tests-using-zc-buildoutrhUrefuririh8h]rjh]rkh]rlh]rmh]rnUinternalrouh+j[h]rp(h-XRunning the tests using rqrr}rs(hXRunning the tests using rth+jdubh!)ru}rv(hX zc.buildoutrwh}rx(h]ryh]rzh]r{h]r|h]r}uh+jdh]r~h-X zc.buildoutrr}r(hUh+juubah1h2ubeh1jGubah1jHubah1jkubj)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU-#building-the-documentation-using-zc-buildoutrUrefurirh8h]rh]rh]rh]rh]rUinternalruh+jh]r(h-X!Building the documentation using rr}r(hX!Building the documentation using rh+jubh!)r}r(hX zc.buildoutrh}r(h]rh]rh]rh]rh]ruh+jh]rh-X zc.buildoutrr}r(hUh+jubah1h2ubeh1jGubah1jHubah1jkubj)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU2#running-tests-on-multiple-python-versions-via-toxrUrefurirh8h]rh]rh]rh]rh]rUinternalruh+jh]r(h-X.Running Tests on Multiple Python Versions via rr}r(hX.Running Tests on Multiple Python Versions via rh+jubh!)r}r(hXtoxrh}r(h]rh]rh]rh]rh]ruh+jh]rh-Xtoxrr}r(hUh+jubah1h2ubeh1jGubah1jHubah1jkubj)r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU#submitting-a-bug-reportrUrefurirh8h]rh]rh]rh]rh]rUinternalruh+jh]rh-XSubmitting a Bug Reportrr}r(hXSubmitting a Bug Reportrh+jubah1jGubah1jHubah1jkubj)r}r(hUh}r(h]rh]r h]r h]r h]r uh+jh]r j )r}r(hUh}r(h]rh]rh]rh]rh]ruh+jh]rj*)r}r(hUh}r(U anchornamerU#sharing-your-changesrUrefurirh8h]rh]rh]rh]r h]r!Uinternalr"uh+jh]r#h-XSharing Your Changesr$r%}r&(hXSharing Your Changesr'h+jubah1jGubah1jHubah1jkubeh1jjubeh1jkubah1jjubhSj )r(}r)(hVUhW}r*(hY]r+h[]r,h]]r-h_]r.ha]r/uhc]r0j)r1}r2(hVUhW}r3(hY]r4h[]r5h]]r6h_]r7ha]r8uhnj(hc]r9(j )r:}r;(hVUhW}r<(hY]r=h[]r>h]]r?h_]r@ha]rAuhnj1hc]rBj*)rC}rD(hVUhW}rE(U anchornamerFUUrefurirGhSh_]rHh]]rIhY]rJh[]rKha]rLUinternalrMuhnj:hc]rN(h!)rO}rP(hVXzope.deprecationrQhW}rR(hY]rSh[]rTh]]rUh_]rVha]rWuhnjChc]rXh-Xzope.deprecationrYrZ}r[(hVUhnjOubahshtubh-X APIr\r]}r^(hVhxhnjCubehsU referencer_ubahsUcompact_paragraphr`ubj )ra}rb(hVUhW}rc(hY]rdh[]reh]]rfh_]rgha]rhuhnj1hc]ri(j)rj}rk(hVUhW}rl(hY]rmh[]rnh]]roh_]rpha]rquhnjahc]rrj )rs}rt(hVUhW}ru(hY]rvh[]rwh]]rxh_]ryha]rzuhnjjhc]r{j*)r|}r}(hVUhW}r~(U anchornamerU$#deprecating-objects-inside-a-modulerUrefurirhSh_]rh]]rhY]rh[]rha]rUinternalruhnjshc]rh-X#Deprecating objects inside a modulerr}r(hVX#Deprecating objects inside a modulerhnj|ubahsj_ubahsj`ubahsU list_itemrubj)r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjahc]rj )r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjhc]rj*)r}r(hVUhW}r(U anchornamerU##deprecating-methods-and-propertiesrUrefurirhSh_]rh]]rhY]rh[]rha]rUinternalruhnjhc]rh-X"Deprecating methods and propertiesrr}r(hVX"Deprecating methods and propertiesrhnjubahsj_ubahsj`ubahsjubj)r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjahc]rj )r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjhc]rj*)r}r(hVUhW}r(U anchornamerU#deprecating-modulesrUrefurirhSh_]rh]]rhY]rh[]rha]rUinternalruhnjhc]rh-XDeprecating modulesrr}r(hVXDeprecating modulesrhnjubahsj_ubahsj`ubahsjubj)r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjahc]rj )r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjhc]rj*)r}r(hVUhW}r(U anchornamerU#moving-modulesrUrefurirhSh_]rh]]rhY]rh[]rha]rUinternalruhnjhc]rh-XMoving modulesrr}r(hVXMoving modulesrhnjubahsj_ubahsj`ubahsjubj)r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjahc]rj )r}r(hVUhW}r(hY]rh[]rh]]rh_]rha]ruhnjhc]rj*)r }r (hVUhW}r (U anchornamer U#moving-packagesr UrefurirhSh_]rh]]rhY]rh[]rha]rUinternalruhnjhc]rh-XMoving packagesrr}r(hVXMoving packagesrhnj ubahsj_ubahsj`ubahsjubj)r}r(hVUhW}r(hY]rh[]rh]]rh_]r ha]r!uhnjahc]r"j )r#}r$(hVUhW}r%(hY]r&h[]r'h]]r(h_]r)ha]r*uhnjhc]r+j*)r,}r-(hVUhW}r.(U anchornamer/U-#temporarily-turning-off-deprecation-warningsr0Urefurir1hSh_]r2h]]r3hY]r4h[]r5ha]r6Uinternalr7uhnj#hc]r8h-X,Temporarily turning off deprecation warningsr9r:}r;(hVX,Temporarily turning off deprecation warningsr<hnj,ubahsj_ubahsj`ubahsjubehsU bullet_listr=ubehsjubahsj=ubuU indexentriesr>}r?(h]r@h8]rAhS]rBuUall_docsrC}rD(hGAԭ%JQh8GAԭ%I{hSGAԭ&`uUsettingsrE}rF(Ucloak_email_addressesrGUtrim_footnote_reference_spacerHU halt_levelrIKUsectsubtitle_xformrJUembed_stylesheetrKU pep_base_urlrLUhttp://www.python.org/dev/peps/rMUdoctitle_xformrNUwarning_streamrOcsphinx.util.nodes WarningStream rP)rQ}rR(U_rerScre _compile rTU+\((DEBUG|INFO|WARNING|ERROR|SEVERE)/[0-4]\)rUKRrVUwarnfuncrWNubUenvrXhU rfc_base_urlrYUhttp://tools.ietf.org/html/rZUfile_insertion_enabledr[Ugettext_compactr\Uinput_encodingr]U utf-8-sigr^uUfiles_to_rebuildr_}r`(jh]rahaRrbjh]rchaRrduUtoc_secnumbersre}rfU_nitpick_ignorergh]RrhU _warnfuncriNub.zope.deprecation-4.1.2/docs/_build/html/0000775000175000017500000000000012455234662021300 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/_build/html/_sources/0000775000175000017500000000000012455234662023122 5ustar tseavertseaver00000000000000zope.deprecation-4.1.2/docs/_build/html/_sources/api.txt0000664000175000017500000003255212255115214024430 0ustar tseavertseaver00000000000000:mod:`zope.deprecation` API =========================== Deprecating objects inside a module ----------------------------------- Let's start with a demonstration of deprecating any name inside a module. To demonstrate the functionality, First, let's set up an example module containing fixtures we will use: .. doctest:: >>> import os >>> import tempfile >>> import zope.deprecation >>> tmp_d = tempfile.mkdtemp('deprecation') >>> zope.deprecation.__path__.append(tmp_d) >>> doctest_ex = '''\ ... from . import deprecated ... ... def demo1(): #pragma NO COVER (used only in doctests) ... return 1 ... deprecated('demo1', 'demo1 is no more.') ... ... def demo2(): #pragma NO COVER (used only in doctests) ... return 2 ... deprecated('demo2', 'demo2 is no more.') ... ... def demo3(): #pragma NO COVER (used only in doctests) ... return 3 ... deprecated('demo3', 'demo3 is no more.') ... ... def demo4(): #pragma NO COVER (used only in doctests) ... return 4 ... def deprecatedemo4(): #pragma NO COVER (used only in doctests) ... """Demonstrate that deprecated() also works in a local scope.""" ... deprecated('demo4', 'demo4 is no more.') ... ''' >>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f: ... f.write(doctest_ex) The first argument to the ``deprecated()`` function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely. Let's now see how the deprecation warnings are displayed. .. doctest:: >>> import warnings >>> from zope.deprecation import doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo1() 1 >>> print log[0].category.__name__ DeprecationWarning >>> print log[0].message demo1: demo1 is no more. >>> import zope.deprecation.doctest_ex >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... zope.deprecation.doctest_ex.demo2() 2 >>> print log[0].message demo2: demo2 is no more. You can see that merely importing the affected module or one of its parents does not cause a deprecation warning. Only when we try to access the name in the module, we get a deprecation warning. On the other hand, if we import the name directly, the deprecation warning will be raised immediately. .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.deprecation.doctest_ex import demo3 >>> print log[0].message demo3: demo3 is no more. Deprecation can also happen inside a function. When we first access ``demo4``, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> len(log) 0 >>> doctest_ex.deprecatedemo4() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... doctest_ex.demo4() 4 >>> print log[0].message.message #XXX oddball case: why nested? demo4: demo4 is no more. Deprecating methods and properties ---------------------------------- New let's see how properties and methods can be deprecated. We are going to use the same function as before, except that this time, we do not pass in names as first argument, but the method or attribute itself. The function then returns a wrapper that sends out a deprecation warning when the attribute or method is accessed. .. doctest:: >>> from zope.deprecation import deprecation >>> class MyComponent(object): ... foo = property(lambda self: 1) ... foo = deprecation.deprecated(foo, 'foo is no more.') ... ... bar = 2 ... ... def blah(self): ... return 3 ... blah = deprecation.deprecated(blah, 'blah() is no more.') ... ... def splat(self): ... return 4 ... ... @deprecation.deprecate("clap() is no more.") ... def clap(self): ... return 5 And here is the result: .. doctest:: >>> my = MyComponent() >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.foo 1 >>> print log[0].message.message # XXX see above foo is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.bar 2 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.blah() 3 >>> print log[0].message.message # XXX see above blah() is no more. >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.splat() 4 >>> len(log) 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... my.clap() 5 >>> print log[0].message.message # XXX see above clap() is no more. Deprecating modules ------------------- It is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let's imagine, the ``zope.deprecation`` module used to be called ``zope.wanda`` and we'd like to retain backward compatibility: .. doctest:: >>> import sys >>> sys.modules['zope.wanda'] = deprecation.deprecated( ... zope.deprecation, 'A module called Wanda is now zope.deprecation.') Now we can import ``wanda``, but when accessing things from it, we get our deprecation message as expected: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... from zope.wanda import deprecated >>> print log[0].message.message # XXX see above A module called Wanda is now zope.deprecation. Before we move on, we should clean up: .. doctest:: >>> del deprecated >>> del sys.modules['zope.wanda'] Moving modules -------------- When a module is moved, you often want to support importing from the old location for a while, generating a deprecation warning when someone uses the old location. This can be done using the moved function. To see how this works, we'll use a helper function to create two fake modules in the zope.deprecation package. First will create a module in the "old" location that used the moved function to indicate the a module on the new location should be used: .. doctest:: >>> import os >>> created_modules = [] >>> def create_module(modules=(), **kw): #** highlightfail ... modules = dict(modules) ... modules.update(kw) ... for name, src in modules.iteritems(): ... pname = name.split('.') ... if pname[-1] == '__init__': ... os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail ... name = '.'.join(pname[:-1]) ... open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf ... created_modules.append(name) >>> create_module(old_location= ... ''' ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_location', 'version 2') ... ''') and we define the module in the new location: .. doctest:: >>> create_module(new_location= ... '''\ ... print "new module imported" ... x = 42 ... ''') Now, if we import the old location, we'll see the output of importing the old location: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_location new module imported >>> print log[0].message.message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_location has moved to zope.deprecation.new_location. Import of zope.deprecation.old_location will become unsupported in version 2 >>> zope.deprecation.old_location.x 42 Moving packages --------------- When moving packages, you need to leave placeholders for each module. Let's look at an example: .. doctest:: >>> create_module({ ... 'new_package.__init__': '''\ ... print __name__, 'imported' ... x=0 ... ''', ... 'new_package.m1': '''\ ... print __name__, 'imported' ... x=1 ... ''', ... 'new_package.m2': '''\ ... print __name__, 'imported' ... def x(): ... pass ... ''', ... 'new_package.m3': '''\ ... print __name__, 'imported' ... x=3 ... ''', ... 'old_package.__init__': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package', 'version 2') ... ''', ... 'old_package.m1': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2') ... ''', ... 'old_package.m2': '''\ ... import zope.deprecation ... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2') ... ''', ... }) Now, if we import the old modules, we'll get warnings: .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package zope.deprecation.new_package imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package has moved to zope.deprecation.new_package. Import of zope.deprecation.old_package will become unsupported in version 2 >>> zope.deprecation.old_package.x 0 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m1 zope.deprecation.new_package.m1 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1. Import of zope.deprecation.old_package.m1 will become unsupported in version 2 >>> zope.deprecation.old_package.m1.x 1 >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... import zope.deprecation.old_package.m2 zope.deprecation.new_package.m2 imported >>> print log[0].message ... # doctest: +NORMALIZE_WHITESPACE zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2. Import of zope.deprecation.old_package.m2 will become unsupported in version 2 >>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x True >>> (zope.deprecation.old_package.m2.x.func_globals ... is zope.deprecation.new_package.m2.__dict__) True >>> zope.deprecation.old_package.m2.x.__module__ 'zope.deprecation.new_package.m2' We'll get an error if we try to import m3, because we didn't create a placeholder for it: .. doctest:: >>> import zope.deprecation.old_package.m3 Traceback (most recent call last): ... ImportError: No module named m3 Before we move on, let's clean up the temporary modules / packages: .. doctest:: >>> zope.deprecation.__path__.remove(tmp_d) >>> import shutil >>> shutil.rmtree(tmp_d) Temporarily turning off deprecation warnings -------------------------------------------- In some cases it is desireable to turn off the deprecation warnings for a short time. To support such a feature, the ``zope.deprecation`` package provides a :term:`context manager` class, :class:`zope.deprecation.Suppressor`. Code running inside the scope of a ``Suppressor`` will not emit deprecation warnings. .. doctest:: >>> from zope.deprecation import Suppressor >>> class Foo(object): ... bar = property(lambda self: 1) ... bar = deprecation.deprecated(bar, 'bar is no more.') ... blah = property(lambda self: 1) ... blah = deprecation.deprecated(blah, 'blah is no more.') >>> foo = Foo() >>> with Suppressor(): ... foo.blah 1 Note that no warning is emitted when ``foo.blah`` is accessed inside the suppressor's scope.: The suppressor is implemented in terms of a ``__show__`` object. One can ask for its status by calling it: .. doctest:: >>> from zope.deprecation import __show__ >>> __show__() True Inside a suppressor's scope, that status is always false: .. doctest:: >>> with Suppressor(): ... __show__() False .. doctest:: >>> with warnings.catch_warnings(record=True) as log: ... del warnings.filters[:] ... foo.bar 1 >>> print log[0].message bar is no more. If needed, your code can manage the depraction warnings manually using the ``on()`` and ``off()`` methods of the ``__show__`` object: .. doctest:: >>> __show__.off() >>> __show__() False >>> foo.blah 1 Now, you can also nest several turn-offs, so that calling ``off()`` multiple times is meaningful: .. doctest:: >>> __show__.stack [False] >>> __show__.off() >>> __show__.stack [False, False] >>> __show__.on() >>> __show__.stack [False] >>> __show__() False >>> __show__.on() >>> __show__.stack [] >>> __show__() True You can also reset ``__show__`` to ``True``: .. doctest:: >>> __show__.off() >>> __show__.off() >>> __show__() False >>> __show__.reset() >>> __show__() True Finally, you cannot call ``on()`` without having called ``off()`` before: .. doctest:: >>> __show__.on() Traceback (most recent call last): ... IndexError: pop from empty list zope.deprecation-4.1.2/docs/_build/html/_sources/hacking.txt0000664000175000017500000002301412072655562025270 0ustar tseavertseaver00000000000000Hacking on :mod:`zope.deprecation` ================================== Getting the Code ----------------- The main repository for :mod:`zope.deprecation` is in the Zope Subversion repository: http://svn.zope.org/zope.deprecation You can get a read-only Subversion checkout from there: .. code-block:: sh $ svn checkout svn://svn.zope.org/repos/main/zope.deprecation/trunk zope.deprecation The project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad: https://code.launchpad.net/zope.deprecation You can branch the trunk from there using Bazaar: .. code-block:: sh $ bzr branch lp:zope.deprecation Running the tests in a ``virtualenv`` ------------------------------------- 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.deprecation Next, get this package registered as a "development egg" in the environment: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/python setup.py develop Finally, run the tests using the build-in ``setuptools`` testrunner: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/python setup.py test running test .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK If you have the :mod:`nose` package installed in the virtualenv, you can use its testrunner too: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/easy_install nose ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests running nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK or: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s 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.deprecation/bin/easy_install nose coverage ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests \ --with coverage --cover-package=zope.deprecation running nosetests .................................................... Name Stmts Miss Cover Missing ------------------------------------------------------------ zope.deprecation 7 0 100% zope.deprecation.deprecation 127 0 100% zope.deprecation.fixture 1 0 100% ------------------------------------------------------------ TOTAL 135 0 100% ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK Building the documentation in a ``virtualenv`` ---------------------------------------------- :mod:`zope.deprecation` 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.deprecation/bin/easy_install Sphinx ... $ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html ... build succeeded. You can also test the code snippets in the documentation: .. code-block:: sh $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 89 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. Running the tests using :mod:`zc.buildout` ------------------------------------------- :mod:`zope.deprecation` 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/tseaver/projects/Zope/BTK/deprecation/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'. 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 52 tests with 0 failures and 0 errors in 0.366 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Building the documentation using :mod:`zc.buildout` --------------------------------------------------- The :mod:`zope.deprecation` buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets: .. code-block:: sh $ cd docs $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 140 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded. Running Tests on Multiple Python Versions via :mod:`tox` -------------------------------------------------------- `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.deprecation` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The ``py26`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. - The ``py27`` environment builds a ``virtualenv`` with ``python2.7``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. - The ``py32`` environment builds a ``virtualenv`` with ``python3.2``, installs :mod:`zope.deprecation` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``pypy`` environment builds a ``virtualenv`` with ``pypy``, installs :mod:`zope.deprecation`, and runs the tests via ``python setup.py test -q``. - The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement coverage. - The ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.deprecation`, 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.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] .......... ---------------------------------------------------------------------- Ran 52 tests in 0.155s 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.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 89 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 :) Submitting a Bug Report ----------------------- :mod:`zope.deprecation` tracks its bugs on Launchpad: https://bugs.launchpad.net/zope.deprecation 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 you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file: .. code-block:: sh $ svn diff > zope.deprecation-cool_feature.patch You can then upload that patch file as an attachment to a Launchpad bug report. 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:~tseaver/zope.deprecation/cool_feature After pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad "merge request" feature. zope.deprecation-4.1.2/docs/_build/html/_sources/index.txt0000664000175000017500000000034612072655562024776 0ustar tseavertseaver00000000000000:mod:`zope.deprecation` Documentation ===================================== Contents: .. toctree:: :maxdepth: 2 api hacking Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` zope.deprecation-4.1.2/docs/_build/html/api.html0000664000175000017500000015134312255115221022731 0ustar tseavertseaver00000000000000 zope.deprecation API — zope.deprecation 4.0 documentation

zope.deprecation API

Deprecating objects inside a module

Let’s start with a demonstration of deprecating any name inside a module. To demonstrate the functionality, First, let’s set up an example module containing fixtures we will use:

>>> import os
>>> import tempfile
>>> import zope.deprecation
>>> tmp_d = tempfile.mkdtemp('deprecation')
>>> zope.deprecation.__path__.append(tmp_d)
>>> doctest_ex = '''\
... from . import deprecated
...
... def demo1(): #pragma NO COVER  (used only in doctests)
...     return 1
... deprecated('demo1', 'demo1 is no more.')
...
... def demo2(): #pragma NO COVER  (used only in doctests)
...     return 2
... deprecated('demo2', 'demo2 is no more.')
...
... def demo3(): #pragma NO COVER  (used only in doctests)
...     return 3
... deprecated('demo3', 'demo3 is no more.')
...
... def demo4(): #pragma NO COVER  (used only in doctests)
...     return 4
... def deprecatedemo4(): #pragma NO COVER  (used only in doctests)
...     """Demonstrate that deprecated() also works in a local scope."""
...     deprecated('demo4', 'demo4 is no more.')
... '''
>>> with open(os.path.join(tmp_d, 'doctest_ex.py'), 'w') as f:
...     f.write(doctest_ex)

The first argument to the deprecated() function is a list of names that should be declared deprecated. If the first argument is a string, it is interpreted as one name. The second argument is the reason the particular name has been deprecated. It is good practice to also list the version in which the name will be removed completely.

Let’s now see how the deprecation warnings are displayed.

>>> import warnings
>>> from zope.deprecation import doctest_ex
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     doctest_ex.demo1()
1
>>> print log[0].category.__name__
DeprecationWarning
>>> print log[0].message
demo1: demo1 is no more.

>>> import zope.deprecation.doctest_ex
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     zope.deprecation.doctest_ex.demo2()
2
>>> print log[0].message
demo2: demo2 is no more.

You can see that merely importing the affected module or one of its parents does not cause a deprecation warning. Only when we try to access the name in the module, we get a deprecation warning. On the other hand, if we import the name directly, the deprecation warning will be raised immediately.

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     from zope.deprecation.doctest_ex import demo3
>>> print log[0].message
demo3: demo3 is no more.

Deprecation can also happen inside a function. When we first access demo4, it can be accessed without problems, then we call a function that sets the deprecation message and we get the message upon the next access:

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     doctest_ex.demo4()
4
>>> len(log)
0
>>> doctest_ex.deprecatedemo4()
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     doctest_ex.demo4()
4
>>> print log[0].message.message #XXX oddball case: why nested?
demo4: demo4 is no more.

Deprecating methods and properties

New let’s see how properties and methods can be deprecated. We are going to use the same function as before, except that this time, we do not pass in names as first argument, but the method or attribute itself. The function then returns a wrapper that sends out a deprecation warning when the attribute or method is accessed.

>>> from zope.deprecation import deprecation
>>> class MyComponent(object):
...     foo = property(lambda self: 1)
...     foo = deprecation.deprecated(foo, 'foo is no more.')
...
...     bar = 2
...
...     def blah(self):
...         return 3
...     blah = deprecation.deprecated(blah, 'blah() is no more.')
...
...     def splat(self):
...         return 4
...
...     @deprecation.deprecate("clap() is no more.")
...     def clap(self):
...         return 5

And here is the result:

>>> my = MyComponent()
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     my.foo
1
>>> print log[0].message.message # XXX see above
foo is no more.
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     my.bar
2
>>> len(log)
0
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     my.blah()
3
>>> print log[0].message.message # XXX see above
blah() is no more.
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     my.splat()
4
>>> len(log)
0
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     my.clap()
5
>>> print log[0].message.message # XXX see above
clap() is no more.

Deprecating modules

It is also possible to deprecate whole modules. This is useful when creating module aliases for backward compatibility. Let’s imagine, the zope.deprecation module used to be called zope.wanda and we’d like to retain backward compatibility:

>>> import sys
>>> sys.modules['zope.wanda'] = deprecation.deprecated(
...     zope.deprecation, 'A module called Wanda is now zope.deprecation.')

Now we can import wanda, but when accessing things from it, we get our deprecation message as expected:

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     from zope.wanda import deprecated
>>> print log[0].message.message # XXX see above
A module called Wanda is now zope.deprecation.

Before we move on, we should clean up:

>>> del deprecated
>>> del sys.modules['zope.wanda']

Moving modules

When a module is moved, you often want to support importing from the old location for a while, generating a deprecation warning when someone uses the old location. This can be done using the moved function.

To see how this works, we’ll use a helper function to create two fake modules in the zope.deprecation package. First will create a module in the “old” location that used the moved function to indicate the a module on the new location should be used:

>>> import os
>>> created_modules = []
>>> def create_module(modules=(), **kw): #** highlightfail
...     modules = dict(modules)
...     modules.update(kw)
...     for name, src in modules.iteritems():
...         pname = name.split('.')
...         if pname[-1] == '__init__':
...             os.mkdir(os.path.join(tmp_d, *pname[:-1])) #* highlightfail
...             name = '.'.join(pname[:-1])
...         open(os.path.join(tmp_d, *pname)+'.py', 'w').write(src) #* hf
...         created_modules.append(name)
>>> create_module(old_location=
... '''
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_location', 'version 2')
... ''')

and we define the module in the new location:

>>> create_module(new_location=
... '''\
... print "new module imported"
... x = 42
... ''')

Now, if we import the old location, we’ll see the output of importing the old location:

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     import zope.deprecation.old_location
new module imported
>>> print log[0].message.message
... 
zope.deprecation.old_location has moved to zope.deprecation.new_location.
Import of zope.deprecation.old_location will become unsupported
in version 2
>>> zope.deprecation.old_location.x
42

Moving packages

When moving packages, you need to leave placeholders for each module. Let’s look at an example:

>>> create_module({
... 'new_package.__init__': '''\
... print __name__, 'imported'
... x=0
... ''',
... 'new_package.m1': '''\
... print __name__, 'imported'
... x=1
... ''',
... 'new_package.m2': '''\
... print __name__, 'imported'
... def x():
...     pass
... ''',
... 'new_package.m3': '''\
... print __name__, 'imported'
... x=3
... ''',
... 'old_package.__init__': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package', 'version 2')
... ''',
... 'old_package.m1': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package.m1', 'version 2')
... ''',
... 'old_package.m2': '''\
... import zope.deprecation
... zope.deprecation.moved('zope.deprecation.new_package.m2', 'version 2')
... ''',
... })

Now, if we import the old modules, we’ll get warnings:

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     import zope.deprecation.old_package
zope.deprecation.new_package imported
>>> print log[0].message
... 
zope.deprecation.old_package has moved to zope.deprecation.new_package.
Import of zope.deprecation.old_package will become unsupported in version 2
>>> zope.deprecation.old_package.x
0

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     import zope.deprecation.old_package.m1
zope.deprecation.new_package.m1 imported
>>> print log[0].message
... 
zope.deprecation.old_package.m1 has moved to zope.deprecation.new_package.m1.
Import of zope.deprecation.old_package.m1 will become unsupported in
version 2
>>> zope.deprecation.old_package.m1.x
1

>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     import zope.deprecation.old_package.m2
zope.deprecation.new_package.m2 imported
>>> print log[0].message
... 
zope.deprecation.old_package.m2 has moved to zope.deprecation.new_package.m2.
Import of zope.deprecation.old_package.m2 will become unsupported in
version 2
>>> zope.deprecation.old_package.m2.x is zope.deprecation.new_package.m2.x
True

>>> (zope.deprecation.old_package.m2.x.func_globals
...  is zope.deprecation.new_package.m2.__dict__)
True

>>> zope.deprecation.old_package.m2.x.__module__
'zope.deprecation.new_package.m2'

We’ll get an error if we try to import m3, because we didn’t create a placeholder for it:

>>> import  zope.deprecation.old_package.m3
Traceback (most recent call last):
...
ImportError: No module named m3

Before we move on, let’s clean up the temporary modules / packages:

>>> zope.deprecation.__path__.remove(tmp_d)
>>> import shutil
>>> shutil.rmtree(tmp_d)

Temporarily turning off deprecation warnings

In some cases it is desireable to turn off the deprecation warnings for a short time.

To support such a feature, the zope.deprecation package provides a context manager class, zope.deprecation.Suppressor. Code running inside the scope of a Suppressor will not emit deprecation warnings.

>>> from zope.deprecation import Suppressor
>>> class Foo(object):
...     bar = property(lambda self: 1)
...     bar = deprecation.deprecated(bar, 'bar is no more.')
...     blah = property(lambda self: 1)
...     blah = deprecation.deprecated(blah, 'blah is no more.')
>>> foo = Foo()
>>> with Suppressor():
...    foo.blah
1

Note that no warning is emitted when foo.blah is accessed inside the suppressor’s scope.:

The suppressor is implemented in terms of a __show__ object. One can ask for its status by calling it:

>>> from zope.deprecation import __show__
>>> __show__()
True

Inside a suppressor’s scope, that status is always false:

>>> with Suppressor():
...     __show__()
False
>>> with warnings.catch_warnings(record=True) as log:
...     del warnings.filters[:]
...     foo.bar
1
>>> print log[0].message
bar is no more.

If needed, your code can manage the depraction warnings manually using the on() and off() methods of the __show__ object:

>>> __show__.off()
>>> __show__()
False

>>> foo.blah
1

Now, you can also nest several turn-offs, so that calling off() multiple times is meaningful:

>>> __show__.stack
[False]

>>> __show__.off()
>>> __show__.stack
[False, False]

>>> __show__.on()
>>> __show__.stack
[False]
>>> __show__()
False

>>> __show__.on()
>>> __show__.stack
[]
>>> __show__()
True

You can also reset __show__ to True:

>>> __show__.off()
>>> __show__.off()
>>> __show__()
False

>>> __show__.reset()
>>> __show__()
True

Finally, you cannot call on() without having called off() before:

>>> __show__.on()
Traceback (most recent call last):
...
IndexError: pop from empty list
zope.deprecation-4.1.2/docs/_build/html/searchindex.js0000664000175000017500000001007012255115221024114 0ustar tseavertseaver00000000000000Search.setIndex({envversion:42,terms:{all:1,dist:1,scratch:1,deprecationwarn:2,follow:1,content:0,depend:1,send:2,sourc:1,string:2,catch_warn:2,fals:2,failur:1,affect:2,new_packag:2,tear:1,list:2,upload:1,"try":2,unsupport:2,pleas:1,cfg:1,old_loc:2,second:[1,2],design:1,pass:[1,2],append:2,compat:2,index:0,access:2,version:[],"new":[1,2],net:1,iteritem:2,gener:[1,2],here:2,let:[1,2],trunk:1,path:[1,2],becom:2,interpret:2,search:0,doctest:[1,2],implement:2,oddbal:2,repositori:1,fake:2,instal:1,txt:1,from:[1,2],zip:1,regist:1,two:2,coverag:1,next:[1,2],call:2,scope:2,checkout:1,more:[1,2],desir:2,particular:2,wanda:2,join:2,setup:1,work:[1,2],del:2,can:[1,2],created_modul:2,def:2,quickstart:1,sdist:1,indic:[],want:2,alwai:2,multipl:[],rather:[],anoth:1,"2dev":1,write:2,how:[1,2],"__init__":2,updat:[1,2],after:1,befor:[1,2],rmtree:2,mai:1,demonstr:2,"short":2,practic:2,bootstrap:1,caus:2,alias:2,maintain:1,environ:1,first:[1,2],egg:1,tmp_d:2,help:1,over:1,becaus:2,snippet:1,nifti:1,fix:1,main:1,suppressor:2,good:2,"return":2,now:[1,2],term:2,name:[1,2],didn:2,stmt:1,each:[1,2],pacakg:1,runtest:1,wrap:[],expect:2,our:2,happen:2,out:2,open:2,categori:2,print:2,got:1,reason:2,base:1,ask:2,org:1,doctre:1,traceback:2,filter:2,thing:2,rais:2,retain:2,lambda:2,directli:2,placehold:2,new_loc:2,done:2,wrapper:2,miss:1,script:1,mkdir:2,system:1,messag:2,attach:1,too:1,statement:1,"final":[1,2],option:1,doctest_ex:2,tool:1,setuptool:1,pname:2,pragma:2,than:1,provid:2,remov:2,depract:2,project:1,ran:1,ani:2,have:[1,2],need:2,imagin:2,self:2,note:2,also:[1,2],exampl:[1,2],btk:1,which:2,noth:1,track:1,glob:1,most:2,why:2,"_build":1,bzr:1,doc:1,request:1,doe:2,declar:2,clean:2,current:1,onli:[1,2],explicitli:[],locat:2,launchpad:1,configur:1,should:[1,2],dict:2,local:2,nosetest:1,get:[],pypi:1,autom:1,repo:1,cannot:2,requir:1,bar:2,patch:1,contain:2,summari:1,"__module__":2,set:[1,2],mkdtemp:2,see:[1,2],result:[1,2],"___________________________________":1,best:1,cool_featur:1,statu:2,py32:1,"import":2,attribut:2,parent:2,tempfil:2,succeed:1,len:2,indexerror:2,last:2,against:1,instanc:[],context:2,whole:2,tseaver:1,unittest:1,pop:2,diff:1,been:2,immedi:2,suppress:[],xxx:2,argument:[1,2],"case":2,look:[1,2],deprecatedemo4:2,defin:2,"while":2,abov:2,error:[1,2],fixtur:[1,2],layer:1,helper:2,site:1,blah:2,itself:2,lightweight:1,shutil:2,sever:2,develop:1,reinst:1,make:1,same:[1,2],binari:1,html:1,split:2,testrunn:1,complet:2,finish:1,http:1,nest:2,upon:2,someon:2,hand:2,demo2:2,demo3:2,demo1:2,temporari:2,demo4:2,stack:2,recent:2,well:1,without:2,command:1,thi:[1,2],"__show__":2,rout:1,left:1,"____________________________________":1,"__path__":2,"__dict__":2,create_modul:2,except:2,cleanup:1,exercis:1,func_glob:2,bin:1,read:1,python3:1,python2:1,like:[1,2],manual:2,nose:1,output:[1,2],page:0,clap:2,mycompon:2,often:2,some:2,mirror:1,home:1,tmp:1,total:1,leav:2,foo:2,importerror:2,although:1,"__name__":2,bazaar:1,src:2,would:1,py27:1,py26:1,manag:2,own:1,easy_instal:1,down:1,empti:2,ensur:1,old:2,subvers:1,mere:2,merg:1,log:2,support:2,splat:2,start:2,interfac:1,includ:1,submiss:1,"function":2,link:1,"true":2,congratul:1,reset:2,made:1,possibl:[1,2],displai:2,record:2,problem:2,emit:2,old_packag:2,featur:[1,2],creat:[1,2],cover:[1,2],exist:1,ini:1,file:1,ship:1,when:2,other:2,branch:1,you:[1,2],highlightfail:2,meaning:2,svn:1,sphinx:1,time:2,push:1,backward:2},objtypes:{},objnames:{},filenames:["index","hacking","api"],titles:["zope.deprecation Documentation","Hacking on zope.deprecation","zope.deprecation API"],objects:{},titleterms:{pre:[0,1,2],code:1,modul:2,move:2,share:1,indic:0,packag:2,temporarili:2,tabl:0,hack:1,your:1,virtualenv:1,tox:1,buildout:1,submit:1,"class":[0,1,2],version:1,build:1,zope:[0,1,2],document:[0,1],method:2,liter:[0,1,2],run:1,insid:2,get:1,python:1,object:2,warn:2,test:1,report:1,multipl:1,bug:1,off:2,deprec:[0,1,2],via:1,docutil:[0,1,2],properti:2,turn:2,api:2,span:[0,1,2],chang:1}})zope.deprecation-4.1.2/docs/_build/html/index.html0000664000175000017500000001572212255115221023267 0ustar tseavertseaver00000000000000 zope.deprecation Documentation — zope.deprecation 4.0 documentation zope.deprecation-4.1.2/docs/_build/html/objects.inv0000664000175000017500000000032412255115221023431 0ustar tseavertseaver00000000000000# Sphinx inventory version 2 # Project: zope.deprecation # Version: 4.0 # The remainder of this file is compressed using zlib. xOKIP(.IILJQ5T(ͅJe(+槔*xShBu@&%g*AC$r1zope.deprecation-4.1.2/docs/_build/html/genindex.html0000664000175000017500000000532612255115221023760 0ustar tseavertseaver00000000000000 Index — zope.deprecation 4.0 documentation

Index

zope.deprecation-4.1.2/docs/_build/html/.buildinfo0000664000175000017500000000034612255115221023242 0ustar tseavertseaver00000000000000# Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. config: 52d702e043adc533a8e135368302be7d tags: 645f666f9bcd5a90fca523b33c5a78b7 zope.deprecation-4.1.2/docs/_build/html/hacking.html0000664000175000017500000005255612255113001023564 0ustar tseavertseaver00000000000000 Hacking on zope.deprecation — zope.deprecation 4.0 documentation

Hacking on zope.deprecation

Getting the Code

The main repository for zope.deprecation is in the Zope Subversion repository:

http://svn.zope.org/zope.deprecation

You can get a read-only Subversion checkout from there:

$ svn checkout svn://svn.zope.org/repos/main/zope.deprecation/trunk zope.deprecation

The project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad:

https://code.launchpad.net/zope.deprecation

You can branch the trunk from there using Bazaar:

$ bzr branch lp:zope.deprecation

Running the tests in a virtualenv

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:

$ /path/to/virtualenv --no-site-packages /tmp/hack-zope.deprecation

Next, get this package registered as a “development egg” in the environment:

$ /tmp/hack-zope.deprecation/bin/python setup.py develop

Finally, run the tests using the build-in setuptools testrunner:

$ /tmp/hack-zope.deprecation/bin/python setup.py test
running test
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.155s

OK

If you have the nose package installed in the virtualenv, you can use its testrunner too:

$ /tmp/hack-zope.deprecation/bin/easy_install nose
...
$ /tmp/hack-zope.deprecation/bin/python setup.py nosetests
running nosetests
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.155s

OK

or:

$ /tmp/hack-zope.deprecation/bin/nosetests
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.155s

OK

If you have the coverage pacakge installed in the virtualenv, you can see how well the tests cover the code:

$ /tmp/hack-zope.deprecation/bin/easy_install nose coverage
...
$ /tmp/hack-zope.deprecation/bin/python setup.py nosetests \
    --with coverage --cover-package=zope.deprecation
running nosetests
....................................................
Name                           Stmts   Miss  Cover   Missing
------------------------------------------------------------
zope.deprecation                   7      0   100%
zope.deprecation.deprecation     127      0   100%
zope.deprecation.fixture           1      0   100%
------------------------------------------------------------
TOTAL                            135      0   100%
----------------------------------------------------------------------
Ran 52 tests in 0.155s

OK

Building the documentation in a virtualenv

zope.deprecation uses the nifty Sphinx documentation system for building its docs. Using the same virtualenv you set up to run the tests, you can build the docs:

$ /tmp/hack-zope.deprecation/bin/easy_install Sphinx
...
$ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
...
build succeeded.

You can also test the code snippets in the documentation:

$ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
...

Doctest summary
===============
   89 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.

Running the tests using zc.buildout

zope.deprecation ships with its own buildout.cfg file and bootstrap.py for setting up a development buildout:

$ /path/to/python2.6 bootstrap.py
...
Generated script '.../bin/buildout'
$ bin/buildout
Develop: '/home/tseaver/projects/Zope/BTK/deprecation/.'
...
Generated script '.../bin/sphinx-quickstart'.
Generated script '.../bin/sphinx-build'.

You can now run the tests:

$ bin/test --all
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
  Ran 52 tests with 0 failures and 0 errors in 0.366 seconds.
Tearing down left over layers:
  Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.

Building the documentation using zc.buildout

The zope.deprecation buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets:

$ cd docs
$ bin/sphinx-build -b doctest -d docs/_build/doctrees   docs docs/_build/doctest
...
Doctest summary
===============
  140 tests
    0 failures in tests
    0 failures in setup code
build succeeded.
Testing of doctests in the sources finished, look at the  results in .../docs/_build/doctest/output.txt.
.../bin/sphinx-build -b html -d .../docs/_build/doctrees   .../docs .../docs/_build/html
...
build succeeded.

Running Tests on Multiple Python Versions via tox

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.

zope.deprecation configures the following tox environments via its tox.ini file:

  • The py26 environment builds a virtualenv with python2.6, installs zope.deprecation, and runs the tests via python setup.py test -q.
  • The py27 environment builds a virtualenv with python2.7, installs zope.deprecation, and runs the tests via python setup.py test -q.
  • The py32 environment builds a virtualenv with python3.2, installs zope.deprecation and dependencies, and runs the tests via python setup.py test -q.
  • The pypy environment builds a virtualenv with pypy, installs zope.deprecation, and runs the tests via python setup.py test -q.
  • The coverage environment builds a virtualenv with python2.6, installs zope.deprecation, installs nose and coverage, and runs nosetests with statement coverage.
  • The docs environment builds a virtualenv with python2.6, installs zope.deprecation, 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:

$ tox -e py26
GLOB sdist-make: .../zope.interface/setup.py
py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip
py26 runtests: commands[0]
..........
----------------------------------------------------------------------
Ran 52 tests in 0.155s

OK
___________________________________ summary ____________________________________
py26: commands succeeded
congratulations :)

Running tox with no arguments runs all the configured environments, including building the docs and testing their snippets:

$ tox
GLOB sdist-make: .../zope.interface/setup.py
py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip
py26 runtests: commands[0]
...
Doctest summary
===============
  89 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 :)

Submitting a Bug Report

zope.deprecation tracks its bugs on Launchpad:

https://bugs.launchpad.net/zope.deprecation

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 you got a read-only checkout from the Subversion repository, and you have made a change you would like to share, the best route is to let Subversion help you make a patch file:

$ svn diff > zope.deprecation-cool_feature.patch

You can then upload that patch file as an attachment to a Launchpad bug report.

If you branched the code from Launchpad using Bazaar, you have another option: you can “push” your branch to Launchpad:

$ bzr push lp:~tseaver/zope.deprecation/cool_feature

After pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad “merge request” feature.

zope.deprecation-4.1.2/docs/_build/html/search.html0000664000175000017500000000621612255115221023423 0ustar tseavertseaver00000000000000 Search — zope.deprecation 4.0 documentation

Search

Please activate JavaScript to enable the search functionality.

From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

zope.deprecation-4.1.2/docs/hacking.rst0000664000175000017500000002237712455233160021237 0ustar tseavertseaver00000000000000Hacking on :mod:`zope.deprecation` ================================== Getting the Code ################ The main repository for :mod:`zope.deprecation` is in the Zope Foundation Github repository: https://github.com/zopefoundation/zope.deprecation You can get a read-only checkout from there: .. code-block:: sh $ git clone https://github.com/zopefoundation/zope.deprecation.git or fork it and get a writeable checkout of your fork: .. code-block:: sh $ git clone git@github.com/jrandom/zope.deprecation.git The project also mirrors the trunk from the Subversion repository as a Bazaar branch on Launchpad: https://code.launchpad.net/zope.deprecation You can branch the trunk from there using Bazaar: .. code-block:: sh $ bzr branch lp:zope.deprecation 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.deprecation Next, get this package registered as a "development egg" in the environment: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/python setup.py develop Running the tests ----------------- Run the tests using the build-in ``setuptools`` testrunner: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/python setup.py test running test .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK If you have the :mod:`nose` package installed in the virtualenv, you can use its testrunner too: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/easy_install nose ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests running nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK or: .. code-block:: sh $ /tmp/hack-zope.deprecation/bin/nosetests .................................................... ---------------------------------------------------------------------- Ran 52 tests in 0.155s 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.deprecation/bin/easy_install nose coverage ... $ /tmp/hack-zope.deprecation/bin/python setup.py nosetests \ --with coverage --cover-package=zope.deprecation running nosetests .................................................... Name Stmts Miss Cover Missing ------------------------------------------------------------ zope.deprecation 7 0 100% zope.deprecation.deprecation 127 0 100% zope.deprecation.fixture 1 0 100% ------------------------------------------------------------ TOTAL 135 0 100% ---------------------------------------------------------------------- Ran 52 tests in 0.155s OK Building the documentation -------------------------- :mod:`zope.deprecation` 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.deprecation/bin/easy_install Sphinx ... $ bin/sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html ... build succeeded. You can also test the code snippets in the documentation: .. code-block:: sh $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 89 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.deprecation` 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/tseaver/projects/Zope/BTK/deprecation/.' ... Generated script '.../bin/sphinx-quickstart'. Generated script '.../bin/sphinx-build'. Running the tests using ----------------------- 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 52 tests with 0 failures and 0 errors in 0.366 seconds. Tearing down left over layers: Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds. Building the documentation -------------------------- The :mod:`zope.deprecation` buildout installs the Sphinx scripts required to build the documentation, including testing its code snippets: .. code-block:: sh $ cd docs $ bin/sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest ... Doctest summary =============== 140 tests 0 failures in tests 0 failures in setup code build succeeded. Testing of doctests in the sources finished, look at the results in .../docs/_build/doctest/output.txt. .../bin/sphinx-build -b html -d .../docs/_build/doctrees .../docs .../docs/_build/html ... build succeeded. 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.deprecation` configures the following :mod:`tox` environments via its ``tox.ini`` file: - The ``py26``, ``py27``, ``py33``, ``py34``, and ``pypy`` environments builds a ``virtualenv`` with ``pypy``, installs :mod:`zope.deprecation` and dependencies, and runs the tests via ``python setup.py test -q``. - The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``, installs :mod:`zope.deprecation`, installs :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement coverage. - The ``docs`` environment builds a virtualenv with ``python2.6``, installs :mod:`zope.deprecation`, 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.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] .......... ---------------------------------------------------------------------- Ran 52 tests in 0.155s 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.interface/setup.py py26 sdist-reinst: .../zope.interface/.tox/dist/zope.interface-4.0.2dev.zip py26 runtests: commands[0] ... Doctest summary =============== 89 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.deprecation` ####################################### Submitting a Bug Report ----------------------- :mod:`zope.deprecation` tracks its bugs on Github: https://github.com/zopefoundation/zope.deprecation/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.deprecation/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:~tseaver/zope.deprecation/cool_feature After pushing your branch, you can link it to a bug report on Launchpad, or request that the maintainers merge your branch using the Launchpad "merge request" feature. zope.deprecation-4.1.2/MANIFEST.in0000664000175000017500000000024212074062560017673 0ustar tseavertseaver00000000000000include *.rst include *.txt recursive-include docs * recursive-include src * global-exclude *.dll global-exclude *.pyc global-exclude *.pyo global-exclude *.so