From aef6313b049b08f08dd48eb6173fcb1eb63f8bcf Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Wed, 12 Sep 2012 08:34:45 +0400 Subject: Fix compatibility with Python 2.5. Emulate next(b, None) through for loop with single round. There wasn't print_function, while it really doesn't needed. --- jsonpointer.py | 3 ++- tests.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jsonpointer.py b/jsonpointer.py index 12f3744..06b9869 100644 --- a/jsonpointer.py +++ b/jsonpointer.py @@ -217,5 +217,6 @@ class JsonPointer(object): def pairwise(iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(iterable) - next(b, None) + for _ in b: + break return izip(a, b) diff --git a/tests.py b/tests.py index df500cc..57a4818 100755 --- a/tests.py +++ b/tests.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import print_function import doctest import unittest import sys @@ -73,7 +72,8 @@ if coverage is not None: coverage.erase() if coverage is None: - print(""" - No coverage reporting done (Python module "coverage" is missing) - Please install the python-coverage package to get coverage reporting. - """, file=sys.stderr) + sys.stderr.write(""" +No coverage reporting done (Python module "coverage" is missing) +Please install the python-coverage package to get coverage reporting. +""") + sys.stderr.flush() -- cgit v1.2.1