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

Before Change


                    "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


    def parse_obj(cls, obj):
        // Validation.
        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: ray-project/ray
Commit Name: f31ee84bfdc6dc2325c8890412a965e509074d0a
Time: 2020-09-05
Author: wlx65005@gmail.com
File Name: streaming/python/runtime/transfer.py
Class Name: DataReader
Method Name: __init__


Project Name: ray-project/ray
Commit Name: 1b1466748f1db72835a594d73d502e9787e080a9
Time: 2020-09-04
Author: wlx65005@gmail.com
File Name: streaming/python/runtime/transfer.py
Class Name: DataReader
Method Name: __init__