def from_api_repr(cls, resource):
        """Factory: construct a model resource given its API representation

        Args:
            resource (Dict[str, object]):
                Model resource representation from the API

        Returns:
            google.cloud.bigquery.model.Model: Model parsed from ``resource``.
        """
        this = cls(None)

        # Convert from millis-from-epoch to timestamp well-known type.
        # TODO: Remove this hack once CL 238585470 hits prod.
        resource = copy.deepcopy(resource)
        for training_run in resource.get("trainingRuns", ()):
            start_time = training_run.get("startTime")
            if not start_time or "-" in start_time:  # Already right format?
                continue
            start_time = datetime_helpers.from_microseconds(1e3 * float(start_time))
            training_run["startTime"] = datetime_helpers.to_rfc3339(start_time)

        this._proto = json_format.ParseDict(resource, types.Model())
        for key in six.itervalues(cls._PROPERTY_TO_API_FIELD):
            # Leave missing keys unset. This allows us to use setdefault in the
            # getters where we want a default value other than None.
            if key in resource:
                this._properties[key] = resource[key]
        return this
def from_api_repr ( cls , resource ) : this = cls ( None ) resource = copy . deepcopy ( resource ) for training_run in resource . get ( "trainingRuns" , ( ) ) : start_time = training_run . get ( "startTime" ) if not start_time or "-" in start_time : continue start_time = datetime_helpers . from_microseconds ( 1e3 * float ( start_time ) ) training_run [ "startTime" ] = datetime_helpers . to_rfc3339 ( start_time ) this . _proto = json_format . ParseDict ( resource , types . Model ( ) ) for key in six . itervalues ( cls . _PROPERTY_TO_API_FIELD ) : if key in resource : this . _properties [ key ] = resource [ key ] return this
Factory: construct a model resource given its API representation

        Args:
            resource (Dict[str, object]):
                Model resource representation from the API

        Returns:
            google.cloud.bigquery.model.Model: Model parsed from ``resource``.