From f98a9ff33a8bd80a2d4cd4b776ad67f193bdbff6 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint <maeva@passcal.nmt.edu> Date: Thu, 2 Apr 2020 20:08:22 -0600 Subject: [PATCH] Updated and tested data2passcal to work with Python 2 and 3 --- HISTORY.rst | 7 +++++++ README.rst | 1 + data2passcal/__init__.py | 2 +- data2passcal/data2passcal.py | 17 +++++++++-------- setup.cfg | 3 +-- setup.py | 2 +- tests/test_data2passcal.py | 3 +-- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index a94f390..db916b9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,3 +10,10 @@ History 2018.228 (2018-08-16) ------------------ * Updated to work with python 2 and 3 + +2020.093 (2020-04-02) +------------------ +* Updated to work with python 2 and 3. +* Resources used: Python-Future project and Futurize tool. +* Changes tested using unittest module on individual test methods(tests.test_data2passcal) +* Changes tested against real seismic dataset (AB.2002 - 2012) diff --git a/README.rst b/README.rst index 1d6dee0..efc03cf 100644 --- a/README.rst +++ b/README.rst @@ -4,6 +4,7 @@ data2passcal Prepare SEED data for shipment to PASSCAL. +Only accept day-long MSEED files. * Free software: GNU General Public License v3 (GPLv3) diff --git a/data2passcal/__init__.py b/data2passcal/__init__.py index 1636f68..afe21e9 100644 --- a/data2passcal/__init__.py +++ b/data2passcal/__init__.py @@ -4,4 +4,4 @@ __author__ = """IRIS PASSCAL""" __email__ = 'software-support@passcal.nmt.edu' -__version__ = '2018.228' +__version__ = '2020.093' diff --git a/data2passcal/data2passcal.py b/data2passcal/data2passcal.py index 7632678..a4afaaf 100644 --- a/data2passcal/data2passcal.py +++ b/data2passcal/data2passcal.py @@ -5,8 +5,9 @@ data2passcal Ship miniseed data to passcal via ftp for qc before archival at DMC DMS Lloyd Carothers IRIS/PASSCAL ''' -from __future__ import print_function -VERSION = '2018.228' +from __future__ import print_function, division +from builtins import * +VERSION = '2020.093' import ftplib import sys, os, signal, struct, pickle, logging @@ -313,11 +314,11 @@ def send2passcal(mslist, sentlist=None): update.bytes_sent += len(data) print('\r' + str(PB) + ' %s /sec ' % ( format_size(size_sent / (time() - starttime )) ), end=' ') ''' - print '%s %0.2f%%. %0.10d / %0.10d.' % ( current_file.center(20), - (update.bytes_sent / update.file_size)*100, - update.bytes_sent, - file_size, - ) , + print '%s %0.2f%%. %0.10d / %0.10d.' % ( current_file.center(20), + (update.bytes_sent / update.file_size)*100, + update.bytes_sent, + file_size, + ) , ''' ETA_sec = ((time() - starttime) / size_sent ) * (size_to_send - size_sent) print('ETA %s %s %s' % ( str(datetime.timedelta(seconds=(ETA_sec))), current_file.center(20), ' '*20 ), end=' ') @@ -388,7 +389,7 @@ def send2passcal(mslist, sentlist=None): ######################################################## # From progressbar 3rd party class will eventually dump not awesome -class ProgressBar: +class ProgressBar(object): def __init__(self, duration): self.duration = duration self.prog_bar = '[]' diff --git a/setup.cfg b/setup.cfg index bd5e695..ac124ca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2018.228 +current_version = 2020.093 commit = True tag = True @@ -19,4 +19,3 @@ exclude = docs [aliases] # Define setup.py command aliases here - diff --git a/setup.py b/setup.py index 3c7b133..6afb3d2 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,6 @@ setup( packages=find_packages(include=['data2passcal']), test_suite='tests', url='https://git.passcal.nmt.edu/passoft/data2passcal', - version='2018.228', + version='2020.093', zip_safe=False, ) diff --git a/tests/test_data2passcal.py b/tests/test_data2passcal.py index e102d31..a82fa89 100644 --- a/tests/test_data2passcal.py +++ b/tests/test_data2passcal.py @@ -22,7 +22,6 @@ class TestData2passcal(unittest.TestCase): def test_import(self): if 'data2passcal' in sys.modules: - self.assert_(True, "data2passcal loaded") + self.assertTrue(True, "data2passcal loaded") else: self.fail() - -- GitLab