mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
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:
@@ -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):
|
def _convert_asset_timestamp_fields(dict):
|
||||||
"""
|
"""
|
||||||
Takes in a dict of Asset init args and converts dates to pd.Timestamps
|
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
|
# Convert 'data' from a RowProxy object to a dict, to allow assignment
|
||||||
data = dict(data.items())
|
data = dict(data.items())
|
||||||
if data:
|
if data:
|
||||||
_convert_asset_str_fields(data)
|
|
||||||
_convert_asset_timestamp_fields(data)
|
_convert_asset_timestamp_fields(data)
|
||||||
|
|
||||||
equity = Equity(**data)
|
equity = Equity(**data)
|
||||||
@@ -251,7 +240,6 @@ class AssetFinder(object):
|
|||||||
# Convert 'data' from a RowProxy object to a dict, to allow assignment
|
# Convert 'data' from a RowProxy object to a dict, to allow assignment
|
||||||
data = dict(data.items())
|
data = dict(data.items())
|
||||||
if data:
|
if data:
|
||||||
_convert_asset_str_fields(data)
|
|
||||||
_convert_asset_timestamp_fields(data)
|
_convert_asset_timestamp_fields(data)
|
||||||
|
|
||||||
future = Future(**data)
|
future = Future(**data)
|
||||||
|
|||||||
Reference in New Issue
Block a user