Create a new model using raw API response.
517662
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data.get("properties", {})

        raw_content = properties.get("ipSecConfiguration", None)
        if raw_content is not None:
            ip_sec = IPSecConfiguration.from_raw_data(raw_content)
            properties["ipSecConfiguration"] = ip_sec

        ip_addresses = []
        for raw_content in properties.get("ipAddresses", []):
            ip_addresses.append(IPAddress.from_raw_data(raw_content))
        properties["ipAddresses"] = ip_addresses

        routes = []
        for raw_content in properties.get("routes", []):
            routes.append(NetworkInterfaceRoute.from_raw_data(raw_content))
        properties["routes"] = routes

        raw_content = properties.get("statistics", None)
        if raw_content is not None:
            statistics = NetworkInterfaceStatistics.from_raw_data(
                raw_content)
            properties["statistics"] = statistics

        raw_content = properties.get("greConfiguration", None)
        if raw_content is not None:
            gre_configuration = GREConfiguration.from_raw_data(raw_content)
            properties["greConfiguration"] = gre_configuration

        raw_content = properties.get("l3Configuration", None)
        if raw_content is not None:
            l3_configuration = L3Configuration.from_raw_data(raw_content)
            properties["l3Configuration"] = l3_configuration

        raw_content = properties.get("gateway", None)
        if raw_content is not None:
            gateway = Resource.from_raw_data(raw_content)
            properties["gateway"] = gateway

        return super(NetworkConnections, cls).process_raw_data(raw_data)
946146
def JsonResponseModel(self):
        """"""
        old_model = self.response_type_model
        self.__response_type_model = 'json'
        yield
        self.__response_type_model = old_model
83580
async def create(self, **kwargs):
        '''
        
        '''
        try:
            # create model
            obj = self._meta.object_class()
            # deserialize data from request body
            self.data.update(kwargs)
            await obj.deserialize(self.data)
            # create document in DB
            await obj.insert(db=self.db)
            # serialize object for response
            return await obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)
1167731
def createNewICM():
    
    data = json.loads(request.data)
    G = AnalysisGraph.from_uncharted_json_serialized_dict(data)
    G.assemble_transition_model_from_gradable_adjectives()
    G.sample_from_prior()
    G.to_sql(app=current_app)
    _metadata = ICMMetadata.query.filter_by(id=G.id).first().deserialize()
    del _metadata["model_id"]
    return jsonify(_metadata)
1141966
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data.get("properties", {})

        raw_metadata = raw_data.get("resourceMetadata", None)
        if raw_metadata is not None:
            metadata = ResourceMetadata.from_raw_data(raw_metadata)
            raw_data["resourceMetadata"] = metadata

        raw_state = properties.get("configurationState", None)
        if raw_state is not None:
            configuration = ConfigurationState.from_raw_data(raw_state)
            properties["configurationState"] = configuration

        return super(_BaseHNVModel, cls).process_raw_data(raw_data)
399176
def create(request):
    """"""

    errors = []
    success = False
    listOfResponses = ['', '', '']  # 3 Blank lines by default
    title = ''
    description = ''
    id = ''

    if request.method == 'POST':  # User saved the form
        # Retrieve parameters
        title = request.form.get('title')
        description = request.form.get('description')

        listOfResponses = []
        for rep in request.form.getlist('rep[]'):
            if rep != '':
                listOfResponses.append(rep)

        # Test if everything is ok
        if title == "":
            errors.append("Please set a title !")

        if len(listOfResponses) == 0:
            errors.append("Please set at least one response !")

        # Can we save the new question ?
        if len(errors) == 0:
            # Yes. Let save data
            curDB.execute("INSERT INTO Poll (title, description) VALUES (?, ?)", (title, description))

            # The id of the poll
            id = curDB.lastrowid

            # Insert responses
            for rep in listOfResponses:
                curDB.execute("INSERT INTO Response (pollId, title) VALUES (?, ?)", (id, rep))

            coxDB.commit()

            success = True

        # Minimum of 3 lines of questions
        while len(listOfResponses) < 3:
            listOfResponses.append('')

    return {'errors': errors, 'success': success, 'listOfResponses': listOfResponses, 'title': title, 'description': description, 'id': id}
