rl
Advanced tools
+8
-0
| Changelog | ||
| ========= | ||
| 2.4 - 2012-10-05 | ||
| ---------------- | ||
| - Update to Python 3.3 Unicode C-API. | ||
| [stefan] | ||
| 2.3 - 2012-07-18 | ||
@@ -14,2 +21,3 @@ ---------------- | ||
| 2.2 - 2012-05-10 | ||
@@ -16,0 +24,0 @@ ---------------- |
+2
-2
@@ -51,5 +51,5 @@ # -*- coding: utf-8 -*- | ||
| # The full version, including alpha/beta/rc tags. | ||
| release = '2.3' | ||
| release = '2.4' | ||
| # The short X.Y version. | ||
| version = '2.3' | ||
| version = '2.4' | ||
@@ -56,0 +56,0 @@ # The language for content autogenerated by Sphinx. Refer to documentation |
+10
-1
| Metadata-Version: 1.1 | ||
| Name: rl | ||
| Version: 2.3 | ||
| Version: 2.4 | ||
| Summary: Alternative Python bindings for GNU Readline | ||
@@ -153,2 +153,9 @@ Home-page: http://pypi.python.org/pypi/rl | ||
| 2.4 - 2012-10-05 | ||
| ---------------- | ||
| - Update to Python 3.3 Unicode C-API. | ||
| [stefan] | ||
| 2.3 - 2012-07-18 | ||
@@ -164,2 +171,3 @@ ---------------- | ||
| 2.2 - 2012-05-10 | ||
@@ -536,2 +544,3 @@ ---------------- | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: GNU General Public License (GPL) | ||
@@ -538,0 +547,0 @@ Classifier: License :: OSI Approved :: Python Software Foundation License |
+10
-1
| Metadata-Version: 1.1 | ||
| Name: rl | ||
| Version: 2.3 | ||
| Version: 2.4 | ||
| Summary: Alternative Python bindings for GNU Readline | ||
@@ -153,2 +153,9 @@ Home-page: http://pypi.python.org/pypi/rl | ||
| 2.4 - 2012-10-05 | ||
| ---------------- | ||
| - Update to Python 3.3 Unicode C-API. | ||
| [stefan] | ||
| 2.3 - 2012-07-18 | ||
@@ -164,2 +171,3 @@ ---------------- | ||
| 2.2 - 2012-05-10 | ||
@@ -536,2 +544,3 @@ ---------------- | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
| Classifier: Intended Audience :: Developers | ||
| Classifier: License :: OSI Approved :: GNU General Public License (GPL) | ||
@@ -538,0 +547,0 @@ Classifier: License :: OSI Approved :: Python Software Foundation License |
+12
-15
| """Readline completion support.""" | ||
| import functools | ||
| from rl import readline | ||
@@ -460,3 +462,3 @@ from rl.utils import DEFAULT_DELIMS | ||
| """ | ||
| d = {} | ||
| cache = {} | ||
@@ -468,16 +470,15 @@ def generator_func(*args): | ||
| if state == 0: | ||
| d['matches'] = iter(func(*args)) | ||
| cache[0] = iter(func(*args)) | ||
| try: | ||
| return d['matches'].next() | ||
| return cache[0].next() | ||
| except StopIteration: | ||
| return None | ||
| # Allow to wrap callable non-functions which may not have a __name__ | ||
| generator_func.__name__ = getattr(func, '__name__', func.__class__.__name__) | ||
| generator_func.__module__ = func.__module__ | ||
| generator_func.__doc__ = func.__doc__ | ||
| generator_func.__dict__.update(func.__dict__) | ||
| return generator_func | ||
| assignments = functools.WRAPPER_ASSIGNMENTS | ||
| if not hasattr(func, '__name__'): | ||
| assignments = [x for x in assignments if x != '__name__'] | ||
| return functools.wraps(func, assignments)(generator_func) | ||
| def print_exc(func): | ||
@@ -489,3 +490,3 @@ """Decorator printing exceptions to stderr. | ||
| """ | ||
| def wrapped_func(*args, **kw): | ||
| def print_exc_func(*args, **kw): | ||
| try: | ||
@@ -497,7 +498,3 @@ return func(*args, **kw) | ||
| wrapped_func.__name__ = func.__name__ | ||
| wrapped_func.__module__ = func.__module__ | ||
| wrapped_func.__doc__ = func.__doc__ | ||
| wrapped_func.__dict__.update(func.__dict__) | ||
| return wrapped_func | ||
| return functools.wraps(func)(print_exc_func) | ||
+11
-2
@@ -36,2 +36,7 @@ # Complete email addresses | ||
| def main(): | ||
| from rl.utils import DEFAULT_DELIMS | ||
| # Configure word break characters | ||
| completer.word_break_characters = DEFAULT_DELIMS.replace('-', '') | ||
| # Configure special prefixes | ||
@@ -46,4 +51,8 @@ completer.special_prefixes = '@' | ||
| email = raw_input('email> ') | ||
| print 'You typed:', email | ||
| try: | ||
| email = raw_input('email> ') | ||
| except (EOFError, KeyboardInterrupt): | ||
| print # Newline | ||
| else: | ||
| print 'You typed:', email.strip() | ||
@@ -50,0 +59,0 @@ |
@@ -24,4 +24,8 @@ # Complete from a static list of strings | ||
| line = raw_input('string> ') | ||
| print 'You typed:', line.strip() | ||
| try: | ||
| line = raw_input('string> ') | ||
| except (EOFError, KeyboardInterrupt): | ||
| print # Newline | ||
| else: | ||
| print 'You typed:', line.strip() | ||
@@ -28,0 +32,0 @@ |
+1
-1
@@ -13,4 +13,4 @@ #include "Python.h" | ||
| /* Custom definitions */ | ||
| #include "unicode.h" | ||
| #include "iterator.h" | ||
| #include "unicode.h" | ||
@@ -17,0 +17,0 @@ /* Fake C++ bool type */ |
@@ -120,2 +120,4 @@ import unittest | ||
| __name__ = 'Complete' | ||
| def __call__(self, text): | ||
@@ -131,3 +133,18 @@ return ['foo', 'bar', 'baz'] | ||
| def test_wrap_callable_object_wo_name(self): | ||
| class Complete(object): | ||
| """Test completer""" | ||
| def __call__(self, text): | ||
| return ['foo', 'bar', 'baz'] | ||
| g = generator(Complete()) | ||
| self.assertEqual(g.__name__, 'generator_func') | ||
| self.assertEqual(g.__doc__, 'Test completer') | ||
| match = g('test', 0) | ||
| self.assertEqual(match, 'foo') | ||
| class PrintExcTests(unittest.TestCase): | ||
@@ -134,0 +151,0 @@ |
@@ -342,2 +342,20 @@ import unittest | ||
| def test_iterate_iterator(self): | ||
| history.append('fred') | ||
| history.append('wilma') | ||
| history.append('barney') | ||
| history.append('betty') | ||
| self.assertEqual([x for x in iter(iter(history))], ['fred', 'wilma', 'barney', 'betty']) | ||
| list = ['a', 'b', 'c', 'd'] | ||
| self.assertEqual([x for x in iter(iter(list))], ['a', 'b', 'c', 'd']) | ||
| def test_reversed_iterator(self): | ||
| history.append('fred') | ||
| history.append('wilma') | ||
| history.append('barney') | ||
| history.append('betty') | ||
| self.assertRaises(TypeError, reversed, iter(history)) | ||
| list = ['a', 'b', 'c', 'd'] | ||
| self.assertRaises(TypeError, reversed, iter(list)) | ||
| def test_shrinking_seq(self): | ||
@@ -418,2 +436,20 @@ # Don't crash if the history is modifed while iterating | ||
| def test_iterate_iterator(self): | ||
| history.append('fred') | ||
| history.append('wilma') | ||
| history.append('barney') | ||
| history.append('betty') | ||
| self.assertEqual([x for x in iter(reversed(history))], ['betty', 'barney', 'wilma', 'fred']) | ||
| list = ['a', 'b', 'c', 'd'] | ||
| self.assertEqual([x for x in iter(reversed(list))], ['d', 'c', 'b', 'a']) | ||
| def test_reversed_iterator(self): | ||
| history.append('fred') | ||
| history.append('wilma') | ||
| history.append('barney') | ||
| history.append('betty') | ||
| self.assertRaises(TypeError, reversed, reversed(history)) | ||
| list = ['a', 'b', 'c', 'd'] | ||
| self.assertRaises(TypeError, reversed, reversed(list)) | ||
| def test_shrinking_seq(self): | ||
@@ -420,0 +456,0 @@ # Don't crash if the history is modifed while iterating |
+7
-12
| #include "Python.h" | ||
| #include "unicode.h" | ||
| /* Unicode support */ | ||
| #if (PY_MAJOR_VERSION >= 3) | ||
@@ -14,2 +11,4 @@ | ||
| /* Unicode support */ | ||
| PyObject * | ||
@@ -41,3 +40,7 @@ PyUnicode_DECODE(const char *text) | ||
| return -1; | ||
| #if (PY_VERSION_HEX >= 0x03030000) | ||
| i = PyUnicode_GET_LENGTH(u); | ||
| #else | ||
| i = PyUnicode_GET_SIZE(u); | ||
| #endif | ||
| Py_DECREF(u); | ||
@@ -51,11 +54,3 @@ return i; | ||
| { | ||
| PyObject *u; | ||
| PyObject *b; | ||
| u = PyUnicode_FromObject(text); | ||
| if (u == NULL) | ||
| return NULL; | ||
| b = PyUnicode_AsEncodedString(u, _ENCODING, _ERRORS); | ||
| Py_DECREF(u); | ||
| return b; | ||
| return PyUnicode_AsEncodedString(text, _ENCODING, _ERRORS); | ||
| } | ||
@@ -62,0 +57,0 @@ |
+13
-7
@@ -12,3 +12,3 @@ # On Linux, install libreadline6-dev before attempting to build rl. | ||
| from setuptools.command.build_ext import build_ext | ||
| from distutils.sysconfig import get_config_vars | ||
| from distutils.sysconfig import get_config_var | ||
| from distutils.spawn import find_executable | ||
@@ -18,3 +18,3 @@ from distutils import log | ||
| version = '2.3' | ||
| version = '2.4' | ||
@@ -32,3 +32,8 @@ | ||
| # Describe the extension | ||
| sources = ['rl/readline.c', 'rl/stringarray.c', 'rl/unicode.c', 'rl/iterator.c'] | ||
| sources = [ | ||
| 'rl/readline.c', | ||
| 'rl/stringarray.c', | ||
| 'rl/unicode.c', | ||
| 'rl/iterator.c', | ||
| ] | ||
| libraries = ['readline'] | ||
@@ -72,10 +77,10 @@ Extension.__init__(self, name, sources, libraries=libraries) | ||
| def use_include_dirs(self): | ||
| cppflags, srcdir = get_config_vars('CPPFLAGS', 'srcdir') | ||
| cppflags = get_config_var('CPPFLAGS') | ||
| for match in re.finditer(r'-I\s*(\S+)', cppflags): | ||
| if match.group(1) not in ['.', 'Include', '%s/Include' % srcdir]: | ||
| if match.group(1) not in ['.', 'Include', './Include']: | ||
| self.include_dirs.append(match.group(1)) | ||
| def use_library_dirs(self): | ||
| ldflags, = get_config_vars('LDFLAGS') | ||
| ldflags = get_config_var('LDFLAGS') | ||
@@ -86,3 +91,3 @@ for match in re.finditer(r'-L\s*(\S+)', ldflags): | ||
| def suppress_warnings(self): | ||
| cflags, = get_config_vars('CFLAGS') | ||
| cflags = get_config_var('CFLAGS') | ||
| cflags = cflags.split() | ||
@@ -245,2 +250,3 @@ | ||
| 'Development Status :: 5 - Production/Stable', | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: GNU General Public License (GPL)', | ||
@@ -247,0 +253,0 @@ 'License :: OSI Approved :: Python Software Foundation License', |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
265070
0.88%2955
1.9%