From e33fa988f2feb2ef1f725da2cc4cf7730a0fe4db Mon Sep 17 00:00:00 2001 From: Stewart Douglas Date: Thu, 1 Oct 2015 13:34:47 -0400 Subject: [PATCH] DEP: Remove _convert_asset_str_fields _convert_asset_str_fields was added to address the fact that the unicode returned by SQLAlchemy was causing test failures, in particular test_repr and test_root_symbols failed because of the leading 'u' character in the unicode of python-2.x. Later it was pointed out that this method would behave differently in python 2 and 3, in particular the str() method would return bytes in python 2 and unicode in python 3. After investigating it was found that the _convert_asset_str_fields was no longer necessary. It is unclear why the original tests were failing. It is not due to SQLAlchemy versions, as tests pass for version >1 and <1. --- zipline/assets/assets.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/zipline/assets/assets.py b/zipline/assets/assets.py index aa984aa5..98351164 100644 --- a/zipline/assets/assets.py +++ b/zipline/assets/assets.py @@ -63,16 +63,6 @@ _asset_timestamp_fields = frozenset({ }) -def _convert_asset_str_fields(dict): - """ - Takes in a dict of Asset init args and converts from unicode to string - where applicable - """ - for key, value in dict.items(): - if key in _asset_str_fields: - dict[key] = str(value) - - def _convert_asset_timestamp_fields(dict): """ Takes in a dict of Asset init args and converts dates to pd.Timestamps @@ -228,7 +218,6 @@ class AssetFinder(object): # Convert 'data' from a RowProxy object to a dict, to allow assignment data = dict(data.items()) if data: - _convert_asset_str_fields(data) _convert_asset_timestamp_fields(data) equity = Equity(**data) @@ -251,7 +240,6 @@ class AssetFinder(object): # Convert 'data' from a RowProxy object to a dict, to allow assignment data = dict(data.items()) if data: - _convert_asset_str_fields(data) _convert_asset_timestamp_fields(data) future = Future(**data)