diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2020-02-29 19:34:34 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2020-03-03 06:50:30 -0500 |
commit | 9bc95add4ecf4af1fd3193b1317b53268453dfe2 (patch) | |
tree | 440940739cc83be7315411377be235e9510b3062 /coverage/files.py | |
parent | ee2d1f6a5405f768c81cb2daa6b0a7fe21e4b4de (diff) | |
download | python-coveragepy-git-9bc95add4ecf4af1fd3193b1317b53268453dfe2.tar.gz |
WIP: drop Python 2
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/coverage/files.py b/coverage/files.py index 5c2ff1ac..64a30763 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -13,7 +13,6 @@ import re import sys from coverage import env -from coverage.backward import unicode_class from coverage.misc import contract, CoverageException, join_regex, isolate_module @@ -105,8 +104,6 @@ if env.WINDOWS: def actual_path(path): """Get the actual path of `path`, including the correct case.""" - if env.PY2 and isinstance(path, unicode_class): - path = path.encode(sys.getfilesystemencoding()) if path in _ACTUAL_PATH_CACHE: return _ACTUAL_PATH_CACHE[path] @@ -143,19 +140,10 @@ else: return filename -if env.PY2: - @contract(returns='unicode') - def unicode_filename(filename): - """Return a Unicode version of `filename`.""" - if isinstance(filename, str): - encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() - filename = filename.decode(encoding, "replace") - return filename -else: - @contract(filename='unicode', returns='unicode') - def unicode_filename(filename): - """Return a Unicode version of `filename`.""" - return filename +@contract(filename='unicode', returns='unicode') +def unicode_filename(filename): + """Return a Unicode version of `filename`.""" + return filename @contract(returns='unicode') |