| Thomas Waldmann | a2cf1d3 | 2013-05-18 13:08:53 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | """ |
| 3 | jinja2._compat |
| 4 | ~~~~~~~~~~~~~~ |
| 5 | |
| Thomas Waldmann | 05ace8b | 2013-05-18 13:14:14 +0200 | [diff] [blame] | 6 | Some py2/py3 compatibility support that is not yet available in |
| Armin Ronacher | 4a41dd6 | 2013-05-19 13:47:33 +0100 | [diff] [blame^] | 7 | "six" 1.3.0. Generally all uses of six should go through this module |
| 8 | so that we have one central place to remove stuff from when we |
| 9 | eventually drop 2.x. |
| Thomas Waldmann | a2cf1d3 | 2013-05-18 13:08:53 +0200 | [diff] [blame] | 10 | |
| 11 | :copyright: Copyright 2013 by the Jinja team, see AUTHORS. |
| 12 | :license: BSD, see LICENSE for details. |
| 13 | """ |
| Armin Ronacher | c87d4cf | 2013-05-19 13:46:22 +0100 | [diff] [blame] | 14 | import six |
| Thomas Waldmann | a2cf1d3 | 2013-05-18 13:08:53 +0200 | [diff] [blame] | 15 | |
| 16 | # https://bitbucket.org/gutworth/six/issue/25/add-unichr |
| 17 | try: |
| 18 | unichr = unichr # py2 |
| 19 | except NameError: |
| 20 | unichr = chr # py3 |
| Armin Ronacher | f6b4b04 | 2013-05-18 12:23:30 +0100 | [diff] [blame] | 21 | |
| Armin Ronacher | c87d4cf | 2013-05-19 13:46:22 +0100 | [diff] [blame] | 22 | range_type = six.moves.xrange |
| 23 | next = six.advance_iterator |
| 24 | imap = six.moves.map |