fd758534e21a68dfc934cf5dff3fe4183986df51,tensorflow/python/keras/utils/version_utils.py,,swap_class,#Any#Any#Any#Any#,98

Before Change


    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__)
  return cls


def disallow_legacy_graph(cls_name, method_name):

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

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

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: jonathf/chaospy
Commit Name: 09c832a4607dfb80f3917ab6f65ce43513141675
Time: 2018-12-14
Author: jonathf@gmail.com
File Name: tests/test_dist.py
Class Name:
Method Name:


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