339318
def _create(self):
        

        if 'name' in self._data:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type(), name=self.obj_name())
        else:
            obj_ref = self.api.add(self.obj_parent(), self.obj_type())
        self.api.commit()
        return self.api.remapIds(obj_ref)
10791
function createResponse(request, response, body){
  return {
    statusCode: response.statusCode,
    statusText: response.statusMessage,
    headers: response.headers,
    originalUrl: request.url,
    effectiveUrl: request.url,
    redirected: false,
    requestMethod: request.method,
    requestHeaders: request.headers,
    body: body,
    retries: 0,
    throttled: false
  };
}
878097
def load_raw(cls, model_fn, schema, *args, **kwargs):
        
        c = cls(*args, **kwargs)
        c.schema = schema.copy(schema_only=True)
        c._model_data = open(model_fn, 'rb').read()
        return c
651904
def from_dict(cls, raw_data, **kwargs):
        
        instance = cls()
        instance.populate(raw_data, **kwargs)
        instance.validate(**kwargs)
        return instance
438811
private void createResponse() {
        response = new GenericAnalyticsResponse(
                queryErrorObservable.onBackpressureBuffer(),
                queryRowObservable.onBackpressureBuffer(),
                querySignatureObservable.onBackpressureBuffer(),
                queryStatusObservable.onBackpressureBuffer(),
                queryInfoObservable.onBackpressureBuffer(),
                handle,
                currentRequest,
                status,
                requestID,
                clientContextID
        );
    }
354053
def build_model(self):
        """"""
        with tf.variable_scope(
                "model", reuse=None, initializer=self.initializer):
            self._create_placeholders()
            self._create_rnn_cells()
            self._create_initstate_and_embeddings()
            self._create_rnn_architecture()
            self._create_optimizer_node()
863196
public static <T> BuiltGenericResponse<T> create(T body, Response rawResponse) {
    ErrorBody errorBody = null;
    int code = rawResponse.getStatus();
    if (code < 200 || code >= 300) {
      errorBody = ErrorBody.fromResponse(rawResponse);
    }

    return new BuiltGenericResponse<T>(body, errorBody, rawResponse);
  }
1328094
function newRecordInstance (raw) {
    // return raw data
    if (this.query.args.raw) {
        return raw
    }
    // return new model instance
    else {
        return this.query.model.newInstance({
            model: this.query.model,
            plain: this.query.args.plain,
            raw: raw,
            session: this.query.session,
        })
    }
}
116030
def new(self, *args, **kwargs):
        '''
'''
        return self.session().add(self.model(*args, **kwargs))
1179218
def create_from_dictionary(self, datas):
        
        if "code" not in datas:
            raise ValueError("A response code must contain a code in \"%s\"." % repr(datas))

        code = ObjectResponseCode()
        self.set_common_datas(code, str(datas["code"]), datas)

        code.code = int(datas["code"])
        if "message" in datas:
            code.message = str(datas["message"])
        elif code.code in self.default_messages.keys():
            code.message = self.default_messages[code.code]
        if "generic" in datas:
            code.generic = to_boolean(datas["generic"])

        return code
344833
def create_model(model_name: Optional[str], params: ModelParams) -> 'Sequential':
    
    if model_name and isfile(model_name):
        print('Loading from ' + model_name + '...')
        model = load_precise_model(model_name)
    else:
        from keras.layers.core import Dense
        from keras.layers.recurrent import GRU
        from keras.models import Sequential

        model = Sequential()
        model.add(GRU(
            params.recurrent_units, activation='linear',
            input_shape=(pr.n_features, pr.feature_size), dropout=params.dropout, name='net'
        ))
        model.add(Dense(1, activation='sigmoid'))

    load_keras()
    metrics = ['accuracy'] + params.extra_metrics * [false_pos, false_neg]
    set_loss_bias(params.loss_bias)
    for i in model.layers[:params.freeze_till]:
        i.trainable = False
    model.compile('rmsprop', weighted_log_loss, metrics=(not params.skip_acc) * metrics)
    return model