c8dfeadbf86dfcf666f5341af97cb6ec894c44d0,src/python/pants/engine/subsystem/native.py,ExternContext,put,#ExternContext#Any#,376

Before Change


      // If we encounter an existing id, return it.
      new_id = self._id_generator
      _id = self._obj_to_id.setdefault(obj, new_id)
      if _id is not new_id:
        // Object already existed.
        return _id

      // Object is new/unique.
      self._id_to_obj[_id] = obj
      self._id_generator += 1
      return _id

  def get(self, id_):
    return self._id_to_obj[id_]

After Change


  def put(self, obj):
    with self._lock:
      // If we encounter an existing id, return it.
      return self._object_id_map.put(obj)

  def get(self, id_):
    return self._object_id_map.get(id_)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: c8dfeadbf86dfcf666f5341af97cb6ec894c44d0
Time: 2017-02-05
Author: wangpeiyu@gmail.com
File Name: src/python/pants/engine/subsystem/native.py
Class Name: ExternContext
Method Name: put


Project Name: cve-search/cve-search
Commit Name: b8ce0940159022a61a2709e615dade45b53f97ef
Time: 2020-08-17
Author: paul.tikken@gmail.com
File Name: sbin/db_mgmt_ref.py
Class Name: VIADownloads
Method Name: process_item


Project Name: facebookresearch/ParlAI
Commit Name: 9ad1d2da68aa4acf817562502340bf319276b283
Time: 2019-05-14
Author: jju@fb.com
File Name: parlai/mturk/core/dev/socket_manager.py
Class Name: SocketManager
Method Name: queue_packet