82844481da6e1f3d391541d47af0c1466679f0f0,nilmtk/appliance.py,Appliance,matches,#Appliance#Any#,62

Before Change


                    return False

            else:
                return False

        return True

After Change


            or `Appliance.appliance_types[appliance.metadata["type"]]`.
            Returns True if key is empty dict.
        
        if not key:
            return True

        if not isinstance(key, dict):
            raise TypeError()

        match = True
        for k, v in key.iteritems():
            if hasattr(self.identifier, k):
                if getattr(self.identifier, k) != v:
                    match = False

            elif self.metadata.has_key(k):
                if self.metadata[k] != v:
                    match = False

            if k == "category":
                if v not in self.categories():
                    match = False

            elif self.type.has_key(k):
                metadata_value = self.type[k]
                if (isinstance(metadata_value, list) and 
                    not isinstance(v, list)):
                    // for example, "control" is a list in metadata
                    if v not in metadata_value:
                        match = False
                elif metadata_value != v:
                    match = False

            else:
                raise KeyError(""{}" not a valid key.".format(k))

        return match
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: nilmtk/nilmtk
Commit Name: 82844481da6e1f3d391541d47af0c1466679f0f0
Time: 2014-07-11
Author: jack-list@xlk.org.uk
File Name: nilmtk/appliance.py
Class Name: Appliance
Method Name: matches


Project Name: KaiyangZhou/deep-person-reid
Commit Name: 4ce9024fcc64d7f98ac5441921c33131306e3186
Time: 2018-10-27
Author: k.zhou@qmul.ac.uk
File Name: torchreid/models/inceptionv4.py
Class Name: InceptionV4Base
Method Name: forward


Project Name: datascienceinc/Skater
Commit Name: 5fe98231a26e08d81f9684a681af43bc2fb2b847
Time: 2017-03-16
Author: aikramer2@gmail.com
File Name: pyinterpret/data/dataset.py
Class Name: DataSet
Method Name: generate_grid


Project Name: pfnet/optuna
Commit Name: 9cdb1b88ba61250ce6931ba22f0cf24ae355bb6c
Time: 2020-05-20
Author: ytsmiling@gmail.com
File Name: optuna/storages/rdb/storage.py
Class Name: RDBStorage
Method Name: get_trial