Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 677932c

Browse files
committed
small simplification
1 parent 3b30c32 commit 677932c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

winpython/utils.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# -*- coding: utf-8 -*-
22
#
3+
# WinPython utilities
34
# Copyright © 2012 Pierre Raybaut
5+
# Copyright © 2014-2025+ The Winpython development team https://github.com/winpython/
46
# Licensed under the terms of the MIT License
57
# (see winpython/__init__.py for details)
68

7-
"""
8-
WinPython utilities
9-
10-
Created on Tue Aug 14 14:08:40 2012
11-
"""
12-
139
import os
1410
import sys
1511
import stat
@@ -23,7 +19,6 @@
2319
import tarfile
2420
import zipfile
2521
import atexit
26-
import io
2722
import winreg
2823

2924
# SOURCE_PATTERN defines what an acceptable source package name is
@@ -259,13 +254,13 @@ def patch_shebang_line_py(fname, to_movable=True, targetdir=""):
259254
def guess_encoding(csv_file):
260255
"""guess the encoding of the given file"""
261256
# UTF_8_BOM = "\xEF\xBB\xBF"
262-
with io.open(csv_file, "rb") as f:
257+
with open(csv_file, "rb") as f:
263258
data = f.read(5)
264259
if data.startswith(b"\xEF\xBB\xBF"): # UTF-8 with a "BOM" (normally no BOM in utf-8)
265260
return ["utf-8-sig"]
266261
else: # in Windows, guessing utf-8 doesn't work, so we have to try
267262
try:
268-
with io.open(csv_file, encoding="utf-8") as f:
263+
with open(csv_file, encoding="utf-8") as f:
269264
preview = f.read(222222)
270265
return ["utf-8"]
271266
except:

0 commit comments

Comments
 (0)