From 077d39eed98851e0232e208be832e4a77dee878c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 16 Mar 2011 20:32:41 -0400 Subject: Clean-ups --- coverage/backward.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index af6da629..e901d84f 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -81,19 +81,23 @@ except AttributeError: """Open a source file the best way.""" return open(fname, "rU") -# Python 3.x is picky about bytes and strings, so provide methods to +# Python 3.x is picky about bytes and strings, so provide methods to # get them right, and make them no-ops in 2.x if sys.version_info >= (3, 0): def to_bytes(s): + """Convert string `s` to bytes.""" return s.encode('utf8') def to_string(b): + """Convert bytes `b` to a string.""" return b.decode('utf8') else: def to_bytes(s): + """Convert string `s` to bytes (no-op in 2.x).""" return s def to_string(b): + """Convert bytes `b` to a string (no-op in 2.x).""" return b -- cgit v1.2.1