diff --git a/eoxmagmod/eoxmagmod/magnetic_model/field_lines.py b/eoxmagmod/eoxmagmod/magnetic_model/field_lines.py index 2902a8f..73ca11b 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/field_lines.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/field_lines.py @@ -26,12 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -try: - # Python 2 - range as an iterator - from buildins import xrange as range -except ImportError: - pass - from numpy import asarray, copy from .._pymm import GEOCENTRIC_CARTESIAN, GEOCENTRIC_SPHERICAL, convert from ..util import vnorm, vrotate diff --git a/eoxmagmod/eoxmagmod/magnetic_model/loader_emm.py b/eoxmagmod/eoxmagmod/magnetic_model/loader_emm.py index ca993ef..990d6da 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/loader_emm.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/loader_emm.py @@ -26,7 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -from io import open from .model import SphericalHarmomicGeomagneticModel from .coefficients import ( SparseSHCoefficientsTimeDependentDecimalYear, diff --git a/eoxmagmod/eoxmagmod/magnetic_model/loader_igrf.py b/eoxmagmod/eoxmagmod/magnetic_model/loader_igrf.py index 130c594..c9a6d57 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/loader_igrf.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/loader_igrf.py @@ -26,7 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -from io import open from .model import SphericalHarmomicGeomagneticModel from .coefficients import SparseSHCoefficientsTimeDependentDecimalYear from .parser_igrf import parse_igrf_file diff --git a/eoxmagmod/eoxmagmod/magnetic_model/loader_mio.py b/eoxmagmod/eoxmagmod/magnetic_model/loader_mio.py index 9a3bfb5..941170c 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/loader_mio.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/loader_mio.py @@ -26,7 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -from io import open from numpy import arange from .model_mio import ( DipoleMIOPrimaryGeomagneticModel, DipoleMIOGeomagneticModel, diff --git a/eoxmagmod/eoxmagmod/magnetic_model/loader_wmm.py b/eoxmagmod/eoxmagmod/magnetic_model/loader_wmm.py index 860f70b..149a4e1 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/loader_wmm.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/loader_wmm.py @@ -26,7 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -from io import open from .model import SphericalHarmomicGeomagneticModel from .coefficients import SparseSHCoefficientsTimeDependentDecimalYear from .parser_wmm import parse_wmm_file diff --git a/eoxmagmod/eoxmagmod/magnetic_model/tests/coefficients_mio.py b/eoxmagmod/eoxmagmod/magnetic_model/tests/coefficients_mio.py index 8d9677a..27ccf8d 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/tests/coefficients_mio.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/tests/coefficients_mio.py @@ -28,7 +28,6 @@ # pylint: disable=missing-docstring from unittest import TestCase, main -from io import open from numpy import inf, nan from numpy.testing import assert_allclose from eoxmagmod.time_util import decimal_year_to_mjd2000 diff --git a/eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py b/eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py index 3b2be86..d140921 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py @@ -27,7 +27,6 @@ #------------------------------------------------------------------------------- # pylint: disable=missing-docstring,no-self-use,invalid-name,too-many-public-methods -from __future__ import print_function from unittest import TestCase, main from itertools import product from numpy import nan, inf, isinf, array, empty, full, nditer, asarray diff --git a/eoxmagmod/eoxmagmod/magnetic_model/tests/util.py b/eoxmagmod/eoxmagmod/magnetic_model/tests/util.py index 7a1c10b..0458c05 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/tests/util.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/tests/util.py @@ -27,7 +27,6 @@ #------------------------------------------------------------------------------- from unittest import TestCase, main -from io import open from hashlib import md5 from eoxmagmod.magnetic_model.util import parse_file from eoxmagmod.magnetic_model.tests.data import SWARM_MIO_SHA_2_TEST_DATA diff --git a/eoxmagmod/eoxmagmod/magnetic_model/util.py b/eoxmagmod/eoxmagmod/magnetic_model/util.py index c374cb6..2a54a52 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/util.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/util.py @@ -26,8 +26,6 @@ # THE SOFTWARE. #------------------------------------------------------------------------------- -from io import open - def parse_file(parser, file_, *args, **kwargs): if isinstance(file_, str): diff --git a/eoxmagmod/eoxmagmod/py_common.h b/eoxmagmod/eoxmagmod/py_common.h index 80c6210..cd42c07 100644 --- a/eoxmagmod/eoxmagmod/py_common.h +++ b/eoxmagmod/eoxmagmod/py_common.h @@ -34,13 +34,7 @@ /* checking the Python version */ -#if PY_MAJOR_VERSION == 2 - #define IS_PYTHON_2 - #if PY_MINOR_VERSION < 6 - #error "Non-supported Python minor version!" - #endif -#elif PY_MAJOR_VERSION == 3 - #define IS_PYTHON_3 +#if PY_MAJOR_VERSION == 3 #if PY_MINOR_VERSION < 4 #error "Non-supported Python minor version!" #endif @@ -48,12 +42,6 @@ #error "Non-supported Python major version!" #endif -/* Python 2/3 compatibility */ - -#ifdef IS_PYTHON_3 -#define PyString_FromString PyUnicode_FromString -#endif - /* Python dictionary operations */ static void set_dict_item_str(PyObject *dict, const char * key, PyObject *value) @@ -74,20 +62,14 @@ static void set_dict_item_str_double(PyObject *dict, const char * key, double va static void set_dict_item_str_str(PyObject *dict, const char * key, const char *value) { - #ifdef IS_PYTHON_2 - set_dict_item_str(dict, key, PyString_FromString(value)); - #else set_dict_item_str(dict, key, PyUnicode_FromString(value)); - #endif } /* Python module initialization */ -#ifdef IS_PYTHON_3 static struct PyModuleDef module_definition = { PyModuleDef_HEAD_INIT, NULL, NULL, -1, NULL, NULL, NULL, NULL, NULL }; -#endif PyObject* init_python_module( const char *name, @@ -96,14 +78,10 @@ PyObject* init_python_module( ) { PyObject *module = NULL; -#ifdef IS_PYTHON_3 module_definition.m_name = name; module_definition.m_doc = doc; module_definition.m_methods = methods; module = PyModule_Create(&module_definition); -#else /* IS_PYTHON2 */ - module = Py_InitModule3(name, methods, doc); -#endif return module; } diff --git a/eoxmagmod/eoxmagmod/pymm.c b/eoxmagmod/eoxmagmod/pymm.c index 6d04cfe..e83f786 100644 --- a/eoxmagmod/eoxmagmod/pymm.c +++ b/eoxmagmod/eoxmagmod/pymm.c @@ -5,7 +5,7 @@ * Author: Martin Paces * *----------------------------------------------------------------------------- - * Copyright (C) 2014 EOX IT Services GmbH + * Copyright (C) 2014-2022 EOX IT Services GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -113,7 +113,7 @@ static PyObject* init_module(void) /* module metadata */ set_dict_item_str_str(dict, "__author__", "Martin Paces (martin.paces@eox.at)"); - set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2014 EOX IT Services GmbH"); + set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2014-2022 EOX IT Services GmbH"); set_dict_item_str_str(dict, "__licence__", "EOX licence (MIT style)"); set_dict_item_str_str(dict, "__version__", VERSION); @@ -121,20 +121,10 @@ static PyObject* init_module(void) return module; } -#if PY_MAJOR_VERSION == 2 - -PyMODINIT_FUNC init_pymm(void) -{ - import_array(); - init_module(); -} - -#else +/*---------------------------------------------------------------------------*/ PyObject* PyInit__pymm(void) { import_array(); return init_module(); } - -#endif diff --git a/eoxmagmod/eoxmagmod/pyqd.c b/eoxmagmod/eoxmagmod/pyqd.c index fb01494..98dbad0 100644 --- a/eoxmagmod/eoxmagmod/pyqd.c +++ b/eoxmagmod/eoxmagmod/pyqd.c @@ -5,7 +5,7 @@ * Author: Martin Paces * *----------------------------------------------------------------------------- - * Copyright (C) 2015 EOX IT Services GmbH + * Copyright (C) 2015-2022 EOX IT Services GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -80,7 +80,7 @@ static PyObject* init_module(void) /* metadata */ set_dict_item_str_str(dict, "__author__", "Martin Paces (martin.paces@eox.at)"); - set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2015 EOX IT Services GmbH"); + set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2015-2022 EOX IT Services GmbH"); set_dict_item_str_str(dict, "__licence__", "EOX licence (MIT style)"); set_dict_item_str_str(dict, "__version__", VERSION); @@ -90,20 +90,8 @@ static PyObject* init_module(void) /*---------------------------------------------------------------------------*/ -#if PY_MAJOR_VERSION == 2 - -PyMODINIT_FUNC init_pyqd(void) -{ - import_array(); - init_module(); -} - -#else - PyObject* PyInit__pyqd(void) { import_array(); return init_module(); } - -#endif diff --git a/eoxmagmod/eoxmagmod/pysunpos.c b/eoxmagmod/eoxmagmod/pysunpos.c index ff1508d..f84ffde 100644 --- a/eoxmagmod/eoxmagmod/pysunpos.c +++ b/eoxmagmod/eoxmagmod/pysunpos.c @@ -5,7 +5,7 @@ * Author: Martin Paces * *----------------------------------------------------------------------------- - * Copyright (C) 2017 EOX IT Services GmbH + * Copyright (C) 2017-2022 EOX IT Services GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -70,7 +70,7 @@ static PyObject* init_module(void) /* module metadata */ set_dict_item_str_str(dict, "__author__", "Martin Paces (martin.paces@eox.at)"); - set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2017 EOX IT Services GmbH"); + set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2017-2022 EOX IT Services GmbH"); set_dict_item_str_str(dict, "__licence__", "EOX licence (MIT style)"); set_dict_item_str_str(dict, "__version__", VERSION); @@ -78,20 +78,10 @@ static PyObject* init_module(void) return module; } -#if PY_MAJOR_VERSION == 2 - -PyMODINIT_FUNC init_pysunpos(void) -{ - import_array(); - init_module(); -} - -#else +/*---------------------------------------------------------------------------*/ PyObject* PyInit__pysunpos(void) { import_array(); return init_module(); } - -#endif diff --git a/eoxmagmod/eoxmagmod/pytimeconv.c b/eoxmagmod/eoxmagmod/pytimeconv.c index 84c92bd..78003a8 100644 --- a/eoxmagmod/eoxmagmod/pytimeconv.c +++ b/eoxmagmod/eoxmagmod/pytimeconv.c @@ -5,7 +5,7 @@ * Author: Martin Paces * *----------------------------------------------------------------------------- - * Copyright (C) 2018 EOX IT Services GmbH + * Copyright (C) 2018-2022 EOX IT Services GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -73,7 +73,7 @@ static PyObject* init_module(void) /* metadata */ set_dict_item_str_str(dict, "__author__", "Martin Paces (martin.paces@eox.at)"); - set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2018 EOX IT Services GmbH"); + set_dict_item_str_str(dict, "__copyright__", "Copyright (C) 2018-2022 EOX IT Services GmbH"); set_dict_item_str_str(dict, "__licence__", "EOX licence (MIT style)"); set_dict_item_str_str(dict, "__version__", VERSION); @@ -81,20 +81,10 @@ static PyObject* init_module(void) return module; } -#if PY_MAJOR_VERSION == 2 - -PyMODINIT_FUNC init_pytimeconv(void) -{ - import_array(); - init_module(); -} - -#else +/*---------------------------------------------------------------------------*/ PyObject* PyInit__pytimeconv(void) { import_array(); return init_module(); } - -#endif diff --git a/eoxmagmod/eoxmagmod/tests/data/generate_quasi_dipole_test_data.py b/eoxmagmod/eoxmagmod/tests/data/generate_quasi_dipole_test_data.py index 70257e6..145b35d 100644 --- a/eoxmagmod/eoxmagmod/tests/data/generate_quasi_dipole_test_data.py +++ b/eoxmagmod/eoxmagmod/tests/data/generate_quasi_dipole_test_data.py @@ -28,11 +28,6 @@ #pylint: disable=missing-docstring import sys -try: - # Python 2 - from itertools import izip as zip -except ImportError: - pass from itertools import product from numpy import array, vectorize from numpy.random import uniform diff --git a/eoxmagmod/eoxmagmod/tests/data/generate_solar_position_test_data.py b/eoxmagmod/eoxmagmod/tests/data/generate_solar_position_test_data.py index 2e4cc50..7dca391 100644 --- a/eoxmagmod/eoxmagmod/tests/data/generate_solar_position_test_data.py +++ b/eoxmagmod/eoxmagmod/tests/data/generate_solar_position_test_data.py @@ -28,11 +28,6 @@ #pylint: disable=missing-docstring import sys -try: - # Python 2 - from itertools import izip as zip -except ImportError: - pass from itertools import product from numpy import array from numpy.random import uniform diff --git a/eoxmagmod/eoxmagmod/tests/data/update_quasi_dipole_test_data.py b/eoxmagmod/eoxmagmod/tests/data/update_quasi_dipole_test_data.py index d62b6fa..800dd1f 100644 --- a/eoxmagmod/eoxmagmod/tests/data/update_quasi_dipole_test_data.py +++ b/eoxmagmod/eoxmagmod/tests/data/update_quasi_dipole_test_data.py @@ -28,11 +28,6 @@ #pylint: disable=missing-docstring import sys -try: - # Python 2 - from itertools import izip as zip -except ImportError: - pass from numpy import array from eoxmagmod import mjd2000_to_decimal_year from eoxmagmod.quasi_dipole_coordinates import ( diff --git a/eoxmagmod/eoxmagmod/tests/quasi_dipole_coordinates.py b/eoxmagmod/eoxmagmod/tests/quasi_dipole_coordinates.py index a30ad20..6aefabe 100644 --- a/eoxmagmod/eoxmagmod/tests/quasi_dipole_coordinates.py +++ b/eoxmagmod/eoxmagmod/tests/quasi_dipole_coordinates.py @@ -28,7 +28,6 @@ #pylint: disable=missing-docstring from unittest import TestCase, main -from io import open from numpy import array from numpy.testing import assert_allclose from eoxmagmod.quasi_dipole_coordinates import ( diff --git a/eoxmagmod/eoxmagmod/tests/solar_position.py b/eoxmagmod/eoxmagmod/tests/solar_position.py index 0757dac..75e42bd 100644 --- a/eoxmagmod/eoxmagmod/tests/solar_position.py +++ b/eoxmagmod/eoxmagmod/tests/solar_position.py @@ -28,7 +28,6 @@ #pylint: disable=missing-docstring from unittest import TestCase, main -from io import open from numpy import array from numpy.testing import assert_allclose from eoxmagmod.quasi_dipole_coordinates import eval_subsol diff --git a/eoxmagmod/setup.py b/eoxmagmod/setup.py index 91444a3..d783a3d 100644 --- a/eoxmagmod/setup.py +++ b/eoxmagmod/setup.py @@ -59,12 +59,11 @@ 'Operating System :: POSIX', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Utilities',