././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/0000775000175100017510000000000000000000000015461 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679308712.0 lazr.delegates-2.1.0/.pre-commit-config.yaml0000664000175100017510000000122500000000000021742 0ustar00jugmac00jugmac0000000000000000# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: check-added-large-files - id: check-ast - id: end-of-file-fixer - id: check-json - id: check-merge-conflict - id: check-xml - id: check-yaml - id: debug-statements - repo: https://github.com/get-woke/woke rev: v0.19.0 hooks: - id: woke-from-source - repo: https://github.com/asottile/pyupgrade rev: v3.3.1 hooks: - id: pyupgrade args: [--keep-percent-format, --py3-plus] ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/.woke.yaml0000664000175100017510000001206600000000000017375 0ustar00jugmac00jugmac0000000000000000 # Based on Canonical's Guidelines # https://docs.google.com/document/d/1mJUa1VJHOMWa723dmKmNjSKGW-nlBv9xktzGZZwacVo/edit#heading=h.5efudb237qdb rules: - name: whitelist terms: - whitelist - white-list - whitelisted - white-listed alternatives: - allowlist - inclusion list severity: warning note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day." - name: blacklist terms: - blacklist - black-list - blacklisted - black-listed alternatives: - denylist - blocklist - exclusion list severity: warning note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day." - name: master-slave terms: - master-slave - master/slave alternatives: - leader/follower - main/replica - primary/replica - primary/standby - primary/secondary - name: slave terms: - slave alternatives: - follower - replica - standby - name: grandfathered terms: - grandfathered alternatives: - legacy status - legacied - exempted - carried - brought forward - rolled over - name: man-hours terms: - man hours - man-hours alternatives: - person hours - engineer hours - name: sanity terms: - sanity alternatives: - confidence - quick check - coherence check - name: dummy terms: - dummy alternatives: - placeholder - sample - name: guys terms: - guys alternatives: - folks - people - you all - y'all - yinz - name: whitebox terms: - white-box - whitebox - white box alternatives: - open-box - name: blackbox terms: - black-box - blackbox - black box alternatives: - closed-box - name: blackhat terms: - blackhat - black-hat - black hat alternatives: - attacker - malicious actor - name: whitehat terms: - whitehat - white-hat - white hat alternatives: - researcher - security specialist - name: illegal characters terms: - illegal characters alternatives: - invalid characters - unsupported characters - special characters - name: native feature terms: - native feature alternatives: - core feature - built-in feature - name: native feature terms: - native feature alternatives: - core feature - built-in feature - name: chairman/foreman terms: - chairman - foreman alternatives: - chair - foreperson - name: man in the middle terms: - man in the middle - man-in-the-middle alternatives: - machine-in-the-middle - person-in-the-middle - system-in-the-middle - intermediary attack - name: middleman terms: - middleman alternatives: - middleperson - intermediary - name: manned terms: - manned alternatives: - crewed - staffed - monitored - human operated - name: mom test / girlfriend test terms: - mom test - girlfriend test alternatives: - user test - user friendly - name: crazy terms: - crazy alternatives: - baffling - unexplained - errant - name: cripples terms: - cripples alternatives: - slows down - hinders - obstructs - name: crippling terms: - crippling alternatives: - attenuating - incapacitating - name: stonith/stomith terms: - stonith - stomith alternatives: - fence failed nodes - machines - name: demilitarized zone terms: - demilitarized zone - dmz alternatives: - perimeter network - passthrough network ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1636043073.0 lazr.delegates-2.1.0/CONTRIBUTING.rst0000664000175100017510000000277200000000000020132 0ustar00jugmac00jugmac0000000000000000.. This file is part of lazr.delegates. lazr.delegates is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3 of the License. lazr.delegates is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with lazr.delegates. If not, see . ========================= Hacking on lazr.delegates ========================= These are guidelines for hacking on the lazr.delegates project. But first, please see the common hacking guidelines at: http://dev.launchpad.net/Hacking ============ Contributing ============ To run this project's tests, use `tox `_. To update the `project's documentation `_ you need to trigger a manual build on the project's dashboard on https://readthedocs.org. Getting help ------------ If you find bugs in this package, you can report them here: https://launchpad.net/lazr.delegates If you want to discuss this package, join the team and mailing list here: https://launchpad.net/~lazr-developers or send a message to: lazr-developers@lists.launchpad.net ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1636038759.0 lazr.delegates-2.1.0/COPYING.txt0000664000175100017510000001672500000000000017345 0ustar00jugmac00jugmac0000000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679308831.0 lazr.delegates-2.1.0/MANIFEST.in0000664000175100017510000000015600000000000017221 0ustar00jugmac00jugmac0000000000000000include *.py *.txt *.rst MANIFEST.in *.ini recursive-include src/lazr *.rst exclude .bzrignore include *.yaml ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679308776.0 lazr.delegates-2.1.0/NEWS.rst0000664000175100017510000000346700000000000017001 0ustar00jugmac00jugmac0000000000000000======================= NEWS for lazr.delegates ======================= 2.1.0 (2023-03-20) ================== - Officially add support for Python 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11. - Drop support for Python 2, 3.2, 3.3, and 3.4. - Test using ``zope.testrunner`` rather than ``nose``. - Bring coverage to 100%. - Switch to declarative ``setuptools`` configuration. - Add linters. - Fix the `woke` linter. 2.0.4 (2017-10-20) ================== - Adjust versioning strategy to avoid importing pkg_resources, which is slow in large environments. 2.0.3 (2015-07-08) ================== - Restore the public import of ``lazr.delegates.Passthrough`` which was inadvertently lost during the port to Python 3. - Officially add support for Python 3.5. - Drop official Python 2.6 support. 2.0.2 (2015-01-05) ================== - Always use old-style namespace package registration in ``lazr/__init__.py`` since the mere presence of this file subverts PEP 420 style namespace packages. (LP: #1407816) 2.0.1 (2014-08-21) ================== - Drop the use of `distribute` in favor of `setuptools`. (LP: #1359927) - Run the test suite with `tox`. 2.0 (2013-01-10) ================ - Port to Python 3, which requires the use of the ``@delegate_to`` class decorator instead of the ``delegates()`` function call. Officially support Python 2.6, 2.7, 3.2, and 3.3. 1.2.0 (2010-07-16) ================== - Extend Passthrough so that it takes an extra (optional) callable argument, used to adapt the context before accessing the delegated attribute. 1.1.0 (2009-08-31) ================== - Remove build dependencies on bzr and egg_info - remove sys.path hack in setup.py for __version__ 1.0.1 (2009-03-24) ================== - specify only v3 of LGPL - build/developer improvements 1.0 (2008-12-19) ================ - Initial release ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/PKG-INFO0000664000175100017510000000620300000000000016557 0ustar00jugmac00jugmac0000000000000000Metadata-Version: 2.1 Name: lazr.delegates Version: 2.1.0 Summary: Easily write objects that delegate behavior Home-page: https://launchpad.net/lazr.delegates Download-URL: https://launchpad.net/lazr.delegates/+download Maintainer: LAZR Developers Maintainer-email: lazr-developers@lists.launchpad.net License: LGPL v3 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.5 Description-Content-Type: text/x-rst Provides-Extra: docs License-File: COPYING.txt The ``lazr.delegates`` package makes it easy to write objects that delegate behavior to another object. The new object adds some property or behavior on to the other object, while still providing the underlying interface, and delegating behavior. ======================= NEWS for lazr.delegates ======================= 2.1.0 (2023-03-20) ================== - Officially add support for Python 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11. - Drop support for Python 2, 3.2, 3.3, and 3.4. - Test using ``zope.testrunner`` rather than ``nose``. - Bring coverage to 100%. - Switch to declarative ``setuptools`` configuration. - Add linters. - Fix the `woke` linter. 2.0.4 (2017-10-20) ================== - Adjust versioning strategy to avoid importing pkg_resources, which is slow in large environments. 2.0.3 (2015-07-08) ================== - Restore the public import of ``lazr.delegates.Passthrough`` which was inadvertently lost during the port to Python 3. - Officially add support for Python 3.5. - Drop official Python 2.6 support. 2.0.2 (2015-01-05) ================== - Always use old-style namespace package registration in ``lazr/__init__.py`` since the mere presence of this file subverts PEP 420 style namespace packages. (LP: #1407816) 2.0.1 (2014-08-21) ================== - Drop the use of `distribute` in favor of `setuptools`. (LP: #1359927) - Run the test suite with `tox`. 2.0 (2013-01-10) ================ - Port to Python 3, which requires the use of the ``@delegate_to`` class decorator instead of the ``delegates()`` function call. Officially support Python 2.6, 2.7, 3.2, and 3.3. 1.2.0 (2010-07-16) ================== - Extend Passthrough so that it takes an extra (optional) callable argument, used to adapt the context before accessing the delegated attribute. 1.1.0 (2009-08-31) ================== - Remove build dependencies on bzr and egg_info - remove sys.path hack in setup.py for __version__ 1.0.1 (2009-03-24) ================== - specify only v3 of LGPL - build/developer improvements 1.0 (2008-12-19) ================ - Initial release ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679295689.0 lazr.delegates-2.1.0/README.rst0000664000175100017510000000036700000000000017156 0ustar00jugmac00jugmac0000000000000000The ``lazr.delegates`` package makes it easy to write objects that delegate behavior to another object. The new object adds some property or behavior on to the other object, while still providing the underlying interface, and delegating behavior. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/setup.cfg0000664000175100017510000000243200000000000017303 0ustar00jugmac00jugmac0000000000000000[metadata] name = lazr.delegates version = 2.1.0 maintainer = LAZR Developers maintainer_email = lazr-developers@lists.launchpad.net description = Easily write objects that delegate behavior long_description = file: README.rst, NEWS.rst long_description_content_type = text/x-rst license = LGPL v3 url = https://launchpad.net/lazr.delegates download_url = https://launchpad.net/lazr.delegates/+download classifiers = Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 [options] namespace_packages = lazr packages = find: package_dir = =src include_package_data = True zip_safe = False install_requires = importlib-metadata; python_version < "3.8" setuptools zope.interface python_requires = >=3.5 [options.packages.find] where = src [options.extras_require] docs = Sphinx [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679295689.0 lazr.delegates-2.1.0/setup.py0000775000175100017510000000136200000000000017200 0ustar00jugmac00jugmac0000000000000000# Copyright 2008-2022 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . from setuptools import setup setup() ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0322337 lazr.delegates-2.1.0/src/0000775000175100017510000000000000000000000016250 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0322337 lazr.delegates-2.1.0/src/lazr/0000775000175100017510000000000000000000000017220 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/__init__.py0000664000175100017510000000162500000000000021335 0ustar00jugmac00jugmac0000000000000000# Copyright 2008-2015 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . # This is a namespace package. try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/src/lazr/delegates/0000775000175100017510000000000000000000000021155 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679295689.0 lazr.delegates-2.1.0/src/lazr/delegates/__init__.py0000664000175100017510000000211300000000000023263 0ustar00jugmac00jugmac0000000000000000# Copyright 2008-2015 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . """Decorator helpers that simplify class composition.""" __all__ = [ 'Passthrough', 'delegate_to', ] try: import importlib.metadata as importlib_metadata except ImportError: # pragma: no cover import importlib_metadata from lazr.delegates._delegates import ( Passthrough, delegate_to, ) __version__ = importlib_metadata.version("lazr.delegates") ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/_delegates.py0000664000175100017510000000656500000000000023637 0ustar00jugmac00jugmac0000000000000000# Copyright 2008-2022 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . """Decorator helpers that simplify class composition.""" __all__ = [ 'Passthrough', 'delegate_to', ] from zope.interface import classImplements def delegate_to(*interfaces, context='context'): """Make an adapter into a decorator. Use like: @implementer(IRosettaProject) @delegate_to(IProject) class RosettaProject: def __init__(self, context): self.context = context def methodFromRosettaProject(self): return self.context.methodFromIProject() If you want to use a different name than "context" then you can explicitly say so: @implementer(IRosettaProject) @delegate_to(IProject, context='project') class RosettaProject: def __init__(self, project): self.project = project def methodFromRosettaProject(self): return self.project.methodFromIProject() The adapter class will implement the interface it is decorating. The minimal decorator looks like this: @delegate_to(IProject) class RosettaProject: def __init__(self, context): self.context = context """ if len(interfaces) == 0: raise TypeError('At least one interface is required') def _decorator(cls): missing = object() for interface in interfaces: classImplements(cls, interface) for name in interface: if getattr(cls, name, missing) is missing: setattr(cls, name, Passthrough(name, context)) return cls return _decorator class Passthrough: """Call the delegated class for the decorator class. If the ``adaptation`` argument is not None, it should be a callable. It will be called with the context, and should return an object that will have the delegated attribute. The ``adaptation`` argument is expected to be used with an interface, to adapt the context. """ def __init__(self, name, contextvar, adaptation=None): self.name = name self.contextvar = contextvar self.adaptation = adaptation def __get__(self, inst, cls=None): if inst is None: return self else: context = getattr(inst, self.contextvar) if self.adaptation is not None: context = self.adaptation(context) return getattr(context, self.name) def __set__(self, inst, value): context = getattr(inst, self.contextvar) if self.adaptation is not None: context = self.adaptation(context) setattr(context, self.name, value) def __delete__(self, inst): raise NotImplementedError ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/src/lazr/delegates/docs/0000775000175100017510000000000000000000000022105 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/docs/CONTRIBUTING.rst0000664000175100017510000000005200000000000024543 0ustar00jugmac00jugmac0000000000000000.. include:: ../../../../CONTRIBUTING.rst ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/docs/NEWS.rst0000664000175100017510000000004200000000000023407 0ustar00jugmac00jugmac0000000000000000.. include:: ../../../../NEWS.rst ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/docs/__init__.py0000664000175100017510000000000000000000000024204 0ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/docs/conf.py0000664000175100017510000001642000000000000023407 0ustar00jugmac00jugmac0000000000000000# lazr.delegates documentation build configuration file, created by # sphinx-quickstart on Mon Jan 7 10:37:37 2013. # # 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. # 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 = [] # 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 = 'lazr.delegates' copyright = '2013-2021, LAZR developers' # 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. from lazr.delegates import __version__ version = __version__ # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build', 'eggs'] # 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 = 'alabaster' # 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 = [] # 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 = { '**': [ 'globaltoc.html', ] } # 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 = 'lazrdelegatesdoc' # -- 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]). # 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). # 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) # 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' ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/docs/index.rst0000664000175100017510000000750200000000000023752 0ustar00jugmac00jugmac0000000000000000============== lazr.delegates ============== The ``lazr.delegates`` package makes it easy to write objects that delegate behavior to another object. The new object adds some property or behavior on to the other object, while still providing the underlying interface, and delegating behavior. Usage ===== The ``@delegate_to`` class decorator makes a class implement zero or more interfaces by delegating the implementation to another object. In the case of a class providing an adapter, that object will be the *context*, but it can really be any object stored in an attribute. So while the interfaces use an inheritance mechanism, the classes use a composition mechanism. For example, we can define two interfaces ``IFoo0`` and ``IFoo1`` where the latter inherits from the former. The first interface defines an attribute. >>> from zope.interface import Interface, Attribute >>> class IFoo0(Interface): ... one = Attribute('attribute in IFoo0') The second (i.e. derived) interface defines a method and an attribute. >>> class IFoo1(IFoo0): ... def bar(): ... """A method in IFoo1""" ... baz = Attribute('attribute in IFoo1') We also define two classes that mirror the interfaces, and do something interesting. :: >>> class Foo0: ... one = 'one' >>> class Foo1(Foo0): ... def bar(self): ... return 'bar' ... baz = 'I am baz' Finally, to tie everything together, we can define a class that delegates the implementation of ``IFoo1`` to an attribute on the instance. By default, ``self.context`` is used as the delegate attribute. >>> from lazr.delegates import delegate_to >>> @delegate_to(IFoo1) ... class SomeClass: ... def __init__(self, context): ... self.context = context When the class doing the delegation is instantiated, an instance of the class implementing the interface is passed in. >>> delegate = Foo1() >>> s = SomeClass(delegate) Now, the ``bar()`` method comes from ``Foo1``. >>> print(s.bar()) bar The ``baz`` attribute also comes from ``Foo1``. >>> print(s.baz) I am baz The ``one`` attribute comes from ``Foo0``. >>> print(s.one) one Even though the interface of ``SomeClass`` is defined through the delegate, the interface is still provided by the instance. >>> IFoo1.providedBy(s) True Custom context -------------- The ``@delegate_to`` decorator takes an optional keyword argument to customize the attribute containing the object to delegate to. >>> @delegate_to(IFoo1, context='myfoo') ... class SomeOtherClass: ... def __init__(self, foo): ... self.myfoo = foo The attributes and methods are still delegated correctly. >>> s = SomeOtherClass(delegate) >>> print(s.bar()) bar >>> print(s.baz) I am baz Multiple interfaces =================== The ``@delegate_to`` decorator accepts more than one interface. Note however, that the context attribute must implement all of the named interfaces. >>> class IFoo2(Interface): ... another = Attribute('another attribute') Here is a class that implements the interface. It inherits from the implementation class that provides the ``IFoo0`` interface. Thus does this class implement both interfaces. >>> class Foo2(Foo0): ... another = 'I am another foo' Again, we tie it all together. >>> @delegate_to(IFoo0, IFoo2) ... class SomeOtherClass: ... def __init__(self, context): ... self.context = context Now, the instance of this class has all the expected attributes, and provides the expected interfaces. >>> s = SomeOtherClass(Foo2()) >>> print(s.another) I am another foo >>> IFoo0.providedBy(s) True >>> IFoo2.providedBy(s) True .. toctree:: self Contributing News ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0362337 lazr.delegates-2.1.0/src/lazr/delegates/tests/0000775000175100017510000000000000000000000022317 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/tests/__init__.py0000664000175100017510000000000000000000000024416 0ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/tests/test_api.py0000664000175100017510000000170600000000000024505 0ustar00jugmac00jugmac0000000000000000# Copyright 2013-2015 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . """Test the new API.""" import unittest from lazr.delegates import delegate_to class TestAPI(unittest.TestCase): """Test various corner cases in the API.""" def test_no_interfaces(self): self.assertRaises(TypeError, delegate_to) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/tests/test_docs.py0000664000175100017510000000330700000000000024663 0ustar00jugmac00jugmac0000000000000000# Copyright 2009-2021 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . """Test harness for doctests.""" __all__ = [] import atexit import doctest import os from pkg_resources import ( resource_filename, resource_exists, resource_listdir, cleanup_resources, ) DOCTEST_FLAGS = ( doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_NDIFF ) def load_tests(loader, tests, pattern): """Load the doc tests (docs/*, if any exist).""" doctest_files = [] if resource_exists("lazr.delegates", "docs"): for name in resource_listdir("lazr.delegates", "docs"): if name.endswith(".rst"): doctest_files.append( os.path.abspath( resource_filename("lazr.delegates", "docs/%s" % name) ) ) atexit.register(cleanup_resources) tests.addTest( doctest.DocFileSuite( *doctest_files, module_relative=False, optionflags=DOCTEST_FLAGS, encoding="UTF-8" ) ) return tests ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1660112979.0 lazr.delegates-2.1.0/src/lazr/delegates/tests/test_passthrough.py0000664000175100017510000000545700000000000026312 0ustar00jugmac00jugmac0000000000000000# Copyright 2013-2015 Canonical Ltd. All rights reserved. # # This file is part of lazr.delegates. # # lazr.delegates is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, version 3 of the License. # # lazr.delegates is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with lazr.delegates. If not, see . """Test the Passthrough implementation.""" import unittest from lazr.delegates import Passthrough class Base: foo = 'foo from Base' @classmethod def clsmethod(cls): return cls.__name__ class TestPassthrough(unittest.TestCase): def setUp(self): self.p = Passthrough('foo', 'mycontext') self.p2 = Passthrough('clsmethod', 'mycontext') self.base = Base() class Adapter: mycontext = self.base self.Adapter = Adapter self.adapter = Adapter() def test_get(self): self.assertEqual(self.p.__get__(self.adapter), 'foo from Base') self.assertTrue(self.p.__get__(None, self.Adapter) is self.p) self.assertEqual(self.p2.__get__(self.adapter)(), 'Base') def test_set(self): self.p.__set__(self.adapter, 'new value') self.assertEqual(self.base.foo, 'new value') def test_no_delete(self): self.assertRaises(NotImplementedError, self.p.__delete__, self.adapter) def test_adaptation(self): # Passthrough's third argument (adaptation) is optional and, when # provided, should be a zope.interface.Interface subclass (although in # practice any callable will do) to which the instance is adapted # before getting/setting the delegated attribute. class HasNoFoo: _foo = 1 no_foo = HasNoFoo() # ... but IHasFooAdapter uses HasNoFoo._foo to provide its own .foo, # so it works like an adapter for HasNoFoo into some interface that # provides a 'foo' attribute. class IHasFooAdapter: def __init__(self, inst): self.inst = inst @property def foo(self): return self.inst._foo @foo.setter def foo(self, value): self.inst._foo = value class Example: context = no_foo p = Passthrough('foo', 'context', adaptation=IHasFooAdapter) e = Example() self.assertEqual(p.__get__(e), 1) p.__set__(e, 2) self.assertEqual(p.__get__(e), 2) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1679317008.0322337 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/0000775000175100017510000000000000000000000022646 5ustar00jugmac00jugmac0000000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/PKG-INFO0000664000175100017510000000620300000000000023744 0ustar00jugmac00jugmac0000000000000000Metadata-Version: 2.1 Name: lazr.delegates Version: 2.1.0 Summary: Easily write objects that delegate behavior Home-page: https://launchpad.net/lazr.delegates Download-URL: https://launchpad.net/lazr.delegates/+download Maintainer: LAZR Developers Maintainer-email: lazr-developers@lists.launchpad.net License: LGPL v3 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.5 Description-Content-Type: text/x-rst Provides-Extra: docs License-File: COPYING.txt The ``lazr.delegates`` package makes it easy to write objects that delegate behavior to another object. The new object adds some property or behavior on to the other object, while still providing the underlying interface, and delegating behavior. ======================= NEWS for lazr.delegates ======================= 2.1.0 (2023-03-20) ================== - Officially add support for Python 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11. - Drop support for Python 2, 3.2, 3.3, and 3.4. - Test using ``zope.testrunner`` rather than ``nose``. - Bring coverage to 100%. - Switch to declarative ``setuptools`` configuration. - Add linters. - Fix the `woke` linter. 2.0.4 (2017-10-20) ================== - Adjust versioning strategy to avoid importing pkg_resources, which is slow in large environments. 2.0.3 (2015-07-08) ================== - Restore the public import of ``lazr.delegates.Passthrough`` which was inadvertently lost during the port to Python 3. - Officially add support for Python 3.5. - Drop official Python 2.6 support. 2.0.2 (2015-01-05) ================== - Always use old-style namespace package registration in ``lazr/__init__.py`` since the mere presence of this file subverts PEP 420 style namespace packages. (LP: #1407816) 2.0.1 (2014-08-21) ================== - Drop the use of `distribute` in favor of `setuptools`. (LP: #1359927) - Run the test suite with `tox`. 2.0 (2013-01-10) ================ - Port to Python 3, which requires the use of the ``@delegate_to`` class decorator instead of the ``delegates()`` function call. Officially support Python 2.6, 2.7, 3.2, and 3.3. 1.2.0 (2010-07-16) ================== - Extend Passthrough so that it takes an extra (optional) callable argument, used to adapt the context before accessing the delegated attribute. 1.1.0 (2009-08-31) ================== - Remove build dependencies on bzr and egg_info - remove sys.path hack in setup.py for __version__ 1.0.1 (2009-03-24) ================== - specify only v3 of LGPL - build/developer improvements 1.0 (2008-12-19) ================ - Initial release ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/SOURCES.txt0000664000175100017510000000151100000000000024530 0ustar00jugmac00jugmac0000000000000000.pre-commit-config.yaml .woke.yaml CONTRIBUTING.rst COPYING.txt MANIFEST.in NEWS.rst README.rst setup.cfg setup.py tox.ini src/lazr/__init__.py src/lazr.delegates.egg-info/PKG-INFO src/lazr.delegates.egg-info/SOURCES.txt src/lazr.delegates.egg-info/dependency_links.txt src/lazr.delegates.egg-info/namespace_packages.txt src/lazr.delegates.egg-info/not-zip-safe src/lazr.delegates.egg-info/requires.txt src/lazr.delegates.egg-info/top_level.txt src/lazr/delegates/__init__.py src/lazr/delegates/_delegates.py src/lazr/delegates/docs/CONTRIBUTING.rst src/lazr/delegates/docs/NEWS.rst src/lazr/delegates/docs/__init__.py src/lazr/delegates/docs/conf.py src/lazr/delegates/docs/index.rst src/lazr/delegates/tests/__init__.py src/lazr/delegates/tests/test_api.py src/lazr/delegates/tests/test_docs.py src/lazr/delegates/tests/test_passthrough.py././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/dependency_links.txt0000664000175100017510000000000100000000000026714 0ustar00jugmac00jugmac0000000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/namespace_packages.txt0000664000175100017510000000000500000000000027174 0ustar00jugmac00jugmac0000000000000000lazr ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1637591208.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/not-zip-safe0000664000175100017510000000000100000000000025074 0ustar00jugmac00jugmac0000000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/requires.txt0000664000175100017510000000012700000000000025246 0ustar00jugmac00jugmac0000000000000000setuptools zope.interface [:python_version < "3.8"] importlib-metadata [docs] Sphinx ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679317008.0 lazr.delegates-2.1.0/src/lazr.delegates.egg-info/top_level.txt0000664000175100017510000000000500000000000025373 0ustar00jugmac00jugmac0000000000000000lazr ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1679308712.0 lazr.delegates-2.1.0/tox.ini0000664000175100017510000000167500000000000017005 0ustar00jugmac00jugmac0000000000000000[tox] envlist = lint py35 py36 py37 py38 py39 py310 py311 coverage docs [testenv] deps = zope.testrunner commands = zope-testrunner --test-path src --tests-pattern ^tests {posargs} [testenv:lint] basepython = python3.8 deps = pre-commit skip_install = true commands = pre-commit run -a passenv = XDG_CACHE_HOME HOME [testenv:docs] basepython = python3 commands = sphinx-build -b html -d src/lazr/delegates/docs/_build/doctrees src/lazr/delegates/docs src/lazr/delegates/docs/_build/html deps = .[docs] [testenv:coverage] basepython = python3 deps = coverage zope.testrunner commands = coverage erase coverage run -m zope.testrunner --test-path src --tests-pattern ^tests {posargs} coverage html coverage report -m --fail-under=100 [coverage:run] source = lazr.delegates omit = */docs/conf.py [coverage:paths] source = src .tox/*/site-packages