From b90ff0794054d60202978d82838c24b146c2a2b5 Mon Sep 17 00:00:00 2001 From: Robert Smallshire Date: Tue, 5 May 2015 13:33:48 +0200 Subject: [PATCH] Relocate four_bytes() from portability to util. --- segpy/ibm_float.py | 2 +- segpy/portability.py | 12 ------------ segpy/util.py | 5 +++++ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/segpy/ibm_float.py b/segpy/ibm_float.py index 4fe07ed..03094bf 100644 --- a/segpy/ibm_float.py +++ b/segpy/ibm_float.py @@ -1,7 +1,7 @@ from math import frexp, isnan, isinf, ceil, floor, trunc from numbers import Real -from segpy.portability import four_bytes +from segpy.util import four_bytes diff --git a/segpy/portability.py b/segpy/portability.py index 243fb86..c6f131c 100644 --- a/segpy/portability.py +++ b/segpy/portability.py @@ -4,18 +4,6 @@ import sys EMPTY_BYTE_STRING = b'' if sys.version_info >= (3, 0) else '' -if sys.version_info >= (3, 0): - def four_bytes(byte_str): - a, b, c, d = byte_str[:4] - return a, b, c, d -else: - def four_bytes(byte_str): - a = ord(byte_str[0]) - b = ord(byte_str[1]) - c = ord(byte_str[2]) - d = ord(byte_str[3]) - return a, b, c, d - if sys.version_info >= (3, 0): unicode = str else: diff --git a/segpy/util.py b/segpy/util.py index 52163bf..e5f774d 100644 --- a/segpy/util.py +++ b/segpy/util.py @@ -319,3 +319,8 @@ def super_class(cls): def flatten(sequence_of_sequences): return chain.from_iterable(sequence_of_sequences) + + +def four_bytes(byte_str): + a, b, c, d = byte_str[:4] + return a, b, c, d \ No newline at end of file