Author: bugman Date: Tue Nov 11 16:13:25 2014 New Revision: 26527 URL: http://svn.gna.org/viewcvs/relax?rev=26527&view=rev Log: The lib.check_types now imports io.IOBase from the lib.compat module. This is to shift more Python 2 vs. 3 compatibility into lib.compat and out of all other modules. Modified: trunk/lib/check_types.py trunk/lib/compat.py Modified: trunk/lib/check_types.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/check_types.py?rev=26527&r1=26526&r2=26527&view=diff ============================================================================== --- trunk/lib/check_types.py (original) +++ trunk/lib/check_types.py Tue Nov 11 16:13:25 2014 @@ -23,12 +23,6 @@ """Special module for checking types.""" # Python module imports. -io_module = True -try: - from io import IOBase # Python 2.5+ import. - file = None -except ImportError: - io_module = False from numpy import complex64, complex128, float32, float64, int16, int32 try: from numpy import complex256 @@ -50,6 +44,11 @@ from numpy import int64 except ImportError: int64 = int32 # Support for 32-bit numpy versions. + + +# relax module imports. +from lib.compat import IOBase + def is_complex(num): """Check if the given number is a Python or numpy complex. @@ -86,7 +85,7 @@ """ # New style check. - if io_module: + if IOBase != None: return isinstance(obj, IOBase) # Old style check. @@ -216,5 +215,5 @@ @rtype: bool """ - # Check using the unicode type (set in the compat module for Python 3). + # Check using the unicode type (set in the lib.compat module for Python 3). return isinstance(obj, unicode) Modified: trunk/lib/compat.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/compat.py?rev=26527&r1=26526&r2=26527&view=diff ============================================================================== --- trunk/lib/compat.py (original) +++ trunk/lib/compat.py Tue Nov 11 16:13:25 2014 @@ -50,8 +50,10 @@ try: import io io_module = True + from io import IOBase except ImportError: io_module = False + IOBase = None import os import platform import sys