2a49973f5a140e2f7fd278f00fc66963bd96d4be,snorkel/loaders.py,,create_or_fetch_set,#Any#Any#Any#,3

Before Change


    Returns a named set ORM object given an instance or name as string
    if isinstance(instance_or_name, str):
        x = session.query(set_class).filter(set_class.name == instance_or_name).first()
        return x if x is not None else set_class(name=instance_or_name)
    elif isinstance(instance_or_name, set_class):
        return instance_or_name
    else:
        return ValueError("%s-type required" % set_class.__class__)

After Change


        if x is not None:
            return x
        else:
            x = set_class(name=instance_or_name)
            session.add(x)
            session.commit()
            return x
    elif isinstance(instance_or_name, set_class):
        return instance_or_name
    else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: snorkel-team/snorkel
Commit Name: 2a49973f5a140e2f7fd278f00fc66963bd96d4be
Time: 2016-09-04
Author: ajratner@gmail.com
File Name: snorkel/loaders.py
Class Name:
Method Name: create_or_fetch_set


Project Name: snorkel-team/snorkel
Commit Name: da0dd1052decff8fe2fd6d46a49992a91d7f232f
Time: 2016-09-02
Author: stephenhbach@gmail.com
File Name: snorkel/annotations.py
Class Name: CandidateFeaturizer
Method Name: create


Project Name: mozilla/bugbug
Commit Name: 0b77df59635715ac4538e35ed2257f1d3dba8d83
Time: 2020-03-11
Author: babadie@mozilla.com
File Name: http_service/tests/conftest.py
Class Name:
Method Name: mock_repo