From 28caf2e06bc7e10f429e3746a864434fc6e6b283 Mon Sep 17 00:00:00 2001
From: Maeva Pourpoint <maeva@passcal.nmt.edu>
Date: Thu, 13 Aug 2020 15:06:18 -0600
Subject: [PATCH] Use open() instead of io.open()

---
 coverplot/coverplot.py | 21 ++++++++++-----------
 setup.py               |  5 ++---
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/coverplot/coverplot.py b/coverplot/coverplot.py
index 0353095..0e69173 100644
--- a/coverplot/coverplot.py
+++ b/coverplot/coverplot.py
@@ -16,7 +16,6 @@ Directory cleanup (remove unused files introduced by Cookiecutter).
 Packaged with conda.
 '''
 
-import io
 import itertools
 import matplotlib
 import matplotlib.dates as mdates
@@ -799,7 +798,7 @@ class Sync(object):
     # READERS
     def read_file(self, filename):
         # print("Using", filename)
-        infh = io.open(filename, 'r')
+        infh = open(filename, 'r')
         self.populate(infh)
         infh.close()
 
@@ -915,7 +914,7 @@ class Sync(object):
             outfh.write('|'.join(line) + '\n')
 
     def write_file(self, filename):
-        outfh = io.open(filename, 'w')
+        outfh = open(filename, 'w')
         self.write(outfh)
         outfh.close()
 
@@ -930,7 +929,7 @@ class Sync(object):
         end = max_lines
         currentfile = filename + '.%d' % filenum
         fileswritten = [currentfile]
-        outfh = io.open(currentfile, 'w')
+        outfh = open(currentfile, 'w')
         while True:
             for line in self.slist[start:end]:
                 outfh.write('|'.join(line) + '\n')
@@ -949,7 +948,7 @@ class Sync(object):
             filenum += 1
             currentfile = filename + '.%d' % filenum
             fileswritten.append(currentfile)
-            outfh = io.open(currentfile, 'w')
+            outfh = open(currentfile, 'w')
         outfh.close()
         return fileswritten
 
@@ -1500,7 +1499,7 @@ def cbl():
     a = [x for x in sys.argv]
     s2 = Sync()
     s2.read_file(a[2])
-    fh = io.open(a[1], 'r')
+    fh = open(a[1], 'r')
     print("comparing")
     synclines = (Sync(val) for val in fh)
     for s1 in synclines:
@@ -1538,7 +1537,7 @@ def has_dups():
 
 def dl_times2sync():
     s = Sync()
-    dl_file = io.open(sys.argv[1])
+    dl_file = open(sys.argv[1])
     s.populate_dlt(dl_file, 'XA')
     print(s)
 
@@ -1547,12 +1546,12 @@ def dl_has_ms():
     net = 'ZW'
     badlist = list()
     dls = Sync()
-    dl_file = io.open(sys.argv[1])
+    dl_file = open(sys.argv[1])
     dls.populate_dlt(dl_file, net)
     # dls.sort_mash_keep_dups()
     print(dls)
     mss = Sync()
-    ms_file = io.open(sys.argv[2])
+    ms_file = open(sys.argv[2])
     mss.populate(ms_file)
     mss.sort_mash()
     print("dl has ms", dls.has_dlt(mss, badlist=badlist))
@@ -1860,7 +1859,7 @@ def split_and_write(filename, fh, max_size=3 * 50 * 1024 ** 2):
     filenum = 0
     currentfile = filename + '.%d' % filenum
     fileswritten = [currentfile]
-    outfh = io.open(currentfile, 'w')
+    outfh = open(currentfile, 'w')
     while True:
         outfh.writelines(fh.readlines(max_size))
         line = fh.readline()
@@ -1877,7 +1876,7 @@ def split_and_write(filename, fh, max_size=3 * 50 * 1024 ** 2):
         filenum += 1
         currentfile = filename + '.%d' % filenum
         fileswritten.append(currentfile)
-        outfh = io.open(currentfile, 'w')
+        outfh = open(currentfile, 'w')
         outfh.write(line)
     outfh.close()
     return fileswritten
diff --git a/setup.py b/setup.py
index 63b4ca8..c4f3679 100644
--- a/setup.py
+++ b/setup.py
@@ -3,14 +3,13 @@
 
 """The setup script."""
 
-import io
 
 from setuptools import setup, find_packages
 
-with io.open('README.rst', 'rt') as readme_file:
+with open('README.rst', 'rt') as readme_file:
     readme = readme_file.read()
 
-with io.open('HISTORY.rst', 'rt') as history_file:
+with open('HISTORY.rst', 'rt') as history_file:
     history = history_file.read()
 
 
-- 
GitLab