changeset 52675:b95b12cb31e2

pyupgrade: replace `io.open()` with `open()` This was rewritten by the `io_open` fixer in `pyupgrade`.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 01:27:42 -0500
parents d903647abbd3
children f066fc0bdc7a
files contrib/import-checker.py i18n/polib.py
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/import-checker.py	Mon Jan 06 01:20:01 2025 -0500
+++ b/contrib/import-checker.py	Mon Jan 06 01:27:42 2025 -0500
@@ -3,7 +3,6 @@
 
 import ast
 import collections
-import io
 import os
 import sys
 
@@ -705,7 +704,7 @@
         # Python source file encoding. But in reality we don't use anything
         # other than ASCII (mainly) and UTF-8 (in a few exceptions), so
         # simplicity is fine.
-        with io.open(f, 'r', encoding='utf-8') as src:
+        with open(f, 'r', encoding='utf-8') as src:
             for script, modname, t, line in embedded(f, modname, src):
                 yield script, modname.encode('utf8'), t, line
 
--- a/i18n/polib.py	Mon Jan 06 01:20:01 2025 -0500
+++ b/i18n/polib.py	Mon Jan 06 01:27:42 2025 -0500
@@ -466,7 +466,7 @@
         if repr_method == 'to_binary':
             fhandle = open(fpath, 'wb')
         else:
-            fhandle = io.open(fpath, 'w', encoding=self.encoding)
+            fhandle = open(fpath, 'w', encoding=self.encoding)
             if not isinstance(contents, text_type):
                 contents = contents.decode(self.encoding)
         fhandle.write(contents)
@@ -1253,10 +1253,10 @@
         enc = kwargs.get('encoding', default_encoding)
         if _is_file(pofile):
             try:
-                self.fhandle = io.open(pofile, 'rt', encoding=enc)
+                self.fhandle = open(pofile, 'rt', encoding=enc)
             except LookupError:
                 enc = default_encoding
-                self.fhandle = io.open(pofile, 'rt', encoding=enc)
+                self.fhandle = open(pofile, 'rt', encoding=enc)
         else:
             self.fhandle = pofile.splitlines()