384e8e0f8a91815568aa3d4c651c8c5e48979262,mltsp/util.py,,cast_model_params,#Any#Any#,92
Before Change
model_params[k] = dest_type(v)
// Parse string describing list correctly, eschewing `eval`
elif param_entry["type"] == list:
model_params[k] = model_params[k].replace("[", "").replace("]", "")\
.replace(" ", "")\
.split(",")
for i in range(len(model_params[k])):
After Change
// If type description is a single type and not of type str, do cast
if type(param_entry["type"]) == type and param_entry["type"] != str:
dest_type = param_entry["type"]
if isinstance(ast.literal_eval(model_params[k]), dest_type):
model_params[k] = ast.literal_eval(model_params[k])
// Type description is a list of types
elif type(param_entry["type"]) == list:
dest_types_list = param_entry["type"]
for dest_type in dest_types_list:
if dest_type != str:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: cesium-ml/cesium
Commit Name: 384e8e0f8a91815568aa3d4c651c8c5e48979262
Time: 2015-12-17
Author: a.crellinquick@gmail.com
File Name: mltsp/util.py
Class Name:
Method Name: cast_model_params
Project Name: allenai/allennlp
Commit Name: 1691cb3a61740fbbc8305d52d4e830c79302a666
Time: 2018-10-10
Author: pradeep.dasigi@gmail.com
File Name: allennlp/semparse/executors/wikitables_variable_free_executor.py
Class Name: WikiTablesVariableFreeExecutor
Method Name: filter_not_in
Project Name: allenai/allennlp
Commit Name: 1691cb3a61740fbbc8305d52d4e830c79302a666
Time: 2018-10-10
Author: pradeep.dasigi@gmail.com
File Name: allennlp/semparse/executors/wikitables_variable_free_executor.py
Class Name: WikiTablesVariableFreeExecutor
Method Name: filter_in