28028a0544632307fe48e66a15a4b2a22c3dddda,allennlp/common/from_params.py,,construct_arg,#Any#Any#Any#Any#Any#,296
Before Change
elif annotation == str:
return popped_params
elif annotation == int:
return int(popped_params) // type: ignore
elif annotation == bool:
return bool(popped_params)
elif annotation == float:
After Change
// If the parameter type is a Python primitive, just pop it off
// using the correct casting pop_xyz operation.
elif annotation in {int, bool}:
if type(popped_params) in {int, bool}:
return annotation(popped_params)
else:
raise TypeError(f"Expected {argument_name} to be a {annotation.__name__}.")
elif annotation == str:
// Strings are special because we allow casting from Path to str.
if type(popped_params) == str or isinstance(popped_params, Path):
return str(popped_params) // type: ignore
else:
raise TypeError(f"Expected {argument_name} to be a string.")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: allenai/allennlp
Commit Name: 28028a0544632307fe48e66a15a4b2a22c3dddda
Time: 2020-02-14
Author: dirkg@allenai.org
File Name: allennlp/common/from_params.py
Class Name:
Method Name: construct_arg
Project Name: scikit-learn-contrib/DESlib
Commit Name: ec396411be11d514a44a18813278f3a41c73ac5f
Time: 2018-09-23
Author: Natlem@users.noreply.github.com
File Name: deslib/des/des_knn.py
Class Name: DESKNN
Method Name: __init__
Project Name: stellargraph/stellargraph
Commit Name: 87601dbf79396f79bbc3af59b9627b4bd1adef44
Time: 2019-09-23
Author: 52440942+geoffj-d61@users.noreply.github.com
File Name: stellargraph/layer/graphsage.py
Class Name: GraphSAGEAggregator
Method Name: build