diff options
Diffstat (limited to 'sphinx/testing/path.py')
-rw-r--r-- | sphinx/testing/path.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sphinx/testing/path.py b/sphinx/testing/path.py index 585933499..78c3cb7bc 100644 --- a/sphinx/testing/path.py +++ b/sphinx/testing/path.py @@ -9,9 +9,8 @@ import os import shutil import sys -from io import open -from six import PY2, text_type +from six import text_type if False: # For type annotation @@ -25,13 +24,6 @@ class path(text_type): """ Represents a path which behaves like a string. """ - if PY2: - def __new__(cls, s, encoding=FILESYSTEMENCODING, errors='strict'): - # type: (unicode, unicode, unicode) -> path - if isinstance(s, str): - s = s.decode(encoding, errors) - return text_type.__new__(cls, s) - return text_type.__new__(cls, s) # type: ignore @property def parent(self): @@ -161,7 +153,7 @@ class path(text_type): """ if isinstance(text, bytes): text = text.decode(encoding) - with open(self, 'w', encoding=encoding, **kwargs) as f: + with open(self, 'w', encoding=encoding, **kwargs) as f: # type: ignore f.write(text) def text(self, encoding='utf-8', **kwargs): @@ -169,8 +161,7 @@ class path(text_type): """ Returns the text in the file. """ - mode = 'rU' if PY2 else 'r' - with open(self, mode=mode, encoding=encoding, **kwargs) as f: + with open(self, mode='r', encoding=encoding, **kwargs) as f: # type: ignore return f.read() def bytes(self): |