fd758534e21a68dfc934cf5dff3fe4183986df51,tensorflow/python/keras/utils/version_utils.py,,swap_class,#Any#Any#Any#Any#,98
Before Change
return cls
if cls in (v2_cls, v1_cls):
if use_v2:
return v2_cls
return v1_cls
// Recursively search superclasses to swap in the right Keras class.
cls.__bases__ = tuple(
swap_class(base, v2_cls, v1_cls, use_v2) for base in cls.__bases__)
After Change
// Recursively search superclasses to swap in the right Keras class.
new_bases = []
for base in cls.__bases__:
if ((use_v2 and issubclass(base, v1_cls)
// `v1_cls` often extends `v2_cls`, so it may still call `swap_class`
// even if it doesn"t need to. That being said, it may be the safest
// not to over optimize this logic for the sake of correctness,
// especially if we swap v1 & v2 classes that don"t extend each other,
// or when the inheritance order is different.
or (not use_v2 and issubclass(base, v2_cls)))):
new_base = swap_class(base, v2_cls, v1_cls, use_v2)
else:
new_base = base
new_bases.append(new_base)
cls.__bases__ = tuple(new_bases)
return cls
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: tensorflow/tensorflow
Commit Name: fd758534e21a68dfc934cf5dff3fe4183986df51
Time: 2021-01-06
Author: gardener@tensorflow.org
File Name: tensorflow/python/keras/utils/version_utils.py
Class Name:
Method Name: swap_class
Project Name: biolab/orange3
Commit Name: bef62df3913de4e7653f278c26d17701c5be5de7
Time: 2020-02-06
Author: aleksandra.turanjanin@gmail.com
File Name: Orange/widgets/utils/state_summary.py
Class Name:
Method Name: format_variables_string
Project Name: keras-team/keras
Commit Name: bf464d7ed9283988fea1f548a11a0171fd2ff364
Time: 2021-01-06
Author: gardener@tensorflow.org
File Name: keras/utils/version_utils.py
Class Name:
Method Name: swap_class