1ac9003c0bbf7297e49fc62e6cb6326192727d84,reframe/core/fields.py,TypedField,__init__,#TypedField#Any#Any#,56

Before Change


    def __init__(self, fieldname, main_type, *other_types):
        super().__init__(fieldname)
        self._types = tuple(map(lambda t: type(t) if t is None else t,
                                itertools.chain((main_type,), other_types)))

    def _check_type(self, value):
        if not any(isinstance(value, t) for t in self._types):

After Change


    def __init__(self, fieldname, main_type, *other_types):
        super().__init__(fieldname)
        self._types = (main_type,) + other_types
        if not all(isinstance(t, type) for t in self._types):
            raise TypeError("{0} is not a sequence of types".
                            format(self._types))

    def _check_type(self, value):
        if not any(isinstance(value, t) for t in self._types):
            typedescr = "|".join(t.__name__ for t in self._types)
            raise TypeError(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: eth-cscs/reframe
Commit Name: 1ac9003c0bbf7297e49fc62e6cb6326192727d84
Time: 2018-10-04
Author: karakasis@cscs.ch
File Name: reframe/core/fields.py
Class Name: TypedField
Method Name: __init__


Project Name: descarteslabs/descarteslabs-python
Commit Name: 0eac7564811728b0ec39381b7d873b51ae9b36ca
Time: 2017-04-07
Author: aliasmrchips@descarteslabs.com
File Name: descarteslabs/services/metadata.py
Class Name: Metadata
Method Name: search


Project Name: nilmtk/nilmtk
Commit Name: 9db16aefbe18bc51b59905682d739dbb1c581341
Time: 2014-07-10
Author: jack-list@xlk.org.uk
File Name: nilmtk/utils.py
Class Name:
Method Name: flatten_2d_list