diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-03-16 20:32:41 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-03-16 20:32:41 -0400 |
commit | cc5a8bed398eed0ab9188e86262c04b6dfc086f3 (patch) | |
tree | de015e579a1047ab52f6c5f9d6b21e5d034645ab /coverage/backward.py | |
parent | d529c33c5d3434f25d06af872438f8d33153a8bb (diff) | |
download | python-coveragepy-cc5a8bed398eed0ab9188e86262c04b6dfc086f3.tar.gz |
Clean-ups
Diffstat (limited to 'coverage/backward.py')
-rw-r--r-- | coverage/backward.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/coverage/backward.py b/coverage/backward.py index af6da62..e901d84 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 |