Hello community, here is the log from the commit of package python-decorator for openSUSE:Factory checked in at 2012-05-29 10:35:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-decorator (Old) and /work/SRC/openSUSE:Factory/.python-decorator.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-decorator", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-decorator/python-decorator.changes 2012-02-16 12:26:56.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-decorator.new/python-decorator.changes 2012-05-29 10:35:26.000000000 +0200 @@ -1,0 +2,7 @@ +Wed May 23 07:56:17 UTC 2012 - [email protected] + +- update to version 3.3.3 +- minor spec improvement +- python3 package added + +------------------------------------------------------------------- New Changes file: --- /dev/null 2012-05-03 01:24:41.895590051 +0200 +++ /work/SRC/openSUSE:Factory/.python-decorator.new/python3-decorator.changes 2012-05-29 10:35:26.000000000 +0200 @@ -0,0 +1,11 @@ +------------------------------------------------------------------- +Fri May 25 08:33:12 UTC 2012 - [email protected] + +- Fix building on openSUSE 11.4 +- spec file cleanups + +------------------------------------------------------------------- +Wed May 23 07:56:47 UTC 2012 - [email protected] + +- python3-decorator package added + Old: ---- decorator-3.3.2.tar.gz New: ---- decorator-3.3.3.tar.gz python3-decorator.changes python3-decorator.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-decorator.spec ++++++ --- /var/tmp/diff_new_pack.oXhh5Q/_old 2012-05-29 10:35:27.000000000 +0200 +++ /var/tmp/diff_new_pack.oXhh5Q/_new 2012-05-29 10:35:27.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-decorator # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: python-decorator -Version: 3.3.2 +Version: 3.3.3 Release: 0 Url: http://pypi.python.org/pypi/decorator Summary: Better living through Python with decorators @@ -62,6 +62,8 @@ %files %defattr(-,root,root,-) %doc README.txt -%{python_sitelib}/* +%{python_sitelib}/decorator.py +%{python_sitelib}/decorator.pyc +%{python_sitelib}/decorator-%{version}-py%{py_ver}.egg-info %changelog ++++++ python3-decorator.spec ++++++ # # spec file for package python3-decorator # # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: python3-decorator Version: 3.3.3 Release: 0 Url: http://pypi.python.org/pypi/decorator Summary: Better living through Python with decorators License: BSD-2-Clause Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/d/decorator/decorator-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python3-devel BuildRequires: python3-distribute BuildRequires: python3-nose BuildRequires: python3-2to3 %if 0%{?suse_version} && 0%{?suse_version} <= 1140 %{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)} %endif Requires: python(abi) = %{py3_ver} %if 0%{?suse_version} && 0%{?suse_version} > 1140 BuildRequires: python3-base %endif %if %{?suse_version: %{suse_version} > 1110} %{!?suse_version:1} BuildArchitectures: noarch %endif %description As of now, writing custom decorators correctly requires some experience and it is not as easy as it could be. For instance, typical implementations of decorators involve nested functions, and we all know that flat is better than nested. Moreover, typical implementations of decorators do not preserve the signature of decorated functions, thus confusing both documentation tools and developers. The aim of the decorator module it to simplify the usage of decorators for the average programmer, and to popularize decorators usage giving examples of useful decorators, such as memoize, tracing, redirecting_stdout, locked, etc. %prep %setup -q -n decorator-%{version} sed -i 's/\r//' README.txt # Fix EOL encoding %build python3 setup.py build %install python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} %if 0%{?suse_version} > 1210 rm -r %{buildroot}%{python3_sitelib}/__pycache__/ %endif %files %defattr(-,root,root,-) %doc README.txt %{python3_sitelib}/decorator.py* %{python3_sitelib}/decorator-%{version}-py%{py3_ver}.egg-info %if 0%{?suse_version} <= 1140 %dir %{_prefix}/lib/python%{py3_ver} %endif %changelog ++++++ decorator-3.3.2.tar.gz -> decorator-3.3.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/decorator-3.3.2/PKG-INFO new/decorator-3.3.3/PKG-INFO --- old/decorator-3.3.2/PKG-INFO 2011-09-01 12:02:49.000000000 +0200 +++ new/decorator-3.3.3/PKG-INFO 2012-04-23 16:52:05.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: decorator -Version: 3.3.2 +Version: 3.3.3 Summary: Better living through Python with decorators Home-page: http://pypi.python.org/pypi/decorator Author: Michele Simionato diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/decorator-3.3.2/documentation.py new/decorator-3.3.3/documentation.py --- old/decorator-3.3.2/documentation.py 2011-04-22 14:32:31.000000000 +0200 +++ new/decorator-3.3.3/documentation.py 2011-11-09 15:21:29.000000000 +0100 @@ -784,12 +784,12 @@ LICENCE --------------------------------------------- +Copyright (c) 2005-2012, Michele Simionato +All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met:: - - Copyright (c) 2005, Michele Simionato - All rights reserved. +met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. @@ -798,18 +798,18 @@ the documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. If you use this software and you are happy with it, consider sending me a note, just to gratify my ego. On the other hand, if you use this software and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/decorator-3.3.2/documentation3.py new/decorator-3.3.3/documentation3.py --- old/decorator-3.3.2/documentation3.py 2011-09-01 12:00:23.000000000 +0200 +++ new/decorator-3.3.3/documentation3.py 2012-04-23 16:48:39.000000000 +0200 @@ -269,8 +269,6 @@ >>> argspec.kwonlyargs [] >>> argspec.kwonlydefaults - >>> sorted(argspec.annotations.items()) - [('args', 'varargs'), ('kw', 'kwargs'), ('x', 'the first argument'), ('y', 'default argument')] You can also check that the ``__annotations__`` dictionary is preserved: @@ -279,16 +277,9 @@ >>> f.__annotations__ == f.__wrapped__.__annotations__ True -The two dictionaries are different objects, though - -.. code-block:: python - - >>> id(f.__annotations__) != id(f.__wrapped__.__annotations__) - True - -since internally the decorator module creates an entirely new dictionary -(it is not simply attaching the ``__annotations__`` attribute to the new -function). +Depending on the version of the decorator module, the two dictionaries can +be the same object or not: you cannot rely on object identity, but you can +rely on the content being the same. ``decorator`` is a decorator --------------------------------------------- @@ -691,7 +682,7 @@ add an hook to make it possible to change their signature directly. That could happen in future versions of Python (see PEP 362_) and then the decorator module would become obsolete. However, at present, -even in Python 3.1 it is impossible to change the function signature +even in Python 3.2 it is impossible to change the function signature directly, therefore the ``decorator`` module is still useful. Actually, this is one of the main reasons why I keep maintaining the module and releasing new versions. @@ -790,12 +781,12 @@ LICENCE --------------------------------------------- +Copyright (c) 2005-2012, Michele Simionato +All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are -met:: - - Copyright (c) 2005, Michele Simionato - All rights reserved. +met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. @@ -804,18 +795,18 @@ the documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. If you use this software and you are happy with it, consider sending me a note, just to gratify my ego. On the other hand, if you use this software and @@ -1063,5 +1054,16 @@ {'kwonly': 2} """ +def test_kwonlyargs(): + """ + >>> @trace + ... def func(a, b, *args, y=2, z=3, **kwargs): + ... return y, z + ... + >>> func('a', 'b', 'c', 'd', 'e', y='y', z='z', cat='dog') + calling func with args ('a', 'b', 'c', 'd', 'e'), {'y': 'y', 'z': 'z', 'cat': 'dog'} + ('y', 'z') + """ + if __name__ == '__main__': import doctest; doctest.testmod() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/decorator-3.3.2/src/decorator.egg-info/PKG-INFO new/decorator-3.3.3/src/decorator.egg-info/PKG-INFO --- old/decorator-3.3.2/src/decorator.egg-info/PKG-INFO 2011-09-01 12:02:47.000000000 +0200 +++ new/decorator-3.3.3/src/decorator.egg-info/PKG-INFO 2012-04-23 16:52:03.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: decorator -Version: 3.3.2 +Version: 3.3.3 Summary: Better living through Python with decorators Home-page: http://pypi.python.org/pypi/decorator Author: Michele Simionato diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/decorator-3.3.2/src/decorator.py new/decorator-3.3.3/src/decorator.py --- old/decorator-3.3.2/src/decorator.py 2011-09-01 12:00:23.000000000 +0200 +++ new/decorator-3.3.3/src/decorator.py 2012-04-23 16:48:39.000000000 +0200 @@ -1,34 +1,38 @@ ########################## LICENCE ############################### -## -## Copyright (c) 2005-2011, Michele Simionato -## All rights reserved. -## -## Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. -## Redistributions in bytecode form must reproduce the above copyright -## notice, this list of conditions and the following disclaimer in -## the documentation and/or other materials provided with the -## distribution. - -## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -## "AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. + +# Copyright (c) 2005-2012, Michele Simionato +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: + +# Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# Redistributions in bytecode form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS 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 OR CONTRIBUTORS 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. """ Decorator module, see http://pypi.python.org/pypi/decorator for the documentation. """ -__version__ = '3.3.2' +__version__ = '3.3.3' __all__ = ["decorator", "FunctionMaker", "partial"] @@ -58,7 +62,6 @@ inspect.getargspec(f) self.kwonlyargs = [] self.kwonlydefaults = None - self.annotations = getattr(f, '__annotations__', {}) def __iter__(self): yield self.args yield self.varargs @@ -86,22 +89,28 @@ self.module = func.__module__ if inspect.isfunction(func): argspec = getfullargspec(func) + self.annotations = getattr(func, '__annotations__', {}) for a in ('args', 'varargs', 'varkw', 'defaults', 'kwonlyargs', - 'kwonlydefaults', 'annotations'): + 'kwonlydefaults'): setattr(self, a, getattr(argspec, a)) for i, arg in enumerate(self.args): setattr(self, 'arg%d' % i, arg) - self.signature = inspect.formatargspec( - formatvalue=lambda val: "", *argspec)[1:-1] - allargs = list(self.args) - if self.varargs: - allargs.append('*' + self.varargs) - if self.varkw: - allargs.append('**' + self.varkw) - try: - self.shortsignature = ', '.join(allargs) - except TypeError: # exotic signature, valid only in Python 2.X - self.shortsignature = self.signature + if sys.version < '3': # easy way + self.shortsignature = self.signature = \ + inspect.formatargspec( + formatvalue=lambda val: "", *argspec)[1:-1] + else: # Python 3 way + self.signature = self.shortsignature = ', '.join(self.args) + if self.varargs: + self.signature += ', *' + self.varargs + self.shortsignature += ', *' + self.varargs + if self.kwonlyargs: + for a in self.kwonlyargs: + self.signature += ', %s=None' % a + self.shortsignature += ', %s=%s' % (a, a) + if self.varkw: + self.signature += ', **' + self.varkw + self.shortsignature += ', **' + self.varkw self.dict = func.__dict__.copy() # func=None happens when decorating a caller if name: @@ -128,6 +137,7 @@ func.__dict__ = getattr(self, 'dict', {}) func.func_defaults = getattr(self, 'defaults', ()) func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None) + func.__annotations__ = getattr(self, 'annotations', None) callermodule = sys._getframe(3).f_globals.get('__name__', '?') func.__module__ = getattr(self, 'module', callermodule) func.__dict__.update(kw) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
