Skip to content

Commit bae7f8a

Browse files
committed
More consistent imports
1 parent dc708a6 commit bae7f8a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/pathlib/_os.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"""
44

55
from errno import *
6+
from io import TextIOWrapper, text_encoding
67
from stat import S_ISDIR, S_ISREG, S_ISLNK, S_IMODE
7-
import io
88
import os
99
import sys
1010
try:
@@ -176,9 +176,9 @@ def magic_open(path, mode='r', buffering=-1, encoding=None, errors=None,
176176
if text:
177177
# Call io.text_encoding() here to ensure any warning is raised at an
178178
# appropriate stack level.
179-
encoding = io.text_encoding(encoding)
179+
encoding = text_encoding(encoding)
180180
try:
181-
return io.open(path, mode, buffering, encoding, errors, newline)
181+
return open(path, mode, buffering, encoding, errors, newline)
182182
except TypeError:
183183
pass
184184
cls = type(path)
@@ -204,7 +204,7 @@ def magic_open(path, mode='r', buffering=-1, encoding=None, errors=None,
204204
else:
205205
stream = attr(path, buffering)
206206
if text:
207-
stream = io.TextIOWrapper(stream, encoding, errors, newline)
207+
stream = TextIOWrapper(stream, encoding, errors, newline)
208208
return stream
209209

210210
raise TypeError(f"{cls.__name__} can't be opened with mode {mode!r}")

0 commit comments

Comments
 (0)