[Checkins] SVN: zope.fixers/trunk/ Cleanup + docs.
Lennart Regebro
regebro at gmail.com
Fri Apr 3 12:59:47 EDT 2009
Log message for revision 98847:
Cleanup + docs.
Changed:
A zope.fixers/trunk/CHANGES.txt
U zope.fixers/trunk/README.txt
A zope.fixers/trunk/ZPL.txt
U zope.fixers/trunk/setup.py
U zope.fixers/trunk/zope/fixers/fix_implements.py
D zope.fixers/trunk/zope/fixers/tests/
A zope.fixers/trunk/zope/fixers/tests.py
-=-
Added: zope.fixers/trunk/CHANGES.txt
===================================================================
--- zope.fixers/trunk/CHANGES.txt (rev 0)
+++ zope.fixers/trunk/CHANGES.txt 2009-04-03 16:59:46 UTC (rev 98847)
@@ -0,0 +1,9 @@
+CHANGES
+*******
+
+==================
+1.0.0 (unreleased)
+==================
+
+Initial release. Includes the implements fix to change implements(IFoo)
+class body call to @implementor(IFoo) class decorator.
\ No newline at end of file
Modified: zope.fixers/trunk/README.txt
===================================================================
--- zope.fixers/trunk/README.txt 2009-04-03 16:44:34 UTC (rev 98846)
+++ zope.fixers/trunk/README.txt 2009-04-03 16:59:46 UTC (rev 98847)
@@ -2,3 +2,14 @@
============
Fixers for Zope Component Architecture and the frameworks built with it.
+
+Currently, there is only one fixer, fix_implements. This fixer will change
+all uses of implements(IFoo) in a class body to the class decorator
+ at implementor(IFoo), which is the most likely Python 3 syntax for
+zope.interfaces implements statements.
+
+
+Usage
+-----
+
+TODO!
Added: zope.fixers/trunk/ZPL.txt
===================================================================
--- zope.fixers/trunk/ZPL.txt (rev 0)
+++ zope.fixers/trunk/ZPL.txt 2009-04-03 16:59:46 UTC (rev 98847)
@@ -0,0 +1,54 @@
+Zope 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.
+
Modified: zope.fixers/trunk/setup.py
===================================================================
--- zope.fixers/trunk/setup.py 2009-04-03 16:44:34 UTC (rev 98846)
+++ zope.fixers/trunk/setup.py 2009-04-03 16:59:46 UTC (rev 98847)
@@ -1,3 +1,21 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Corporation 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.
+#
+##############################################################################
+"""Setup for zope.fixers package
+
+$Id$
+"""
+
from setuptools import setup, find_packages
import os
@@ -16,7 +34,7 @@
keywords='2to3 python3 zope',
author='Lennart Regebro',
author_email='regebro at gmail.com',
- url='',
+ url='http://svn.zope.org/zope.fixers/',
license='ZPL',
packages=find_packages(exclude=['ez_setup']),
namespace_packages=['zope'],
@@ -24,7 +42,6 @@
zip_safe=True,
install_requires=[
'setuptools',
- # -*- Extra requirements: -*-
],
entry_points="""
# -*- Entry points: -*-
Modified: zope.fixers/trunk/zope/fixers/fix_implements.py
===================================================================
--- zope.fixers/trunk/zope/fixers/fix_implements.py 2009-04-03 16:44:34 UTC (rev 98846)
+++ zope.fixers/trunk/zope/fixers/fix_implements.py 2009-04-03 16:59:46 UTC (rev 98847)
@@ -1,7 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Corporation 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.
+#
+##############################################################################
"""Fixer for implements(IX) -> @implementor(IX).
+$Id$
"""
-# Author: Lennart Regebro, based on Jack Diederich's metaclass fixer
# Local imports
from lib2to3.fixer_base import BaseFix
Copied: zope.fixers/trunk/zope/fixers/tests.py (from rev 98846, zope.fixers/trunk/zope/fixers/tests/__init__.py)
===================================================================
--- zope.fixers/trunk/zope/fixers/tests.py (rev 0)
+++ zope.fixers/trunk/zope/fixers/tests.py 2009-04-03 16:59:46 UTC (rev 98847)
@@ -0,0 +1,64 @@
+import unittest
+from lib2to3.refactor import RefactoringTool
+
+example = """
+# Basic test:
+from zope.interface import Interface, implements, providedBy
+from zope.interface import providedBy, implements, Interface
+from zope.interface import providedBy, implements
+from zope.interface import implements, Interface
+from zope.interface import implements
+from zope.interface import implements as renamed
+
+class IFoo(Interface):
+ pass
+
+class Foo:
+ "An IFoo class"
+
+ implements(IFoo)
+
+class IBar(Interface):
+ pass
+
+class Bar:
+ "An IBar class"
+
+ renamed(IBar)
+
+# Test ends
+"""
+
+target = """
+# Basic test:
+from zope.interface import Interface, implementor, providedBy
+from zope.interface import providedBy, implementor, Interface
+from zope.interface import providedBy, implementor
+from zope.interface import implementor, Interface
+from zope.interface import implementor
+from zope.interface import implementor as renamed
+
+class IFoo(Interface):
+ pass
+
+ at implementor(IFoo)
+class Foo:
+ "An IFoo class"
+
+class IBar(Interface):
+ pass
+
+ at renamed(IBar)
+class Bar:
+ "An IBar class"
+
+# Test ends
+"""
+
+class FixerTest(unittest.TestCase):
+
+ def test_fixer(self):
+ tool = RefactoringTool(['zope.fixers.fix_implements'])
+ refactored = str(tool.refactor_string(example, 'zope.fixer.test'))
+ self.assertEquals(refactored, target)
+
\ No newline at end of file
Property changes on: zope.fixers/trunk/zope/fixers/tests.py
___________________________________________________________________
Added: svn:mergeinfo
+
More information about the Checkins
mailing list