summaryrefslogtreecommitdiff
path: root/coverage/backward.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/backward.py')
-rw-r--r--coverage/backward.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/coverage/backward.py b/coverage/backward.py
index 15f4e88a..26d8d0e5 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -5,72 +5,6 @@
import sys
-# A function to iterate listlessly over a dict's items, and one to get the
-# items as a list.
-try:
- {}.iteritems
-except AttributeError:
- # Python 3
- def iitems(d):
- """Produce the items from dict `d`."""
- return d.items()
-
- def litems(d):
- """Return a list of items from dict `d`."""
- return list(d.items())
-else:
- # Python 2
- def iitems(d):
- """Produce the items from dict `d`."""
- return d.iteritems()
-
- def litems(d):
- """Return a list of items from dict `d`."""
- return d.items()
-
-# Getting the `next` function from an iterator is different in 2 and 3.
-try:
- iter([]).next
-except AttributeError:
- def iternext(seq):
- """Get the `next` function for iterating over `seq`."""
- return iter(seq).__next__
-else:
- def iternext(seq):
- """Get the `next` function for iterating over `seq`."""
- return iter(seq).next
-
-# Python 3.x is picky about bytes and strings, so provide methods to
-# get them right.
-def to_bytes(s):
- """Convert string `s` to bytes."""
- return s.encode('utf8')
-
-def to_string(b):
- """Convert bytes `b` to string."""
- return b.decode('utf8')
-
-def binary_bytes(byte_values):
- """Produce a byte string with the ints from `byte_values`."""
- return bytes(byte_values)
-
-def byte_to_int(byte):
- """Turn a byte indexed from a bytes object into an int."""
- return byte
-
-def bytes_to_ints(bytes_value):
- """Turn a bytes object into a sequence of ints."""
- # In Python 3, iterating bytes gives ints.
- return bytes_value
-
-try:
- # In Python 2.x, the builtins were in __builtin__
- BUILTINS = sys.modules['__builtin__']
-except KeyError:
- # In Python 3.x, they're in builtins
- BUILTINS = sys.modules['builtins']
-
-
# imp was deprecated in Python 3.3
try:
import importlib