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.
This commit is contained in:
Stewart Douglas
2015-10-01 13:34:47 -04:00
parent 8ba15a6f72
commit e33fa988f2
-12
View File
@@ -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)