From 132b3a698f3669ae4f740122788f3bfe8fc6cc8a Mon Sep 17 00:00:00 2001
From: Yash Shah <yashshah0127@gmail.com>
Date: Fri, 20 Jan 2017 19:28:01 -0800
Subject: [PATCH] Add more absolute imports, change dict keys function

---
 bin/__init__.py                      | 3 ++-
 geomagio/iaga2002/IAGA2002Factory.py | 2 +-
 geomagio/pcdcp/PCDCPFactory.py       | 2 +-
 test/TimeseriesUtility_test.py       | 4 +++-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/__init__.py b/bin/__init__.py
index fa2c72cea..a01f64b9e 100644
--- a/bin/__init__.py
+++ b/bin/__init__.py
@@ -1,7 +1,8 @@
 """Module for bin
 """
+from __future__ import absolute_import
 
-import geomag
+from . import geomag
 
 __all__ = [
     'geomag'
diff --git a/geomagio/iaga2002/IAGA2002Factory.py b/geomagio/iaga2002/IAGA2002Factory.py
index b7f5f601e..eb48e32a5 100644
--- a/geomagio/iaga2002/IAGA2002Factory.py
+++ b/geomagio/iaga2002/IAGA2002Factory.py
@@ -58,7 +58,7 @@ class IAGA2002Factory(TimeseriesFactory):
         endtime = obspy.core.UTCDateTime(parser.times[-1])
         data = parser.data
         stream = obspy.core.Stream()
-        length = len(data[data.keys()[0]])
+        length = len(data[list(data)[0]])
         if starttime != endtime:
             rate = (length - 1) / (endtime - starttime)
         else:
diff --git a/geomagio/pcdcp/PCDCPFactory.py b/geomagio/pcdcp/PCDCPFactory.py
index ad70d01ed..fb3d9ea8c 100644
--- a/geomagio/pcdcp/PCDCPFactory.py
+++ b/geomagio/pcdcp/PCDCPFactory.py
@@ -69,7 +69,7 @@ class PCDCPFactory(TimeseriesFactory):
                         minute=endMinute)
 
         data = parser.data
-        length = len(data[data.keys()[0]])
+        length = len(data[list(data)[0]])
         rate = (length - 1) / (endtime - starttime)
         stream = obspy.core.Stream()
 
diff --git a/test/TimeseriesUtility_test.py b/test/TimeseriesUtility_test.py
index a64c92ef2..ea1adc9e4 100644
--- a/test/TimeseriesUtility_test.py
+++ b/test/TimeseriesUtility_test.py
@@ -1,6 +1,8 @@
 #! /usr/bin/env python
+from __future__ import absolute_import
+
 from nose.tools import assert_equals
-from StreamConverter_test import __create_trace
+from .StreamConverter_test import __create_trace
 import numpy
 from geomagio import TimeseriesUtility
 from obspy.core import Stream, UTCDateTime
-- 
GitLab