From e918b4c9029a97efa10f919eb58ca194d32f368c Mon Sep 17 00:00:00 2001
From: "E. Joshua Rigler" <erigler@usgs.gov>
Date: Fri, 27 May 2022 13:04:57 -0600
Subject: [PATCH] Remove BYTESIO object creation

It turns out that none of the factories currently being used in
production expects bytes as input, and in fact, Util.read_url()
converts everthing to a string anyway, so a BYTES-oriented input
would couldn't not possibly be working. So, just remove all use
of BYTESIO, and instead use only STRINGIO.
---
 geomagio/Controller.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 18634056..aa717974 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -1,7 +1,7 @@
 """Controller class for geomag algorithms"""
 
 import argparse
-from io import BytesIO, StringIO
+from io import StringIO
 import sys
 from typing import List, Optional, Tuple, Union
 
@@ -506,15 +506,7 @@ def get_input_factory(args):
             input_factory_args["urlInterval"] = args.input_url_interval
             input_factory_args["urlTemplate"] = args.input_url
         else:
-            try:
-                input_stream = BytesIO(Util.read_url(args.input_url))
-            except TypeError as e:
-                print(str(e), file=sys.stderr)
-                print(
-                    "Warning: reading url as BytesIO failed; attempting StringIO",
-                    file=sys.stderr,
-                )
-                input_stream = StringIO(Util.read_url(args.input_url))
+            input_stream = StringIO(Util.read_url(args.input_url))
     input_type = args.input
     if input_type == "edge":
         input_factory = edge.EdgeFactory(
-- 
GitLab