[Python-checkins] r67621 - in sandbox/trunk/pep362: README examples.py setup.py tests/test_pep362.py
brett.cannon
python-checkins at python.org
Sun Dec 7 00:56:11 CET 2008
Author: brett.cannon
Date: Sun Dec 7 00:56:10 2008
New Revision: 67621
Log:
Update to 0.6.1 which adds 3.0 final compatibility.
Modified:
sandbox/trunk/pep362/ (props changed)
sandbox/trunk/pep362/README
sandbox/trunk/pep362/examples.py
sandbox/trunk/pep362/setup.py
sandbox/trunk/pep362/tests/test_pep362.py
Modified: sandbox/trunk/pep362/README
==============================================================================
--- sandbox/trunk/pep362/README (original)
+++ sandbox/trunk/pep362/README Sun Dec 7 00:56:10 2008
@@ -5,16 +5,15 @@
====================
An implementation of `PEP 362`_; an object representation of the call signature
-of functions/methods.
-
-Hopefully this code will end up in Python's standard library at some point
-(aiming for Python 2.6).
+of functions/methods. The module makes it easier to introspect on the
+parameters of a function or method. See ``examples.py`` on how to use the
+module to implement a type-checking decorator for Python 3.0.
.. _PEP 362: http://www.python.org/dev/peps/pep-0362/
-Where is the documentation
-==========================
+Where is the documentation?
+===========================
`PEP 362`_ is considered the official documentation for this code.
@@ -22,18 +21,16 @@
Why package it up?
====================
-There has been some interest in the work now. I am still hoping to get the code
-into Python's standard library, but until then there is no reason for the code
-to not be used by others immediately.
+There has been some interest in the work and I am taking a long time to get
+this into Python's standard library.
What versions of Python does it work with?
==========================================
-Running the unit tests suggests that Python 2.4 and greater work with the code.
-But this is NOT a guarantee this will hold for future versions of this code!
+Python 2.5 and higher for the 2.x series is supported.
-The code, as-is, also runs on Python 3.0a1.
+Python 3.0 is also supported with the exact same code.
What is the version history?
Modified: sandbox/trunk/pep362/examples.py
==============================================================================
--- sandbox/trunk/pep362/examples.py (original)
+++ sandbox/trunk/pep362/examples.py Sun Dec 7 00:56:10 2008
@@ -11,7 +11,7 @@
>>> one_arg('a')
Traceback (most recent call last):
...
- TypeError: 'a' does not quack like a <type 'int'>
+ TypeError: 'a' does not quack like a <class 'int'>
*args
@@ -22,7 +22,7 @@
>>> var_args(*[1,'b',3])
Traceback (most recent call last):
...
- TypeError: *args contains a a value that does not quack like a <type 'int'>
+ TypeError: *args contains a a value that does not quack like a <class 'int'>
**kwargs
>>> @quack_check
@@ -32,7 +32,7 @@
>>> var_kw_args(**{'a': 'A'})
Traceback (most recent call last):
...
- TypeError: **kwargs contains a value that does not quack like a <type 'int'>
+ TypeError: **kwargs contains a value that does not quack like a <class 'int'>
Return annotations.
>>> @quack_check
@@ -43,7 +43,7 @@
>>> returned('a')
Traceback (most recent call last):
...
- TypeError: the return value 'a' does not quack like a <type 'int'>
+ TypeError: the return value 'a' does not quack like a <class 'int'>
"""
# Get the signature; only needs to be calculated once.
Modified: sandbox/trunk/pep362/setup.py
==============================================================================
--- sandbox/trunk/pep362/setup.py (original)
+++ sandbox/trunk/pep362/setup.py Sun Dec 7 00:56:10 2008
@@ -3,12 +3,18 @@
setup(
# Package metadata.
name='pep362',
- version='0.6',
+ version='0.6.1',
description='Implementation of PEP 362 (Function Signature objects)',
author='Brett Cannon',
author_email='brett at python.org',
url='http://svn.python.org/view/sandbox/trunk/pep362/',
# Files.
- py_modules=['pep362'],
+ py_modules=['pep362', 'examples'],
+ packages=['tests'],
data_files=['README'],
+ classifiers=[
+ 'Programming Language :: Python :: 2.5',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 3.0',
+ ]
)
Modified: sandbox/trunk/pep362/tests/test_pep362.py
==============================================================================
--- sandbox/trunk/pep362/tests/test_pep362.py (original)
+++ sandbox/trunk/pep362/tests/test_pep362.py Sun Dec 7 00:56:10 2008
@@ -1,12 +1,13 @@
import pep362
import unittest
-from test import test_support
from tests import pep362_fodder
try:
from tests import pep362_py2_fodder
+ from test import test_support
except SyntaxError:
from tests import pep362_py3k_fodder
+ from test import support as test_support
from sys import version_info
@@ -215,7 +216,7 @@
def fresh_method(self):
pass
sig = pep362.signature(FreshClass.fresh_method)
- self.failUnlessEqual(sig, FreshClass.fresh_method.im_func.__signature__)
+ self.failUnlessEqual(sig, FreshClass.fresh_method.__signature__)
class SignatureBindTests(unittest.TestCase):
More information about the Python-checkins
mailing list