595799cb641c6514eccd4b6908cfaf4426c5a389,src/python/pants/engine/exp/configuration.py,Configuration,create,#Configuration#,161

Before Change


      return configuration_type(**attributes)
    elif self.merges:
      attributes = self._extract_inheritable_attributes(self.merges)
      for k, v in self._asdict().items():
        if k not in self._SPECIAL_FIELDS:
          if isinstance(v, MutableMapping):
            mapping = attributes.get(k) or {}
            mapping.update(v)
            attributes[k] = mapping
          elif isinstance(v, MutableSequence):
            sequence = attributes.get(k) or []
            sequence.extend(v)
            attributes[k] = sequence
          elif v is not None:
            attributes[k] = v
      configuration_type = type(self)
      return configuration_type(**attributes)
    else:
      return self

After Change


    return attributes

  def create(self):
    if not (self.extends or self.merges):
      return self

    attributes = {k: v for k, v in self._asdict().items()
                  if k not in self._SPECIAL_FIELDS and v is not None}

    if self.extends:
      for k, v in self._extract_inheritable_attributes(self.extends).items():
        attributes.setdefault(k, v)

    if self.merges:
      def merge(attrs):
        for k, v in attrs.items():
          if isinstance(v, MutableMapping):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: pantsbuild/pants
Commit Name: 595799cb641c6514eccd4b6908cfaf4426c5a389
Time: 2015-10-23
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/exp/configuration.py
Class Name: Configuration
Method Name: create


Project Name: dpressel/mead-baseline
Commit Name: 4edc5dd05bb737dcba543b12c8943ffbae6c9c92
Time: 2018-09-26
Author: blester125@users.noreply.github.com
File Name: python/mead/tasks.py
Class Name: Task
Method Name: _configure_reporting


Project Name: OpenNMT/OpenNMT-py
Commit Name: a473c777983b7f2e123f996c9b15607cb1979701
Time: 2018-05-11
Author: stig-arne.gronroos@aalto.fi
File Name: onmt/ModelConstructor.py
Class Name:
Method Name: load_test_model