990d954031a1121bc0b9ec1678c0b7db7cfaa374,tpot/operators/base.py,Operator,parameter_types,#Operator#,117

Before Change


        // Inspect preprocess_args function to get parameter information
        // Uses function parameter annotations to determine parameter types
        operator_parameters = signature(self.preprocess_args).parameters
        param_names = list(operator_parameters.keys())

        for param in param_names:
            annotation = operator_parameters[param].annotation

            // Raise RuntimeError if a type is not annotated
            if annotation == Signature.empty:
                raise RuntimeError("Undocumented argument type for {} in operator {}".
                    format(param, self.sklearn_class.__class__.__name__))
            else:
                arg_types.append(annotation)

        return_type = Output_DF if self.root else pd.DataFrame

        return (arg_types, return_type)

After Change


            operator

        
        try:
            // Python 3
            num_args = len(signature(self.preprocess_args).parameters.keys())
        except NameError:
            // Python 2
            num_args = len(getargspec(self.preprocess_args).args[1:])  // Remove "self"

        // Make sure the class has been written properly
        if num_args != len(self.arg_types):
            raise RuntimeError(("{}"s arg_types does not correspond to the "
                                "arguments defined for itself".format(self.__name__)))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: EpistasisLab/tpot
Commit Name: 990d954031a1121bc0b9ec1678c0b7db7cfaa374
Time: 2016-07-08
Author: supacoofoo@gmail.com
File Name: tpot/operators/base.py
Class Name: Operator
Method Name: parameter_types


Project Name: D2KLab/entity2rec
Commit Name: a02d9d9f91d04ec2247f1dd955cf1fd912dc27f1
Time: 2018-11-15
Author: enricopalumbo0@gmail.com
File Name: entity2rec/sparql.py
Class Name: Sparql
Method Name: get_item_metadata


Project Name: wandb/client
Commit Name: e3eddd47c5efe5cb9257e2727d473a48f316d408
Time: 2020-08-24
Author: jeff@wandb.com
File Name: wandb/internal/meta.py
Class Name: Meta
Method Name: __init__


Project Name: catalyst-cooperative/pudl
Commit Name: fc44c71d4aa2e8a5ef60effd4bfe7fb82dffbf17
Time: 2021-01-06
Author: rousik@gmail.com
File Name: src/pudl/extract/excel.py
Class Name: GenericExtractor
Method Name: load_excel_file