def create_dataset(self, auth_header: str, request: "product_CreateDatasetRequest", test_header_arg: str) -> "product_datasets_Dataset": _headers: Dict[str, Any] = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': auth_header, 'Test-Header': test_header_arg, } _params: Dict[str, Any] = {} _path_params: Dict[str, Any] = {} _json: Any = ConjureEncoder().default(request) _path = '/catalog/datasets' _path = _path.format(**_path_params) _response: Response = self._request('POST', self._uri + _path, params=_params, headers=_headers, json=_json) _decoder = ConjureDecoder() return _decoder.decode(_response.json(), product_datasets_Dataset)
def test_endpoint(self, string): # type: (str) -> str _headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', } # type: Dict[str, Any] _params = {} # type: Dict[str, Any] _path_params = {} # type: Dict[str, Any] _json = ConjureEncoder().default(string) # type: Any _path = '/catalog/testEndpoint' _path = _path.format(**_path_params) _response = self._request( # type: ignore 'POST', self._uri + _path, params=_params, headers=_headers, json=_json) _decoder = ConjureDecoder() return _decoder.decode(_response.json(), str)
def create_dataset(self, auth_header, request, test_header_arg): # type: (str, CreateDatasetRequest, str) -> Dataset _headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': auth_header, 'Test-Header': test_header_arg, } # type: Dict[str, Any] _params = {} # type: Dict[str, Any] _path_params = {} # type: Dict[str, Any] _json = ConjureEncoder().default(request) # type: Any _path = '/catalog/datasets' _path = _path.format(**_path_params) _response = self._request( # type: ignore 'POST', self._uri + _path, params=_params, headers=_headers, json=_json) _decoder = ConjureDecoder() return _decoder.decode(_response.json(), Dataset)
def upload_raw_data(self, auth_header, input): # type: (str, Any) -> None _headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': auth_header, } # type: Dict[str, Any] _params = {} # type: Dict[str, Any] _path_params = {} # type: Dict[str, Any] _json = ConjureEncoder().default(input) # type: Any _path = '/catalog/datasets/upload-raw' _path = _path.format(**_path_params) _response = self._request( # type: ignore 'POST', self._uri + _path, params=_params, headers=_headers, json=_json) return
def test_inf_float_encodes(value, expected_encoded): encoded = ConjureEncoder.encode_primitive(value) assert(encoded == expected_encoded)
def test_nan_float_encodes(): encoded = ConjureEncoder.encode_primitive(float('nan')) assert(encoded == 'NaN')
def test_float_encodes(): encoded = ConjureEncoder.encode_primitive(1.0) assert(type(encoded) is float)