From 930f32f6a16253cdfbd8d32c81135e68e259e7d0 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 14 Jul 2016 10:55:11 -0400 Subject: [PATCH] ENH: Make INT_DTYPES_BY_SIZE_BYTES ordered. --- zipline/utils/numpy_utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/zipline/utils/numpy_utils.py b/zipline/utils/numpy_utils.py index 7a6326cc..26d5ab15 100644 --- a/zipline/utils/numpy_utils.py +++ b/zipline/utils/numpy_utils.py @@ -1,6 +1,7 @@ """ Utilities for working with numpy arrays. """ +from collections import OrderedDict from datetime import datetime from warnings import ( catch_warnings, @@ -60,12 +61,12 @@ _FILLVALUE_DEFAULTS = { object_dtype: None, } -INT_DTYPES_BY_SIZE_BYTES = { - 1: dtype('int8'), - 2: dtype('int16'), - 4: dtype('int32'), - 8: dtype('int64'), -} +INT_DTYPES_BY_SIZE_BYTES = OrderedDict([ + (1, dtype('int8')), + (2, dtype('int16')), + (4, dtype('int32')), + (8, dtype('int64')), +]) def int_dtype_with_size_in_bytes(size):