1d532d1cb8b829bdf7055a22c206032ca0b72e46,python/ray/dashboard/metrics_exporter/schema.py,BaseModel,parse_obj,#Any#Any#,32

Before Change



        // Check if given_args have args that is not required.
        for arg in given_args:
            if arg not in required_args:
                raise ValidationError(
                    "Given argument has a key {}, which is not required "
                    "by this schema: {}".format(arg, required_args))

        // Check if given args have all required args.
        if len(required_args) != len(given_args):
            raise ValidationError("Given args: {} doesn"t have all the "
                                  "necessary args for this schema: {}".format(
                                      given_args, required_args))

After Change


        assert type(obj) == dict, ("It can only parse dict type object.")
        for field, schema in cls.__schema__.items():
            required, default, arg_type = schema
            if field not in obj:
                if required:
                    raise ValidationError("{} is required, but doesn"t "
                                          "exist in a given object {}".format(
                                              field, obj))
                else:
                    // Set default value if the field is optional
                    obj[field] = default

        return cls(**obj)


class IngestRequest(BaseModel):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ray-project/ray
Commit Name: 1d532d1cb8b829bdf7055a22c206032ca0b72e46
Time: 2020-04-02
Author: rkooo567@gmail.com
File Name: python/ray/dashboard/metrics_exporter/schema.py
Class Name: BaseModel
Method Name: parse_obj


Project Name: tryolabs/luminoth
Commit Name: 3d76f1419df74f80369785cc962f1d143eb172de
Time: 2018-03-20
Author: joaquin.alori@gmail.com
File Name: luminoth/models/ssd/ssd_feature_extractor.py
Class Name: SSDFeatureExtractor
Method Name: __init__


Project Name: uber/ludwig
Commit Name: eb91f3cc51551f7aea71c653b0dcf9b86b2c224a
Time: 2019-08-26
Author: smiryala@uber.com
File Name: ludwig/features/vector_feature.py
Class Name: VectorBaseFeature
Method Name: add_feature_data