diff --git a/Makefile b/Makefile index 9eeaf9f0..14edd0ca 100644 --- a/Makefile +++ b/Makefile @@ -76,3 +76,15 @@ lint_javascript: ## Check Javascript code style compliance .PHONY: lint lint: lint_javascript lint_python ## Check for code style violations (JavaScript, Python) @echo "$@: OK" + +.PHONY: format_python +format_python: + @which autoflake > /dev/null || pip install autoflake + @which autopep8 > /dev/null || pip install autopep8 + @autoflake api tools/python -i --recursive --remove-all-unused-imports \ + --ignore-init-module-imports --remove-unused-variables + @autopep8 api/ tools/python/ -i --recursive -a -a -a --experimental \ + --select=E9,E2,E3,E5,F63,F7,F82,F4,F841,W291 \ + --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,venv \ + --max-line-length=140 + @echo "$@: OK" diff --git a/api/client/setup.py b/api/client/setup.py index 8fba4f4b..78a12b14 100644 --- a/api/client/setup.py +++ b/api/client/setup.py @@ -26,8 +26,13 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["certifi>=2017.4.17", "python-dateutil>=2.1", "six>=1.10", "urllib3>=1.23"] - +REQUIRES = [ + "certifi>=2017.4.17", + "python-dateutil>=2.1", + "six>=1.10", + "urllib3>=1.23" +] + setup( name=NAME, @@ -42,5 +47,5 @@ include_package_data=True, long_description="""\ Machine Learning Exchange API Client - """, + """ ) diff --git a/api/client/swagger_client/__init__.py b/api/client/swagger_client/__init__.py index 688eecbb..223c01d6 100644 --- a/api/client/swagger_client/__init__.py +++ b/api/client/swagger_client/__init__.py @@ -33,7 +33,6 @@ # import ApiClient from swagger_client.api_client import ApiClient from swagger_client.configuration import Configuration - # import models into sdk package from swagger_client.models.any_value import AnyValue from swagger_client.models.api_access_token import ApiAccessToken @@ -42,25 +41,15 @@ from swagger_client.models.api_catalog_upload_item import ApiCatalogUploadItem from swagger_client.models.api_credential import ApiCredential from swagger_client.models.api_generate_code_response import ApiGenerateCodeResponse -from swagger_client.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) +from swagger_client.models.api_generate_model_code_response import ApiGenerateModelCodeResponse from swagger_client.models.api_get_template_response import ApiGetTemplateResponse from swagger_client.models.api_inferenceservice import ApiInferenceservice -from swagger_client.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_client.models.api_list_catalog_upload_errors import ( # noqa: F401 - ApiListCatalogUploadErrors, -) +from swagger_client.models.api_list_catalog_items_response import ApiListCatalogItemsResponse +from swagger_client.models.api_list_catalog_upload_errors import ApiListCatalogUploadErrors from swagger_client.models.api_list_components_response import ApiListComponentsResponse -from swagger_client.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) +from swagger_client.models.api_list_credentials_response import ApiListCredentialsResponse from swagger_client.models.api_list_datasets_response import ApiListDatasetsResponse -from swagger_client.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) +from swagger_client.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse from swagger_client.models.api_list_models_response import ApiListModelsResponse from swagger_client.models.api_list_notebooks_response import ApiListNotebooksResponse from swagger_client.models.api_list_pipelines_response import ApiListPipelinesResponse @@ -71,9 +60,7 @@ from swagger_client.models.api_parameter import ApiParameter from swagger_client.models.api_pipeline import ApiPipeline from swagger_client.models.api_pipeline_custom import ApiPipelineCustom -from swagger_client.models.api_pipeline_custom_run_payload import ( # noqa: F401 - ApiPipelineCustomRunPayload, -) +from swagger_client.models.api_pipeline_custom_run_payload import ApiPipelineCustomRunPayload from swagger_client.models.api_pipeline_dag import ApiPipelineDAG from swagger_client.models.api_pipeline_extension import ApiPipelineExtension from swagger_client.models.api_pipeline_inputs import ApiPipelineInputs @@ -81,7 +68,7 @@ from swagger_client.models.api_pipeline_task_arguments import ApiPipelineTaskArguments from swagger_client.models.api_run_code_response import ApiRunCodeResponse from swagger_client.models.api_settings import ApiSettings -from swagger_client.models.api_settings_section import ApiSettingsSection # noqa: F401 +from swagger_client.models.api_settings_section import ApiSettingsSection from swagger_client.models.api_status import ApiStatus from swagger_client.models.api_url import ApiUrl from swagger_client.models.dictionary import Dictionary diff --git a/api/client/swagger_client/api/application_settings_api.py b/api/client/swagger_client/api/application_settings_api.py index 0271a59d..4e312b6e 100644 --- a/api/client/swagger_client/api/application_settings_api.py +++ b/api/client/swagger_client/api/application_settings_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,13 +50,11 @@ def get_application_settings(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_application_settings_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_application_settings_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.get_application_settings_with_http_info( - **kwargs - ) + (data) = self.get_application_settings_with_http_info(**kwargs) # noqa: E501 return data def get_application_settings_with_http_info(self, **kwargs): # noqa: E501 @@ -75,20 +73,20 @@ def get_application_settings_with_http_info(self, **kwargs): # noqa: E501 """ all_params = [] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_application_settings" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} @@ -103,30 +101,27 @@ def get_application_settings_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/settings", - "GET", + '/settings', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiSettings", # noqa: E501 + response_type='ApiSettings', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def modify_application_settings(self, dictionary, **kwargs): # noqa: E501 """modify_application_settings # noqa: E501 @@ -143,20 +138,14 @@ def modify_application_settings(self, dictionary, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.modify_application_settings_with_http_info( - dictionary, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.modify_application_settings_with_http_info(dictionary, **kwargs) # noqa: E501 else: - (data) = self.modify_application_settings_with_http_info( - dictionary, **kwargs - ) + (data) = self.modify_application_settings_with_http_info(dictionary, **kwargs) # noqa: E501 return data - def modify_application_settings_with_http_info( - self, dictionary, **kwargs - ): # noqa: E501 + def modify_application_settings_with_http_info(self, dictionary, **kwargs): # noqa: E501 """modify_application_settings # noqa: E501 Modify one or more of the application settings. # noqa: E501 @@ -172,26 +161,25 @@ def modify_application_settings_with_http_info( returns the request thread. """ - all_params = ["dictionary"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['dictionary'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method modify_application_settings" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'dictionary' is set - if "dictionary" not in params or params["dictionary"] is None: - raise ValueError( - "Missing the required parameter `dictionary` when calling `modify_application_settings`" - ) + if ('dictionary' not in params or + params['dictionary'] is None): + raise ValueError("Missing the required parameter `dictionary` when calling `modify_application_settings`") # noqa: E501 collection_formats = {} @@ -205,40 +193,34 @@ def modify_application_settings_with_http_info( local_var_files = {} body_params = None - if "dictionary" in params: - body_params = params["dictionary"] + if 'dictionary' in params: + body_params = params['dictionary'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/settings", - "PUT", + '/settings', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiSettings", # noqa: E501 + response_type='ApiSettings', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_application_settings(self, settings, **kwargs): # noqa: E501 """set_application_settings # noqa: E501 @@ -255,15 +237,11 @@ def set_application_settings(self, settings, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_application_settings_with_http_info( - settings, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_application_settings_with_http_info(settings, **kwargs) # noqa: E501 else: - (data) = self.set_application_settings_with_http_info( - settings, **kwargs - ) + (data) = self.set_application_settings_with_http_info(settings, **kwargs) # noqa: E501 return data def set_application_settings_with_http_info(self, settings, **kwargs): # noqa: E501 @@ -282,26 +260,25 @@ def set_application_settings_with_http_info(self, settings, **kwargs): # noqa: returns the request thread. """ - all_params = ["settings"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['settings'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_application_settings" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'settings' is set - if "settings" not in params or params["settings"] is None: - raise ValueError( - "Missing the required parameter `settings` when calling `set_application_settings`" - ) + if ('settings' not in params or + params['settings'] is None): + raise ValueError("Missing the required parameter `settings` when calling `set_application_settings`") # noqa: E501 collection_formats = {} @@ -315,37 +292,31 @@ def set_application_settings_with_http_info(self, settings, **kwargs): # noqa: local_var_files = {} body_params = None - if "settings" in params: - body_params = params["settings"] + if 'settings' in params: + body_params = params['settings'] # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/settings", - "POST", + '/settings', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiSettings", # noqa: E501 + response_type='ApiSettings', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/catalog_service_api.py b/api/client/swagger_client/api/catalog_service_api.py index 35bdaf28..5a5590f0 100644 --- a/api/client/swagger_client/api/catalog_service_api.py +++ b/api/client/swagger_client/api/catalog_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -53,11 +53,11 @@ def list_all_assets(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_all_assets_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_all_assets_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_all_assets_with_http_info(**kwargs) + (data) = self.list_all_assets_with_http_info(**kwargs) # noqa: E501 return data def list_all_assets_with_http_info(self, **kwargs): # noqa: E501 @@ -78,35 +78,35 @@ def list_all_assets_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_all_assets" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -118,22 +118,20 @@ def list_all_assets_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/catalog", - "GET", + '/catalog', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListCatalogItemsResponse", # noqa: E501 + response_type='ApiListCatalogItemsResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_catalog_from_url(self, url, **kwargs): # noqa: E501 """upload_catalog_from_url # noqa: E501 @@ -150,15 +148,11 @@ def upload_catalog_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_catalog_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_catalog_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_catalog_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_catalog_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_catalog_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -177,26 +171,25 @@ def upload_catalog_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_catalog_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_catalog_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_catalog_from_url`") # noqa: E501 collection_formats = {} @@ -208,44 +201,38 @@ def upload_catalog_from_url_with_http_info(self, url, **kwargs): # noqa: E501 form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/catalog/upload_from_url", - "POST", + '/catalog/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiCatalogUploadResponse", # noqa: E501 + response_type='ApiCatalogUploadResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_multiple_assets(self, body, **kwargs): # noqa: E501 """upload_multiple_assets # noqa: E501 @@ -261,15 +248,11 @@ def upload_multiple_assets(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_multiple_assets_with_http_info( - body, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_multiple_assets_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.upload_multiple_assets_with_http_info( - body, **kwargs - ) + (data) = self.upload_multiple_assets_with_http_info(body, **kwargs) # noqa: E501 return data def upload_multiple_assets_with_http_info(self, body, **kwargs): # noqa: E501 @@ -287,26 +270,25 @@ def upload_multiple_assets_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_multiple_assets" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `upload_multiple_assets`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `upload_multiple_assets`") # noqa: E501 collection_formats = {} @@ -320,25 +302,23 @@ def upload_multiple_assets_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/catalog", - "POST", + '/catalog', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiCatalogUploadResponse", # noqa: E501 + response_type='ApiCatalogUploadResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/component_service_api.py b/api/client/swagger_client/api/component_service_api.py index 86be65a0..94b05bb6 100644 --- a/api/client/swagger_client/api/component_service_api.py +++ b/api/client/swagger_client/api/component_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,20 +50,14 @@ def approve_components_for_publishing(self, component_ids, **kwargs): # noqa: E If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.approve_components_for_publishing_with_http_info( - component_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.approve_components_for_publishing_with_http_info(component_ids, **kwargs) # noqa: E501 else: - (data) = self.approve_components_for_publishing_with_http_info( - component_ids, **kwargs - ) + (data) = self.approve_components_for_publishing_with_http_info(component_ids, **kwargs) # noqa: E501 return data - def approve_components_for_publishing_with_http_info( - self, component_ids, **kwargs - ): # noqa: E501 + def approve_components_for_publishing_with_http_info(self, component_ids, **kwargs): # noqa: E501 """approve_components_for_publishing # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -78,26 +72,25 @@ def approve_components_for_publishing_with_http_info( returns the request thread. """ - all_params = ["component_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['component_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method approve_components_for_publishing" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'component_ids' is set - if "component_ids" not in params or params["component_ids"] is None: - raise ValueError( - "Missing the required parameter `component_ids` when calling `approve_components_for_publishing`" - ) + if ('component_ids' not in params or + params['component_ids'] is None): + raise ValueError("Missing the required parameter `component_ids` when calling `approve_components_for_publishing`") # noqa: E501 collection_formats = {} @@ -111,14 +104,13 @@ def approve_components_for_publishing_with_http_info( local_var_files = {} body_params = None - if "component_ids" in params: - body_params = params["component_ids"] + if 'component_ids' in params: + body_params = params['component_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/publish_approved", - "POST", + '/components/publish_approved', 'POST', path_params, query_params, header_params, @@ -127,12 +119,11 @@ def approve_components_for_publishing_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def create_component(self, body, **kwargs): # noqa: E501 """create_component # noqa: E501 @@ -148,11 +139,11 @@ def create_component(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_component_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_component_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_component_with_http_info(body, **kwargs) + (data) = self.create_component_with_http_info(body, **kwargs) # noqa: E501 return data def create_component_with_http_info(self, body, **kwargs): # noqa: E501 @@ -170,26 +161,25 @@ def create_component_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_component" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_component`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_component`") # noqa: E501 collection_formats = {} @@ -203,28 +193,26 @@ def create_component_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components", - "POST", + '/components', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiComponent", # noqa: E501 + response_type='ApiComponent', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_component(self, id, **kwargs): # noqa: E501 """delete_component # noqa: E501 @@ -240,11 +228,11 @@ def delete_component(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_component_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_component_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_component_with_http_info(id, **kwargs) + (data) = self.delete_component_with_http_info(id, **kwargs) # noqa: E501 return data def delete_component_with_http_info(self, id, **kwargs): # noqa: E501 @@ -262,32 +250,31 @@ def delete_component_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_component" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_component`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_component`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -301,8 +288,7 @@ def delete_component_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}", - "DELETE", + '/components/{id}', 'DELETE', path_params, query_params, header_params, @@ -311,12 +297,11 @@ def delete_component_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def download_component_files(self, id, **kwargs): # noqa: E501 """Returns the component artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 @@ -333,15 +318,11 @@ def download_component_files(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.download_component_files_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_component_files_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.download_component_files_with_http_info( - id, **kwargs - ) + (data) = self.download_component_files_with_http_info(id, **kwargs) # noqa: E501 return data def download_component_files_with_http_info(self, id, **kwargs): # noqa: E501 @@ -360,38 +341,35 @@ def download_component_files_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "include_generated_code"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'include_generated_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_component_files" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `download_component_files`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `download_component_files`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "include_generated_code" in params: - query_params.append( - ("include_generated_code", params["include_generated_code"]) - ) + if 'include_generated_code' in params: + query_params.append(('include_generated_code', params['include_generated_code'])) # noqa: E501 header_params = {} @@ -400,30 +378,27 @@ def download_component_files_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/gzip"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/gzip']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}/download", - "GET", + '/components/{id}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="file", # noqa: E501 + response_type='file', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", False), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', False), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def generate_component_code(self, id, **kwargs): # noqa: E501 """generate_component_code # noqa: E501 @@ -440,15 +415,11 @@ def generate_component_code(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.generate_component_code_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_component_code_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.generate_component_code_with_http_info( - id, **kwargs - ) + (data) = self.generate_component_code_with_http_info(id, **kwargs) # noqa: E501 return data def generate_component_code_with_http_info(self, id, **kwargs): # noqa: E501 @@ -467,32 +438,31 @@ def generate_component_code_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method generate_component_code" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `generate_component_code`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `generate_component_code`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -506,22 +476,20 @@ def generate_component_code_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}/generate_code", - "GET", + '/components/{id}/generate_code', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGenerateCodeResponse", # noqa: E501 + response_type='ApiGenerateCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_component(self, id, **kwargs): # noqa: E501 """get_component # noqa: E501 @@ -537,11 +505,11 @@ def get_component(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_component_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_component_with_http_info(id, **kwargs) + (data) = self.get_component_with_http_info(id, **kwargs) # noqa: E501 return data def get_component_with_http_info(self, id, **kwargs): # noqa: E501 @@ -559,32 +527,31 @@ def get_component_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_component" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_component`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_component`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -598,22 +565,20 @@ def get_component_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}", - "GET", + '/components/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiComponent", # noqa: E501 + response_type='ApiComponent', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_component_template(self, id, **kwargs): # noqa: E501 """get_component_template # noqa: E501 @@ -629,15 +594,11 @@ def get_component_template(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_component_template_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_template_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_component_template_with_http_info( - id, **kwargs - ) + (data) = self.get_component_template_with_http_info(id, **kwargs) # noqa: E501 return data def get_component_template_with_http_info(self, id, **kwargs): # noqa: E501 @@ -655,32 +616,31 @@ def get_component_template_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_component_template" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_component_template`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_component_template`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -694,22 +654,20 @@ def get_component_template_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}/templates", - "GET", + '/components/{id}/templates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGetTemplateResponse", # noqa: E501 + response_type='ApiGetTemplateResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_components(self, **kwargs): # noqa: E501 """list_components # noqa: E501 @@ -728,11 +686,11 @@ def list_components(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_components_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_components_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_components_with_http_info(**kwargs) + (data) = self.list_components_with_http_info(**kwargs) # noqa: E501 return data def list_components_with_http_info(self, **kwargs): # noqa: E501 @@ -753,35 +711,35 @@ def list_components_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_components" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -793,22 +751,20 @@ def list_components_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components", - "GET", + '/components', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListComponentsResponse", # noqa: E501 + response_type='ApiListComponentsResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_component(self, id, parameters, **kwargs): # noqa: E501 """run_component # noqa: E501 @@ -826,15 +782,11 @@ def run_component(self, id, parameters, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_component_with_http_info( - id, parameters, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_component_with_http_info(id, parameters, **kwargs) # noqa: E501 else: - (data) = self.run_component_with_http_info( - id, parameters, **kwargs - ) + (data) = self.run_component_with_http_info(id, parameters, **kwargs) # noqa: E501 return data def run_component_with_http_info(self, id, parameters, **kwargs): # noqa: E501 @@ -854,41 +806,39 @@ def run_component_with_http_info(self, id, parameters, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "parameters", "run_name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'parameters', 'run_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_component" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `run_component`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `run_component`") # noqa: E501 # verify the required parameter 'parameters' is set - if "parameters" not in params or params["parameters"] is None: - raise ValueError( - "Missing the required parameter `parameters` when calling `run_component`" - ) + if ('parameters' not in params or + params['parameters'] is None): + raise ValueError("Missing the required parameter `parameters` when calling `run_component`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -896,28 +846,26 @@ def run_component_with_http_info(self, id, parameters, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "parameters" in params: - body_params = params["parameters"] + if 'parameters' in params: + body_params = params['parameters'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}/run", - "POST", + '/components/{id}/run', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_featured_components(self, component_ids, **kwargs): # noqa: E501 """set_featured_components # noqa: E501 @@ -933,20 +881,14 @@ def set_featured_components(self, component_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_featured_components_with_http_info( - component_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_featured_components_with_http_info(component_ids, **kwargs) # noqa: E501 else: - (data) = self.set_featured_components_with_http_info( - component_ids, **kwargs - ) + (data) = self.set_featured_components_with_http_info(component_ids, **kwargs) # noqa: E501 return data - def set_featured_components_with_http_info( - self, component_ids, **kwargs - ): # noqa: E501 + def set_featured_components_with_http_info(self, component_ids, **kwargs): # noqa: E501 """set_featured_components # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -961,26 +903,25 @@ def set_featured_components_with_http_info( returns the request thread. """ - all_params = ["component_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['component_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_featured_components" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'component_ids' is set - if "component_ids" not in params or params["component_ids"] is None: - raise ValueError( - "Missing the required parameter `component_ids` when calling `set_featured_components`" - ) + if ('component_ids' not in params or + params['component_ids'] is None): + raise ValueError("Missing the required parameter `component_ids` when calling `set_featured_components`") # noqa: E501 collection_formats = {} @@ -994,14 +935,13 @@ def set_featured_components_with_http_info( local_var_files = {} body_params = None - if "component_ids" in params: - body_params = params["component_ids"] + if 'component_ids' in params: + body_params = params['component_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/featured", - "POST", + '/components/featured', 'POST', path_params, query_params, header_params, @@ -1010,12 +950,11 @@ def set_featured_components_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_component(self, uploadfile, **kwargs): # noqa: E501 """upload_component # noqa: E501 @@ -1032,15 +971,11 @@ def upload_component(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_component_with_http_info( - uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_component_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_component_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_component_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_component_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -1059,75 +994,68 @@ def upload_component_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_component" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_component`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_component`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/upload", - "POST", + '/components/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiComponent", # noqa: E501 + response_type='ApiComponent', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_component_file(self, id, uploadfile, **kwargs): # noqa: E501 """upload_component_file # noqa: E501 @@ -1144,20 +1072,14 @@ def upload_component_file(self, id, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_component_file_with_http_info( - id, uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_component_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_component_file_with_http_info( - id, uploadfile, **kwargs - ) + (data) = self.upload_component_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 return data - def upload_component_file_with_http_info( - self, id, uploadfile, **kwargs - ): # noqa: E501 + def upload_component_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E501 """upload_component_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1173,37 +1095,35 @@ def upload_component_file_with_http_info( returns the request thread. """ - all_params = ["id", "uploadfile"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'uploadfile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_component_file" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `upload_component_file`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `upload_component_file`") # noqa: E501 # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_component_file`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_component_file`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -1211,42 +1131,36 @@ def upload_component_file_with_http_info( form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/{id}/upload", - "POST", + '/components/{id}/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiComponent", # noqa: E501 + response_type='ApiComponent', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_component_from_url(self, url, **kwargs): # noqa: E501 """upload_component_from_url # noqa: E501 @@ -1264,15 +1178,11 @@ def upload_component_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_component_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_component_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_component_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_component_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_component_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -1292,74 +1202,67 @@ def upload_component_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "name", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'name', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_component_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_component_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_component_from_url`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/components/upload_from_url", - "POST", + '/components/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiComponent", # noqa: E501 + response_type='ApiComponent', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/credential_service_api.py b/api/client/swagger_client/api/credential_service_api.py index a289c52b..8f9d60d8 100644 --- a/api/client/swagger_client/api/credential_service_api.py +++ b/api/client/swagger_client/api/credential_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -51,11 +51,11 @@ def create_credential(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_credential_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_credential_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_credential_with_http_info(body, **kwargs) + (data) = self.create_credential_with_http_info(body, **kwargs) # noqa: E501 return data def create_credential_with_http_info(self, body, **kwargs): # noqa: E501 @@ -74,26 +74,25 @@ def create_credential_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_credential" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_credential`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_credential`") # noqa: E501 collection_formats = {} @@ -107,35 +106,30 @@ def create_credential_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/credentials", - "POST", + '/credentials', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiCredential", # noqa: E501 + response_type='ApiCredential', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_credential(self, id, **kwargs): # noqa: E501 """delete_credential # noqa: E501 @@ -151,11 +145,11 @@ def delete_credential(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_credential_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_credential_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_credential_with_http_info(id, **kwargs) + (data) = self.delete_credential_with_http_info(id, **kwargs) # noqa: E501 return data def delete_credential_with_http_info(self, id, **kwargs): # noqa: E501 @@ -173,32 +167,31 @@ def delete_credential_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_credential" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_credential`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_credential`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -212,8 +205,7 @@ def delete_credential_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/credentials/{id}", - "DELETE", + '/credentials/{id}', 'DELETE', path_params, query_params, header_params, @@ -222,12 +214,11 @@ def delete_credential_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_credential(self, id, **kwargs): # noqa: E501 """get_credential # noqa: E501 @@ -243,11 +234,11 @@ def get_credential(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_credential_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_credential_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_credential_with_http_info(id, **kwargs) + (data) = self.get_credential_with_http_info(id, **kwargs) # noqa: E501 return data def get_credential_with_http_info(self, id, **kwargs): # noqa: E501 @@ -265,32 +256,31 @@ def get_credential_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_credential" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_credential`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_credential`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -304,22 +294,20 @@ def get_credential_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/credentials/{id}", - "GET", + '/credentials/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiCredential", # noqa: E501 + response_type='ApiCredential', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_credentials(self, **kwargs): # noqa: E501 """list_credentials # noqa: E501 @@ -338,11 +326,11 @@ def list_credentials(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_credentials_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_credentials_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_credentials_with_http_info(**kwargs) + (data) = self.list_credentials_with_http_info(**kwargs) # noqa: E501 return data def list_credentials_with_http_info(self, **kwargs): # noqa: E501 @@ -363,35 +351,35 @@ def list_credentials_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_credentials" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -403,19 +391,17 @@ def list_credentials_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/credentials", - "GET", + '/credentials', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListCredentialsResponse", # noqa: E501 + response_type='ApiListCredentialsResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/dataset_service_api.py b/api/client/swagger_client/api/dataset_service_api.py index 9d5d944a..b23151e1 100644 --- a/api/client/swagger_client/api/dataset_service_api.py +++ b/api/client/swagger_client/api/dataset_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,20 +50,14 @@ def approve_datasets_for_publishing(self, dataset_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.approve_datasets_for_publishing_with_http_info( - dataset_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.approve_datasets_for_publishing_with_http_info(dataset_ids, **kwargs) # noqa: E501 else: - (data) = self.approve_datasets_for_publishing_with_http_info( - dataset_ids, **kwargs - ) + (data) = self.approve_datasets_for_publishing_with_http_info(dataset_ids, **kwargs) # noqa: E501 return data - def approve_datasets_for_publishing_with_http_info( - self, dataset_ids, **kwargs - ): # noqa: E501 + def approve_datasets_for_publishing_with_http_info(self, dataset_ids, **kwargs): # noqa: E501 """approve_datasets_for_publishing # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -78,26 +72,25 @@ def approve_datasets_for_publishing_with_http_info( returns the request thread. """ - all_params = ["dataset_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['dataset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method approve_datasets_for_publishing" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'dataset_ids' is set - if "dataset_ids" not in params or params["dataset_ids"] is None: - raise ValueError( - "Missing the required parameter `dataset_ids` when calling `approve_datasets_for_publishing`" - ) + if ('dataset_ids' not in params or + params['dataset_ids'] is None): + raise ValueError("Missing the required parameter `dataset_ids` when calling `approve_datasets_for_publishing`") # noqa: E501 collection_formats = {} @@ -111,14 +104,13 @@ def approve_datasets_for_publishing_with_http_info( local_var_files = {} body_params = None - if "dataset_ids" in params: - body_params = params["dataset_ids"] + if 'dataset_ids' in params: + body_params = params['dataset_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/publish_approved", - "POST", + '/datasets/publish_approved', 'POST', path_params, query_params, header_params, @@ -127,12 +119,11 @@ def approve_datasets_for_publishing_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def create_dataset(self, body, **kwargs): # noqa: E501 """create_dataset # noqa: E501 @@ -148,11 +139,11 @@ def create_dataset(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_dataset_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_dataset_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_dataset_with_http_info(body, **kwargs) + (data) = self.create_dataset_with_http_info(body, **kwargs) # noqa: E501 return data def create_dataset_with_http_info(self, body, **kwargs): # noqa: E501 @@ -170,26 +161,25 @@ def create_dataset_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_dataset" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_dataset`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_dataset`") # noqa: E501 collection_formats = {} @@ -203,28 +193,26 @@ def create_dataset_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets", - "POST", + '/datasets', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiDataset", # noqa: E501 + response_type='ApiDataset', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_dataset(self, id, **kwargs): # noqa: E501 """delete_dataset # noqa: E501 @@ -240,11 +228,11 @@ def delete_dataset(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_dataset_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_dataset_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_dataset_with_http_info(id, **kwargs) + (data) = self.delete_dataset_with_http_info(id, **kwargs) # noqa: E501 return data def delete_dataset_with_http_info(self, id, **kwargs): # noqa: E501 @@ -262,32 +250,31 @@ def delete_dataset_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_dataset" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_dataset`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_dataset`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -301,8 +288,7 @@ def delete_dataset_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}", - "DELETE", + '/datasets/{id}', 'DELETE', path_params, query_params, header_params, @@ -311,12 +297,11 @@ def delete_dataset_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def download_dataset_files(self, id, **kwargs): # noqa: E501 """Returns the dataset artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 @@ -333,15 +318,11 @@ def download_dataset_files(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.download_dataset_files_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_dataset_files_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.download_dataset_files_with_http_info( - id, **kwargs - ) + (data) = self.download_dataset_files_with_http_info(id, **kwargs) # noqa: E501 return data def download_dataset_files_with_http_info(self, id, **kwargs): # noqa: E501 @@ -360,38 +341,35 @@ def download_dataset_files_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "include_generated_code"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'include_generated_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_dataset_files" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `download_dataset_files`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `download_dataset_files`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "include_generated_code" in params: - query_params.append( - ("include_generated_code", params["include_generated_code"]) - ) + if 'include_generated_code' in params: + query_params.append(('include_generated_code', params['include_generated_code'])) # noqa: E501 header_params = {} @@ -400,30 +378,27 @@ def download_dataset_files_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/gzip"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/gzip']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}/download", - "GET", + '/datasets/{id}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="file", # noqa: E501 + response_type='file', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", False), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', False), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def generate_dataset_code(self, id, **kwargs): # noqa: E501 """generate_dataset_code # noqa: E501 @@ -440,13 +415,11 @@ def generate_dataset_code(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.generate_dataset_code_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_dataset_code_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.generate_dataset_code_with_http_info( - id, **kwargs - ) + (data) = self.generate_dataset_code_with_http_info(id, **kwargs) # noqa: E501 return data def generate_dataset_code_with_http_info(self, id, **kwargs): # noqa: E501 @@ -465,32 +438,31 @@ def generate_dataset_code_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method generate_dataset_code" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `generate_dataset_code`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `generate_dataset_code`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -504,22 +476,20 @@ def generate_dataset_code_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}/generate_code", - "GET", + '/datasets/{id}/generate_code', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGenerateCodeResponse", # noqa: E501 + response_type='ApiGenerateCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_dataset(self, id, **kwargs): # noqa: E501 """get_dataset # noqa: E501 @@ -535,11 +505,11 @@ def get_dataset(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_dataset_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dataset_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_dataset_with_http_info(id, **kwargs) + (data) = self.get_dataset_with_http_info(id, **kwargs) # noqa: E501 return data def get_dataset_with_http_info(self, id, **kwargs): # noqa: E501 @@ -557,32 +527,31 @@ def get_dataset_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_dataset" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_dataset`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_dataset`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -596,22 +565,20 @@ def get_dataset_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}", - "GET", + '/datasets/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiDataset", # noqa: E501 + response_type='ApiDataset', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_dataset_template(self, id, **kwargs): # noqa: E501 """get_dataset_template # noqa: E501 @@ -627,13 +594,11 @@ def get_dataset_template(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_dataset_template_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dataset_template_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_dataset_template_with_http_info( - id, **kwargs - ) + (data) = self.get_dataset_template_with_http_info(id, **kwargs) # noqa: E501 return data def get_dataset_template_with_http_info(self, id, **kwargs): # noqa: E501 @@ -651,32 +616,31 @@ def get_dataset_template_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_dataset_template" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_dataset_template`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_dataset_template`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -690,22 +654,20 @@ def get_dataset_template_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}/templates", - "GET", + '/datasets/{id}/templates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGetTemplateResponse", # noqa: E501 + response_type='ApiGetTemplateResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_datasets(self, **kwargs): # noqa: E501 """list_datasets # noqa: E501 @@ -724,11 +686,11 @@ def list_datasets(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_datasets_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_datasets_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_datasets_with_http_info(**kwargs) + (data) = self.list_datasets_with_http_info(**kwargs) # noqa: E501 return data def list_datasets_with_http_info(self, **kwargs): # noqa: E501 @@ -749,35 +711,35 @@ def list_datasets_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_datasets" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -789,22 +751,20 @@ def list_datasets_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets", - "GET", + '/datasets', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListDatasetsResponse", # noqa: E501 + response_type='ApiListDatasetsResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_dataset(self, id, **kwargs): # noqa: E501 """run_dataset # noqa: E501 @@ -822,11 +782,11 @@ def run_dataset(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_dataset_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_dataset_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.run_dataset_with_http_info(id, **kwargs) + (data) = self.run_dataset_with_http_info(id, **kwargs) # noqa: E501 return data def run_dataset_with_http_info(self, id, **kwargs): # noqa: E501 @@ -846,36 +806,35 @@ def run_dataset_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "parameters", "run_name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'parameters', 'run_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_dataset" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `run_dataset`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `run_dataset`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -883,28 +842,26 @@ def run_dataset_with_http_info(self, id, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "parameters" in params: - body_params = params["parameters"] + if 'parameters' in params: + body_params = params['parameters'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}/run", - "POST", + '/datasets/{id}/run', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_featured_datasets(self, dataset_ids, **kwargs): # noqa: E501 """set_featured_datasets # noqa: E501 @@ -920,15 +877,11 @@ def set_featured_datasets(self, dataset_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_featured_datasets_with_http_info( - dataset_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_featured_datasets_with_http_info(dataset_ids, **kwargs) # noqa: E501 else: - (data) = self.set_featured_datasets_with_http_info( - dataset_ids, **kwargs - ) + (data) = self.set_featured_datasets_with_http_info(dataset_ids, **kwargs) # noqa: E501 return data def set_featured_datasets_with_http_info(self, dataset_ids, **kwargs): # noqa: E501 @@ -946,26 +899,25 @@ def set_featured_datasets_with_http_info(self, dataset_ids, **kwargs): # noqa: returns the request thread. """ - all_params = ["dataset_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['dataset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_featured_datasets" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'dataset_ids' is set - if "dataset_ids" not in params or params["dataset_ids"] is None: - raise ValueError( - "Missing the required parameter `dataset_ids` when calling `set_featured_datasets`" - ) + if ('dataset_ids' not in params or + params['dataset_ids'] is None): + raise ValueError("Missing the required parameter `dataset_ids` when calling `set_featured_datasets`") # noqa: E501 collection_formats = {} @@ -979,14 +931,13 @@ def set_featured_datasets_with_http_info(self, dataset_ids, **kwargs): # noqa: local_var_files = {} body_params = None - if "dataset_ids" in params: - body_params = params["dataset_ids"] + if 'dataset_ids' in params: + body_params = params['dataset_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/featured", - "POST", + '/datasets/featured', 'POST', path_params, query_params, header_params, @@ -995,12 +946,11 @@ def set_featured_datasets_with_http_info(self, dataset_ids, **kwargs): # noqa: files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_dataset(self, uploadfile, **kwargs): # noqa: E501 """upload_dataset # noqa: E501 @@ -1017,15 +967,11 @@ def upload_dataset(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_dataset_with_http_info( - uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_dataset_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_dataset_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_dataset_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_dataset_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -1044,75 +990,68 @@ def upload_dataset_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_dataset" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_dataset`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_dataset`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/upload", - "POST", + '/datasets/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiDataset", # noqa: E501 + response_type='ApiDataset', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_dataset_file(self, id, uploadfile, **kwargs): # noqa: E501 """upload_dataset_file # noqa: E501 @@ -1129,20 +1068,14 @@ def upload_dataset_file(self, id, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_dataset_file_with_http_info( - id, uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_dataset_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_dataset_file_with_http_info( - id, uploadfile, **kwargs - ) + (data) = self.upload_dataset_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 return data - def upload_dataset_file_with_http_info( - self, id, uploadfile, **kwargs - ): # noqa: E501 + def upload_dataset_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E501 """upload_dataset_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1158,37 +1091,35 @@ def upload_dataset_file_with_http_info( returns the request thread. """ - all_params = ["id", "uploadfile"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'uploadfile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_dataset_file" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `upload_dataset_file`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `upload_dataset_file`") # noqa: E501 # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_dataset_file`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_dataset_file`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -1196,42 +1127,36 @@ def upload_dataset_file_with_http_info( form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/{id}/upload", - "POST", + '/datasets/{id}/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiDataset", # noqa: E501 + response_type='ApiDataset', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_dataset_from_url(self, url, **kwargs): # noqa: E501 """upload_dataset_from_url # noqa: E501 @@ -1249,15 +1174,11 @@ def upload_dataset_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_dataset_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_dataset_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_dataset_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_dataset_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_dataset_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -1277,74 +1198,67 @@ def upload_dataset_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "name", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'name', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_dataset_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_dataset_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_dataset_from_url`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/datasets/upload_from_url", - "POST", + '/datasets/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiDataset", # noqa: E501 + response_type='ApiDataset', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/health_check_api.py b/api/client/swagger_client/api/health_check_api.py index 9e731452..a717819e 100644 --- a/api/client/swagger_client/api/health_check_api.py +++ b/api/client/swagger_client/api/health_check_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -51,11 +51,11 @@ def health_check(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.health_check_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.health_check_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.health_check_with_http_info(**kwargs) + (data) = self.health_check_with_http_info(**kwargs) # noqa: E501 return data def health_check_with_http_info(self, **kwargs): # noqa: E501 @@ -74,35 +74,31 @@ def health_check_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["check_database", "check_object_store"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['check_database', 'check_object_store'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method health_check" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "check_database" in params: - query_params.append( - ("check_database", params["check_database"]) - ) - if "check_object_store" in params: - query_params.append( - ("check_object_store", params["check_object_store"]) - ) + if 'check_database' in params: + query_params.append(('check_database', params['check_database'])) # noqa: E501 + if 'check_object_store' in params: + query_params.append(('check_object_store', params['check_object_store'])) # noqa: E501 header_params = {} @@ -114,8 +110,7 @@ def health_check_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/health_check", - "GET", + '/health_check', 'GET', path_params, query_params, header_params, @@ -124,9 +119,8 @@ def health_check_with_http_info(self, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/inference_service_api.py b/api/client/swagger_client/api/inference_service_api.py index 5361d83c..16821c5a 100644 --- a/api/client/swagger_client/api/inference_service_api.py +++ b/api/client/swagger_client/api/inference_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -51,11 +51,11 @@ def create_service(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_service_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_service_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_service_with_http_info(body, **kwargs) + (data) = self.create_service_with_http_info(body, **kwargs) # noqa: E501 return data def create_service_with_http_info(self, body, **kwargs): # noqa: E501 @@ -74,34 +74,33 @@ def create_service_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body", "namespace"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body', 'namespace'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_service" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_service`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_service`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "namespace" in params: - query_params.append(("namespace", params["namespace"])) + if 'namespace' in params: + query_params.append(('namespace', params['namespace'])) # noqa: E501 header_params = {} @@ -109,28 +108,26 @@ def create_service_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/inferenceservices", - "POST", + '/inferenceservices', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiInferenceservice", # noqa: E501 + response_type='ApiInferenceservice', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_inferenceservices(self, id, **kwargs): # noqa: E501 """get_inferenceservices # noqa: E501 @@ -147,13 +144,11 @@ def get_inferenceservices(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_inferenceservices_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_inferenceservices_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_inferenceservices_with_http_info( - id, **kwargs - ) + (data) = self.get_inferenceservices_with_http_info(id, **kwargs) # noqa: E501 return data def get_inferenceservices_with_http_info(self, id, **kwargs): # noqa: E501 @@ -172,36 +167,35 @@ def get_inferenceservices_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "namespace"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'namespace'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_inferenceservices" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_inferenceservices`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_inferenceservices`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "namespace" in params: - query_params.append(("namespace", params["namespace"])) + if 'namespace' in params: + query_params.append(('namespace', params['namespace'])) # noqa: E501 header_params = {} @@ -213,22 +207,20 @@ def get_inferenceservices_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/inferenceservices/{id}", - "GET", + '/inferenceservices/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiInferenceservice", # noqa: E501 + response_type='ApiInferenceservice', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_inferenceservices(self, **kwargs): # noqa: E501 """list_inferenceservices # noqa: E501 @@ -248,11 +240,11 @@ def list_inferenceservices(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_inferenceservices_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_inferenceservices_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_inferenceservices_with_http_info(**kwargs) + (data) = self.list_inferenceservices_with_http_info(**kwargs) # noqa: E501 return data def list_inferenceservices_with_http_info(self, **kwargs): # noqa: E501 @@ -274,43 +266,37 @@ def list_inferenceservices_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = [ - "page_token", - "page_size", - "sort_by", - "filter", - "namespace", - ] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter', 'namespace'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_inferenceservices" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) - if "namespace" in params: - query_params.append(("namespace", params["namespace"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 + if 'namespace' in params: + query_params.append(('namespace', params['namespace'])) # noqa: E501 header_params = {} @@ -322,22 +308,20 @@ def list_inferenceservices_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/inferenceservices", - "GET", + '/inferenceservices', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListInferenceservicesResponse", # noqa: E501 + response_type='ApiListInferenceservicesResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_service(self, uploadfile, **kwargs): # noqa: E501 """upload_service # noqa: E501 @@ -355,15 +339,11 @@ def upload_service(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_service_with_http_info( - uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_service_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_service_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_service_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_service_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -383,74 +363,67 @@ def upload_service_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name", "namespace"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name', 'namespace'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_service" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_service`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_service`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) - if "namespace" in params: - query_params.append(("namespace", params["namespace"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 + if 'namespace' in params: + query_params.append(('namespace', params['namespace'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/inferenceservices/upload", - "POST", + '/inferenceservices/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiInferenceservice", # noqa: E501 + response_type='ApiInferenceservice', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/model_service_api.py b/api/client/swagger_client/api/model_service_api.py index cd1e64de..bc6d95c0 100644 --- a/api/client/swagger_client/api/model_service_api.py +++ b/api/client/swagger_client/api/model_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,20 +50,14 @@ def approve_models_for_publishing(self, model_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.approve_models_for_publishing_with_http_info( - model_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.approve_models_for_publishing_with_http_info(model_ids, **kwargs) # noqa: E501 else: - (data) = self.approve_models_for_publishing_with_http_info( - model_ids, **kwargs - ) + (data) = self.approve_models_for_publishing_with_http_info(model_ids, **kwargs) # noqa: E501 return data - def approve_models_for_publishing_with_http_info( - self, model_ids, **kwargs - ): # noqa: E501 + def approve_models_for_publishing_with_http_info(self, model_ids, **kwargs): # noqa: E501 """approve_models_for_publishing # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -78,26 +72,25 @@ def approve_models_for_publishing_with_http_info( returns the request thread. """ - all_params = ["model_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['model_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method approve_models_for_publishing" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'model_ids' is set - if "model_ids" not in params or params["model_ids"] is None: - raise ValueError( - "Missing the required parameter `model_ids` when calling `approve_models_for_publishing`" - ) + if ('model_ids' not in params or + params['model_ids'] is None): + raise ValueError("Missing the required parameter `model_ids` when calling `approve_models_for_publishing`") # noqa: E501 collection_formats = {} @@ -111,14 +104,13 @@ def approve_models_for_publishing_with_http_info( local_var_files = {} body_params = None - if "model_ids" in params: - body_params = params["model_ids"] + if 'model_ids' in params: + body_params = params['model_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/publish_approved", - "POST", + '/models/publish_approved', 'POST', path_params, query_params, header_params, @@ -127,12 +119,11 @@ def approve_models_for_publishing_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def create_model(self, body, **kwargs): # noqa: E501 """create_model # noqa: E501 @@ -148,11 +139,11 @@ def create_model(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_model_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_model_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_model_with_http_info(body, **kwargs) + (data) = self.create_model_with_http_info(body, **kwargs) # noqa: E501 return data def create_model_with_http_info(self, body, **kwargs): # noqa: E501 @@ -170,26 +161,25 @@ def create_model_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_model" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_model`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_model`") # noqa: E501 collection_formats = {} @@ -203,28 +193,26 @@ def create_model_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models", - "POST", + '/models', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiModel", # noqa: E501 + response_type='ApiModel', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_model(self, id, **kwargs): # noqa: E501 """delete_model # noqa: E501 @@ -240,11 +228,11 @@ def delete_model(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_model_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_model_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_model_with_http_info(id, **kwargs) + (data) = self.delete_model_with_http_info(id, **kwargs) # noqa: E501 return data def delete_model_with_http_info(self, id, **kwargs): # noqa: E501 @@ -262,32 +250,31 @@ def delete_model_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_model" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_model`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_model`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -301,8 +288,7 @@ def delete_model_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}", - "DELETE", + '/models/{id}', 'DELETE', path_params, query_params, header_params, @@ -311,12 +297,11 @@ def delete_model_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def download_model_files(self, id, **kwargs): # noqa: E501 """Returns the model artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 @@ -333,13 +318,11 @@ def download_model_files(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.download_model_files_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_model_files_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.download_model_files_with_http_info( - id, **kwargs - ) + (data) = self.download_model_files_with_http_info(id, **kwargs) # noqa: E501 return data def download_model_files_with_http_info(self, id, **kwargs): # noqa: E501 @@ -358,38 +341,35 @@ def download_model_files_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "include_generated_code"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'include_generated_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_model_files" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `download_model_files`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `download_model_files`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "include_generated_code" in params: - query_params.append( - ("include_generated_code", params["include_generated_code"]) - ) + if 'include_generated_code' in params: + query_params.append(('include_generated_code', params['include_generated_code'])) # noqa: E501 header_params = {} @@ -398,30 +378,27 @@ def download_model_files_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/gzip"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/gzip']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}/download", - "GET", + '/models/{id}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="file", # noqa: E501 + response_type='file', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", False), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', False), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def generate_model_code(self, id, **kwargs): # noqa: E501 """generate_model_code # noqa: E501 @@ -437,11 +414,11 @@ def generate_model_code(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.generate_model_code_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_model_code_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.generate_model_code_with_http_info(id, **kwargs) + (data) = self.generate_model_code_with_http_info(id, **kwargs) # noqa: E501 return data def generate_model_code_with_http_info(self, id, **kwargs): # noqa: E501 @@ -459,32 +436,31 @@ def generate_model_code_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method generate_model_code" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `generate_model_code`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `generate_model_code`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -498,22 +474,20 @@ def generate_model_code_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}/generate_code", - "GET", + '/models/{id}/generate_code', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGenerateModelCodeResponse", # noqa: E501 + response_type='ApiGenerateModelCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_model(self, id, **kwargs): # noqa: E501 """get_model # noqa: E501 @@ -529,11 +503,11 @@ def get_model(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_model_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_model_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_model_with_http_info(id, **kwargs) + (data) = self.get_model_with_http_info(id, **kwargs) # noqa: E501 return data def get_model_with_http_info(self, id, **kwargs): # noqa: E501 @@ -551,32 +525,31 @@ def get_model_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_model" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_model`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_model`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -590,22 +563,20 @@ def get_model_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}", - "GET", + '/models/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiModel", # noqa: E501 + response_type='ApiModel', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_model_template(self, id, **kwargs): # noqa: E501 """get_model_template # noqa: E501 @@ -621,11 +592,11 @@ def get_model_template(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_model_template_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_model_template_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_model_template_with_http_info(id, **kwargs) + (data) = self.get_model_template_with_http_info(id, **kwargs) # noqa: E501 return data def get_model_template_with_http_info(self, id, **kwargs): # noqa: E501 @@ -643,32 +614,31 @@ def get_model_template_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_model_template" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_model_template`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_model_template`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -682,22 +652,20 @@ def get_model_template_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}/templates", - "GET", + '/models/{id}/templates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGetTemplateResponse", # noqa: E501 + response_type='ApiGetTemplateResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_models(self, **kwargs): # noqa: E501 """list_models # noqa: E501 @@ -716,11 +684,11 @@ def list_models(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_models_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_models_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_models_with_http_info(**kwargs) + (data) = self.list_models_with_http_info(**kwargs) # noqa: E501 return data def list_models_with_http_info(self, **kwargs): # noqa: E501 @@ -741,35 +709,35 @@ def list_models_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_models" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -781,22 +749,20 @@ def list_models_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models", - "GET", + '/models', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListModelsResponse", # noqa: E501 + response_type='ApiListModelsResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_model(self, id, pipeline_stage, execution_platform, **kwargs): # noqa: E501 """run_model # noqa: E501 @@ -816,20 +782,14 @@ def run_model(self, id, pipeline_stage, execution_platform, **kwargs): # noqa: If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_model_with_http_info( - id, pipeline_stage, execution_platform, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_model_with_http_info(id, pipeline_stage, execution_platform, **kwargs) # noqa: E501 else: - (data) = self.run_model_with_http_info( - id, pipeline_stage, execution_platform, **kwargs - ) + (data) = self.run_model_with_http_info(id, pipeline_stage, execution_platform, **kwargs) # noqa: E501 return data - def run_model_with_http_info( - self, id, pipeline_stage, execution_platform, **kwargs - ): # noqa: E501 + def run_model_with_http_info(self, id, pipeline_stage, execution_platform, **kwargs): # noqa: E501 """run_model # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -848,60 +808,47 @@ def run_model_with_http_info( returns the request thread. """ - all_params = [ - "id", - "pipeline_stage", - "execution_platform", - "run_name", - "parameters", - ] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'pipeline_stage', 'execution_platform', 'run_name', 'parameters'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_model" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `run_model`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `run_model`") # noqa: E501 # verify the required parameter 'pipeline_stage' is set - if "pipeline_stage" not in params or params["pipeline_stage"] is None: - raise ValueError( - "Missing the required parameter `pipeline_stage` when calling `run_model`" - ) + if ('pipeline_stage' not in params or + params['pipeline_stage'] is None): + raise ValueError("Missing the required parameter `pipeline_stage` when calling `run_model`") # noqa: E501 # verify the required parameter 'execution_platform' is set - if "execution_platform" not in params or params["execution_platform"] is None: - raise ValueError( - "Missing the required parameter `execution_platform` when calling `run_model`" - ) + if ('execution_platform' not in params or + params['execution_platform'] is None): + raise ValueError("Missing the required parameter `execution_platform` when calling `run_model`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "pipeline_stage" in params: - query_params.append( - ("pipeline_stage", params["pipeline_stage"]) - ) - if "execution_platform" in params: - query_params.append( - ("execution_platform", params["execution_platform"]) - ) - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'pipeline_stage' in params: + query_params.append(('pipeline_stage', params['pipeline_stage'])) # noqa: E501 + if 'execution_platform' in params: + query_params.append(('execution_platform', params['execution_platform'])) # noqa: E501 + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -909,28 +856,26 @@ def run_model_with_http_info( local_var_files = {} body_params = None - if "parameters" in params: - body_params = params["parameters"] + if 'parameters' in params: + body_params = params['parameters'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}/run", - "POST", + '/models/{id}/run', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_featured_models(self, model_ids, **kwargs): # noqa: E501 """set_featured_models # noqa: E501 @@ -946,15 +891,11 @@ def set_featured_models(self, model_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_featured_models_with_http_info( - model_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_featured_models_with_http_info(model_ids, **kwargs) # noqa: E501 else: - (data) = self.set_featured_models_with_http_info( - model_ids, **kwargs - ) + (data) = self.set_featured_models_with_http_info(model_ids, **kwargs) # noqa: E501 return data def set_featured_models_with_http_info(self, model_ids, **kwargs): # noqa: E501 @@ -972,26 +913,25 @@ def set_featured_models_with_http_info(self, model_ids, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["model_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['model_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_featured_models" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'model_ids' is set - if "model_ids" not in params or params["model_ids"] is None: - raise ValueError( - "Missing the required parameter `model_ids` when calling `set_featured_models`" - ) + if ('model_ids' not in params or + params['model_ids'] is None): + raise ValueError("Missing the required parameter `model_ids` when calling `set_featured_models`") # noqa: E501 collection_formats = {} @@ -1005,14 +945,13 @@ def set_featured_models_with_http_info(self, model_ids, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "model_ids" in params: - body_params = params["model_ids"] + if 'model_ids' in params: + body_params = params['model_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/featured", - "POST", + '/models/featured', 'POST', path_params, query_params, header_params, @@ -1021,12 +960,11 @@ def set_featured_models_with_http_info(self, model_ids, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_model(self, uploadfile, **kwargs): # noqa: E501 """upload_model # noqa: E501 @@ -1043,13 +981,11 @@ def upload_model(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_model_with_http_info(uploadfile, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_model_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_model_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_model_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_model_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -1068,75 +1004,68 @@ def upload_model_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_model" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_model`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_model`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/upload", - "POST", + '/models/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiModel", # noqa: E501 + response_type='ApiModel', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_model_file(self, id, uploadfile, **kwargs): # noqa: E501 """upload_model_file # noqa: E501 @@ -1153,15 +1082,11 @@ def upload_model_file(self, id, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_model_file_with_http_info( - id, uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_model_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_model_file_with_http_info( - id, uploadfile, **kwargs - ) + (data) = self.upload_model_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 return data def upload_model_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E501 @@ -1180,37 +1105,35 @@ def upload_model_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E returns the request thread. """ - all_params = ["id", "uploadfile"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'uploadfile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_model_file" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `upload_model_file`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `upload_model_file`") # noqa: E501 # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_model_file`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_model_file`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -1218,42 +1141,36 @@ def upload_model_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/{id}/upload", - "POST", + '/models/{id}/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiModel", # noqa: E501 + response_type='ApiModel', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_model_from_url(self, url, **kwargs): # noqa: E501 """upload_model_from_url # noqa: E501 @@ -1271,15 +1188,11 @@ def upload_model_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_model_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_model_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_model_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_model_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_model_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -1299,74 +1212,67 @@ def upload_model_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "name", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'name', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_model_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_model_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_model_from_url`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/models/upload_from_url", - "POST", + '/models/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiModel", # noqa: E501 + response_type='ApiModel', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/notebook_service_api.py b/api/client/swagger_client/api/notebook_service_api.py index f900a992..05722971 100644 --- a/api/client/swagger_client/api/notebook_service_api.py +++ b/api/client/swagger_client/api/notebook_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,20 +50,14 @@ def approve_notebooks_for_publishing(self, notebook_ids, **kwargs): # noqa: E50 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.approve_notebooks_for_publishing_with_http_info( - notebook_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.approve_notebooks_for_publishing_with_http_info(notebook_ids, **kwargs) # noqa: E501 else: - (data) = self.approve_notebooks_for_publishing_with_http_info( - notebook_ids, **kwargs - ) + (data) = self.approve_notebooks_for_publishing_with_http_info(notebook_ids, **kwargs) # noqa: E501 return data - def approve_notebooks_for_publishing_with_http_info( - self, notebook_ids, **kwargs - ): # noqa: E501 + def approve_notebooks_for_publishing_with_http_info(self, notebook_ids, **kwargs): # noqa: E501 """approve_notebooks_for_publishing # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -78,26 +72,25 @@ def approve_notebooks_for_publishing_with_http_info( returns the request thread. """ - all_params = ["notebook_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['notebook_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method approve_notebooks_for_publishing" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'notebook_ids' is set - if "notebook_ids" not in params or params["notebook_ids"] is None: - raise ValueError( - "Missing the required parameter `notebook_ids` when calling `approve_notebooks_for_publishing`" - ) + if ('notebook_ids' not in params or + params['notebook_ids'] is None): + raise ValueError("Missing the required parameter `notebook_ids` when calling `approve_notebooks_for_publishing`") # noqa: E501 collection_formats = {} @@ -111,14 +104,13 @@ def approve_notebooks_for_publishing_with_http_info( local_var_files = {} body_params = None - if "notebook_ids" in params: - body_params = params["notebook_ids"] + if 'notebook_ids' in params: + body_params = params['notebook_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/publish_approved", - "POST", + '/notebooks/publish_approved', 'POST', path_params, query_params, header_params, @@ -127,12 +119,11 @@ def approve_notebooks_for_publishing_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def create_notebook(self, body, **kwargs): # noqa: E501 """create_notebook # noqa: E501 @@ -148,11 +139,11 @@ def create_notebook(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_notebook_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_notebook_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_notebook_with_http_info(body, **kwargs) + (data) = self.create_notebook_with_http_info(body, **kwargs) # noqa: E501 return data def create_notebook_with_http_info(self, body, **kwargs): # noqa: E501 @@ -170,26 +161,25 @@ def create_notebook_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_notebook" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_notebook`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_notebook`") # noqa: E501 collection_formats = {} @@ -203,28 +193,26 @@ def create_notebook_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks", - "POST", + '/notebooks', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiNotebook", # noqa: E501 + response_type='ApiNotebook', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_notebook(self, id, **kwargs): # noqa: E501 """delete_notebook # noqa: E501 @@ -240,11 +228,11 @@ def delete_notebook(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_notebook_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notebook_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_notebook_with_http_info(id, **kwargs) + (data) = self.delete_notebook_with_http_info(id, **kwargs) # noqa: E501 return data def delete_notebook_with_http_info(self, id, **kwargs): # noqa: E501 @@ -262,32 +250,31 @@ def delete_notebook_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_notebook" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_notebook`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notebook`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -301,8 +288,7 @@ def delete_notebook_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}", - "DELETE", + '/notebooks/{id}', 'DELETE', path_params, query_params, header_params, @@ -311,12 +297,11 @@ def delete_notebook_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def download_notebook_files(self, id, **kwargs): # noqa: E501 """Returns the notebook artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 @@ -333,15 +318,11 @@ def download_notebook_files(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.download_notebook_files_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_notebook_files_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.download_notebook_files_with_http_info( - id, **kwargs - ) + (data) = self.download_notebook_files_with_http_info(id, **kwargs) # noqa: E501 return data def download_notebook_files_with_http_info(self, id, **kwargs): # noqa: E501 @@ -360,38 +341,35 @@ def download_notebook_files_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "include_generated_code"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'include_generated_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_notebook_files" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `download_notebook_files`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `download_notebook_files`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "include_generated_code" in params: - query_params.append( - ("include_generated_code", params["include_generated_code"]) - ) + if 'include_generated_code' in params: + query_params.append(('include_generated_code', params['include_generated_code'])) # noqa: E501 header_params = {} @@ -400,30 +378,27 @@ def download_notebook_files_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/gzip"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/gzip']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}/download", - "GET", + '/notebooks/{id}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="file", # noqa: E501 + response_type='file', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", False), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', False), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def generate_notebook_code(self, id, **kwargs): # noqa: E501 """generate_notebook_code # noqa: E501 @@ -440,15 +415,11 @@ def generate_notebook_code(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.generate_notebook_code_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_notebook_code_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.generate_notebook_code_with_http_info( - id, **kwargs - ) + (data) = self.generate_notebook_code_with_http_info(id, **kwargs) # noqa: E501 return data def generate_notebook_code_with_http_info(self, id, **kwargs): # noqa: E501 @@ -467,32 +438,31 @@ def generate_notebook_code_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method generate_notebook_code" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `generate_notebook_code`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `generate_notebook_code`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -506,22 +476,20 @@ def generate_notebook_code_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}/generate_code", - "GET", + '/notebooks/{id}/generate_code', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGenerateCodeResponse", # noqa: E501 + response_type='ApiGenerateCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_notebook(self, id, **kwargs): # noqa: E501 """get_notebook # noqa: E501 @@ -537,11 +505,11 @@ def get_notebook(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_notebook_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notebook_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_notebook_with_http_info(id, **kwargs) + (data) = self.get_notebook_with_http_info(id, **kwargs) # noqa: E501 return data def get_notebook_with_http_info(self, id, **kwargs): # noqa: E501 @@ -559,32 +527,31 @@ def get_notebook_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_notebook" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_notebook`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notebook`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -598,22 +565,20 @@ def get_notebook_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}", - "GET", + '/notebooks/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiNotebook", # noqa: E501 + response_type='ApiNotebook', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_notebook_template(self, id, **kwargs): # noqa: E501 """get_notebook_template # noqa: E501 @@ -629,13 +594,11 @@ def get_notebook_template(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_notebook_template_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notebook_template_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_notebook_template_with_http_info( - id, **kwargs - ) + (data) = self.get_notebook_template_with_http_info(id, **kwargs) # noqa: E501 return data def get_notebook_template_with_http_info(self, id, **kwargs): # noqa: E501 @@ -653,32 +616,31 @@ def get_notebook_template_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_notebook_template" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_notebook_template`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notebook_template`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -692,22 +654,20 @@ def get_notebook_template_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}/templates", - "GET", + '/notebooks/{id}/templates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGetTemplateResponse", # noqa: E501 + response_type='ApiGetTemplateResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_notebooks(self, **kwargs): # noqa: E501 """list_notebooks # noqa: E501 @@ -726,11 +686,11 @@ def list_notebooks(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_notebooks_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_notebooks_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_notebooks_with_http_info(**kwargs) + (data) = self.list_notebooks_with_http_info(**kwargs) # noqa: E501 return data def list_notebooks_with_http_info(self, **kwargs): # noqa: E501 @@ -751,35 +711,35 @@ def list_notebooks_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_notebooks" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -791,22 +751,20 @@ def list_notebooks_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks", - "GET", + '/notebooks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListNotebooksResponse", # noqa: E501 + response_type='ApiListNotebooksResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_notebook(self, id, **kwargs): # noqa: E501 """run_notebook # noqa: E501 @@ -824,11 +782,11 @@ def run_notebook(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_notebook_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_notebook_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.run_notebook_with_http_info(id, **kwargs) + (data) = self.run_notebook_with_http_info(id, **kwargs) # noqa: E501 return data def run_notebook_with_http_info(self, id, **kwargs): # noqa: E501 @@ -848,36 +806,35 @@ def run_notebook_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "run_name", "parameters"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'run_name', 'parameters'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_notebook" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `run_notebook`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `run_notebook`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -885,28 +842,26 @@ def run_notebook_with_http_info(self, id, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "parameters" in params: - body_params = params["parameters"] + if 'parameters' in params: + body_params = params['parameters'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}/run", - "POST", + '/notebooks/{id}/run', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_featured_notebooks(self, notebook_ids, **kwargs): # noqa: E501 """set_featured_notebooks # noqa: E501 @@ -922,20 +877,14 @@ def set_featured_notebooks(self, notebook_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_featured_notebooks_with_http_info( - notebook_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_featured_notebooks_with_http_info(notebook_ids, **kwargs) # noqa: E501 else: - (data) = self.set_featured_notebooks_with_http_info( - notebook_ids, **kwargs - ) + (data) = self.set_featured_notebooks_with_http_info(notebook_ids, **kwargs) # noqa: E501 return data - def set_featured_notebooks_with_http_info( - self, notebook_ids, **kwargs - ): # noqa: E501 + def set_featured_notebooks_with_http_info(self, notebook_ids, **kwargs): # noqa: E501 """set_featured_notebooks # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -950,26 +899,25 @@ def set_featured_notebooks_with_http_info( returns the request thread. """ - all_params = ["notebook_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['notebook_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_featured_notebooks" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'notebook_ids' is set - if "notebook_ids" not in params or params["notebook_ids"] is None: - raise ValueError( - "Missing the required parameter `notebook_ids` when calling `set_featured_notebooks`" - ) + if ('notebook_ids' not in params or + params['notebook_ids'] is None): + raise ValueError("Missing the required parameter `notebook_ids` when calling `set_featured_notebooks`") # noqa: E501 collection_formats = {} @@ -983,14 +931,13 @@ def set_featured_notebooks_with_http_info( local_var_files = {} body_params = None - if "notebook_ids" in params: - body_params = params["notebook_ids"] + if 'notebook_ids' in params: + body_params = params['notebook_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/featured", - "POST", + '/notebooks/featured', 'POST', path_params, query_params, header_params, @@ -999,12 +946,11 @@ def set_featured_notebooks_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_notebook(self, uploadfile, **kwargs): # noqa: E501 """upload_notebook # noqa: E501 @@ -1022,15 +968,11 @@ def upload_notebook(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_notebook_with_http_info( - uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_notebook_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_notebook_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_notebook_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_notebook_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -1050,79 +992,70 @@ def upload_notebook_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name", "enterprise_github_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name', 'enterprise_github_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_notebook" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_notebook`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_notebook`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 - if "enterprise_github_token" in params: - form_params.append( - ("enterprise_github_token", params["enterprise_github_token"]) - ) + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 + if 'enterprise_github_token' in params: + form_params.append(('enterprise_github_token', params['enterprise_github_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/upload", - "POST", + '/notebooks/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiNotebook", # noqa: E501 + response_type='ApiNotebook', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_notebook_file(self, id, uploadfile, **kwargs): # noqa: E501 """upload_notebook_file # noqa: E501 @@ -1139,20 +1072,14 @@ def upload_notebook_file(self, id, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_notebook_file_with_http_info( - id, uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_notebook_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_notebook_file_with_http_info( - id, uploadfile, **kwargs - ) + (data) = self.upload_notebook_file_with_http_info(id, uploadfile, **kwargs) # noqa: E501 return data - def upload_notebook_file_with_http_info( - self, id, uploadfile, **kwargs - ): # noqa: E501 + def upload_notebook_file_with_http_info(self, id, uploadfile, **kwargs): # noqa: E501 """upload_notebook_file # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1168,37 +1095,35 @@ def upload_notebook_file_with_http_info( returns the request thread. """ - all_params = ["id", "uploadfile"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'uploadfile'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_notebook_file" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `upload_notebook_file`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `upload_notebook_file`") # noqa: E501 # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_notebook_file`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_notebook_file`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -1206,42 +1131,36 @@ def upload_notebook_file_with_http_info( form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/{id}/upload", - "POST", + '/notebooks/{id}/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiNotebook", # noqa: E501 + response_type='ApiNotebook', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_notebook_from_url(self, url, **kwargs): # noqa: E501 """upload_notebook_from_url # noqa: E501 @@ -1259,15 +1178,11 @@ def upload_notebook_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_notebook_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_notebook_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_notebook_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_notebook_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_notebook_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -1287,74 +1202,67 @@ def upload_notebook_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "name", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'name', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_notebook_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_notebook_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_notebook_from_url`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/notebooks/upload_from_url", - "POST", + '/notebooks/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiNotebook", # noqa: E501 + response_type='ApiNotebook', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api/pipeline_service_api.py b/api/client/swagger_client/api/pipeline_service_api.py index 5a0bbd7a..06fe670f 100644 --- a/api/client/swagger_client/api/pipeline_service_api.py +++ b/api/client/swagger_client/api/pipeline_service_api.py @@ -19,7 +19,7 @@ import re # noqa: F401 # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from swagger_client.api_client import ApiClient @@ -50,20 +50,14 @@ def approve_pipelines_for_publishing(self, pipeline_ids, **kwargs): # noqa: E50 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.approve_pipelines_for_publishing_with_http_info( - pipeline_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.approve_pipelines_for_publishing_with_http_info(pipeline_ids, **kwargs) # noqa: E501 else: - (data) = self.approve_pipelines_for_publishing_with_http_info( - pipeline_ids, **kwargs - ) + (data) = self.approve_pipelines_for_publishing_with_http_info(pipeline_ids, **kwargs) # noqa: E501 return data - def approve_pipelines_for_publishing_with_http_info( - self, pipeline_ids, **kwargs - ): # noqa: E501 + def approve_pipelines_for_publishing_with_http_info(self, pipeline_ids, **kwargs): # noqa: E501 """approve_pipelines_for_publishing # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -78,26 +72,25 @@ def approve_pipelines_for_publishing_with_http_info( returns the request thread. """ - all_params = ["pipeline_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['pipeline_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method approve_pipelines_for_publishing" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'pipeline_ids' is set - if "pipeline_ids" not in params or params["pipeline_ids"] is None: - raise ValueError( - "Missing the required parameter `pipeline_ids` when calling `approve_pipelines_for_publishing`" - ) + if ('pipeline_ids' not in params or + params['pipeline_ids'] is None): + raise ValueError("Missing the required parameter `pipeline_ids` when calling `approve_pipelines_for_publishing`") # noqa: E501 collection_formats = {} @@ -111,14 +104,13 @@ def approve_pipelines_for_publishing_with_http_info( local_var_files = {} body_params = None - if "pipeline_ids" in params: - body_params = params["pipeline_ids"] + if 'pipeline_ids' in params: + body_params = params['pipeline_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/publish_approved", - "POST", + '/pipelines/publish_approved', 'POST', path_params, query_params, header_params, @@ -127,12 +119,11 @@ def approve_pipelines_for_publishing_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def create_pipeline(self, body, **kwargs): # noqa: E501 """create_pipeline # noqa: E501 @@ -148,11 +139,11 @@ def create_pipeline(self, body, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_pipeline_with_http_info(body, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_pipeline_with_http_info(body, **kwargs) # noqa: E501 else: - (data) = self.create_pipeline_with_http_info(body, **kwargs) + (data) = self.create_pipeline_with_http_info(body, **kwargs) # noqa: E501 return data def create_pipeline_with_http_info(self, body, **kwargs): # noqa: E501 @@ -170,26 +161,25 @@ def create_pipeline_with_http_info(self, body, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError( - "Missing the required parameter `body` when calling `create_pipeline`" - ) + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_pipeline`") # noqa: E501 collection_formats = {} @@ -203,28 +193,26 @@ def create_pipeline_with_http_info(self, body, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "body" in params: - body_params = params["body"] + if 'body' in params: + body_params = params['body'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines", - "POST", + '/pipelines', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiPipeline", # noqa: E501 + response_type='ApiPipeline', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def delete_pipeline(self, id, **kwargs): # noqa: E501 """delete_pipeline # noqa: E501 @@ -240,11 +228,11 @@ def delete_pipeline(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_pipeline_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_pipeline_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.delete_pipeline_with_http_info(id, **kwargs) + (data) = self.delete_pipeline_with_http_info(id, **kwargs) # noqa: E501 return data def delete_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 @@ -262,32 +250,31 @@ def delete_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `delete_pipeline`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_pipeline`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -301,8 +288,7 @@ def delete_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/{id}", - "DELETE", + '/pipelines/{id}', 'DELETE', path_params, query_params, header_params, @@ -311,12 +297,11 @@ def delete_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def download_pipeline_files(self, id, **kwargs): # noqa: E501 """Returns the pipeline YAML compressed into a .tgz (.tar.gz) file. # noqa: E501 @@ -332,15 +317,11 @@ def download_pipeline_files(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.download_pipeline_files_with_http_info( - id, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_pipeline_files_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.download_pipeline_files_with_http_info( - id, **kwargs - ) + (data) = self.download_pipeline_files_with_http_info(id, **kwargs) # noqa: E501 return data def download_pipeline_files_with_http_info(self, id, **kwargs): # noqa: E501 @@ -358,32 +339,31 @@ def download_pipeline_files_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_pipeline_files" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `download_pipeline_files`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `download_pipeline_files`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -394,30 +374,27 @@ def download_pipeline_files_with_http_info(self, id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/gzip"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/gzip']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/{id}/download", - "GET", + '/pipelines/{id}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="file", # noqa: E501 + response_type='file', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", False), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', False), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_pipeline(self, id, **kwargs): # noqa: E501 """get_pipeline # noqa: E501 @@ -433,11 +410,11 @@ def get_pipeline(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_pipeline_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_pipeline_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_pipeline_with_http_info(id, **kwargs) + (data) = self.get_pipeline_with_http_info(id, **kwargs) # noqa: E501 return data def get_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 @@ -455,32 +432,31 @@ def get_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_pipeline`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_pipeline`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -494,22 +470,20 @@ def get_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/{id}", - "GET", + '/pipelines/{id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiPipelineExtended", # noqa: E501 + response_type='ApiPipelineExtended', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def get_template(self, id, **kwargs): # noqa: E501 """get_template # noqa: E501 @@ -525,11 +499,11 @@ def get_template(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_template_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_template_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.get_template_with_http_info(id, **kwargs) + (data) = self.get_template_with_http_info(id, **kwargs) # noqa: E501 return data def get_template_with_http_info(self, id, **kwargs): # noqa: E501 @@ -547,32 +521,31 @@ def get_template_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_template" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `get_template`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_template`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] @@ -586,22 +559,20 @@ def get_template_with_http_info(self, id, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/{id}/templates", - "GET", + '/pipelines/{id}/templates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiGetTemplateResponse", # noqa: E501 + response_type='ApiGetTemplateResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def list_pipelines(self, **kwargs): # noqa: E501 """list_pipelines # noqa: E501 @@ -620,11 +591,11 @@ def list_pipelines(self, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_pipelines_with_http_info(**kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_pipelines_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.list_pipelines_with_http_info(**kwargs) + (data) = self.list_pipelines_with_http_info(**kwargs) # noqa: E501 return data def list_pipelines_with_http_info(self, **kwargs): # noqa: E501 @@ -645,35 +616,35 @@ def list_pipelines_with_http_info(self, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["page_token", "page_size", "sort_by", "filter"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['page_token', 'page_size', 'sort_by', 'filter'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_pipelines" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] collection_formats = {} path_params = {} query_params = [] - if "page_token" in params: - query_params.append(("page_token", params["page_token"])) - if "page_size" in params: - query_params.append(("page_size", params["page_size"])) - if "sort_by" in params: - query_params.append(("sort_by", params["sort_by"])) - if "filter" in params: - query_params.append(("filter", params["filter"])) + if 'page_token' in params: + query_params.append(('page_token', params['page_token'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('page_size', params['page_size'])) # noqa: E501 + if 'sort_by' in params: + query_params.append(('sort_by', params['sort_by'])) # noqa: E501 + if 'filter' in params: + query_params.append(('filter', params['filter'])) # noqa: E501 header_params = {} @@ -685,27 +656,25 @@ def list_pipelines_with_http_info(self, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines", - "GET", + '/pipelines', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiListPipelinesResponse", # noqa: E501 + response_type='ApiListPipelinesResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_custom_pipeline(self, run_custom_pipeline_payload, **kwargs): # noqa: E501 """run_custom_pipeline # noqa: E501 - Run a complex pipeline defined by a directed acyclic graph (DAG) + Run a complex pipeline defined by a directed acyclic graph (DAG) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.run_custom_pipeline(run_custom_pipeline_payload, async_req=True) @@ -718,23 +687,17 @@ def run_custom_pipeline(self, run_custom_pipeline_payload, **kwargs): # noqa: E If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_custom_pipeline_with_http_info( - run_custom_pipeline_payload, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_custom_pipeline_with_http_info(run_custom_pipeline_payload, **kwargs) # noqa: E501 else: - (data) = self.run_custom_pipeline_with_http_info( - run_custom_pipeline_payload, **kwargs - ) + (data) = self.run_custom_pipeline_with_http_info(run_custom_pipeline_payload, **kwargs) # noqa: E501 return data - def run_custom_pipeline_with_http_info( - self, run_custom_pipeline_payload, **kwargs - ): # noqa: E501 + def run_custom_pipeline_with_http_info(self, run_custom_pipeline_payload, **kwargs): # noqa: E501 """run_custom_pipeline # noqa: E501 - Run a complex pipeline defined by a directed acyclic graph (DAG) + Run a complex pipeline defined by a directed acyclic graph (DAG) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.run_custom_pipeline_with_http_info(run_custom_pipeline_payload, async_req=True) @@ -748,37 +711,33 @@ def run_custom_pipeline_with_http_info( returns the request thread. """ - all_params = ["run_custom_pipeline_payload", "run_name"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['run_custom_pipeline_payload', 'run_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_custom_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'run_custom_pipeline_payload' is set - if ( - "run_custom_pipeline_payload" not in params - or params["run_custom_pipeline_payload"] is None - ): - raise ValueError( - "Missing the required parameter `run_custom_pipeline_payload` when calling `run_custom_pipeline`" - ) + if ('run_custom_pipeline_payload' not in params or + params['run_custom_pipeline_payload'] is None): + raise ValueError("Missing the required parameter `run_custom_pipeline_payload` when calling `run_custom_pipeline`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -786,35 +745,30 @@ def run_custom_pipeline_with_http_info( local_var_files = {} body_params = None - if "run_custom_pipeline_payload" in params: - body_params = params["run_custom_pipeline_payload"] + if 'run_custom_pipeline_payload' in params: + body_params = params['run_custom_pipeline_payload'] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/run_custom_pipeline", - "POST", + '/pipelines/run_custom_pipeline', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def run_pipeline(self, id, **kwargs): # noqa: E501 """run_pipeline # noqa: E501 @@ -832,11 +786,11 @@ def run_pipeline(self, id, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.run_pipeline_with_http_info(id, **kwargs) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.run_pipeline_with_http_info(id, **kwargs) # noqa: E501 else: - (data) = self.run_pipeline_with_http_info(id, **kwargs) + (data) = self.run_pipeline_with_http_info(id, **kwargs) # noqa: E501 return data def run_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 @@ -856,36 +810,35 @@ def run_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["id", "run_name", "parameters"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['id', 'run_name', 'parameters'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method run_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'id' is set - if "id" not in params or params["id"] is None: - raise ValueError( - "Missing the required parameter `id` when calling `run_pipeline`" - ) + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `run_pipeline`") # noqa: E501 collection_formats = {} path_params = {} - if "id" in params: - path_params["id"] = params["id"] # noqa: E501 + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 query_params = [] - if "run_name" in params: - query_params.append(("run_name", params["run_name"])) + if 'run_name' in params: + query_params.append(('run_name', params['run_name'])) # noqa: E501 header_params = {} @@ -893,35 +846,30 @@ def run_pipeline_with_http_info(self, id, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if "parameters" in params: - body_params = params["parameters"] + if 'parameters' in params: + body_params = params['parameters'] # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/{id}/run", - "POST", + '/pipelines/{id}/run', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiRunCodeResponse", # noqa: E501 + response_type='ApiRunCodeResponse', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def set_featured_pipelines(self, pipeline_ids, **kwargs): # noqa: E501 """set_featured_pipelines # noqa: E501 @@ -937,20 +885,14 @@ def set_featured_pipelines(self, pipeline_ids, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.set_featured_pipelines_with_http_info( - pipeline_ids, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_featured_pipelines_with_http_info(pipeline_ids, **kwargs) # noqa: E501 else: - (data) = self.set_featured_pipelines_with_http_info( - pipeline_ids, **kwargs - ) + (data) = self.set_featured_pipelines_with_http_info(pipeline_ids, **kwargs) # noqa: E501 return data - def set_featured_pipelines_with_http_info( - self, pipeline_ids, **kwargs - ): # noqa: E501 + def set_featured_pipelines_with_http_info(self, pipeline_ids, **kwargs): # noqa: E501 """set_featured_pipelines # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -965,26 +907,25 @@ def set_featured_pipelines_with_http_info( returns the request thread. """ - all_params = ["pipeline_ids"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['pipeline_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method set_featured_pipelines" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'pipeline_ids' is set - if "pipeline_ids" not in params or params["pipeline_ids"] is None: - raise ValueError( - "Missing the required parameter `pipeline_ids` when calling `set_featured_pipelines`" - ) + if ('pipeline_ids' not in params or + params['pipeline_ids'] is None): + raise ValueError("Missing the required parameter `pipeline_ids` when calling `set_featured_pipelines`") # noqa: E501 collection_formats = {} @@ -998,14 +939,13 @@ def set_featured_pipelines_with_http_info( local_var_files = {} body_params = None - if "pipeline_ids" in params: - body_params = params["pipeline_ids"] + if 'pipeline_ids' in params: + body_params = params['pipeline_ids'] # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/featured", - "POST", + '/pipelines/featured', 'POST', path_params, query_params, header_params, @@ -1014,12 +954,11 @@ def set_featured_pipelines_with_http_info( files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_pipeline(self, uploadfile, **kwargs): # noqa: E501 """upload_pipeline # noqa: E501 @@ -1038,15 +977,11 @@ def upload_pipeline(self, uploadfile, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_pipeline_with_http_info( - uploadfile, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_pipeline_with_http_info(uploadfile, **kwargs) # noqa: E501 else: - (data) = self.upload_pipeline_with_http_info( - uploadfile, **kwargs - ) + (data) = self.upload_pipeline_with_http_info(uploadfile, **kwargs) # noqa: E501 return data def upload_pipeline_with_http_info(self, uploadfile, **kwargs): # noqa: E501 @@ -1067,79 +1002,72 @@ def upload_pipeline_with_http_info(self, uploadfile, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["uploadfile", "name", "description", "annotations"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['uploadfile', 'name', 'description', 'annotations'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_pipeline" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'uploadfile' is set - if "uploadfile" not in params or params["uploadfile"] is None: - raise ValueError( - "Missing the required parameter `uploadfile` when calling `upload_pipeline`" - ) + if ('uploadfile' not in params or + params['uploadfile'] is None): + raise ValueError("Missing the required parameter `uploadfile` when calling `upload_pipeline`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) - if "description" in params: - query_params.append(("description", params["description"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 + if 'description' in params: + query_params.append(('description', params['description'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "uploadfile" in params: - local_var_files["uploadfile"] = params["uploadfile"] # noqa: E501 - if "annotations" in params: - form_params.append(("annotations", params["annotations"])) + if 'uploadfile' in params: + local_var_files['uploadfile'] = params['uploadfile'] # noqa: E501 + if 'annotations' in params: + form_params.append(('annotations', params['annotations'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/upload", - "POST", + '/pipelines/upload', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiPipelineExtended", # noqa: E501 + response_type='ApiPipelineExtended', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) def upload_pipeline_from_url(self, url, **kwargs): # noqa: E501 """upload_pipeline_from_url # noqa: E501 @@ -1157,15 +1085,11 @@ def upload_pipeline_from_url(self, url, **kwargs): # noqa: E501 If the method is called asynchronously, returns the request thread. """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.upload_pipeline_from_url_with_http_info( - url, **kwargs - ) + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.upload_pipeline_from_url_with_http_info(url, **kwargs) # noqa: E501 else: - (data) = self.upload_pipeline_from_url_with_http_info( - url, **kwargs - ) + (data) = self.upload_pipeline_from_url_with_http_info(url, **kwargs) # noqa: E501 return data def upload_pipeline_from_url_with_http_info(self, url, **kwargs): # noqa: E501 @@ -1185,74 +1109,67 @@ def upload_pipeline_from_url_with_http_info(self, url, **kwargs): # noqa: E501 returns the request thread. """ - all_params = ["url", "name", "access_token"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") + all_params = ['url', 'name', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') params = locals() - for key, val in six.iteritems(params["kwargs"]): + for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method upload_pipeline_from_url" % key ) params[key] = val - del params["kwargs"] + del params['kwargs'] # verify the required parameter 'url' is set - if "url" not in params or params["url"] is None: - raise ValueError( - "Missing the required parameter `url` when calling `upload_pipeline_from_url`" - ) + if ('url' not in params or + params['url'] is None): + raise ValueError("Missing the required parameter `url` when calling `upload_pipeline_from_url`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if "name" in params: - query_params.append(("name", params["name"])) + if 'name' in params: + query_params.append(('name', params['name'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} - if "url" in params: - form_params.append(("url", params["url"])) - if "access_token" in params: - form_params.append(("access_token", params["access_token"])) + if 'url' in params: + form_params.append(('url', params['url'])) # noqa: E501 + if 'access_token' in params: + form_params.append(('access_token', params['access_token'])) # noqa: E501 body_params = None # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - "Content-Type" - ] = self.api_client.select_header_content_type( # noqa: E501 - ["multipart/form-data"] - ) + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - "/pipelines/upload_from_url", - "POST", + '/pipelines/upload_from_url', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type="ApiPipeline", # noqa: E501 + response_type='ApiPipeline', # noqa: E501 auth_settings=auth_settings, - async_req=params.get("async_req"), - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/api/client/swagger_client/api_client.py b/api/client/swagger_client/api_client.py index 5f8090bc..d1301ef2 100644 --- a/api/client/swagger_client/api_client.py +++ b/api/client/swagger_client/api_client.py @@ -23,11 +23,11 @@ import tempfile # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from six.moves.urllib.parse import quote from swagger_client.configuration import Configuration -import swagger_client # noqa: F401.models +import swagger_client.models from swagger_client import rest @@ -53,19 +53,18 @@ class ApiClient(object): PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types NATIVE_TYPES_MAPPING = { - "int": int, - "long": int if six.PY3 else long, # noqa: F821 - "float": float, - "str": str, - "bool": bool, - "date": datetime.date, - "datetime": datetime.datetime, - "object": object, + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, } - def __init__( - self, configuration=None, header_name=None, header_value=None, cookie=None - ): + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): if configuration is None: configuration = Configuration() self.configuration = configuration @@ -78,7 +77,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "Swagger-Codegen/1.0.0/python" + self.user_agent = 'Swagger-Codegen/1.0.0/python' def __del__(self): if self._pool is not None: @@ -94,32 +93,21 @@ def pool(self): @property def user_agent(self): """User agent for this API client""" - return self.default_headers["User-Agent"] + return self.default_headers['User-Agent'] @user_agent.setter def user_agent(self, value): - self.default_headers["User-Agent"] = value + self.default_headers['User-Agent'] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - ): + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): config = self.configuration @@ -127,33 +115,36 @@ def __call_api( header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params["Cookie"] = self.cookie + header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict( - self.parameters_to_tuples(header_params, collection_formats) - ) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, collection_formats) + path_params = self.parameters_to_tuples(path_params, + collection_formats) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( - "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) ) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, collection_formats) + query_params = self.parameters_to_tuples(query_params, + collection_formats) # post parameters if post_params or files: post_params = self.prepare_post_parameters(post_params, files) post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) + post_params = self.parameters_to_tuples(post_params, + collection_formats) # auth setting self.update_params_for_auth(header_params, query_params, auth_settings) @@ -167,15 +158,10 @@ def __call_api( # perform request and return response response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) + _request_timeout=_request_timeout) self.last_response = response_data @@ -188,9 +174,10 @@ def __call_api( return_data = None if _return_http_data_only: - return return_data + return (return_data) else: - return (return_data, response_data.status, response_data.getheaders()) + return (return_data, response_data.status, + response_data.getheaders()) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -211,9 +198,11 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -225,16 +214,12 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = { - obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None - } + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} - return { - key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict) - } + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} def deserialize(self, response, response_type): """Deserializes response into an object. @@ -270,15 +255,15 @@ def __deserialize(self, data, klass): return None if type(klass) == str: - if klass.startswith("list["): - sub_kls = re.match(r"list\[(.*)\]", klass).group(1) - return [self.__deserialize(sub_data, sub_kls) for sub_data in data] + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] - if klass.startswith("dict("): - sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2) - return { - k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data) - } + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -297,24 +282,12 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - ): + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async request, set the async_req parameter. @@ -352,121 +325,78 @@ def call_api( then the method will return the response directly. """ if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - ) + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) else: - thread = self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - ), - ) + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) return thread - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "HEAD": - return self.rest_client.HEAD( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "OPTIONS": - return self.rest_client.OPTIONS( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "POST": - return self.rest_client.POST( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PUT": - return self.rest_client.PUT( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PATCH": - return self.rest_client.PATCH( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "DELETE": - return self.rest_client.DELETE( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) else: raise ValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," @@ -483,23 +413,22 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in ( - six.iteritems(params) if isinstance(params, dict) else params - ): # noqa: E501 + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] - if collection_format == "multi": + if collection_format == 'multi': new_params.extend((k, value) for value in v) else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(str(value) for value in v))) + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -522,14 +451,13 @@ def prepare_post_parameters(self, post_params=None, files=None): continue file_names = v if type(v) is list else [v] for n in file_names: - with open(n, "rb") as f: + with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = ( - mimetypes.guess_type(filename)[0] - or "application/octet-stream" - ) - params.append(tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -544,10 +472,10 @@ def select_header_accept(self, accepts): accepts = [x.lower() for x in accepts] - if "application/json" in accepts: - return "application/json" + if 'application/json' in accepts: + return 'application/json' else: - return ", ".join(accepts) + return ', '.join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -556,12 +484,12 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return "application/json" + return 'application/json' content_types = [x.lower() for x in content_types] - if "application/json" in content_types or "*/*" in content_types: - return "application/json" + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' else: return content_types[0] @@ -578,15 +506,15 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting["value"]: + if not auth_setting['value']: continue - elif auth_setting["in"] == "header": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - querys.append((auth_setting["key"], auth_setting["value"])) + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) else: raise ValueError( - "Authentication token must be in `query` or `header`" + 'Authentication token must be in `query` or `header`' ) def __deserialize_file(self, response): @@ -604,9 +532,8 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition - ).group(1) + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -644,13 +571,13 @@ def __deserialize_date(self, string): """ try: from dateutil.parser import parse - return parse(string).date() except ImportError: return string except ValueError: raise rest.ApiException( - status=0, reason="Failed to parse `{0}` as date object".format(string) + status=0, + reason="Failed to parse `{0}` as date object".format(string) ) def __deserialize_datatime(self, string): @@ -663,14 +590,16 @@ def __deserialize_datatime(self, string): """ try: from dateutil.parser import parse - return parse(string) except ImportError: return string except ValueError: raise rest.ApiException( status=0, - reason=("Failed to parse `{0}` as datetime object".format(string)), + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) ) def __hasattr(self, object, name): @@ -684,33 +613,28 @@ def __deserialize_model(self, data, klass): :return: model object. """ - if not klass.swagger_types and not self.__hasattr( - klass, "get_real_child_model" - ): + if (not klass.swagger_types and + not self.__hasattr(klass, 'get_real_child_model')): return data kwargs = {} if klass.swagger_types is not None: for attr, attr_type in six.iteritems(klass.swagger_types): - if ( - data is not None - and klass.attribute_map[attr] in data - and isinstance(data, (list, dict)) - ): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) instance = klass(**kwargs) - if ( - isinstance(instance, dict) - and klass.swagger_types is not None - and isinstance(data, dict) - ): + if (isinstance(instance, dict) and + klass.swagger_types is not None and + isinstance(data, dict)): for key, value in data.items(): if key not in klass.swagger_types: instance[key] = value - if self.__hasattr(instance, "get_real_child_model"): + if self.__hasattr(instance, 'get_real_child_model'): klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/api/client/swagger_client/configuration.py b/api/client/swagger_client/configuration.py index 3ff0d882..972d8de9 100644 --- a/api/client/swagger_client/configuration.py +++ b/api/client/swagger_client/configuration.py @@ -22,7 +22,7 @@ import sys import urllib3 -import six # noqa: F401 +import six from six.moves import http_client as httplib @@ -62,7 +62,7 @@ def __init__(self): self.logger["package_logger"] = logging.getLogger("swagger_client") self.logger["urllib3_logger"] = logging.getLogger("urllib3") # Log format - self.logger_format = "%(asctime)s %(levelname)s %(message)s" + self.logger_format = '%(asctime)s %(levelname)s %(message)s' # Log stream handler self.logger_stream_handler = None # Log file handler @@ -95,7 +95,7 @@ def __init__(self): # Proxy URL self.proxy = None # Safe chars for path_param - self.safe_chars_for_path_param = "" + self.safe_chars_for_path_param = '' @classmethod def set_default(cls, default): @@ -203,10 +203,9 @@ def get_api_key_with_prefix(self, identifier): :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ - if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): - return ( - self.api_key_prefix[identifier] + " " + self.api_key[identifier] - ) + if (self.api_key.get(identifier) and + self.api_key_prefix.get(identifier)): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 elif self.api_key.get(identifier): return self.api_key[identifier] @@ -216,25 +215,26 @@ def get_basic_auth_token(self): :return: The token for basic HTTP authentication. """ return urllib3.util.make_headers( - basic_auth=self.username + ":" + self.password - ).get("authorization") + basic_auth=self.username + ':' + self.password + ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - return {} + return { + + } def to_debug_report(self): """Gets the essential information for debugging. :return: The report for debugging. """ - return ( - "Python SDK Debug Report:\n" - "OS: {env}\n" - "Python Version: {pyversion}\n" - "Version of the API: 0.1.30-upload-catalog-from-url\n" - "SDK Package Version: 0.1.0".format(env=sys.platform, pyversion=sys.version) - ) + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.30-upload-catalog-from-url\n"\ + "SDK Package Version: 0.1.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/api/client/swagger_client/models/__init__.py b/api/client/swagger_client/models/__init__.py index e0d9725e..a158fbb7 100644 --- a/api/client/swagger_client/models/__init__.py +++ b/api/client/swagger_client/models/__init__.py @@ -25,25 +25,15 @@ from swagger_client.models.api_catalog_upload_item import ApiCatalogUploadItem from swagger_client.models.api_credential import ApiCredential from swagger_client.models.api_generate_code_response import ApiGenerateCodeResponse -from swagger_client.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) +from swagger_client.models.api_generate_model_code_response import ApiGenerateModelCodeResponse from swagger_client.models.api_get_template_response import ApiGetTemplateResponse from swagger_client.models.api_inferenceservice import ApiInferenceservice -from swagger_client.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_client.models.api_list_catalog_upload_errors import ( # noqa: F401 - ApiListCatalogUploadErrors, -) +from swagger_client.models.api_list_catalog_items_response import ApiListCatalogItemsResponse +from swagger_client.models.api_list_catalog_upload_errors import ApiListCatalogUploadErrors from swagger_client.models.api_list_components_response import ApiListComponentsResponse -from swagger_client.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) +from swagger_client.models.api_list_credentials_response import ApiListCredentialsResponse from swagger_client.models.api_list_datasets_response import ApiListDatasetsResponse -from swagger_client.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) +from swagger_client.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse from swagger_client.models.api_list_models_response import ApiListModelsResponse from swagger_client.models.api_list_notebooks_response import ApiListNotebooksResponse from swagger_client.models.api_list_pipelines_response import ApiListPipelinesResponse @@ -54,9 +44,7 @@ from swagger_client.models.api_parameter import ApiParameter from swagger_client.models.api_pipeline import ApiPipeline from swagger_client.models.api_pipeline_custom import ApiPipelineCustom -from swagger_client.models.api_pipeline_custom_run_payload import ( # noqa: F401 - ApiPipelineCustomRunPayload, -) +from swagger_client.models.api_pipeline_custom_run_payload import ApiPipelineCustomRunPayload from swagger_client.models.api_pipeline_dag import ApiPipelineDAG from swagger_client.models.api_pipeline_extension import ApiPipelineExtension from swagger_client.models.api_pipeline_inputs import ApiPipelineInputs @@ -64,7 +52,7 @@ from swagger_client.models.api_pipeline_task_arguments import ApiPipelineTaskArguments from swagger_client.models.api_run_code_response import ApiRunCodeResponse from swagger_client.models.api_settings import ApiSettings -from swagger_client.models.api_settings_section import ApiSettingsSection # noqa: F401 +from swagger_client.models.api_settings_section import ApiSettingsSection from swagger_client.models.api_status import ApiStatus from swagger_client.models.api_url import ApiUrl from swagger_client.models.dictionary import Dictionary diff --git a/api/client/swagger_client/models/any_value.py b/api/client/swagger_client/models/any_value.py index bcdf7f73..6c3b1192 100644 --- a/api/client/swagger_client/models/any_value.py +++ b/api/client/swagger_client/models/any_value.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class AnyValue(object): @@ -33,9 +33,11 @@ class AnyValue(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {} + swagger_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """AnyValue - a model defined in Swagger""" # noqa: E501 @@ -48,20 +50,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(AnyValue, dict): diff --git a/api/client/swagger_client/models/api_access_token.py b/api/client/swagger_client/models/api_access_token.py index 15528eb7..3bea5f88 100644 --- a/api/client/swagger_client/models/api_access_token.py +++ b/api/client/swagger_client/models/api_access_token.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiAccessToken(object): @@ -33,9 +33,15 @@ class ApiAccessToken(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"api_token": "str", "url_host": "str"} + swagger_types = { + 'api_token': 'str', + 'url_host': 'str' + } - attribute_map = {"api_token": "api_token", "url_host": "url_host"} + attribute_map = { + 'api_token': 'api_token', + 'url_host': 'url_host' + } def __init__(self, api_token=None, url_host=None): # noqa: E501 """ApiAccessToken - a model defined in Swagger""" # noqa: E501 @@ -68,9 +74,7 @@ def api_token(self, api_token): :type: str """ if api_token is None: - raise ValueError( - "Invalid value for `api_token`, must not be `None`" - ) + raise ValueError("Invalid value for `api_token`, must not be `None`") # noqa: E501 self._api_token = api_token @@ -95,9 +99,7 @@ def url_host(self, url_host): :type: str """ if url_host is None: - raise ValueError( - "Invalid value for `url_host`, must not be `None`" - ) + raise ValueError("Invalid value for `url_host`, must not be `None`") # noqa: E501 self._url_host = url_host @@ -108,20 +110,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiAccessToken, dict): diff --git a/api/client/swagger_client/models/api_asset.py b/api/client/swagger_client/models/api_asset.py index bcbe4355..2e2f45a6 100644 --- a/api/client/swagger_client/models/api_asset.py +++ b/api/client/swagger_client/models/api_asset.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiAsset(object): @@ -34,38 +34,28 @@ class ApiAsset(object): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "featured": "bool", - "publish_approved": "bool", - "related_assets": "list[str]", - "filter_categories": "dict(str, str)", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'featured': 'bool', + 'publish_approved': 'bool', + 'related_assets': 'list[str]', + 'filter_categories': 'dict(str, str)' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - featured=None, - publish_approved=None, - related_assets=None, - filter_categories=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, featured=None, publish_approved=None, related_assets=None, filter_categories=None): # noqa: E501 """ApiAsset - a model defined in Swagger""" # noqa: E501 self._id = None @@ -154,9 +144,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -179,9 +167,7 @@ def description(self, description): :type: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -276,20 +262,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiAsset, dict): diff --git a/api/client/swagger_client/models/api_catalog_upload.py b/api/client/swagger_client/models/api_catalog_upload.py index 690e633e..8b6a22f5 100644 --- a/api/client/swagger_client/models/api_catalog_upload.py +++ b/api/client/swagger_client/models/api_catalog_upload.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiCatalogUpload(object): @@ -34,32 +34,24 @@ class ApiCatalogUpload(object): and the value is json key in definition. """ swagger_types = { - "api_access_tokens": "list[ApiAccessToken]", - "components": "list[ApiCatalogUploadItem]", - "datasets": "list[ApiCatalogUploadItem]", - "models": "list[ApiCatalogUploadItem]", - "notebooks": "list[ApiCatalogUploadItem]", - "pipelines": "list[ApiCatalogUploadItem]", + 'api_access_tokens': 'list[ApiAccessToken]', + 'components': 'list[ApiCatalogUploadItem]', + 'datasets': 'list[ApiCatalogUploadItem]', + 'models': 'list[ApiCatalogUploadItem]', + 'notebooks': 'list[ApiCatalogUploadItem]', + 'pipelines': 'list[ApiCatalogUploadItem]' } attribute_map = { - "api_access_tokens": "api_access_tokens", - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", + 'api_access_tokens': 'api_access_tokens', + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines' } - def __init__( - self, - api_access_tokens=None, - components=None, - datasets=None, - models=None, - notebooks=None, - pipelines=None, - ): # noqa: E501 + def __init__(self, api_access_tokens=None, components=None, datasets=None, models=None, notebooks=None, pipelines=None): # noqa: E501 """ApiCatalogUpload - a model defined in Swagger""" # noqa: E501 self._api_access_tokens = None @@ -218,20 +210,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiCatalogUpload, dict): diff --git a/api/client/swagger_client/models/api_catalog_upload_error.py b/api/client/swagger_client/models/api_catalog_upload_error.py index 42f4a550..bd2cb71b 100644 --- a/api/client/swagger_client/models/api_catalog_upload_error.py +++ b/api/client/swagger_client/models/api_catalog_upload_error.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiCatalogUploadError(object): @@ -34,22 +34,20 @@ class ApiCatalogUploadError(object): and the value is json key in definition. """ swagger_types = { - "name": "str", - "url": "str", - "error_message": "str", - "status_code": "int", + 'name': 'str', + 'url': 'str', + 'error_message': 'str', + 'status_code': 'int' } attribute_map = { - "name": "name", - "url": "url", - "error_message": "error_message", - "status_code": "status_code", + 'name': 'name', + 'url': 'url', + 'error_message': 'error_message', + 'status_code': 'status_code' } - def __init__( - self, name=None, url=None, error_message=None, status_code=None - ): # noqa: E501 + def __init__(self, name=None, url=None, error_message=None, status_code=None): # noqa: E501 """ApiCatalogUploadError - a model defined in Swagger""" # noqa: E501 self._name = None @@ -108,9 +106,7 @@ def url(self, url): :type: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url @@ -163,20 +159,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiCatalogUploadError, dict): diff --git a/api/client/swagger_client/models/api_catalog_upload_item.py b/api/client/swagger_client/models/api_catalog_upload_item.py index e260e055..96aea05e 100644 --- a/api/client/swagger_client/models/api_catalog_upload_item.py +++ b/api/client/swagger_client/models/api_catalog_upload_item.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiCatalogUploadItem(object): @@ -33,9 +33,15 @@ class ApiCatalogUploadItem(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"name": "str", "url": "str"} + swagger_types = { + 'name': 'str', + 'url': 'str' + } - attribute_map = {"name": "name", "url": "url"} + attribute_map = { + 'name': 'name', + 'url': 'url' + } def __init__(self, name=None, url=None): # noqa: E501 """ApiCatalogUploadItem - a model defined in Swagger""" # noqa: E501 @@ -90,9 +96,7 @@ def url(self, url): :type: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url @@ -103,20 +107,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiCatalogUploadItem, dict): diff --git a/api/client/swagger_client/models/api_catalog_upload_response.py b/api/client/swagger_client/models/api_catalog_upload_response.py index c5de243c..eab6cb44 100644 --- a/api/client/swagger_client/models/api_catalog_upload_response.py +++ b/api/client/swagger_client/models/api_catalog_upload_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiCatalogUploadResponse(object): @@ -34,44 +34,32 @@ class ApiCatalogUploadResponse(object): and the value is json key in definition. """ swagger_types = { - "components": "list[ApiComponent]", - "datasets": "list[ApiDataset]", - "models": "list[ApiModel]", - "notebooks": "list[ApiNotebook]", - "pipelines": "list[ApiPipeline]", - "total_size": "int", - "next_page_token": "str", - "errors": "list[ApiCatalogUploadError]", - "total_errors": "int", - "total_created": "int", + 'components': 'list[ApiComponent]', + 'datasets': 'list[ApiDataset]', + 'models': 'list[ApiModel]', + 'notebooks': 'list[ApiNotebook]', + 'pipelines': 'list[ApiPipeline]', + 'total_size': 'int', + 'next_page_token': 'str', + 'errors': 'list[ApiCatalogUploadError]', + 'total_errors': 'int', + 'total_created': 'int' } attribute_map = { - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", - "errors": "errors", - "total_errors": "total_errors", - "total_created": "total_created", + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token', + 'errors': 'errors', + 'total_errors': 'total_errors', + 'total_created': 'total_created' } - def __init__( - self, - components=None, - datasets=None, - models=None, - notebooks=None, - pipelines=None, - total_size=None, - next_page_token=None, - errors=None, - total_errors=None, - total_created=None, - ): # noqa: E501 + def __init__(self, components=None, datasets=None, models=None, notebooks=None, pipelines=None, total_size=None, next_page_token=None, errors=None, total_errors=None, total_created=None): # noqa: E501 """ApiCatalogUploadResponse - a model defined in Swagger""" # noqa: E501 self._components = None @@ -324,20 +312,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiCatalogUploadResponse, dict): diff --git a/api/client/swagger_client/models/api_component.py b/api/client/swagger_client/models/api_component.py index 99d2e4e8..57edd56b 100644 --- a/api/client/swagger_client/models/api_component.py +++ b/api/client/swagger_client/models/api_component.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_asset import ApiAsset from swagger_client.models.api_metadata import ApiMetadata # noqa: F401,E501 @@ -38,44 +38,32 @@ class ApiComponent(ApiAsset): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "featured": "bool", - "publish_approved": "bool", - "related_assets": "list[str]", - "filter_categories": "dict(str, str)", - "metadata": "ApiMetadata", - "parameters": "list[ApiParameter]", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'featured': 'bool', + 'publish_approved': 'bool', + 'related_assets': 'list[str]', + 'filter_categories': 'dict(str, str)', + 'metadata': 'ApiMetadata', + 'parameters': 'list[ApiParameter]' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "metadata": "metadata", - "parameters": "parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'metadata': 'metadata', + 'parameters': 'parameters' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - featured=None, - publish_approved=None, - related_assets=None, - filter_categories=None, - metadata=None, - parameters=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, featured=None, publish_approved=None, related_assets=None, filter_categories=None, metadata=None, parameters=None): # noqa: E501 """ApiComponent - a model defined in Swagger""" # noqa: E501 self._id = None @@ -170,9 +158,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -195,9 +181,7 @@ def description(self, description): :type: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -334,20 +318,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiComponent, dict): diff --git a/api/client/swagger_client/models/api_credential.py b/api/client/swagger_client/models/api_credential.py index c68752fd..6586383f 100644 --- a/api/client/swagger_client/models/api_credential.py +++ b/api/client/swagger_client/models/api_credential.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiCredential(object): @@ -34,32 +34,24 @@ class ApiCredential(object): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "pipeline_id": "str", - "project_id": "str", - "api_key": "str", - "data_assets": "list[str]", + 'id': 'str', + 'created_at': 'datetime', + 'pipeline_id': 'str', + 'project_id': 'str', + 'api_key': 'str', + 'data_assets': 'list[str]' } attribute_map = { - "id": "id", - "created_at": "created_at", - "pipeline_id": "pipeline_id", - "project_id": "project_id", - "api_key": "api_key", - "data_assets": "data_assets", + 'id': 'id', + 'created_at': 'created_at', + 'pipeline_id': 'pipeline_id', + 'project_id': 'project_id', + 'api_key': 'api_key', + 'data_assets': 'data_assets' } - def __init__( - self, - id=None, - created_at=None, - pipeline_id=None, - project_id=None, - api_key=None, - data_assets=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, pipeline_id=None, project_id=None, api_key=None, data_assets=None): # noqa: E501 """ApiCredential - a model defined in Swagger""" # noqa: E501 self._id = None @@ -142,9 +134,7 @@ def pipeline_id(self, pipeline_id): :type: str """ if pipeline_id is None: - raise ValueError( - "Invalid value for `pipeline_id`, must not be `None`" - ) + raise ValueError("Invalid value for `pipeline_id`, must not be `None`") # noqa: E501 self._pipeline_id = pipeline_id @@ -167,9 +157,7 @@ def project_id(self, project_id): :type: str """ if project_id is None: - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 self._project_id = project_id @@ -226,20 +214,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiCredential, dict): diff --git a/api/client/swagger_client/models/api_dataset.py b/api/client/swagger_client/models/api_dataset.py index 5861879a..71e73383 100644 --- a/api/client/swagger_client/models/api_dataset.py +++ b/api/client/swagger_client/models/api_dataset.py @@ -14,9 +14,9 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_asset import ApiAsset @@ -35,56 +35,40 @@ class ApiDataset(ApiAsset): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "featured": "bool", - "publish_approved": "bool", - "related_assets": "list[str]", - "filter_categories": "dict(str, str)", - "domain": "str", - "format": "str", - "size": "str", - "number_of_records": "int", - "license": "str", - "metadata": "ApiMetadata", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'featured': 'bool', + 'publish_approved': 'bool', + 'related_assets': 'list[str]', + 'filter_categories': 'dict(str, str)', + 'domain': 'str', + 'format': 'str', + 'size': 'str', + 'number_of_records': 'int', + 'license': 'str', + 'metadata': 'ApiMetadata' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "domain": "domain", - "format": "format", - "size": "size", - "number_of_records": "number_of_records", - "license": "license", - "metadata": "metadata", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'domain': 'domain', + 'format': 'format', + 'size': 'size', + 'number_of_records': 'number_of_records', + 'license': 'license', + 'metadata': 'metadata' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - featured=None, - publish_approved=None, - related_assets=None, - filter_categories=None, - domain=None, - format=None, - size=None, - number_of_records=None, - license=None, - metadata=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, featured=None, publish_approved=None, related_assets=None, filter_categories=None, domain=None, format=None, size=None, number_of_records=None, license=None, metadata=None): # noqa: E501 """ApiDataset - a model defined in Swagger""" # noqa: E501 self._id = None @@ -191,9 +175,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -216,9 +198,7 @@ def description(self, description): :type: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -439,20 +419,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiDataset, dict): diff --git a/api/client/swagger_client/models/api_generate_code_response.py b/api/client/swagger_client/models/api_generate_code_response.py index 75aa82dd..a3728407 100644 --- a/api/client/swagger_client/models/api_generate_code_response.py +++ b/api/client/swagger_client/models/api_generate_code_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiGenerateCodeResponse(object): @@ -33,9 +33,13 @@ class ApiGenerateCodeResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"script": "str"} + swagger_types = { + 'script': 'str' + } - attribute_map = {"script": "script"} + attribute_map = { + 'script': 'script' + } def __init__(self, script=None): # noqa: E501 """ApiGenerateCodeResponse - a model defined in Swagger""" # noqa: E501 @@ -76,20 +80,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiGenerateCodeResponse, dict): diff --git a/api/client/swagger_client/models/api_generate_model_code_response.py b/api/client/swagger_client/models/api_generate_model_code_response.py index 7e6a76d7..787571ab 100644 --- a/api/client/swagger_client/models/api_generate_model_code_response.py +++ b/api/client/swagger_client/models/api_generate_model_code_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_model_script import ApiModelScript # noqa: F401,E501 @@ -35,9 +35,13 @@ class ApiGenerateModelCodeResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"scripts": "list[ApiModelScript]"} + swagger_types = { + 'scripts': 'list[ApiModelScript]' + } - attribute_map = {"scripts": "scripts"} + attribute_map = { + 'scripts': 'scripts' + } def __init__(self, scripts=None): # noqa: E501 """ApiGenerateModelCodeResponse - a model defined in Swagger""" # noqa: E501 @@ -78,20 +82,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiGenerateModelCodeResponse, dict): diff --git a/api/client/swagger_client/models/api_get_template_response.py b/api/client/swagger_client/models/api_get_template_response.py index 5885ba83..b0418a9d 100644 --- a/api/client/swagger_client/models/api_get_template_response.py +++ b/api/client/swagger_client/models/api_get_template_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiGetTemplateResponse(object): @@ -33,9 +33,15 @@ class ApiGetTemplateResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"template": "str", "url": "str"} + swagger_types = { + 'template': 'str', + 'url': 'str' + } - attribute_map = {"template": "template", "url": "url"} + attribute_map = { + 'template': 'template', + 'url': 'url' + } def __init__(self, template=None, url=None): # noqa: E501 """ApiGetTemplateResponse - a model defined in Swagger""" # noqa: E501 @@ -76,7 +82,7 @@ def template(self, template): def url(self): """Gets the url of this ApiGetTemplateResponse. # noqa: E501 - The URL to download the template text from S3 storage (Minio) + The URL to download the template text from S3 storage (Minio) # noqa: E501 :return: The url of this ApiGetTemplateResponse. # noqa: E501 :rtype: str @@ -87,7 +93,7 @@ def url(self): def url(self, url): """Sets the url of this ApiGetTemplateResponse. - The URL to download the template text from S3 storage (Minio) + The URL to download the template text from S3 storage (Minio) # noqa: E501 :param url: The url of this ApiGetTemplateResponse. # noqa: E501 :type: str @@ -102,20 +108,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiGetTemplateResponse, dict): diff --git a/api/client/swagger_client/models/api_inferenceservice.py b/api/client/swagger_client/models/api_inferenceservice.py index 17bf41ff..f1c25172 100644 --- a/api/client/swagger_client/models/api_inferenceservice.py +++ b/api/client/swagger_client/models/api_inferenceservice.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.any_value import AnyValue # noqa: F401,E501 @@ -36,22 +36,20 @@ class ApiInferenceservice(object): and the value is json key in definition. """ swagger_types = { - "api_version": "str", - "kind": "str", - "metadata": "AnyValue", - "spec": "AnyValue", + 'api_version': 'str', + 'kind': 'str', + 'metadata': 'AnyValue', + 'spec': 'AnyValue' } attribute_map = { - "api_version": "apiVersion", - "kind": "kind", - "metadata": "metadata", - "spec": "spec", + 'api_version': 'apiVersion', + 'kind': 'kind', + 'metadata': 'metadata', + 'spec': 'spec' } - def __init__( - self, api_version=None, kind=None, metadata=None, spec=None - ): # noqa: E501 + def __init__(self, api_version=None, kind=None, metadata=None, spec=None): # noqa: E501 """ApiInferenceservice - a model defined in Swagger""" # noqa: E501 self._api_version = None @@ -86,9 +84,7 @@ def api_version(self, api_version): :type: str """ if api_version is None: - raise ValueError( - "Invalid value for `api_version`, must not be `None`" - ) + raise ValueError("Invalid value for `api_version`, must not be `None`") # noqa: E501 self._api_version = api_version @@ -111,9 +107,7 @@ def kind(self, kind): :type: str """ if kind is None: - raise ValueError( - "Invalid value for `kind`, must not be `None`" - ) + raise ValueError("Invalid value for `kind`, must not be `None`") # noqa: E501 self._kind = kind @@ -166,20 +160,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiInferenceservice, dict): diff --git a/api/client/swagger_client/models/api_list_catalog_items_response.py b/api/client/swagger_client/models/api_list_catalog_items_response.py index 173993c5..8296f422 100644 --- a/api/client/swagger_client/models/api_list_catalog_items_response.py +++ b/api/client/swagger_client/models/api_list_catalog_items_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiListCatalogItemsResponse(object): @@ -34,35 +34,26 @@ class ApiListCatalogItemsResponse(object): and the value is json key in definition. """ swagger_types = { - "components": "list[ApiComponent]", - "datasets": "list[ApiDataset]", - "models": "list[ApiModel]", - "notebooks": "list[ApiNotebook]", - "pipelines": "list[ApiPipeline]", - "total_size": "int", - "next_page_token": "str", + 'components': 'list[ApiComponent]', + 'datasets': 'list[ApiDataset]', + 'models': 'list[ApiModel]', + 'notebooks': 'list[ApiNotebook]', + 'pipelines': 'list[ApiPipeline]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, - components=None, - datasets=None, - models=None, - notebooks=None, - pipelines=None, - total_size=None, - next_page_token=None, - ): # noqa: E501 + def __init__(self, components=None, datasets=None, models=None, notebooks=None, pipelines=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListCatalogItemsResponse - a model defined in Swagger""" # noqa: E501 self._components = None @@ -243,20 +234,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListCatalogItemsResponse, dict): diff --git a/api/client/swagger_client/models/api_list_catalog_upload_errors.py b/api/client/swagger_client/models/api_list_catalog_upload_errors.py index c9d78838..f434defe 100644 --- a/api/client/swagger_client/models/api_list_catalog_upload_errors.py +++ b/api/client/swagger_client/models/api_list_catalog_upload_errors.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiListCatalogUploadErrors(object): @@ -33,9 +33,15 @@ class ApiListCatalogUploadErrors(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"errors": "list[ApiCatalogUploadError]", "total_errors": "int"} + swagger_types = { + 'errors': 'list[ApiCatalogUploadError]', + 'total_errors': 'int' + } - attribute_map = {"errors": "errors", "total_errors": "total_errors"} + attribute_map = { + 'errors': 'errors', + 'total_errors': 'total_errors' + } def __init__(self, errors=None, total_errors=None): # noqa: E501 """ApiListCatalogUploadErrors - a model defined in Swagger""" # noqa: E501 @@ -98,20 +104,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListCatalogUploadErrors, dict): diff --git a/api/client/swagger_client/models/api_list_components_response.py b/api/client/swagger_client/models/api_list_components_response.py index e044f259..c1d0085d 100644 --- a/api/client/swagger_client/models/api_list_components_response.py +++ b/api/client/swagger_client/models/api_list_components_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_component import ApiComponent # noqa: F401,E501 @@ -36,20 +36,18 @@ class ApiListComponentsResponse(object): and the value is json key in definition. """ swagger_types = { - "components": "list[ApiComponent]", - "total_size": "int", - "next_page_token": "str", + 'components': 'list[ApiComponent]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "components": "components", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'components': 'components', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, components=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, components=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListComponentsResponse - a model defined in Swagger""" # noqa: E501 self._components = None @@ -134,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListComponentsResponse, dict): diff --git a/api/client/swagger_client/models/api_list_credentials_response.py b/api/client/swagger_client/models/api_list_credentials_response.py index 79da88aa..edca354f 100644 --- a/api/client/swagger_client/models/api_list_credentials_response.py +++ b/api/client/swagger_client/models/api_list_credentials_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_credential import ApiCredential # noqa: F401,E501 @@ -36,20 +36,18 @@ class ApiListCredentialsResponse(object): and the value is json key in definition. """ swagger_types = { - "credentials": "list[ApiCredential]", - "total_size": "int", - "next_page_token": "str", + 'credentials': 'list[ApiCredential]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "credentials": "credentials", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'credentials': 'credentials', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, credentials=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, credentials=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListCredentialsResponse - a model defined in Swagger""" # noqa: E501 self._credentials = None @@ -134,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListCredentialsResponse, dict): diff --git a/api/client/swagger_client/models/api_list_datasets_response.py b/api/client/swagger_client/models/api_list_datasets_response.py index 4d7596fe..7f94a35b 100644 --- a/api/client/swagger_client/models/api_list_datasets_response.py +++ b/api/client/swagger_client/models/api_list_datasets_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiListDatasetsResponse(object): @@ -34,20 +34,18 @@ class ApiListDatasetsResponse(object): and the value is json key in definition. """ swagger_types = { - "datasets": "list[ApiDataset]", - "total_size": "int", - "next_page_token": "str", + 'datasets': 'list[ApiDataset]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "datasets": "datasets", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'datasets': 'datasets', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, datasets=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, datasets=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListDatasetsResponse - a model defined in Swagger""" # noqa: E501 self._datasets = None @@ -132,20 +130,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListDatasetsResponse, dict): diff --git a/api/client/swagger_client/models/api_list_inferenceservices_response.py b/api/client/swagger_client/models/api_list_inferenceservices_response.py index aa5dcdd3..9d70b760 100644 --- a/api/client/swagger_client/models/api_list_inferenceservices_response.py +++ b/api/client/swagger_client/models/api_list_inferenceservices_response.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_inferenceservice import ( # noqa: F401 - ApiInferenceservice, -) +from swagger_client.models.api_inferenceservice import ApiInferenceservice # noqa: F401,E501 class ApiListInferenceservicesResponse(object): @@ -38,20 +36,18 @@ class ApiListInferenceservicesResponse(object): and the value is json key in definition. """ swagger_types = { - "inferenceservices": "list[ApiInferenceservice]", - "total_size": "int", - "next_page_token": "str", + 'inferenceservices': 'list[ApiInferenceservice]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "inferenceservices": "Inferenceservices", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'inferenceservices': 'Inferenceservices', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, inferenceservices=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, inferenceservices=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListInferenceservicesResponse - a model defined in Swagger""" # noqa: E501 self._inferenceservices = None @@ -136,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListInferenceservicesResponse, dict): diff --git a/api/client/swagger_client/models/api_list_models_response.py b/api/client/swagger_client/models/api_list_models_response.py index 373f805e..c61cf0aa 100644 --- a/api/client/swagger_client/models/api_list_models_response.py +++ b/api/client/swagger_client/models/api_list_models_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_model import ApiModel # noqa: F401,E501 @@ -36,20 +36,18 @@ class ApiListModelsResponse(object): and the value is json key in definition. """ swagger_types = { - "models": "list[ApiModel]", - "total_size": "int", - "next_page_token": "str", + 'models': 'list[ApiModel]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "models": "models", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'models': 'models', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, models=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, models=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListModelsResponse - a model defined in Swagger""" # noqa: E501 self._models = None @@ -134,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListModelsResponse, dict): diff --git a/api/client/swagger_client/models/api_list_notebooks_response.py b/api/client/swagger_client/models/api_list_notebooks_response.py index 4e86569b..3470ed7f 100644 --- a/api/client/swagger_client/models/api_list_notebooks_response.py +++ b/api/client/swagger_client/models/api_list_notebooks_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_notebook import ApiNotebook # noqa: F401,E501 @@ -36,20 +36,18 @@ class ApiListNotebooksResponse(object): and the value is json key in definition. """ swagger_types = { - "notebooks": "list[ApiNotebook]", - "total_size": "int", - "next_page_token": "str", + 'notebooks': 'list[ApiNotebook]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "notebooks": "notebooks", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'notebooks': 'notebooks', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, notebooks=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, notebooks=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListNotebooksResponse - a model defined in Swagger""" # noqa: E501 self._notebooks = None @@ -134,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListNotebooksResponse, dict): diff --git a/api/client/swagger_client/models/api_list_pipelines_response.py b/api/client/swagger_client/models/api_list_pipelines_response.py index 40daa439..eaa36945 100644 --- a/api/client/swagger_client/models/api_list_pipelines_response.py +++ b/api/client/swagger_client/models/api_list_pipelines_response.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) +from swagger_client.models.api_pipeline_extended import ApiPipelineExtended # noqa: F401,E501 class ApiListPipelinesResponse(object): @@ -38,20 +36,18 @@ class ApiListPipelinesResponse(object): and the value is json key in definition. """ swagger_types = { - "pipelines": "list[ApiPipelineExtended]", - "total_size": "int", - "next_page_token": "str", + 'pipelines': 'list[ApiPipelineExtended]', + 'total_size': 'int', + 'next_page_token': 'str' } attribute_map = { - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } - def __init__( - self, pipelines=None, total_size=None, next_page_token=None - ): # noqa: E501 + def __init__(self, pipelines=None, total_size=None, next_page_token=None): # noqa: E501 """ApiListPipelinesResponse - a model defined in Swagger""" # noqa: E501 self._pipelines = None @@ -136,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiListPipelinesResponse, dict): diff --git a/api/client/swagger_client/models/api_metadata.py b/api/client/swagger_client/models/api_metadata.py index 02bec979..e405fba4 100644 --- a/api/client/swagger_client/models/api_metadata.py +++ b/api/client/swagger_client/models/api_metadata.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiMetadata(object): @@ -34,12 +34,16 @@ class ApiMetadata(object): and the value is json key in definition. """ swagger_types = { - "annotations": "dict(str, str)", - "labels": "dict(str, str)", - "tags": "list[str]", + 'annotations': 'dict(str, str)', + 'labels': 'dict(str, str)', + 'tags': 'list[str]' } - attribute_map = {"annotations": "annotations", "labels": "labels", "tags": "tags"} + attribute_map = { + 'annotations': 'annotations', + 'labels': 'labels', + 'tags': 'tags' + } def __init__(self, annotations=None, labels=None, tags=None): # noqa: E501 """ApiMetadata - a model defined in Swagger""" # noqa: E501 @@ -126,20 +130,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiMetadata, dict): diff --git a/api/client/swagger_client/models/api_model.py b/api/client/swagger_client/models/api_model.py index f14bcc1a..2d53f266 100644 --- a/api/client/swagger_client/models/api_model.py +++ b/api/client/swagger_client/models/api_model.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_asset import ApiAsset -from swagger_client.models.api_model_framework import ( # noqa: F401 - ApiModelFramework, -) +from swagger_client.models.api_model_framework import ApiModelFramework # noqa: F401,E501 from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 @@ -39,71 +37,50 @@ class ApiModel(ApiAsset): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "featured": "bool", - "publish_approved": "bool", - "related_assets": "list[str]", - "filter_categories": "dict(str, str)", - "domain": "str", - "labels": "dict(str, str)", - "framework": "ApiModelFramework", - "trainable": "bool", - "trainable_tested_platforms": "list[str]", - "trainable_credentials_required": "bool", - "trainable_parameters": "list[ApiParameter]", - "servable": "bool", - "servable_tested_platforms": "list[str]", - "servable_credentials_required": "bool", - "servable_parameters": "list[ApiParameter]", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'featured': 'bool', + 'publish_approved': 'bool', + 'related_assets': 'list[str]', + 'filter_categories': 'dict(str, str)', + 'domain': 'str', + 'labels': 'dict(str, str)', + 'framework': 'ApiModelFramework', + 'trainable': 'bool', + 'trainable_tested_platforms': 'list[str]', + 'trainable_credentials_required': 'bool', + 'trainable_parameters': 'list[ApiParameter]', + 'servable': 'bool', + 'servable_tested_platforms': 'list[str]', + 'servable_credentials_required': 'bool', + 'servable_parameters': 'list[ApiParameter]' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "domain": "domain", - "labels": "labels", - "framework": "framework", - "trainable": "trainable", - "trainable_tested_platforms": "trainable_tested_platforms", - "trainable_credentials_required": "trainable_credentials_required", - "trainable_parameters": "trainable_parameters", - "servable": "servable", - "servable_tested_platforms": "servable_tested_platforms", - "servable_credentials_required": "servable_credentials_required", - "servable_parameters": "servable_parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'domain': 'domain', + 'labels': 'labels', + 'framework': 'framework', + 'trainable': 'trainable', + 'trainable_tested_platforms': 'trainable_tested_platforms', + 'trainable_credentials_required': 'trainable_credentials_required', + 'trainable_parameters': 'trainable_parameters', + 'servable': 'servable', + 'servable_tested_platforms': 'servable_tested_platforms', + 'servable_credentials_required': 'servable_credentials_required', + 'servable_parameters': 'servable_parameters' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - featured=None, - publish_approved=None, - related_assets=None, - filter_categories=None, - domain=None, - labels=None, - framework=None, - trainable=None, - trainable_tested_platforms=None, - trainable_credentials_required=None, - trainable_parameters=None, - servable=None, - servable_tested_platforms=None, - servable_credentials_required=None, - servable_parameters=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, featured=None, publish_approved=None, related_assets=None, filter_categories=None, domain=None, labels=None, framework=None, trainable=None, trainable_tested_platforms=None, trainable_credentials_required=None, trainable_parameters=None, servable=None, servable_tested_platforms=None, servable_credentials_required=None, servable_parameters=None): # noqa: E501 """ApiModel - a model defined in Swagger""" # noqa: E501 self._id = None @@ -224,9 +201,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -249,9 +224,7 @@ def description(self, description): :type: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -400,9 +373,7 @@ def framework(self, framework): :type: ApiModelFramework """ if framework is None: - raise ValueError( - "Invalid value for `framework`, must not be `None`" - ) + raise ValueError("Invalid value for `framework`, must not be `None`") # noqa: E501 self._framework = framework @@ -581,20 +552,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiModel, dict): diff --git a/api/client/swagger_client/models/api_model_framework.py b/api/client/swagger_client/models/api_model_framework.py index d418dcb6..87eb99a9 100644 --- a/api/client/swagger_client/models/api_model_framework.py +++ b/api/client/swagger_client/models/api_model_framework.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_model_framework_runtimes import ( # noqa: F401 - ApiModelFrameworkRuntimes, -) +from swagger_client.models.api_model_framework_runtimes import ApiModelFrameworkRuntimes # noqa: F401,E501 class ApiModelFramework(object): @@ -38,12 +36,16 @@ class ApiModelFramework(object): and the value is json key in definition. """ swagger_types = { - "name": "str", - "version": "str", - "runtimes": "ApiModelFrameworkRuntimes", + 'name': 'str', + 'version': 'str', + 'runtimes': 'ApiModelFrameworkRuntimes' } - attribute_map = {"name": "name", "version": "version", "runtimes": "runtimes"} + attribute_map = { + 'name': 'name', + 'version': 'version', + 'runtimes': 'runtimes' + } def __init__(self, name=None, version=None, runtimes=None): # noqa: E501 """ApiModelFramework - a model defined in Swagger""" # noqa: E501 @@ -78,9 +80,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -133,20 +133,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiModelFramework, dict): diff --git a/api/client/swagger_client/models/api_model_framework_runtimes.py b/api/client/swagger_client/models/api_model_framework_runtimes.py index 4dde8579..db1fa331 100644 --- a/api/client/swagger_client/models/api_model_framework_runtimes.py +++ b/api/client/swagger_client/models/api_model_framework_runtimes.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiModelFrameworkRuntimes(object): @@ -33,9 +33,15 @@ class ApiModelFrameworkRuntimes(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"name": "str", "version": "str"} + swagger_types = { + 'name': 'str', + 'version': 'str' + } - attribute_map = {"name": "name", "version": "version"} + attribute_map = { + 'name': 'name', + 'version': 'version' + } def __init__(self, name=None, version=None): # noqa: E501 """ApiModelFrameworkRuntimes - a model defined in Swagger""" # noqa: E501 @@ -98,20 +104,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiModelFrameworkRuntimes, dict): diff --git a/api/client/swagger_client/models/api_model_script.py b/api/client/swagger_client/models/api_model_script.py index d7ae8201..d57941c9 100644 --- a/api/client/swagger_client/models/api_model_script.py +++ b/api/client/swagger_client/models/api_model_script.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiModelScript(object): @@ -34,20 +34,18 @@ class ApiModelScript(object): and the value is json key in definition. """ swagger_types = { - "pipeline_stage": "str", - "execution_platform": "str", - "script_code": "str", + 'pipeline_stage': 'str', + 'execution_platform': 'str', + 'script_code': 'str' } attribute_map = { - "pipeline_stage": "pipeline_stage", - "execution_platform": "execution_platform", - "script_code": "script_code", + 'pipeline_stage': 'pipeline_stage', + 'execution_platform': 'execution_platform', + 'script_code': 'script_code' } - def __init__( - self, pipeline_stage=None, execution_platform=None, script_code=None - ): # noqa: E501 + def __init__(self, pipeline_stage=None, execution_platform=None, script_code=None): # noqa: E501 """ApiModelScript - a model defined in Swagger""" # noqa: E501 self._pipeline_stage = None @@ -80,9 +78,7 @@ def pipeline_stage(self, pipeline_stage): :type: str """ if pipeline_stage is None: - raise ValueError( - "Invalid value for `pipeline_stage`, must not be `None`" - ) + raise ValueError("Invalid value for `pipeline_stage`, must not be `None`") # noqa: E501 self._pipeline_stage = pipeline_stage @@ -107,9 +103,7 @@ def execution_platform(self, execution_platform): :type: str """ if execution_platform is None: - raise ValueError( - "Invalid value for `execution_platform`, must not be `None`" - ) + raise ValueError("Invalid value for `execution_platform`, must not be `None`") # noqa: E501 self._execution_platform = execution_platform @@ -134,9 +128,7 @@ def script_code(self, script_code): :type: str """ if script_code is None: - raise ValueError( - "Invalid value for `script_code`, must not be `None`" - ) + raise ValueError("Invalid value for `script_code`, must not be `None`") # noqa: E501 self._script_code = script_code @@ -147,20 +139,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiModelScript, dict): diff --git a/api/client/swagger_client/models/api_notebook.py b/api/client/swagger_client/models/api_notebook.py index 3b60e821..8c608ade 100644 --- a/api/client/swagger_client/models/api_notebook.py +++ b/api/client/swagger_client/models/api_notebook.py @@ -14,9 +14,9 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_asset import ApiAsset from swagger_client.models.api_metadata import ApiMetadata # noqa: F401,E501 @@ -37,47 +37,34 @@ class ApiNotebook(ApiAsset): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "featured": "bool", - "publish_approved": "bool", - "related_assets": "list[str]", - "filter_categories": "dict(str, str)", - "url": "str", - "metadata": "ApiMetadata", - "parameters": "list[ApiParameter]", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'featured': 'bool', + 'publish_approved': 'bool', + 'related_assets': 'list[str]', + 'filter_categories': 'dict(str, str)', + 'url': 'str', + 'metadata': 'ApiMetadata', + 'parameters': 'list[ApiParameter]' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "url": "url", - "metadata": "metadata", - "parameters": "parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'url': 'url', + 'metadata': 'metadata', + 'parameters': 'parameters' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - featured=None, - publish_approved=None, - related_assets=None, - filter_categories=None, - url=None, - metadata=None, - parameters=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, featured=None, publish_approved=None, related_assets=None, filter_categories=None, url=None, metadata=None, parameters=None): # noqa: E501 """ApiNotebook - a model defined in Swagger""" # noqa: E501 self._id = None @@ -174,9 +161,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -199,9 +184,7 @@ def description(self, description): :type: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -310,9 +293,7 @@ def url(self, url): :type: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url @@ -365,20 +346,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiNotebook, dict): diff --git a/api/client/swagger_client/models/api_parameter.py b/api/client/swagger_client/models/api_parameter.py index 8194043b..b1c2b206 100644 --- a/api/client/swagger_client/models/api_parameter.py +++ b/api/client/swagger_client/models/api_parameter.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.any_value import AnyValue # noqa: F401,E501 @@ -36,22 +36,20 @@ class ApiParameter(object): and the value is json key in definition. """ swagger_types = { - "name": "str", - "description": "str", - "default": "AnyValue", - "value": "AnyValue", + 'name': 'str', + 'description': 'str', + 'default': 'AnyValue', + 'value': 'AnyValue' } attribute_map = { - "name": "name", - "description": "description", - "default": "default", - "value": "value", + 'name': 'name', + 'description': 'description', + 'default': 'default', + 'value': 'value' } - def __init__( - self, name=None, description=None, default=None, value=None - ): # noqa: E501 + def __init__(self, name=None, description=None, default=None, value=None): # noqa: E501 """ApiParameter - a model defined in Swagger""" # noqa: E501 self._name = None @@ -87,9 +85,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -163,20 +159,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiParameter, dict): diff --git a/api/client/swagger_client/models/api_pipeline.py b/api/client/swagger_client/models/api_pipeline.py index 947110b5..8546a04b 100644 --- a/api/client/swagger_client/models/api_pipeline.py +++ b/api/client/swagger_client/models/api_pipeline.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 @@ -36,38 +36,28 @@ class ApiPipeline(object): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "parameters": "list[ApiParameter]", - "status": "str", - "default_version_id": "str", - "namespace": "str", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'parameters': 'list[ApiParameter]', + 'status': 'str', + 'default_version_id': 'str', + 'namespace': 'str' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "parameters": "parameters", - "status": "status", - "default_version_id": "default_version_id", - "namespace": "namespace", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'parameters': 'parameters', + 'status': 'status', + 'default_version_id': 'default_version_id', + 'namespace': 'namespace' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - parameters=None, - status=None, - default_version_id=None, - namespace=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, parameters=None, status=None, default_version_id=None, namespace=None): # noqa: E501 """ApiPipeline - a model defined in Swagger""" # noqa: E501 self._id = None @@ -229,7 +219,7 @@ def status(self, status): def default_version_id(self): """Gets the default_version_id of this ApiPipeline. # noqa: E501 - The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) + The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 :return: The default_version_id of this ApiPipeline. # noqa: E501 :rtype: str @@ -240,7 +230,7 @@ def default_version_id(self): def default_version_id(self, default_version_id): """Sets the default_version_id of this ApiPipeline. - The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) + The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 :param default_version_id: The default_version_id of this ApiPipeline. # noqa: E501 :type: str @@ -276,20 +266,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipeline, dict): diff --git a/api/client/swagger_client/models/api_pipeline_custom.py b/api/client/swagger_client/models/api_pipeline_custom.py index 6a2df615..2a28c336 100644 --- a/api/client/swagger_client/models/api_pipeline_custom.py +++ b/api/client/swagger_client/models/api_pipeline_custom.py @@ -14,15 +14,13 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_pipeline_dag import ApiPipelineDAG # noqa: F401,E501 -from swagger_client.models.api_pipeline_inputs import ( # noqa: F401 - ApiPipelineInputs, -) +from swagger_client.models.api_pipeline_inputs import ApiPipelineInputs # noqa: F401,E501 class ApiPipelineCustom(object): @@ -39,22 +37,20 @@ class ApiPipelineCustom(object): and the value is json key in definition. """ swagger_types = { - "dag": "ApiPipelineDAG", - "inputs": "ApiPipelineInputs", - "name": "str", - "description": "str", + 'dag': 'ApiPipelineDAG', + 'inputs': 'ApiPipelineInputs', + 'name': 'str', + 'description': 'str' } attribute_map = { - "dag": "dag", - "inputs": "inputs", - "name": "name", - "description": "description", + 'dag': 'dag', + 'inputs': 'inputs', + 'name': 'name', + 'description': 'description' } - def __init__( - self, dag=None, inputs=None, name=None, description=None - ): # noqa: E501 + def __init__(self, dag=None, inputs=None, name=None, description=None): # noqa: E501 """ApiPipelineCustom - a model defined in Swagger""" # noqa: E501 self._dag = None @@ -89,9 +85,7 @@ def dag(self, dag): :type: ApiPipelineDAG """ if dag is None: - raise ValueError( - "Invalid value for `dag`, must not be `None`" - ) + raise ValueError("Invalid value for `dag`, must not be `None`") # noqa: E501 self._dag = dag @@ -137,9 +131,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -173,20 +165,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineCustom, dict): diff --git a/api/client/swagger_client/models/api_pipeline_custom_run_payload.py b/api/client/swagger_client/models/api_pipeline_custom_run_payload.py index 50422297..14b49cb0 100644 --- a/api/client/swagger_client/models/api_pipeline_custom_run_payload.py +++ b/api/client/swagger_client/models/api_pipeline_custom_run_payload.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_pipeline_custom import ( # noqa: F401 - ApiPipelineCustom, -) +from swagger_client.models.api_pipeline_custom import ApiPipelineCustom # noqa: F401,E501 from swagger_client.models.dictionary import Dictionary # noqa: F401,E501 @@ -39,13 +37,13 @@ class ApiPipelineCustomRunPayload(object): and the value is json key in definition. """ swagger_types = { - "custom_pipeline": "ApiPipelineCustom", - "run_parameters": "Dictionary", + 'custom_pipeline': 'ApiPipelineCustom', + 'run_parameters': 'Dictionary' } attribute_map = { - "custom_pipeline": "custom_pipeline", - "run_parameters": "run_parameters", + 'custom_pipeline': 'custom_pipeline', + 'run_parameters': 'run_parameters' } def __init__(self, custom_pipeline=None, run_parameters=None): # noqa: E501 @@ -109,20 +107,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineCustomRunPayload, dict): diff --git a/api/client/swagger_client/models/api_pipeline_dag.py b/api/client/swagger_client/models/api_pipeline_dag.py index d1a39ead..44ecde1b 100644 --- a/api/client/swagger_client/models/api_pipeline_dag.py +++ b/api/client/swagger_client/models/api_pipeline_dag.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_pipeline_task import ApiPipelineTask # noqa: F401,E501 @@ -35,9 +35,13 @@ class ApiPipelineDAG(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"tasks": "list[ApiPipelineTask]"} + swagger_types = { + 'tasks': 'list[ApiPipelineTask]' + } - attribute_map = {"tasks": "tasks"} + attribute_map = { + 'tasks': 'tasks' + } def __init__(self, tasks=None): # noqa: E501 """ApiPipelineDAG - a model defined in Swagger""" # noqa: E501 @@ -78,20 +82,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineDAG, dict): diff --git a/api/client/swagger_client/models/api_pipeline_extended.py b/api/client/swagger_client/models/api_pipeline_extended.py index a67d452c..1468b6b2 100644 --- a/api/client/swagger_client/models/api_pipeline_extended.py +++ b/api/client/swagger_client/models/api_pipeline_extended.py @@ -13,16 +13,13 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git """ -import pprint # noqa: F401 # noqa: F401 + import re # noqa: F401 -import six # noqa: F401 from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 from swagger_client.models.api_pipeline import ApiPipeline # noqa: F401,E501 -from swagger_client.models.api_pipeline_extension import ( # noqa: F401 - ApiPipelineExtension, -) +from swagger_client.models.api_pipeline_extension import ApiPipelineExtension # noqa: F401,E501 class ApiPipelineExtended(ApiPipeline, ApiPipelineExtension): @@ -39,47 +36,34 @@ class ApiPipelineExtended(ApiPipeline, ApiPipelineExtension): and the value is json key in definition. """ swagger_types = { - "id": "str", - "created_at": "datetime", - "name": "str", - "description": "str", - "parameters": "list[ApiParameter]", - "status": "str", - "default_version_id": "str", - "namespace": "str", - "annotations": "dict(str, str)", - "featured": "bool", - "publish_approved": "bool", + 'id': 'str', + 'created_at': 'datetime', + 'name': 'str', + 'description': 'str', + 'parameters': 'list[ApiParameter]', + 'status': 'str', + 'default_version_id': 'str', + 'namespace': 'str', + 'annotations': 'dict(str, str)', + 'featured': 'bool', + 'publish_approved': 'bool' } attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "parameters": "parameters", - "status": "status", - "default_version_id": "default_version_id", - "namespace": "namespace", - "annotations": "annotations", - "featured": "featured", - "publish_approved": "publish_approved", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'parameters': 'parameters', + 'status': 'status', + 'default_version_id': 'default_version_id', + 'namespace': 'namespace', + 'annotations': 'annotations', + 'featured': 'featured', + 'publish_approved': 'publish_approved' } - def __init__( - self, - id=None, - created_at=None, - name=None, - description=None, - parameters=None, - status=None, - default_version_id=None, - namespace=None, - annotations=None, - featured=None, - publish_approved=None, - ): # noqa: E501 + def __init__(self, id=None, created_at=None, name=None, description=None, parameters=None, status=None, default_version_id=None, namespace=None, annotations=None, featured=None, publish_approved=None): # noqa: E501 """ApiPipelineExtended - a model defined in Swagger""" # noqa: E501 self._id = None diff --git a/api/client/swagger_client/models/api_pipeline_extension.py b/api/client/swagger_client/models/api_pipeline_extension.py index 2c863507..5a178fa2 100644 --- a/api/client/swagger_client/models/api_pipeline_extension.py +++ b/api/client/swagger_client/models/api_pipeline_extension.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiPipelineExtension(object): @@ -34,22 +34,20 @@ class ApiPipelineExtension(object): and the value is json key in definition. """ swagger_types = { - "id": "str", - "annotations": "dict(str, str)", - "featured": "bool", - "publish_approved": "bool", + 'id': 'str', + 'annotations': 'dict(str, str)', + 'featured': 'bool', + 'publish_approved': 'bool' } attribute_map = { - "id": "id", - "annotations": "annotations", - "featured": "featured", - "publish_approved": "publish_approved", + 'id': 'id', + 'annotations': 'annotations', + 'featured': 'featured', + 'publish_approved': 'publish_approved' } - def __init__( - self, id=None, annotations=None, featured=None, publish_approved=None - ): # noqa: E501 + def __init__(self, id=None, annotations=None, featured=None, publish_approved=None): # noqa: E501 """ApiPipelineExtension - a model defined in Swagger""" # noqa: E501 self._id = None @@ -158,20 +156,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineExtension, dict): diff --git a/api/client/swagger_client/models/api_pipeline_inputs.py b/api/client/swagger_client/models/api_pipeline_inputs.py index 15275a24..84349a36 100644 --- a/api/client/swagger_client/models/api_pipeline_inputs.py +++ b/api/client/swagger_client/models/api_pipeline_inputs.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 @@ -35,9 +35,13 @@ class ApiPipelineInputs(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"parameters": "list[ApiParameter]"} + swagger_types = { + 'parameters': 'list[ApiParameter]' + } - attribute_map = {"parameters": "parameters"} + attribute_map = { + 'parameters': 'parameters' + } def __init__(self, parameters=None): # noqa: E501 """ApiPipelineInputs - a model defined in Swagger""" # noqa: E501 @@ -78,20 +82,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineInputs, dict): diff --git a/api/client/swagger_client/models/api_pipeline_task.py b/api/client/swagger_client/models/api_pipeline_task.py index f61c14ef..405973ce 100644 --- a/api/client/swagger_client/models/api_pipeline_task.py +++ b/api/client/swagger_client/models/api_pipeline_task.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_pipeline_task_arguments import ( # noqa: F401 - ApiPipelineTaskArguments, -) +from swagger_client.models.api_pipeline_task_arguments import ApiPipelineTaskArguments # noqa: F401,E501 class ApiPipelineTask(object): @@ -38,29 +36,22 @@ class ApiPipelineTask(object): and the value is json key in definition. """ swagger_types = { - "name": "str", - "artifact_type": "str", - "artifact_id": "str", - "arguments": "ApiPipelineTaskArguments", - "dependencies": "list[str]", + 'name': 'str', + 'artifact_type': 'str', + 'artifact_id': 'str', + 'arguments': 'ApiPipelineTaskArguments', + 'dependencies': 'list[str]' } attribute_map = { - "name": "name", - "artifact_type": "artifact_type", - "artifact_id": "artifact_id", - "arguments": "arguments", - "dependencies": "dependencies", + 'name': 'name', + 'artifact_type': 'artifact_type', + 'artifact_id': 'artifact_id', + 'arguments': 'arguments', + 'dependencies': 'dependencies' } - def __init__( - self, - name=None, - artifact_type=None, - artifact_id=None, - arguments=None, - dependencies=None, - ): # noqa: E501 + def __init__(self, name=None, artifact_type=None, artifact_id=None, arguments=None, dependencies=None): # noqa: E501 """ApiPipelineTask - a model defined in Swagger""" # noqa: E501 self._name = None @@ -121,9 +112,7 @@ def artifact_type(self, artifact_type): :type: str """ if artifact_type is None: - raise ValueError( - "Invalid value for `artifact_type`, must not be `None`" - ) + raise ValueError("Invalid value for `artifact_type`, must not be `None`") # noqa: E501 self._artifact_type = artifact_type @@ -148,9 +137,7 @@ def artifact_id(self, artifact_id): :type: str """ if artifact_id is None: - raise ValueError( - "Invalid value for `artifact_id`, must not be `None`" - ) + raise ValueError("Invalid value for `artifact_id`, must not be `None`") # noqa: E501 self._artifact_id = artifact_id @@ -205,20 +192,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineTask, dict): diff --git a/api/client/swagger_client/models/api_pipeline_task_arguments.py b/api/client/swagger_client/models/api_pipeline_task_arguments.py index 3455505c..13bd3be0 100644 --- a/api/client/swagger_client/models/api_pipeline_task_arguments.py +++ b/api/client/swagger_client/models/api_pipeline_task_arguments.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 @@ -35,9 +35,13 @@ class ApiPipelineTaskArguments(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"parameters": "list[ApiParameter]"} + swagger_types = { + 'parameters': 'list[ApiParameter]' + } - attribute_map = {"parameters": "parameters"} + attribute_map = { + 'parameters': 'parameters' + } def __init__(self, parameters=None): # noqa: E501 """ApiPipelineTaskArguments - a model defined in Swagger""" # noqa: E501 @@ -76,20 +80,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiPipelineTaskArguments, dict): diff --git a/api/client/swagger_client/models/api_run_code_response.py b/api/client/swagger_client/models/api_run_code_response.py index 309cbf29..23bf180c 100644 --- a/api/client/swagger_client/models/api_run_code_response.py +++ b/api/client/swagger_client/models/api_run_code_response.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiRunCodeResponse(object): @@ -33,9 +33,15 @@ class ApiRunCodeResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"run_url": "str", "run_output_location": "str"} + swagger_types = { + 'run_url': 'str', + 'run_output_location': 'str' + } - attribute_map = {"run_url": "run_url", "run_output_location": "run_output_location"} + attribute_map = { + 'run_url': 'run_url', + 'run_output_location': 'run_output_location' + } def __init__(self, run_url=None, run_output_location=None): # noqa: E501 """ApiRunCodeResponse - a model defined in Swagger""" # noqa: E501 @@ -69,9 +75,7 @@ def run_url(self, run_url): :type: str """ if run_url is None: - raise ValueError( - "Invalid value for `run_url`, must not be `None`" - ) + raise ValueError("Invalid value for `run_url`, must not be `None`") # noqa: E501 self._run_url = run_url @@ -105,20 +109,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiRunCodeResponse, dict): diff --git a/api/client/swagger_client/models/api_settings.py b/api/client/swagger_client/models/api_settings.py index 30f39d8f..8b7656c5 100644 --- a/api/client/swagger_client/models/api_settings.py +++ b/api/client/swagger_client/models/api_settings.py @@ -14,14 +14,12 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six -from swagger_client.models.api_settings_section import ( # noqa: F401 - ApiSettingsSection, -) +from swagger_client.models.api_settings_section import ApiSettingsSection # noqa: F401,E501 class ApiSettings(object): @@ -37,9 +35,13 @@ class ApiSettings(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"sections": "list[ApiSettingsSection]"} + swagger_types = { + 'sections': 'list[ApiSettingsSection]' + } - attribute_map = {"sections": "sections"} + attribute_map = { + 'sections': 'sections' + } def __init__(self, sections=None): # noqa: E501 """ApiSettings - a model defined in Swagger""" # noqa: E501 @@ -70,9 +72,7 @@ def sections(self, sections): :type: list[ApiSettingsSection] """ if sections is None: - raise ValueError( - "Invalid value for `sections`, must not be `None`" - ) + raise ValueError("Invalid value for `sections`, must not be `None`") # noqa: E501 self._sections = sections @@ -83,20 +83,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiSettings, dict): diff --git a/api/client/swagger_client/models/api_settings_section.py b/api/client/swagger_client/models/api_settings_section.py index 292141a5..8c52ff99 100644 --- a/api/client/swagger_client/models/api_settings_section.py +++ b/api/client/swagger_client/models/api_settings_section.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.api_parameter import ApiParameter # noqa: F401,E501 @@ -36,15 +36,15 @@ class ApiSettingsSection(object): and the value is json key in definition. """ swagger_types = { - "name": "str", - "description": "str", - "settings": "list[ApiParameter]", + 'name': 'str', + 'description': 'str', + 'settings': 'list[ApiParameter]' } attribute_map = { - "name": "name", - "description": "description", - "settings": "settings", + 'name': 'name', + 'description': 'description', + 'settings': 'settings' } def __init__(self, name=None, description=None, settings=None): # noqa: E501 @@ -82,9 +82,7 @@ def name(self, name): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -141,20 +139,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiSettingsSection, dict): diff --git a/api/client/swagger_client/models/api_status.py b/api/client/swagger_client/models/api_status.py index b9a51d65..0393c10e 100644 --- a/api/client/swagger_client/models/api_status.py +++ b/api/client/swagger_client/models/api_status.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.protobuf_any import ProtobufAny # noqa: F401,E501 @@ -35,9 +35,17 @@ class ApiStatus(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"error": "str", "code": "int", "details": "list[ProtobufAny]"} - - attribute_map = {"error": "error", "code": "code", "details": "details"} + swagger_types = { + 'error': 'str', + 'code': 'int', + 'details': 'list[ProtobufAny]' + } + + attribute_map = { + 'error': 'error', + 'code': 'code', + 'details': 'details' + } def __init__(self, error=None, code=None, details=None): # noqa: E501 """ApiStatus - a model defined in Swagger""" # noqa: E501 @@ -124,20 +132,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiStatus, dict): diff --git a/api/client/swagger_client/models/api_url.py b/api/client/swagger_client/models/api_url.py index 2d34f301..7bd94eae 100644 --- a/api/client/swagger_client/models/api_url.py +++ b/api/client/swagger_client/models/api_url.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ApiUrl(object): @@ -33,9 +33,13 @@ class ApiUrl(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"pipeline_url": "str"} + swagger_types = { + 'pipeline_url': 'str' + } - attribute_map = {"pipeline_url": "pipeline_url"} + attribute_map = { + 'pipeline_url': 'pipeline_url' + } def __init__(self, pipeline_url=None): # noqa: E501 """ApiUrl - a model defined in Swagger""" # noqa: E501 @@ -74,20 +78,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ApiUrl, dict): diff --git a/api/client/swagger_client/models/dictionary.py b/api/client/swagger_client/models/dictionary.py index 122a39f0..b10e9562 100644 --- a/api/client/swagger_client/models/dictionary.py +++ b/api/client/swagger_client/models/dictionary.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six from swagger_client.models.any_value import AnyValue # noqa: F401,E501 @@ -35,9 +35,11 @@ class Dictionary(dict): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {} + swagger_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """Dictionary - a model defined in Swagger""" # noqa: E501 @@ -50,20 +52,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(Dictionary, dict): diff --git a/api/client/swagger_client/models/protobuf_any.py b/api/client/swagger_client/models/protobuf_any.py index e23808ed..40e14b00 100644 --- a/api/client/swagger_client/models/protobuf_any.py +++ b/api/client/swagger_client/models/protobuf_any.py @@ -14,10 +14,10 @@ """ -import pprint # noqa: F401 +import pprint import re # noqa: F401 -import six # noqa: F401 +import six class ProtobufAny(object): @@ -33,9 +33,15 @@ class ProtobufAny(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - swagger_types = {"type_url": "str", "value": "str"} + swagger_types = { + 'type_url': 'str', + 'value': 'str' + } - attribute_map = {"type_url": "type_url", "value": "value"} + attribute_map = { + 'type_url': 'type_url', + 'value': 'value' + } def __init__(self, type_url=None, value=None): # noqa: E501 """ProtobufAny - a model defined in Swagger""" # noqa: E501 @@ -92,13 +98,8 @@ def value(self, value): :param value: The value of this ProtobufAny. # noqa: E501 :type: str """ - if value is not None and not re.search( - r"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$", - value, - ): # noqa: E501 - raise ValueError( - r"Invalid value for `value`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`" # noqa: E501 - ) + if value is not None and not re.search(r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', value): # noqa: E501 + raise ValueError(r"Invalid value for `value`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501 self._value = value @@ -109,20 +110,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) else: result[attr] = value if issubclass(ProtobufAny, dict): diff --git a/api/client/swagger_client/rest.py b/api/client/swagger_client/rest.py index 2ae713fc..dbff75e3 100644 --- a/api/client/swagger_client/rest.py +++ b/api/client/swagger_client/rest.py @@ -23,21 +23,21 @@ import ssl import certifi - # python 2 and python 3 compatibility library -import six # noqa: F401 +import six from six.moves.urllib.parse import urlencode try: import urllib3 except ImportError: - raise ImportError("Swagger python client requires urllib3.") + raise ImportError('Swagger python client requires urllib3.') logger = logging.getLogger(__name__) class RESTResponse(io.IOBase): + def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -54,6 +54,7 @@ def getheader(self, name, default=None): class RESTClientObject(object): + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -76,9 +77,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -109,17 +108,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): **addition_pool_args ) - def request( - self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, - _request_timeout=None, - ): + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): """Perform requests. :param method: http request method @@ -139,7 +130,8 @@ def request( (connection, read) timeouts. """ method = method.upper() - assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] if post_params and body: raise ValueError( @@ -151,74 +143,62 @@ def request( timeout = None if _request_timeout: - if isinstance( - _request_timeout, (int,) if six.PY3 else (int, long) # noqa: E501,F821 - ): + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1] - ) + connect=_request_timeout[0], read=_request_timeout[1]) - if "Content-Type" not in headers: - headers["Content-Type"] = "application/json" + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: if query_params: - url += "?" + urlencode(query_params) - if re.search("json", headers["Content-Type"], re.IGNORECASE): + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif ( - headers["Content-Type"] == "application/x-www-form-urlencoded" - ): # noqa: E501 + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif headers["Content-Type"] == "multipart/form-data": + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers["Content-Type"] + del headers['Content-Type'] r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str): request_body = body r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -227,14 +207,11 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( - method, - url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers, - ) + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -245,7 +222,7 @@ def request( # In the python 3, the response.data is bytes. # we need to decode it to string. if six.PY3: - r.data = r.data.decode("utf8") + r.data = r.data.decode('utf8') # log response body logger.debug("response body: %s", r.data) @@ -255,145 +232,74 @@ def request( return r - def GET( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def HEAD( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def OPTIONS( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def DELETE( - self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def POST( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PUT( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def PATCH( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) class ApiException(Exception): + def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status @@ -408,9 +314,11 @@ def __init__(self, status=None, reason=None, http_resp=None): def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format(self.headers) + error_message += "HTTP response headers: {0}\n".format( + self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) diff --git a/api/client/test/test_any_value.py b/api/client/test/test_any_value.py index c5af008a..f4877a9b 100644 --- a/api/client/test/test_any_value.py +++ b/api/client/test/test_any_value.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.any_value import AnyValue # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.any_value import AnyValue # noqa: E501 class TestAnyValue(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testAnyValue(self): """Test AnyValue""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.any_value.AnyValue() - pass + # model = swagger_client.models.any_value.AnyValue() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_access_token.py b/api/client/test/test_api_access_token.py index b30c254c..ab1e64e9 100644 --- a/api/client/test/test_api_access_token.py +++ b/api/client/test/test_api_access_token.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_access_token import ApiAccessToken # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_access_token import ApiAccessToken # noqa: E501 class TestApiAccessToken(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiAccessToken(self): """Test ApiAccessToken""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_access_token.ApiAccessToken() - pass + # model = swagger_client.models.api_access_token.ApiAccessToken() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_asset.py b/api/client/test/test_api_asset.py index 2f07093b..52769082 100644 --- a/api/client/test/test_api_asset.py +++ b/api/client/test/test_api_asset.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_asset import ApiAsset # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_asset import ApiAsset # noqa: E501 class TestApiAsset(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiAsset(self): """Test ApiAsset""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_asset.ApiAsset() - pass + # model = swagger_client.models.api_asset.ApiAsset() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_catalog_upload.py b/api/client/test/test_api_catalog_upload.py index a8d3b48d..74f77e8a 100644 --- a/api/client/test/test_api_catalog_upload.py +++ b/api/client/test/test_api_catalog_upload.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_catalog_upload import ApiCatalogUpload # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_catalog_upload import ApiCatalogUpload # noqa: E501 class TestApiCatalogUpload(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiCatalogUpload(self): """Test ApiCatalogUpload""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_catalog_upload.ApiCatalogUpload() - pass + # model = swagger_client.models.api_catalog_upload.ApiCatalogUpload() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_catalog_upload_error.py b/api/client/test/test_api_catalog_upload_error.py index 8ce84e1b..a6808dc9 100644 --- a/api/client/test/test_api_catalog_upload_error.py +++ b/api/client/test/test_api_catalog_upload_error.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_catalog_upload_error import ( # noqa: F401 - ApiCatalogUploadError, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_catalog_upload_error import ApiCatalogUploadError # noqa: E501 class TestApiCatalogUploadError(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiCatalogUploadError(self): """Test ApiCatalogUploadError""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_catalog_upload_error.ApiCatalogUploadError() - pass + # model = swagger_client.models.api_catalog_upload_error.ApiCatalogUploadError() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_catalog_upload_item.py b/api/client/test/test_api_catalog_upload_item.py index ccfeb2f9..351e2683 100644 --- a/api/client/test/test_api_catalog_upload_item.py +++ b/api/client/test/test_api_catalog_upload_item.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_catalog_upload_item import ( # noqa: F401 - ApiCatalogUploadItem, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_catalog_upload_item import ApiCatalogUploadItem # noqa: E501 class TestApiCatalogUploadItem(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiCatalogUploadItem(self): """Test ApiCatalogUploadItem""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_catalog_upload_item.ApiCatalogUploadItem() - pass + # model = swagger_client.models.api_catalog_upload_item.ApiCatalogUploadItem() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_catalog_upload_response.py b/api/client/test/test_api_catalog_upload_response.py index c483c0df..1e46a944 100644 --- a/api/client/test/test_api_catalog_upload_response.py +++ b/api/client/test/test_api_catalog_upload_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_catalog_upload_response import ( # noqa: F401 - ApiCatalogUploadResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_catalog_upload_response import ApiCatalogUploadResponse # noqa: E501 class TestApiCatalogUploadResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiCatalogUploadResponse(self): """Test ApiCatalogUploadResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_catalog_upload_response.ApiCatalogUploadResponse() - pass + # model = swagger_client.models.api_catalog_upload_response.ApiCatalogUploadResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_component.py b/api/client/test/test_api_component.py index 646284ef..6e740393 100644 --- a/api/client/test/test_api_component.py +++ b/api/client/test/test_api_component.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_component import ApiComponent # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_component import ApiComponent # noqa: E501 class TestApiComponent(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiComponent(self): """Test ApiComponent""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_component.ApiComponent() - pass + # model = swagger_client.models.api_component.ApiComponent() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_credential.py b/api/client/test/test_api_credential.py index 256bb01f..567c2735 100644 --- a/api/client/test/test_api_credential.py +++ b/api/client/test/test_api_credential.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_credential import ApiCredential # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_credential import ApiCredential # noqa: E501 class TestApiCredential(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiCredential(self): """Test ApiCredential""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_credential.ApiCredential() - pass + # model = swagger_client.models.api_credential.ApiCredential() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_dataset.py b/api/client/test/test_api_dataset.py index 8fad9a6f..815c5366 100644 --- a/api/client/test/test_api_dataset.py +++ b/api/client/test/test_api_dataset.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_dataset import ApiDataset # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_dataset import ApiDataset # noqa: E501 class TestApiDataset(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiDataset(self): """Test ApiDataset""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_dataset.ApiDataset() - pass + # model = swagger_client.models.api_dataset.ApiDataset() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_generate_code_response.py b/api/client/test/test_api_generate_code_response.py index 5c7b42d5..26ddada7 100644 --- a/api/client/test/test_api_generate_code_response.py +++ b/api/client/test/test_api_generate_code_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 class TestApiGenerateCodeResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiGenerateCodeResponse(self): """Test ApiGenerateCodeResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_generate_code_response.ApiGenerateCodeResponse() - pass + # model = swagger_client.models.api_generate_code_response.ApiGenerateCodeResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_generate_model_code_response.py b/api/client/test/test_api_generate_model_code_response.py index 7cbf6f63..da8e64a2 100644 --- a/api/client/test/test_api_generate_model_code_response.py +++ b/api/client/test/test_api_generate_model_code_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_generate_model_code_response import ApiGenerateModelCodeResponse # noqa: E501 class TestApiGenerateModelCodeResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiGenerateModelCodeResponse(self): """Test ApiGenerateModelCodeResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_generate_model_code_response.ApiGenerateModelCodeResponse() - pass + # model = swagger_client.models.api_generate_model_code_response.ApiGenerateModelCodeResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_get_template_response.py b/api/client/test/test_api_get_template_response.py index 6bab1203..942ab185 100644 --- a/api/client/test/test_api_get_template_response.py +++ b/api/client/test/test_api_get_template_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 class TestApiGetTemplateResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiGetTemplateResponse(self): """Test ApiGetTemplateResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_get_template_response.ApiGetTemplateResponse() - pass + # model = swagger_client.models.api_get_template_response.ApiGetTemplateResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_inferenceservice.py b/api/client/test/test_api_inferenceservice.py index b1c5d48a..bdd3bef1 100644 --- a/api/client/test/test_api_inferenceservice.py +++ b/api/client/test/test_api_inferenceservice.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_inferenceservice import ApiInferenceservice # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_inferenceservice import ApiInferenceservice # noqa: E501 class TestApiInferenceservice(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiInferenceservice(self): """Test ApiInferenceservice""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_inferenceservice.ApiInferenceservice() - pass + # model = swagger_client.models.api_inferenceservice.ApiInferenceservice() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_catalog_items_response.py b/api/client/test/test_api_list_catalog_items_response.py index f89c1118..783c82d6 100644 --- a/api/client/test/test_api_list_catalog_items_response.py +++ b/api/client/test/test_api_list_catalog_items_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_catalog_items_response import ApiListCatalogItemsResponse # noqa: E501 class TestApiListCatalogItemsResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListCatalogItemsResponse(self): """Test ApiListCatalogItemsResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_catalog_items_response.ApiListCatalogItemsResponse() - pass + # model = swagger_client.models.api_list_catalog_items_response.ApiListCatalogItemsResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_catalog_upload_errors.py b/api/client/test/test_api_list_catalog_upload_errors.py index 02d4854c..92a946ec 100644 --- a/api/client/test/test_api_list_catalog_upload_errors.py +++ b/api/client/test/test_api_list_catalog_upload_errors.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_catalog_upload_errors import ( # noqa: F401 - ApiListCatalogUploadErrors, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_catalog_upload_errors import ApiListCatalogUploadErrors # noqa: E501 class TestApiListCatalogUploadErrors(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListCatalogUploadErrors(self): """Test ApiListCatalogUploadErrors""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_catalog_upload_errors.ApiListCatalogUploadErrors() - pass + # model = swagger_client.models.api_list_catalog_upload_errors.ApiListCatalogUploadErrors() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_components_response.py b/api/client/test/test_api_list_components_response.py index 61b30910..23fa8f53 100644 --- a/api/client/test/test_api_list_components_response.py +++ b/api/client/test/test_api_list_components_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_components_response import ( # noqa: F401 - ApiListComponentsResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_components_response import ApiListComponentsResponse # noqa: E501 class TestApiListComponentsResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListComponentsResponse(self): """Test ApiListComponentsResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_components_response.ApiListComponentsResponse() - pass + # model = swagger_client.models.api_list_components_response.ApiListComponentsResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_credentials_response.py b/api/client/test/test_api_list_credentials_response.py index 7119794f..904ed028 100644 --- a/api/client/test/test_api_list_credentials_response.py +++ b/api/client/test/test_api_list_credentials_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_credentials_response import ApiListCredentialsResponse # noqa: E501 class TestApiListCredentialsResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListCredentialsResponse(self): """Test ApiListCredentialsResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_credentials_response.ApiListCredentialsResponse() - pass + # model = swagger_client.models.api_list_credentials_response.ApiListCredentialsResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_datasets_response.py b/api/client/test/test_api_list_datasets_response.py index 329322e9..24662957 100644 --- a/api/client/test/test_api_list_datasets_response.py +++ b/api/client/test/test_api_list_datasets_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_datasets_response import ( # noqa: F401 - ApiListDatasetsResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_datasets_response import ApiListDatasetsResponse # noqa: E501 class TestApiListDatasetsResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListDatasetsResponse(self): """Test ApiListDatasetsResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_datasets_response.ApiListDatasetsResponse() - pass + # model = swagger_client.models.api_list_datasets_response.ApiListDatasetsResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_inferenceservices_response.py b/api/client/test/test_api_list_inferenceservices_response.py index cc3a1501..3d537313 100644 --- a/api/client/test/test_api_list_inferenceservices_response.py +++ b/api/client/test/test_api_list_inferenceservices_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse # noqa: E501 class TestApiListInferenceservicesResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListInferenceservicesResponse(self): """Test ApiListInferenceservicesResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_inferenceservices_response.ApiListInferenceservicesResponse() - pass + # model = swagger_client.models.api_list_inferenceservices_response.ApiListInferenceservicesResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_models_response.py b/api/client/test/test_api_list_models_response.py index 0f23f154..f42cb96e 100644 --- a/api/client/test/test_api_list_models_response.py +++ b/api/client/test/test_api_list_models_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_models_response import ( # noqa: F401 - ApiListModelsResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_models_response import ApiListModelsResponse # noqa: E501 class TestApiListModelsResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListModelsResponse(self): """Test ApiListModelsResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_models_response.ApiListModelsResponse() - pass + # model = swagger_client.models.api_list_models_response.ApiListModelsResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_notebooks_response.py b/api/client/test/test_api_list_notebooks_response.py index c22ea98c..4abc9548 100644 --- a/api/client/test/test_api_list_notebooks_response.py +++ b/api/client/test/test_api_list_notebooks_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_notebooks_response import ( # noqa: F401 - ApiListNotebooksResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_notebooks_response import ApiListNotebooksResponse # noqa: E501 class TestApiListNotebooksResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListNotebooksResponse(self): """Test ApiListNotebooksResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_notebooks_response.ApiListNotebooksResponse() - pass + # model = swagger_client.models.api_list_notebooks_response.ApiListNotebooksResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_list_pipelines_response.py b/api/client/test/test_api_list_pipelines_response.py index 8ac7447f..42ac500e 100644 --- a/api/client/test/test_api_list_pipelines_response.py +++ b/api/client/test/test_api_list_pipelines_response.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_list_pipelines_response import ( # noqa: F401 - ApiListPipelinesResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_list_pipelines_response import ApiListPipelinesResponse # noqa: E501 class TestApiListPipelinesResponse(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiListPipelinesResponse(self): """Test ApiListPipelinesResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_list_pipelines_response.ApiListPipelinesResponse() - pass + # model = swagger_client.models.api_list_pipelines_response.ApiListPipelinesResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_metadata.py b/api/client/test/test_api_metadata.py index d7c9743e..5c048c80 100644 --- a/api/client/test/test_api_metadata.py +++ b/api/client/test/test_api_metadata.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_metadata import ApiMetadata # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_metadata import ApiMetadata # noqa: E501 class TestApiMetadata(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiMetadata(self): """Test ApiMetadata""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_metadata.ApiMetadata() - pass + # model = swagger_client.models.api_metadata.ApiMetadata() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_model.py b/api/client/test/test_api_model.py index 1eaca289..a6aa6986 100644 --- a/api/client/test/test_api_model.py +++ b/api/client/test/test_api_model.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_model import ApiModel # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_model import ApiModel # noqa: E501 class TestApiModel(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiModel(self): """Test ApiModel""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_model.ApiModel() - pass + # model = swagger_client.models.api_model.ApiModel() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_model_framework.py b/api/client/test/test_api_model_framework.py index a8e5afc1..53cece20 100644 --- a/api/client/test/test_api_model_framework.py +++ b/api/client/test/test_api_model_framework.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_model_framework import ApiModelFramework # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_model_framework import ApiModelFramework # noqa: E501 class TestApiModelFramework(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiModelFramework(self): """Test ApiModelFramework""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_model_framework.ApiModelFramework() - pass + # model = swagger_client.models.api_model_framework.ApiModelFramework() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_model_framework_runtimes.py b/api/client/test/test_api_model_framework_runtimes.py index 83e457fe..73e38149 100644 --- a/api/client/test/test_api_model_framework_runtimes.py +++ b/api/client/test/test_api_model_framework_runtimes.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_model_framework_runtimes import ( # noqa: F401 - ApiModelFrameworkRuntimes, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_model_framework_runtimes import ApiModelFrameworkRuntimes # noqa: E501 class TestApiModelFrameworkRuntimes(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiModelFrameworkRuntimes(self): """Test ApiModelFrameworkRuntimes""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_model_framework_runtimes.ApiModelFrameworkRuntimes() - pass + # model = swagger_client.models.api_model_framework_runtimes.ApiModelFrameworkRuntimes() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_model_script.py b/api/client/test/test_api_model_script.py index c7300a1c..356aff56 100644 --- a/api/client/test/test_api_model_script.py +++ b/api/client/test/test_api_model_script.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_model_script import ApiModelScript # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_model_script import ApiModelScript # noqa: E501 class TestApiModelScript(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiModelScript(self): """Test ApiModelScript""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_model_script.ApiModelScript() - pass + # model = swagger_client.models.api_model_script.ApiModelScript() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_notebook.py b/api/client/test/test_api_notebook.py index 45337b00..5594848d 100644 --- a/api/client/test/test_api_notebook.py +++ b/api/client/test/test_api_notebook.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_notebook import ApiNotebook # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_notebook import ApiNotebook # noqa: E501 class TestApiNotebook(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiNotebook(self): """Test ApiNotebook""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_notebook.ApiNotebook() - pass + # model = swagger_client.models.api_notebook.ApiNotebook() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_parameter.py b/api/client/test/test_api_parameter.py index 9388d0f3..f59cb079 100644 --- a/api/client/test/test_api_parameter.py +++ b/api/client/test/test_api_parameter.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_parameter import ApiParameter # noqa: E501 class TestApiParameter(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiParameter(self): """Test ApiParameter""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_parameter.ApiParameter() - pass + # model = swagger_client.models.api_parameter.ApiParameter() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline.py b/api/client/test/test_api_pipeline.py index 2d2d9364..f656eca5 100644 --- a/api/client/test/test_api_pipeline.py +++ b/api/client/test/test_api_pipeline.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline import ApiPipeline # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline import ApiPipeline # noqa: E501 class TestApiPipeline(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiPipeline(self): """Test ApiPipeline""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline.ApiPipeline() - pass + # model = swagger_client.models.api_pipeline.ApiPipeline() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_custom.py b/api/client/test/test_api_pipeline_custom.py index a896c5d3..867f7acc 100644 --- a/api/client/test/test_api_pipeline_custom.py +++ b/api/client/test/test_api_pipeline_custom.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_custom import ApiPipelineCustom # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_custom import ApiPipelineCustom # noqa: E501 class TestApiPipelineCustom(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiPipelineCustom(self): """Test ApiPipelineCustom""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_custom.ApiPipelineCustom() - pass + # model = swagger_client.models.api_pipeline_custom.ApiPipelineCustom() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_custom_run_payload.py b/api/client/test/test_api_pipeline_custom_run_payload.py index 54c16b02..1444f3ba 100644 --- a/api/client/test/test_api_pipeline_custom_run_payload.py +++ b/api/client/test/test_api_pipeline_custom_run_payload.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_custom_run_payload import ( # noqa: F401 - ApiPipelineCustomRunPayload, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_custom_run_payload import ApiPipelineCustomRunPayload # noqa: E501 class TestApiPipelineCustomRunPayload(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiPipelineCustomRunPayload(self): """Test ApiPipelineCustomRunPayload""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_custom_run_payload.ApiPipelineCustomRunPayload() - pass + # model = swagger_client.models.api_pipeline_custom_run_payload.ApiPipelineCustomRunPayload() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_dag.py b/api/client/test/test_api_pipeline_dag.py index 2c1fa1b3..88474a73 100644 --- a/api/client/test/test_api_pipeline_dag.py +++ b/api/client/test/test_api_pipeline_dag.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_dag import ApiPipelineDAG # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_dag import ApiPipelineDAG # noqa: E501 class TestApiPipelineDAG(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiPipelineDAG(self): """Test ApiPipelineDAG""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_dag.ApiPipelineDAG() - pass + # model = swagger_client.models.api_pipeline_dag.ApiPipelineDAG() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_extended.py b/api/client/test/test_api_pipeline_extended.py index 61e95520..e2fa65e9 100644 --- a/api/client/test/test_api_pipeline_extended.py +++ b/api/client/test/test_api_pipeline_extended.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_extended import ApiPipelineExtended # noqa: E501 class TestApiPipelineExtended(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiPipelineExtended(self): """Test ApiPipelineExtended""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_extended.ApiPipelineExtended() - pass + # model = swagger_client.models.api_pipeline_extended.ApiPipelineExtended() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_extension.py b/api/client/test/test_api_pipeline_extension.py index 5c6ea743..a46c9fc9 100644 --- a/api/client/test/test_api_pipeline_extension.py +++ b/api/client/test/test_api_pipeline_extension.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_extension import ( # noqa: F401 - ApiPipelineExtension, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_extension import ApiPipelineExtension # noqa: E501 class TestApiPipelineExtension(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiPipelineExtension(self): """Test ApiPipelineExtension""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_extension.ApiPipelineExtension() - pass + # model = swagger_client.models.api_pipeline_extension.ApiPipelineExtension() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_inputs.py b/api/client/test/test_api_pipeline_inputs.py index b29cbb96..814198dc 100644 --- a/api/client/test/test_api_pipeline_inputs.py +++ b/api/client/test/test_api_pipeline_inputs.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_inputs import ApiPipelineInputs # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_inputs import ApiPipelineInputs # noqa: E501 class TestApiPipelineInputs(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiPipelineInputs(self): """Test ApiPipelineInputs""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_inputs.ApiPipelineInputs() - pass + # model = swagger_client.models.api_pipeline_inputs.ApiPipelineInputs() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_task.py b/api/client/test/test_api_pipeline_task.py index 4a8f8d03..78742a6b 100644 --- a/api/client/test/test_api_pipeline_task.py +++ b/api/client/test/test_api_pipeline_task.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_task import ApiPipelineTask # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_task import ApiPipelineTask # noqa: E501 class TestApiPipelineTask(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiPipelineTask(self): """Test ApiPipelineTask""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_task.ApiPipelineTask() - pass + # model = swagger_client.models.api_pipeline_task.ApiPipelineTask() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_pipeline_task_arguments.py b/api/client/test/test_api_pipeline_task_arguments.py index e6db7ecb..0ddb0f9c 100644 --- a/api/client/test/test_api_pipeline_task_arguments.py +++ b/api/client/test/test_api_pipeline_task_arguments.py @@ -18,11 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_pipeline_task_arguments import ( # noqa: F401 - ApiPipelineTaskArguments, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_pipeline_task_arguments import ApiPipelineTaskArguments # noqa: E501 class TestApiPipelineTaskArguments(unittest.TestCase): @@ -37,9 +33,8 @@ def tearDown(self): def testApiPipelineTaskArguments(self): """Test ApiPipelineTaskArguments""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_pipeline_task_arguments.ApiPipelineTaskArguments() - pass + # model = swagger_client.models.api_pipeline_task_arguments.ApiPipelineTaskArguments() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_run_code_response.py b/api/client/test/test_api_run_code_response.py index 36be4cbb..e99442f5 100644 --- a/api/client/test/test_api_run_code_response.py +++ b/api/client/test/test_api_run_code_response.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 class TestApiRunCodeResponse(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiRunCodeResponse(self): """Test ApiRunCodeResponse""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_run_code_response.ApiRunCodeResponse() - pass + # model = swagger_client.models.api_run_code_response.ApiRunCodeResponse() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_settings.py b/api/client/test/test_api_settings.py index 0ffb6be6..bdcd20f8 100644 --- a/api/client/test/test_api_settings.py +++ b/api/client/test/test_api_settings.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_settings import ApiSettings # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_settings import ApiSettings # noqa: E501 class TestApiSettings(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiSettings(self): """Test ApiSettings""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_settings.ApiSettings() - pass + # model = swagger_client.models.api_settings.ApiSettings() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_settings_section.py b/api/client/test/test_api_settings_section.py index 38f5cc20..8d3035b9 100644 --- a/api/client/test/test_api_settings_section.py +++ b/api/client/test/test_api_settings_section.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_settings_section import ApiSettingsSection # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_settings_section import ApiSettingsSection # noqa: E501 class TestApiSettingsSection(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiSettingsSection(self): """Test ApiSettingsSection""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_settings_section.ApiSettingsSection() - pass + # model = swagger_client.models.api_settings_section.ApiSettingsSection() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_status.py b/api/client/test/test_api_status.py index de184aed..71eeb977 100644 --- a/api/client/test/test_api_status.py +++ b/api/client/test/test_api_status.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_status import ApiStatus # noqa: E501 class TestApiStatus(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiStatus(self): """Test ApiStatus""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_status.ApiStatus() - pass + # model = swagger_client.models.api_status.ApiStatus() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_api_url.py b/api/client/test/test_api_url.py index f1ebb2b2..53e2dea3 100644 --- a/api/client/test/test_api_url.py +++ b/api/client/test/test_api_url.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.api_url import ApiUrl # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.api_url import ApiUrl # noqa: E501 class TestApiUrl(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testApiUrl(self): """Test ApiUrl""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.api_url.ApiUrl() - pass + # model = swagger_client.models.api_url.ApiUrl() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_application_settings_api.py b/api/client/test/test_application_settings_api.py index 1f92eea1..e6310163 100644 --- a/api/client/test/test_application_settings_api.py +++ b/api/client/test/test_application_settings_api.py @@ -18,36 +18,34 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.application_settings_api import ( # noqa: F401 - ApplicationSettingsApi, -) -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.application_settings_api import ApplicationSettingsApi # noqa: E501 class TestApplicationSettingsApi(unittest.TestCase): """ApplicationSettingsApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.application_settings_api.ApplicationSettingsApi() - ) + self.api = swagger_client.api.application_settings_api.ApplicationSettingsApi() # noqa: E501 def tearDown(self): pass def test_get_application_settings(self): - """Test case for get_application_settings""" - pass + """Test case for get_application_settings + + """ def test_modify_application_settings(self): - """Test case for modify_application_settings""" - pass + """Test case for modify_application_settings + + """ def test_set_application_settings(self): - """Test case for set_application_settings""" - pass + """Test case for set_application_settings + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_catalog_service_api.py b/api/client/test/test_catalog_service_api.py index 75cc66db..82ed643d 100644 --- a/api/client/test/test_catalog_service_api.py +++ b/api/client/test/test_catalog_service_api.py @@ -18,30 +18,29 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.catalog_service_api import CatalogServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.catalog_service_api import CatalogServiceApi # noqa: E501 class TestCatalogServiceApi(unittest.TestCase): """CatalogServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.catalog_service_api.CatalogServiceApi() - ) + self.api = swagger_client.api.catalog_service_api.CatalogServiceApi() # noqa: E501 def tearDown(self): pass def test_list_all_assets(self): - """Test case for list_all_assets""" - pass + """Test case for list_all_assets + + """ def test_upload_multiple_assets(self): - """Test case for upload_multiple_assets""" - pass + """Test case for upload_multiple_assets + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_component_service_api.py b/api/client/test/test_component_service_api.py index dc27274f..8c435c47 100644 --- a/api/client/test/test_component_service_api.py +++ b/api/client/test/test_component_service_api.py @@ -18,73 +18,80 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.component_service_api import ComponentServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.component_service_api import ComponentServiceApi # noqa: E501 class TestComponentServiceApi(unittest.TestCase): """ComponentServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.component_service_api.ComponentServiceApi() - ) + self.api = swagger_client.api.component_service_api.ComponentServiceApi() # noqa: E501 def tearDown(self): pass def test_approve_components_for_publishing(self): - """Test case for approve_components_for_publishing""" - pass + """Test case for approve_components_for_publishing + + """ def test_create_component(self): - """Test case for create_component""" - pass + """Test case for create_component + + """ def test_delete_component(self): - """Test case for delete_component""" - pass + """Test case for delete_component + + """ def test_download_component_files(self): """Test case for download_component_files Returns the component artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 """ - pass def test_generate_component_code(self): - """Test case for generate_component_code""" - pass + """Test case for generate_component_code + + """ def test_get_component(self): - """Test case for get_component""" - pass + """Test case for get_component + + """ def test_get_component_template(self): - """Test case for get_component_template""" - pass + """Test case for get_component_template + + """ def test_list_components(self): - """Test case for list_components""" - pass + """Test case for list_components + + """ def test_run_component(self): - """Test case for run_component""" - pass + """Test case for run_component + + """ def test_set_featured_components(self): - """Test case for set_featured_components""" - pass + """Test case for set_featured_components + + """ def test_upload_component(self): - """Test case for upload_component""" - pass + """Test case for upload_component + + """ def test_upload_component_file(self): - """Test case for upload_component_file""" - pass + """Test case for upload_component_file + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_credential_service_api.py b/api/client/test/test_credential_service_api.py index 131d3455..6d8cdfec 100644 --- a/api/client/test/test_credential_service_api.py +++ b/api/client/test/test_credential_service_api.py @@ -18,34 +18,34 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.credential_service_api import CredentialServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.credential_service_api import CredentialServiceApi # noqa: E501 class TestCredentialServiceApi(unittest.TestCase): """CredentialServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.credential_service_api.CredentialServiceApi() - ) + self.api = swagger_client.api.credential_service_api.CredentialServiceApi() # noqa: E501 def tearDown(self): pass def test_create_credentials(self): - """Test case for create_credentials""" - pass + """Test case for create_credentials + + """ def test_delete_credential(self): - """Test case for delete_credential""" - pass + """Test case for delete_credential + + """ def test_get_credential(self): - """Test case for get_credential""" - pass + """Test case for get_credential + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_dataset_service_api.py b/api/client/test/test_dataset_service_api.py index 72652ad3..e589c80c 100644 --- a/api/client/test/test_dataset_service_api.py +++ b/api/client/test/test_dataset_service_api.py @@ -18,69 +18,75 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.dataset_service_api import DatasetServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.dataset_service_api import DatasetServiceApi # noqa: E501 class TestDatasetServiceApi(unittest.TestCase): """DatasetServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.dataset_service_api.DatasetServiceApi() - ) + self.api = swagger_client.api.dataset_service_api.DatasetServiceApi() # noqa: E501 def tearDown(self): pass def test_approve_datasets_for_publishing(self): - """Test case for approve_datasets_for_publishing""" - pass + """Test case for approve_datasets_for_publishing + + """ def test_create_dataset(self): - """Test case for create_dataset""" - pass + """Test case for create_dataset + + """ def test_delete_dataset(self): - """Test case for delete_dataset""" - pass + """Test case for delete_dataset + + """ def test_download_dataset_files(self): """Test case for download_dataset_files Returns the dataset artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 """ - pass def test_generate_dataset_code(self): - """Test case for generate_dataset_code""" - pass + """Test case for generate_dataset_code + + """ def test_get_dataset(self): - """Test case for get_dataset""" - pass + """Test case for get_dataset + + """ def test_get_dataset_template(self): - """Test case for get_dataset_template""" - pass + """Test case for get_dataset_template + + """ def test_list_datasets(self): - """Test case for list_datasets""" - pass + """Test case for list_datasets + + """ def test_set_featured_datasets(self): - """Test case for set_featured_datasets""" - pass + """Test case for set_featured_datasets + + """ def test_upload_dataset(self): - """Test case for upload_dataset""" - pass + """Test case for upload_dataset + + """ def test_upload_dataset_file(self): - """Test case for upload_dataset_file""" - pass + """Test case for upload_dataset_file + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_dictionary.py b/api/client/test/test_dictionary.py index e0fcad1b..53778ea6 100644 --- a/api/client/test/test_dictionary.py +++ b/api/client/test/test_dictionary.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.dictionary import Dictionary # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.dictionary import Dictionary # noqa: E501 class TestDictionary(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testDictionary(self): """Test Dictionary""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.dictionary.Dictionary() - pass + # model = swagger_client.models.dictionary.Dictionary() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_health_check_api.py b/api/client/test/test_health_check_api.py index ef9eb895..894077e8 100644 --- a/api/client/test/test_health_check_api.py +++ b/api/client/test/test_health_check_api.py @@ -18,16 +18,15 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.health_check_api import HealthCheckApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.health_check_api import HealthCheckApi # noqa: E501 class TestHealthCheckApi(unittest.TestCase): """HealthCheckApi unit test stubs""" def setUp(self): - self.api = swagger_client.api.health_check_api.HealthCheckApi() + self.api = swagger_client.api.health_check_api.HealthCheckApi() # noqa: E501 def tearDown(self): pass @@ -37,8 +36,7 @@ def test_health_check(self): Checks if the server is running # noqa: E501 """ - pass -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_inference_service_api.py b/api/client/test/test_inference_service_api.py index 27642eec..eb04c0a4 100644 --- a/api/client/test/test_inference_service_api.py +++ b/api/client/test/test_inference_service_api.py @@ -18,33 +18,30 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.inference_service_api import InferenceServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.inference_service_api import InferenceServiceApi # noqa: E501 class TestInferenceServiceApi(unittest.TestCase): """InferenceServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.inference_service_api.InferenceServiceApi() - ) + self.api = swagger_client.api.inference_service_api.InferenceServiceApi() # noqa: E501 def tearDown(self): pass def test_get_service(self): - """Test case for get_service""" - pass + """Test case for get_service + + """ def test_list_services(self): """Test case for list_services Gets all KFServing services # noqa: E501 """ - pass -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_model_service_api.py b/api/client/test/test_model_service_api.py index 99c81fac..22273e1b 100644 --- a/api/client/test/test_model_service_api.py +++ b/api/client/test/test_model_service_api.py @@ -18,71 +18,80 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.model_service_api import ModelServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.model_service_api import ModelServiceApi # noqa: E501 class TestModelServiceApi(unittest.TestCase): """ModelServiceApi unit test stubs""" def setUp(self): - self.api = swagger_client.api.model_service_api.ModelServiceApi() + self.api = swagger_client.api.model_service_api.ModelServiceApi() # noqa: E501 def tearDown(self): pass def test_approve_models_for_publishing(self): - """Test case for approve_models_for_publishing""" - pass + """Test case for approve_models_for_publishing + + """ def test_create_model(self): - """Test case for create_model""" - pass + """Test case for create_model + + """ def test_delete_model(self): - """Test case for delete_model""" - pass + """Test case for delete_model + + """ def test_download_model_files(self): """Test case for download_model_files Returns the model artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 """ - pass def test_generate_model_code(self): - """Test case for generate_model_code""" - pass + """Test case for generate_model_code + + """ def test_get_model(self): - """Test case for get_model""" - pass + """Test case for get_model + + """ def test_get_model_template(self): - """Test case for get_model_template""" - pass + """Test case for get_model_template + + """ def test_list_models(self): - """Test case for list_models""" - pass + """Test case for list_models + + """ def test_run_model(self): - """Test case for run_model""" - pass + """Test case for run_model + + """ def test_set_featured_models(self): - """Test case for set_featured_models""" - pass + """Test case for set_featured_models + + """ def test_upload_model(self): - """Test case for upload_model""" - pass + """Test case for upload_model + + """ def test_upload_model_file(self): - """Test case for upload_model_file""" - pass + """Test case for upload_model_file + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_notebook_service_api.py b/api/client/test/test_notebook_service_api.py index 7e156ba9..fba3a53b 100644 --- a/api/client/test/test_notebook_service_api.py +++ b/api/client/test/test_notebook_service_api.py @@ -18,73 +18,80 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.notebook_service_api import NotebookServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.notebook_service_api import NotebookServiceApi # noqa: E501 class TestNotebookServiceApi(unittest.TestCase): """NotebookServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.notebook_service_api.NotebookServiceApi() - ) + self.api = swagger_client.api.notebook_service_api.NotebookServiceApi() # noqa: E501 def tearDown(self): pass def test_approve_notebooks_for_publishing(self): - """Test case for approve_notebooks_for_publishing""" - pass + """Test case for approve_notebooks_for_publishing + + """ def test_create_notebook(self): - """Test case for create_notebook""" - pass + """Test case for create_notebook + + """ def test_delete_notebook(self): - """Test case for delete_notebook""" - pass + """Test case for delete_notebook + + """ def test_download_notebook_files(self): """Test case for download_notebook_files Returns the notebook artifacts compressed into a .tgz (.tar.gz) file. # noqa: E501 """ - pass def test_generate_notebook_code(self): - """Test case for generate_notebook_code""" - pass + """Test case for generate_notebook_code + + """ def test_get_notebook(self): - """Test case for get_notebook""" - pass + """Test case for get_notebook + + """ def test_get_notebook_template(self): - """Test case for get_notebook_template""" - pass + """Test case for get_notebook_template + + """ def test_list_notebooks(self): - """Test case for list_notebooks""" - pass + """Test case for list_notebooks + + """ def test_run_notebook(self): - """Test case for run_notebook""" - pass + """Test case for run_notebook + + """ def test_set_featured_notebooks(self): - """Test case for set_featured_notebooks""" - pass + """Test case for set_featured_notebooks + + """ def test_upload_notebook(self): - """Test case for upload_notebook""" - pass + """Test case for upload_notebook + + """ def test_upload_notebook_file(self): - """Test case for upload_notebook_file""" - pass + """Test case for upload_notebook_file + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_pipeline_service_api.py b/api/client/test/test_pipeline_service_api.py index 8fbcf77d..a7130138 100644 --- a/api/client/test/test_pipeline_service_api.py +++ b/api/client/test/test_pipeline_service_api.py @@ -18,61 +18,65 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.api.pipeline_service_api import PipelineServiceApi # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +import swagger_client +from swagger_client.api.pipeline_service_api import PipelineServiceApi # noqa: E501 class TestPipelineServiceApi(unittest.TestCase): """PipelineServiceApi unit test stubs""" def setUp(self): - self.api = ( - swagger_client.api.pipeline_service_api.PipelineServiceApi() - ) + self.api = swagger_client.api.pipeline_service_api.PipelineServiceApi() # noqa: E501 def tearDown(self): pass def test_approve_pipelines_for_publishing(self): - """Test case for approve_pipelines_for_publishing""" - pass + """Test case for approve_pipelines_for_publishing + + """ def test_create_pipeline(self): - """Test case for create_pipeline""" - pass + """Test case for create_pipeline + + """ def test_delete_pipeline(self): - """Test case for delete_pipeline""" - pass + """Test case for delete_pipeline + + """ def test_download_pipeline_files(self): """Test case for download_pipeline_files Returns the pipeline YAML compressed into a .tgz (.tar.gz) file. # noqa: E501 """ - pass def test_get_pipeline(self): - """Test case for get_pipeline""" - pass + """Test case for get_pipeline + + """ def test_get_template(self): - """Test case for get_template""" - pass + """Test case for get_template + + """ def test_list_pipelines(self): - """Test case for list_pipelines""" - pass + """Test case for list_pipelines + + """ def test_set_featured_pipelines(self): - """Test case for set_featured_pipelines""" - pass + """Test case for set_featured_pipelines + + """ def test_upload_pipeline(self): - """Test case for upload_pipeline""" - pass + """Test case for upload_pipeline + + """ -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/client/test/test_protobuf_any.py b/api/client/test/test_protobuf_any.py index 60562fa3..605448fb 100644 --- a/api/client/test/test_protobuf_any.py +++ b/api/client/test/test_protobuf_any.py @@ -18,9 +18,7 @@ import unittest -import swagger_client # noqa: F401 -from swagger_client.models.protobuf_any import ProtobufAny # noqa: F401, E501 -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models.protobuf_any import ProtobufAny # noqa: E501 class TestProtobufAny(unittest.TestCase): @@ -35,9 +33,8 @@ def tearDown(self): def testProtobufAny(self): """Test ProtobufAny""" # FIXME: construct object with mandatory attributes with example values - # model = swagger_client.models.protobuf_any.ProtobufAny() - pass + # model = swagger_client.models.protobuf_any.ProtobufAny() # noqa: E501 -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() diff --git a/api/examples/catalog_api.py b/api/examples/catalog_api.py index e50e2033..91d1e941 100644 --- a/api/examples/catalog_api.py +++ b/api/examples/catalog_api.py @@ -5,28 +5,22 @@ from __future__ import print_function import json -import swagger_client # noqa: F401 +import swagger_client -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from os import environ as env from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( # noqa: F401 - ApiListCatalogItemsResponse, - ApiCatalogUpload, - ApiCatalogUploadItem, - ApiCatalogUploadResponse, - ApiAccessToken, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiListCatalogItemsResponse, ApiCatalogUpload,\ + ApiCatalogUploadResponse, ApiAccessToken +from swagger_client.rest import ApiException from sys import stderr -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' catalog_upload_file = "./../../bootstrapper/catalog_upload.json" @@ -36,13 +30,14 @@ def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client def print_function_name_decorator(func): + def wrapper(*args, **kwargs): print() print(f"---[ {func.__name__} ]---") @@ -63,38 +58,30 @@ def upload_catalog_assets(upload_file=catalog_upload_file) -> ApiCatalogUploadRe upload_items = json.load(f) upload_body = ApiCatalogUpload( - api_access_tokens=[ - ApiAccessToken(api_token=IBM_GHE_API_TOKEN, url_host="github.ibm.com") - ], + api_access_tokens=[ApiAccessToken(api_token=IBM_GHE_API_TOKEN, url_host="github.ibm.com")], components=upload_items.get("components"), datasets=upload_items.get("datasets"), models=upload_items.get("models"), notebooks=upload_items.get("notebooks"), - pipelines=upload_items.get("pipelines"), - ) + pipelines=upload_items.get("pipelines")) - upload_response: ApiCatalogUploadResponse = api_instance.upload_multiple_assets( - upload_body - ) + upload_response: ApiCatalogUploadResponse = api_instance.upload_multiple_assets(upload_body) - print( - f"Uploaded '{upload_response.total_created}' assets, {upload_response.total_errors} errors" - ) + print(f"Uploaded '{upload_response.total_created}' assets, {upload_response.total_errors} errors") # print a short-ish table instead of the full JSON response - asset_types = ["components", "datasets", "models", "notebooks", "pipelines"] + asset_types = [ + "components", + "datasets", + "models", + "notebooks", + "pipelines" + ] for asset_type in asset_types: asset_list = upload_response.__getattribute__(asset_type) print(f"\n{asset_type.upper()}:\n") for asset in asset_list: - print( - "%s %s %s" - % ( - asset.id, - asset.created_at.strftime("%Y-%m-%d %H:%M:%S"), - asset.name, - ) - ) + print("%s %s %s" % (asset.id, asset.created_at.strftime("%Y-%m-%d %H:%M:%S"), asset.name)) if upload_response.total_errors > 0: print(f"\nERRORS:\n") @@ -104,11 +91,7 @@ def upload_catalog_assets(upload_file=catalog_upload_file) -> ApiCatalogUploadRe return upload_response except ApiException as e: - print( - "Exception when calling CatalogServiceApi -> upload_multiple_assets: %s\n" - % e, - file=stderr, - ) + print("Exception when calling CatalogServiceApi -> upload_multiple_assets: %s\n" % e, file=stderr) raise e return None @@ -124,7 +107,7 @@ def delete_assets(upload_assets_response: ApiCatalogUploadResponse = None): "datasets": swagger_client.DatasetServiceApi(api_client).delete_dataset, "models": swagger_client.ModelServiceApi(api_client).delete_model, "notebooks": swagger_client.NotebookServiceApi(api_client).delete_notebook, - "pipelines": swagger_client.PipelineServiceApi(api_client).delete_pipeline, + "pipelines": swagger_client.PipelineServiceApi(api_client).delete_pipeline } try: @@ -141,9 +124,7 @@ def delete_assets(upload_assets_response: ApiCatalogUploadResponse = None): @print_function_name_decorator -def list_assets( - filter_dict: dict = {}, sort_by: str = None -) -> ApiListCatalogItemsResponse: +def list_assets(filter_dict: dict = {}, sort_by: str = None) -> ApiListCatalogItemsResponse: api_client = get_swagger_client() api_instance = swagger_client.CatalogServiceApi(api_client=api_client) @@ -151,32 +132,27 @@ def list_assets( try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListCatalogItemsResponse = api_instance.list_all_assets( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListCatalogItemsResponse = \ + api_instance.list_all_assets(filter=filter_str, sort_by=sort_by) - asset_types = ["components", "datasets", "models", "notebooks", "pipelines"] + asset_types = [ + "components", + "datasets", + "models", + "notebooks", + "pipelines" + ] # print a short-ish table instead of the full JSON response for asset_type in asset_types: asset_list = api_response.__getattribute__(asset_type) for asset in asset_list: - print( - "%s %s %s" - % ( - asset.id, - asset.created_at.strftime("%Y-%m-%d %H:%M:%S"), - asset.name, - ) - ) + print("%s %s %s" % (asset.id, asset.created_at.strftime("%Y-%m-%d %H:%M:%S"), asset.name)) return api_response except ApiException as e: - print( - "Exception when calling CatalogServiceApi -> list_all_assets: %s\n" % e, - file=stderr, - ) + print("Exception when calling CatalogServiceApi -> list_all_assets: %s\n" % e, file=stderr) return [] @@ -187,7 +163,7 @@ def main(): delete_assets() # upload the assets configured in the bootstrapper - upload_response = upload_catalog_assets() + upload_catalog_assets() # delete (only) the assets we just uploaded # delete_assets(upload_response) @@ -196,5 +172,5 @@ def main(): list_assets() -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/api/examples/components_api.py b/api/examples/components_api.py index 47645068..4ec20b32 100644 --- a/api/examples/components_api.py +++ b/api/examples/components_api.py @@ -9,48 +9,42 @@ import os import random import re -import swagger_client # noqa: F401 +import swagger_client import tarfile import tempfile from io import BytesIO -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from os import environ as env +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( - ApiComponent, - ApiGetTemplateResponse, - ApiListComponentsResponse, - ApiGenerateCodeResponse, - ApiRunCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiComponent, ApiGetTemplateResponse, ApiListComponentsResponse, \ + ApiGenerateCodeResponse, ApiRunCodeResponse +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 +from urllib3.response import HTTPResponse -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' -yaml_files = glob.glob( - "./../../../katalog/component-samples/**/component.yaml", recursive=True -) +yaml_files = glob.glob("./../../../katalog/component-samples/**/component.yaml", recursive=True) def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client def print_function_name_decorator(func): + def wrapper(*args, **kwargs): print() print(f"---[ {func.__name__}{args}{kwargs} ]---") @@ -80,17 +74,12 @@ def upload_component_template(uploadfile_name, name=None) -> str: api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - component: ApiComponent = api_instance.upload_component( - uploadfile=uploadfile_name, name=name - ) + component: ApiComponent = api_instance.upload_component(uploadfile=uploadfile_name, name=name) print(f"Uploaded '{component.name}': {component.id}") return component.id except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> upload_component: %s\n" % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> upload_component: %s\n" % e, file=stderr) raise e return None @@ -117,17 +106,11 @@ def upload_component_file(component_id, file_path): api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - response = api_instance.upload_component_file( - id=component_id, uploadfile=file_path - ) + response = api_instance.upload_component_file(id=component_id, uploadfile=file_path) print(f"Upload file '{file_path}' to component with ID '{component_id}'") except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> upload_component_file: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> upload_component_file: %s\n" % e, file=stderr) raise e @@ -138,13 +121,13 @@ def download_component_tgz(component_id) -> str: api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_component_files( - component_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_component_files(component_id, + include_generated_code=True, + _preload_content=False) - attachment_header = response.info().get( - "Content-Disposition", f"attachment; filename={component_id}.tgz" - ) + attachment_header = response.info().get("Content-Disposition", + f"attachment; filename={component_id}.tgz") download_filename = re.sub("attachment; filename=", "", attachment_header) @@ -152,7 +135,7 @@ def download_component_tgz(component_id) -> str: os.makedirs(download_dir, exist_ok=True) tarfile_path = os.path.join(download_dir, download_filename) - with open(tarfile_path, "wb") as f: + with open(tarfile_path, 'wb') as f: f.write(response.read()) print(tarfile_path) @@ -160,11 +143,7 @@ def download_component_tgz(component_id) -> str: return tarfile_path except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> download_component_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> download_component_files: %s\n" % e, file=stderr) return "Download failed?" @@ -176,49 +155,35 @@ def verify_component_download(component_id: str) -> bool: api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_component_files( - component_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_component_files(component_id, + include_generated_code=True, + _preload_content=False) tgz_file = BytesIO(response.read()) tar = tarfile.open(fileobj=tgz_file) - file_contents = { - m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") - for m in tar.getmembers() - } + file_contents = {m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") + for m in tar.getmembers()} - template_response: ApiGetTemplateResponse = api_instance.get_component_template( - component_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_component_template(component_id) template_text_from_api = template_response.template - assert template_text_from_api == file_contents.get( - "yaml", file_contents.get("yml") - ) + assert template_text_from_api == file_contents.get("yaml", file_contents.get("yml")) - generate_code_response: ApiGenerateCodeResponse = ( - api_instance.generate_component_code(component_id) - ) + generate_code_response: ApiGenerateCodeResponse = api_instance.generate_component_code(component_id) run_script_from_api = generate_code_response.script - regex = re.compile( - r"name='[^']*'" - ) # controller adds random chars to name, replace those + regex = re.compile(r"name='[^']*'") # controller adds random chars to name, replace those - assert regex.sub("name='...'", run_script_from_api) == regex.sub( - "name='...'", file_contents.get("py") - ) + assert regex.sub("name='...'", run_script_from_api) == \ + regex.sub("name='...'", file_contents.get("py")) print("downloaded files match") return True except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> download_component_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> download_component_files: %s\n" % e, file=stderr) return False @@ -230,14 +195,10 @@ def approve_components_for_publishing(component_ids: [str]): api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - api_response = api_instance.approve_components_for_publishing(component_ids) + api_instance.approve_components_for_publishing(component_ids) except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> approve_components_for_publishing: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> approve_components_for_publishing: %s\n" % e, file=stderr) return None @@ -249,14 +210,10 @@ def set_featured_components(component_ids: [str]): api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - api_response = api_instance.set_featured_components(component_ids) + api_instance.set_featured_components(component_ids) except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> set_featured_components: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> set_featured_components: %s\n" % e, file=stderr) return None @@ -273,10 +230,7 @@ def get_component(component_id: str) -> ApiComponent: return component_meta except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> get_component: %s\n" % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> get_component: %s\n" % e, file=stderr) return None @@ -290,10 +244,7 @@ def delete_component(component_id: str): try: api_instance.delete_component(component_id) except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> delete_component: %s\n" % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> delete_component: %s\n" % e, file=stderr) @print_function_name_decorator @@ -303,9 +254,7 @@ def get_template(template_id: str) -> str: api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - template_response: ApiGetTemplateResponse = api_instance.get_component_template( - template_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_component_template(template_id) print(template_response.template) # yaml_dict = yaml.load(template_response.template, Loader=yaml.FullLoader) @@ -318,11 +267,7 @@ def get_template(template_id: str) -> str: return template_response.template except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> get_component_template: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> get_component_template: %s\n" % e, file=stderr) return None @@ -334,18 +279,13 @@ def generate_code(component_id: str) -> str: api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - generate_code_response: ApiGenerateCodeResponse = ( - api_instance.generate_component_code(component_id) - ) + generate_code_response: ApiGenerateCodeResponse = api_instance.generate_component_code(component_id) print(generate_code_response.script) return generate_code_response.script except ApiException as e: - print( - "Exception while calling ComponentServiceApi -> generate_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling ComponentServiceApi -> generate_code: %s\n" % e, file=stderr) return None @@ -357,21 +297,14 @@ def run_code(component_id: str, parameters: dict = {}, run_name: str = None) -> api_instance = swagger_client.ComponentServiceApi(api_client=api_client) try: - param_array = [ - {"name": key, "value": value} for key, value in parameters.items() - ] - run_code_response: ApiRunCodeResponse = api_instance.run_component( - component_id, param_array, run_name=run_name - ) + param_array = [{"name": key, "value": value} for key, value in parameters.items()] + run_code_response: ApiRunCodeResponse = api_instance.run_component(component_id, param_array, run_name=run_name) print(run_code_response.run_url) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling ComponentServiceApi -> run_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling ComponentServiceApi -> run_code: %s\n" % e, file=stderr) return None @@ -385,23 +318,15 @@ def list_components(filter_dict: dict = {}, sort_by: str = None) -> [ApiComponen try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListComponentsResponse = api_instance.list_components( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListComponentsResponse = api_instance.list_components(filter=filter_str, sort_by=sort_by) for c in api_response.components: - print( - "%s %s %s" - % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name) - ) + print("%s %s %s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name)) return api_response.components except ApiException as e: - print( - "Exception when calling ComponentServiceApi -> list_components: %s\n" % e, - file=stderr, - ) + print("Exception when calling ComponentServiceApi -> list_components: %s\n" % e, file=stderr) return [] @@ -436,24 +361,22 @@ def main(): verify_component_download(component_id) upload_component_file(component_id, tgz_file) - component = list_components( - filter_dict={"name": "Create Secret - Kubernetes Cluster"} - )[0] + component = list_components(filter_dict={"name": 'Create Secret - Kubernetes Cluster'})[0] generate_code(component.id) args = { - "token": env.get("IBM_GHE_API_TOKEN"), - "url": "https://raw.github.ibm.com/user/repo/master/secret.yml", - "name": "my-test-credential", + 'token': env.get("IBM_GHE_API_TOKEN"), + 'url': 'https://raw.github.ibm.com/user/repo/master/secret.yml', + 'name': 'my-test-credential' } run_code(component.id, args, f"Running component '{component.id}'") # # delete one component # delete_component(component_id) - + # # update a component # component = list_components(filter_dict={"name": 'Fabric for Deep Learning - Train Model'})[0] # update_component_template(component.id, "temp/files/ffdl_train.yaml") -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/api/examples/credentials_api.py b/api/examples/credentials_api.py index 249417e8..d971cbbf 100644 --- a/api/examples/credentials_api.py +++ b/api/examples/credentials_api.py @@ -5,36 +5,35 @@ import json import random -import swagger_client # noqa: F401 +import swagger_client -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from pprint import pprint from pipelines_api import list_pipelines from swagger_client.api_client import ApiClient, Configuration from swagger_client.models import ApiCredential, ApiListCredentialsResponse -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client def print_function_name_decorator(func): + def wrapper(*args, **kwargs): print() print(f"---[ {func.__name__}{args}{kwargs} ]---") @@ -45,28 +44,20 @@ def wrapper(*args, **kwargs): @print_function_name_decorator -def create_credential( - pipeline_id: str, project_id: str, data_assets: [str] = [] -) -> ApiCredential: +def create_credential(pipeline_id: str, project_id: str, data_assets: [str] = []) -> ApiCredential: api_client = get_swagger_client() api_instance = swagger_client.CredentialServiceApi(api_client=api_client) try: - api_credential = ApiCredential( - pipeline_id=pipeline_id, project_id=project_id, data_assets=data_assets - ) + api_credential = ApiCredential(pipeline_id=pipeline_id, project_id=project_id, data_assets=data_assets) api_response: ApiCredential = api_instance.create_credential(api_credential) return api_response except ApiException as e: - print( - "Exception when calling CredentialServiceApi -> create_credential: %s\n" - % e, - file=stderr, - ) + print("Exception when calling CredentialServiceApi -> create_credential: %s\n" % e, file=stderr) return [] @@ -83,10 +74,7 @@ def get_credential(credential_id: str) -> ApiCredential: return api_credential except ApiException as e: - print( - "Exception when calling CredentialServiceApi -> get_credential: %s\n" % e, - file=stderr, - ) + print("Exception when calling CredentialServiceApi -> get_credential: %s\n" % e, file=stderr) return None @@ -100,11 +88,7 @@ def delete_credential(credential_id: str): try: api_instance.delete_credential(credential_id) except ApiException as e: - print( - "Exception when calling CredentialServiceApi -> delete_credential: %s\n" - % e, - file=stderr, - ) + print("Exception when calling CredentialServiceApi -> delete_credential: %s\n" % e, file=stderr) @print_function_name_decorator @@ -116,28 +100,15 @@ def list_credentials(filter_dict: dict = {}, sort_by: str = None) -> [ApiCredent try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListCredentialsResponse = api_instance.list_credentials( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListCredentialsResponse = api_instance.list_credentials(filter=filter_str, sort_by=sort_by) for c in api_response.credentials: - print( - "%s %s pl:%s pr:%s" - % ( - c.id, - c.created_at.strftime("%Y-%m-%d %H:%M:%S"), - c.pipeline_id, - c.project_id, - ) - ) + print("%s %s pl:%s pr:%s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.pipeline_id, c.project_id)) return api_response.credentials except ApiException as e: - print( - "Exception when calling CredentialServiceApi -> list_credentials: %s\n" % e, - file=stderr, - ) + print("Exception when calling CredentialServiceApi -> list_credentials: %s\n" % e, file=stderr) return [] @@ -148,9 +119,7 @@ def main(): i = random.randint(0, len(pipelines) - 1) # create a new credential - credential = create_credential( - pipeline_id=pipelines[i].id, project_id="xyz", data_assets=["data1", "data2"] - ) + credential = create_credential(pipeline_id=pipelines[i].id, project_id="xyz", data_assets=["data1", "data2"]) pprint(credential) # list credentials @@ -167,6 +136,6 @@ def main(): delete_credential(credential.id) -if __name__ == "__main__": +if __name__ == '__main__': # delete_credential("*") main() diff --git a/api/examples/dataset_api.py b/api/examples/dataset_api.py index 9467b495..1beba049 100644 --- a/api/examples/dataset_api.py +++ b/api/examples/dataset_api.py @@ -8,44 +8,34 @@ import os import random import re -import swagger_client # noqa: F401 +import swagger_client import tarfile import tempfile from glob import glob from io import BytesIO -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( - ApiDataset, - ApiGetTemplateResponse, - ApiListDatasetsResponse, - ApiGenerateCodeResponse, - ApiRunCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiDataset, ApiGetTemplateResponse, ApiListDatasetsResponse, \ + ApiGenerateCodeResponse, ApiRunCodeResponse +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 +from urllib3.response import HTTPResponse -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' -yaml_files = sorted( - filter( - lambda f: "template" not in f, - glob("./../../../katalog/dataset-samples/**/*.yaml", recursive=True), - ) -) +yaml_files = sorted(filter(lambda f: "template" not in f, + glob("./../../../katalog/dataset-samples/**/*.yaml", recursive=True))) def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client @@ -56,7 +46,6 @@ def wrapper(*args, **kwargs): print(f"---[ {func.__name__}{args}{kwargs} ]---") print() return func(*args, **kwargs) - return wrapper @@ -79,17 +68,12 @@ def upload_dataset_template(uploadfile_name, name=None) -> str: api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - dataset: ApiDataset = api_instance.upload_dataset( - uploadfile=uploadfile_name, name=name - ) + dataset: ApiDataset = api_instance.upload_dataset(uploadfile=uploadfile_name, name=name) print(f"Uploaded '{dataset.name}': {dataset.id}") return dataset.id except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> upload_dataset: %s\n" % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> upload_dataset: %s\n" % e, file=stderr) # raise e return None @@ -118,10 +102,7 @@ def upload_dataset_file(dataset_id, file_path): print(f"Upload file '{file_path}' to dataset with ID '{dataset_id}'") except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> upload_dataset_file: %s\n" % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> upload_dataset_file: %s\n" % e, file=stderr) raise e @@ -131,13 +112,13 @@ def download_dataset_tgz(dataset_id) -> str: api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_dataset_files( - dataset_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_dataset_files(dataset_id, + include_generated_code=True, + _preload_content=False) - attachment_header = response.info().get( - "Content-Disposition", f"attachment; filename={dataset_id}.tgz" - ) + attachment_header = response.info().get("Content-Disposition", + f"attachment; filename={dataset_id}.tgz") download_filename = re.sub("attachment; filename=", "", attachment_header) @@ -145,7 +126,7 @@ def download_dataset_tgz(dataset_id) -> str: os.makedirs(download_dir, exist_ok=True) tarfile_path = os.path.join(download_dir, download_filename) - with open(tarfile_path, "wb") as f: + with open(tarfile_path, 'wb') as f: f.write(response.read()) print(tarfile_path) @@ -153,11 +134,7 @@ def download_dataset_tgz(dataset_id) -> str: return tarfile_path except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> download_dataset_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> download_dataset_files: %s\n" % e, file=stderr) return "Download failed?" @@ -168,25 +145,20 @@ def verify_dataset_download(dataset_id: str) -> bool: api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_dataset_files( - dataset_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_dataset_files(dataset_id, + include_generated_code=True, + _preload_content=False) tgz_file = BytesIO(response.read()) tar = tarfile.open(fileobj=tgz_file) - file_contents = { - m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") - for m in tar.getmembers() - } + file_contents = {m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") + for m in tar.getmembers()} - template_response: ApiGetTemplateResponse = api_instance.get_dataset_template( - dataset_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_dataset_template(dataset_id) template_text_from_api = template_response.template - assert template_text_from_api == file_contents.get( - "yaml", file_contents.get("yml") - ) + assert template_text_from_api == file_contents.get("yaml", file_contents.get("yml")) # TODO: verify generated code # generate_code_response: ApiGenerateCodeResponse = api_instance.generate_dataset_code(dataset_id) @@ -202,11 +174,7 @@ def verify_dataset_download(dataset_id: str) -> bool: return True except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> download_dataset_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> download_dataset_files: %s\n" % e, file=stderr) return False @@ -217,14 +185,10 @@ def approve_datasets_for_publishing(dataset_ids: [str]): api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - api_response = api_instance.approve_datasets_for_publishing(dataset_ids) + api_instance.approve_datasets_for_publishing(dataset_ids) except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> approve_datasets_for_publishing: %s\n" - % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> approve_datasets_for_publishing: %s\n" % e, file=stderr) return None @@ -235,14 +199,10 @@ def set_featured_datasets(dataset_ids: [str]): api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - api_response = api_instance.set_featured_datasets(dataset_ids) + api_instance.set_featured_datasets(dataset_ids) except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> set_featured_datasets: %s\n" - % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> set_featured_datasets: %s\n" % e, file=stderr) return None @@ -258,10 +218,7 @@ def get_dataset(dataset_id: str) -> ApiDataset: return dataset_meta except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> get_dataset: %s\n" % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> get_dataset: %s\n" % e, file=stderr) return None @@ -274,10 +231,7 @@ def delete_dataset(dataset_id: str): try: api_instance.delete_dataset(dataset_id) except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> delete_dataset: %s\n" % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> delete_dataset: %s\n" % e, file=stderr) @print_function_name_decorator @@ -286,9 +240,7 @@ def get_template(template_id: str) -> str: api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - template_response: ApiGetTemplateResponse = api_instance.get_dataset_template( - template_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_dataset_template(template_id) print(template_response.template) # yaml_dict = yaml.load(template_response.template, Loader=yaml.FullLoader) @@ -301,11 +253,7 @@ def get_template(template_id: str) -> str: return template_response.template except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> get_dataset_template: %s\n" - % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> get_dataset_template: %s\n" % e, file=stderr) return None @@ -316,18 +264,13 @@ def generate_code(dataset_id: str) -> str: api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - generate_code_response: ApiGenerateCodeResponse = ( - api_instance.generate_dataset_code(dataset_id) - ) + generate_code_response: ApiGenerateCodeResponse = api_instance.generate_dataset_code(dataset_id) print(generate_code_response.script) return generate_code_response.script except ApiException as e: - print( - "Exception while calling DatasetServiceApi -> generate_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling DatasetServiceApi -> generate_code: %s\n" % e, file=stderr) return None @@ -338,21 +281,16 @@ def run_code(dataset_id: str, parameters: dict = {}, run_name: str = None) -> st api_instance = swagger_client.DatasetServiceApi(api_client=api_client) try: - param_array = [ - {"name": key, "value": value} for key, value in parameters.items() - ] - run_code_response: ApiRunCodeResponse = api_instance.run_dataset( - dataset_id, run_name=run_name, parameters=param_array - ) + param_array = [{"name": key, "value": value} for key, value in parameters.items()] + run_code_response: ApiRunCodeResponse = api_instance.run_dataset(dataset_id, + run_name=run_name, + parameters=param_array) print(run_code_response.run_url) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling DatasetServiceApi -> run_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling DatasetServiceApi -> run_code: %s\n" % e, file=stderr) return None @@ -365,23 +303,15 @@ def list_datasets(filter_dict: dict = {}, sort_by: str = None) -> [ApiDataset]: try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListDatasetsResponse = api_instance.list_datasets( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListDatasetsResponse = api_instance.list_datasets(filter=filter_str, sort_by=sort_by) for c in api_response.datasets: - print( - "%s %s %s" - % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name) - ) + print("%s %s %s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name)) return api_response.datasets except ApiException as e: - print( - "Exception when calling DatasetServiceApi -> list_datasets: %s\n" % e, - file=stderr, - ) + print("Exception when calling DatasetServiceApi -> list_datasets: %s\n" % e, file=stderr) return [] @@ -432,6 +362,6 @@ def main(): # update_dataset_template(dataset.id, "temp/files/fashion-mnist.yaml") -if __name__ == "__main__": +if __name__ == '__main__': pprint(yaml_files) main() diff --git a/api/examples/models_api.py b/api/examples/models_api.py index 514c4c64..904bbb5b 100644 --- a/api/examples/models_api.py +++ b/api/examples/models_api.py @@ -8,45 +8,35 @@ import os import random import re -import swagger_client # noqa: F401 +import swagger_client import tarfile import tempfile from glob import glob from io import BytesIO -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( - ApiModel, - ApiGetTemplateResponse, - ApiListModelsResponse, - ApiGenerateModelCodeResponse, - ApiRunCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiModel, ApiGetTemplateResponse, ApiListModelsResponse, \ + ApiGenerateModelCodeResponse, ApiRunCodeResponse +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 +from urllib3.response import HTTPResponse -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' -yaml_files = sorted( - filter( - lambda f: "template" not in f, - glob("./../../../katalog/model-samples/**/*.yaml", recursive=True), - ) -) +yaml_files = sorted(filter(lambda f: "template" not in f, + glob("./../../../katalog/model-samples/**/*.yaml", recursive=True))) def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client @@ -57,7 +47,6 @@ def wrapper(*args, **kwargs): print(f"---[ {func.__name__}{args}{kwargs} ]---") print() return func(*args, **kwargs) - return wrapper @@ -75,17 +64,12 @@ def upload_model_template(uploadfile_name, name=None) -> str: api_client = get_swagger_client() api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - print(f"Uploading '{uploadfile_name}' ... ", end="") - model: ApiModel = api_instance.upload_model( - uploadfile=uploadfile_name, name=name - ) + print(f"Uploading '{uploadfile_name}' ... ", end='') + model: ApiModel = api_instance.upload_model(uploadfile=uploadfile_name, name=name) print(f"{model.id} '{model.name}'") return model.id except ApiException as e: - print( - "Exception when calling ModelServiceApi -> upload_model: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> upload_model: %s\n" % e, file=stderr) raise e return None @@ -98,10 +82,7 @@ def upload_model_file(model_id, file_path): response = api_instance.upload_model_file(id=model_id, uploadfile=file_path) print(f"Upload file '{file_path}' to model '{model_id}'") except ApiException as e: - print( - "Exception when calling ModelServiceApi -> upload_model_file: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> upload_model_file: %s\n" % e, file=stderr) raise e @@ -123,23 +104,21 @@ def download_model_tgz(model_id, download_dir: str = None) -> str: api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_model_files( - model_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_model_files(model_id, + include_generated_code=True, + _preload_content=False) - attachment_header = response.info().get( - "Content-Disposition", f"attachment; filename={model_id}.tgz" - ) + attachment_header = response.info().get("Content-Disposition", + f"attachment; filename={model_id}.tgz") download_filename = re.sub("attachment; filename=", "", attachment_header) - download_dir = download_dir or os.path.join( - tempfile.gettempdir(), "download", "models" - ) + download_dir = download_dir or os.path.join(tempfile.gettempdir(), "download", "models") os.makedirs(download_dir, exist_ok=True) tarfile_path = os.path.join(download_dir, download_filename) - with open(tarfile_path, "wb") as f: + with open(tarfile_path, 'wb') as f: f.write(response.read()) print(tarfile_path) @@ -147,10 +126,7 @@ def download_model_tgz(model_id, download_dir: str = None) -> str: return tarfile_path except ApiException as e: - print( - "Exception when calling ModelServiceApi -> download_model_files: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> download_model_files: %s\n" % e, file=stderr) return "Download failed?" @@ -162,46 +138,37 @@ def verify_model_download(model_id: str) -> bool: api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_model_files( - model_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_model_files(model_id, + include_generated_code=True, + _preload_content=False) tgz_file = BytesIO(response.read()) tar = tarfile.open(fileobj=tgz_file) - file_contents = { - m.name: tar.extractfile(m).read().decode("utf-8") for m in tar.getmembers() - } + file_contents = {m.name: tar.extractfile(m).read().decode("utf-8") + for m in tar.getmembers()} # verify template text matches - template_response: ApiGetTemplateResponse = api_instance.get_model_template( - model_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_model_template(model_id) template_from_api = template_response.template - template_from_tgz = [ - content - for filename, content in file_contents.items() - if filename.endswith(".yaml") or filename.endswith(".yml") - ][0] + template_from_tgz = [content for filename, content in file_contents.items() + if filename.endswith(".yaml") or filename.endswith(".yml")][0] assert template_from_api == template_from_tgz # verify generated code matches - generate_code_response: ApiGenerateModelCodeResponse = ( + generate_code_response: ApiGenerateModelCodeResponse = \ api_instance.generate_model_code(model_id) - ) for model_script in generate_code_response.scripts: stage = model_script.pipeline_stage platform = model_script.execution_platform script_from_api = model_script.script_code - downloaded_script = [ - content - for filename, content in file_contents.items() - if f"run_{stage}_{platform}" in filename - ][0] + downloaded_script = [content for filename, content in file_contents.items() + if f"run_{stage}_{platform}" in filename][0] assert script_from_api == downloaded_script @@ -210,10 +177,7 @@ def verify_model_download(model_id: str) -> bool: return True except ApiException as e: - print( - "Exception when calling ModelServiceApi -> download_model_files: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> download_model_files: %s\n" % e, file=stderr) return False @@ -225,14 +189,10 @@ def approve_models_for_publishing(model_ids: [str]): api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - api_response = api_instance.approve_models_for_publishing(model_ids) + api_instance.approve_models_for_publishing(model_ids) except ApiException as e: - print( - "Exception when calling ModelServiceApi -> approve_models_for_publishing: %s\n" - % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> approve_models_for_publishing: %s\n" % e, file=stderr) return None @@ -244,13 +204,10 @@ def set_featured_models(model_ids: [str]): api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - api_response = api_instance.set_featured_models(model_ids) + api_instance.set_featured_models(model_ids) except ApiException as e: - print( - "Exception when calling ModelServiceApi -> set_featured_models: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> set_featured_models: %s\n" % e, file=stderr) return None @@ -264,9 +221,7 @@ def get_model(model_id: str) -> ApiModel: pprint(model_meta, indent=2) return model_meta except ApiException as e: - print( - "Exception when calling ModelServiceApi -> get_model: %s\n" % e, file=stderr - ) + print("Exception when calling ModelServiceApi -> get_model: %s\n" % e, file=stderr) return None @@ -277,10 +232,7 @@ def delete_model(model_id: str): try: api_instance.delete_model(model_id) except ApiException as e: - print( - "Exception when calling ModelServiceApi -> delete_model: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> delete_model: %s\n" % e, file=stderr) @print_function_name_decorator @@ -290,9 +242,7 @@ def get_template(template_id: str) -> str: api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - template_response: ApiGetTemplateResponse = api_instance.get_model_template( - template_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_model_template(template_id) print(template_response.template) # yaml_dict = yaml.load(template_response.template, Loader=yaml.FullLoader) @@ -305,10 +255,7 @@ def get_template(template_id: str) -> str: return template_response.template except ApiException as e: - print( - "Exception when calling ModelServiceApi -> get_model_template: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> get_model_template: %s\n" % e, file=stderr) return None @@ -320,9 +267,7 @@ def generate_code(model_id: str) -> str: api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - generate_code_response: ApiGenerateModelCodeResponse = ( - api_instance.generate_model_code(model_id) - ) + generate_code_response: ApiGenerateModelCodeResponse = api_instance.generate_model_code(model_id) for model_script in generate_code_response.scripts: print(f"#######################################################") @@ -336,42 +281,26 @@ def generate_code(model_id: str) -> str: return generate_code_response.scripts except ApiException as e: - print( - "Exception while calling ModelServiceApi -> generate_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling ModelServiceApi -> generate_code: %s\n" % e, file=stderr) return None @print_function_name_decorator -def run_code( - model_id: str, - pipeline_stage: str, - execution_platform: str, - run_name: str = None, - parameters=dict(), -) -> str: +def run_code(model_id: str, pipeline_stage: str, execution_platform: str, run_name: str = None, parameters=dict()) -> str: api_client = get_swagger_client() api_instance = swagger_client.ModelServiceApi(api_client=api_client) try: - run_code_response: ApiRunCodeResponse = api_instance.run_model( - model_id, - pipeline_stage, - execution_platform, - run_name=run_name, - parameters=parameters, - ) + run_code_response: ApiRunCodeResponse = api_instance.run_model(model_id, pipeline_stage, execution_platform, + run_name=run_name, parameters=parameters) print(run_code_response.run_url) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling ModelServiceApi -> run_code: %s\n" % e, file=stderr - ) + print("Exception while calling ModelServiceApi -> run_code: %s\n" % e, file=stderr) return None @@ -385,23 +314,15 @@ def list_models(filter_dict: dict = {}, sort_by: str = None) -> [ApiModel]: try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListModelsResponse = api_instance.list_models( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListModelsResponse = api_instance.list_models(filter=filter_str, sort_by=sort_by) for c in api_response.models: - print( - "%s %s %s" - % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name) - ) + print("%s %s %s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name)) return api_response.models except ApiException as e: - print( - "Exception when calling ModelServiceApi -> list_models: %s\n" % e, - file=stderr, - ) + print("Exception when calling ModelServiceApi -> list_models: %s\n" % e, file=stderr) return [] @@ -452,6 +373,6 @@ def main(): # upload_model_file(model.id, "temp/files/max-audio-classifier.yaml") -if __name__ == "__main__": +if __name__ == '__main__': pprint(yaml_files) main() diff --git a/api/examples/notebooks_api.py b/api/examples/notebooks_api.py index acb071ed..ba6bf3b3 100644 --- a/api/examples/notebooks_api.py +++ b/api/examples/notebooks_api.py @@ -9,41 +9,31 @@ import random import re import requests -import swagger_client # noqa: F401 +import swagger_client import tarfile import tempfile -import yaml # noqa: F401 +import yaml from glob import glob from io import BytesIO -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from os import environ as env +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( - ApiNotebook, - ApiGetTemplateResponse, - ApiListNotebooksResponse, - ApiGenerateCodeResponse, - ApiRunCodeResponse, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiNotebook, ApiGetTemplateResponse, ApiListNotebooksResponse, \ + ApiGenerateCodeResponse, ApiRunCodeResponse +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 +from urllib3.response import HTTPResponse -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' -yaml_files = sorted( - filter( - lambda f: "template" not in f, - glob("./../../../katalog/notebook-samples/*.yaml", recursive=True), - ) -) +yaml_files = sorted(filter(lambda f: "template" not in f, glob("./../../../katalog/notebook-samples/*.yaml", recursive=True))) IBM_GHE_API_TOKEN = env.get("IBM_GHE_API_TOKEN") @@ -51,13 +41,14 @@ def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client def print_function_name_decorator(func): + def wrapper(*args, **kwargs): print() print(f"---[ {func.__name__}{args}{kwargs} ]---") @@ -88,22 +79,16 @@ def upload_notebook_template(uploadfile_name, name=None, ghe_token=None) -> str: try: if ghe_token: - notebook: ApiNotebook = api_instance.upload_notebook( - uploadfile=uploadfile_name, name=name, enterprise_github_token=ghe_token - ) + notebook: ApiNotebook = api_instance.upload_notebook(uploadfile=uploadfile_name, name=name, + enterprise_github_token=ghe_token) else: - notebook: ApiNotebook = api_instance.upload_notebook( - uploadfile=uploadfile_name, name=name - ) + notebook: ApiNotebook = api_instance.upload_notebook(uploadfile=uploadfile_name, name=name) print(f"Uploaded '{notebook.name}': {notebook.id}") return notebook.id except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> upload_notebook: %s\n" % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> upload_notebook: %s\n" % e, file=stderr) # raise e return None @@ -139,43 +124,35 @@ def upload_notebook_file(notebook_id, file_path): api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - response = api_instance.upload_notebook_file( - id=notebook_id, uploadfile=file_path - ) + response = api_instance.upload_notebook_file(id=notebook_id, uploadfile=file_path) print(f"Upload file '{file_path}' to notebook with ID '{notebook_id}'") except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> upload_notebook_file: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> upload_notebook_file: %s\n" % e, file=stderr) raise e @print_function_name_decorator -def download_notebook_tgz( - notebook_id, - download_dir=os.path.join(tempfile.gettempdir(), "download", "notebooks"), -) -> str: +def download_notebook_tgz(notebook_id, + download_dir=os.path.join(tempfile.gettempdir(), "download", "notebooks")) -> str: api_client = get_swagger_client() api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_notebook_files( - notebook_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_notebook_files(notebook_id, + include_generated_code=True, + _preload_content=False) - attachment_header = response.info().get( - "Content-Disposition", f"attachment; filename={notebook_id}.tgz" - ) + attachment_header = response.info().get("Content-Disposition", + f"attachment; filename={notebook_id}.tgz") download_filename = re.sub("attachment; filename=", "", attachment_header) os.makedirs(download_dir, exist_ok=True) tarfile_path = os.path.join(download_dir, download_filename) - with open(tarfile_path, "wb") as f: + with open(tarfile_path, 'wb') as f: f.write(response.read()) print(tarfile_path) @@ -183,11 +160,7 @@ def download_notebook_tgz( return tarfile_path except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> download_notebook_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> download_notebook_files: %s\n" % e, file=stderr) return "Download failed?" @@ -199,49 +172,35 @@ def verify_notebook_download(notebook_id: str) -> bool: api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_notebook_files( - notebook_id, include_generated_code=True, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_notebook_files(notebook_id, + include_generated_code=True, + _preload_content=False) tgz_file = BytesIO(response.read()) tar = tarfile.open(fileobj=tgz_file) - file_contents = { - m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") - for m in tar.getmembers() - } + file_contents = {m.name.split(".")[-1]: tar.extractfile(m).read().decode("utf-8") + for m in tar.getmembers()} - template_response: ApiGetTemplateResponse = api_instance.get_notebook_template( - notebook_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_notebook_template(notebook_id) template_text_from_api = template_response.template - assert template_text_from_api == file_contents.get( - "yaml", file_contents.get("yml") - ) + assert template_text_from_api == file_contents.get("yaml", file_contents.get("yml")) - generate_code_response: ApiGenerateCodeResponse = ( - api_instance.generate_notebook_code(notebook_id) - ) + generate_code_response: ApiGenerateCodeResponse = api_instance.generate_notebook_code(notebook_id) run_script_from_api = generate_code_response.script - regex = re.compile( - r"name='[^']*'" - ) # controller adds random chars to name, replace those + regex = re.compile(r"name='[^']*'") # controller adds random chars to name, replace those - assert regex.sub("name='...'", run_script_from_api) == regex.sub( - "name='...'", file_contents.get("py") - ) + assert regex.sub("name='...'", run_script_from_api) == \ + regex.sub("name='...'", file_contents.get("py")) print("downloaded files match") return True except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> download_notebook_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> download_notebook_files: %s\n" % e, file=stderr) return False @@ -253,14 +212,10 @@ def approve_notebooks_for_publishing(notebook_ids: [str]): api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - api_response = api_instance.approve_notebooks_for_publishing(notebook_ids) + api_instance.approve_notebooks_for_publishing(notebook_ids) except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> approve_notebooks_for_publishing: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> approve_notebooks_for_publishing: %s\n" % e, file=stderr) return None @@ -272,14 +227,10 @@ def set_featured_notebooks(notebook_ids: [str]): api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - api_response = api_instance.set_featured_notebooks(notebook_ids) + api_instance.set_featured_notebooks(notebook_ids) except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> set_featured_notebooks: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> set_featured_notebooks: %s\n" % e, file=stderr) return None @@ -296,10 +247,7 @@ def get_notebook(notebook_id: str) -> ApiNotebook: return notebook_meta except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> get_notebook: %s\n" % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> get_notebook: %s\n" % e, file=stderr) return None @@ -313,10 +261,7 @@ def delete_notebook(notebook_id: str): try: api_instance.delete_notebook(notebook_id) except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> delete_notebook: %s\n" % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> delete_notebook: %s\n" % e, file=stderr) @print_function_name_decorator @@ -326,9 +271,7 @@ def get_template(template_id: str) -> str: api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - template_response: ApiGetTemplateResponse = api_instance.get_notebook_template( - template_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_notebook_template(template_id) print(template_response.template) # yaml_dict = yaml.load(template_response.template, Loader=yaml.FullLoader) @@ -341,11 +284,7 @@ def get_template(template_id: str) -> str: return template_response.template except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> get_notebook_template: %s\n" - % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> get_notebook_template: %s\n" % e, file=stderr) return None @@ -357,18 +296,13 @@ def generate_code(notebook_id: str) -> str: api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - generate_code_response: ApiGenerateCodeResponse = ( - api_instance.generate_notebook_code(notebook_id) - ) + generate_code_response: ApiGenerateCodeResponse = api_instance.generate_notebook_code(notebook_id) print(generate_code_response.script) return generate_code_response.script except ApiException as e: - print( - "Exception while calling NotebookServiceApi -> generate_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling NotebookServiceApi -> generate_code: %s\n" % e, file=stderr) return None @@ -380,19 +314,16 @@ def run_notebook(notebook_id: str, parameters=dict(), run_name: str = None) -> s api_instance = swagger_client.NotebookServiceApi(api_client=api_client) try: - run_code_response: ApiRunCodeResponse = api_instance.run_notebook( - notebook_id, parameters=parameters, run_name=run_name - ) + run_code_response: ApiRunCodeResponse = api_instance.run_notebook(notebook_id, + parameters=parameters, + run_name=run_name) print(run_code_response.run_url) print(run_code_response.run_output_location) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling NotebookServiceApi -> run_code: %s\n" % e, - file=stderr, - ) + print("Exception while calling NotebookServiceApi -> run_code: %s\n" % e, file=stderr) return None @@ -406,23 +337,15 @@ def list_notebooks(filter_dict: dict = {}, sort_by: str = None) -> [ApiNotebook] try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListNotebooksResponse = api_instance.list_notebooks( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListNotebooksResponse = api_instance.list_notebooks(filter=filter_str, sort_by=sort_by) for c in api_response.notebooks: - print( - "%s %s %s" - % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name) - ) + print("%s %s %s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name)) return api_response.notebooks except ApiException as e: - print( - "Exception when calling NotebookServiceApi -> list_notebooks: %s\n" % e, - file=stderr, - ) + print("Exception when calling NotebookServiceApi -> list_notebooks: %s\n" % e, file=stderr) return [] @@ -440,28 +363,23 @@ def download_notebooks_from_github(): url = yaml_dict["implementation"]["github"]["source"] - download_url = ( - url.replace("/blob", "") - .replace("github.com", "raw.githubusercontent.com") + download_url = url.replace("/blob", "")\ + .replace("github.com", "raw.githubusercontent.com")\ .replace("github.ibm.com", "raw.github.ibm.com") - ) if "github.ibm.com" in url: - headers = {"Authorization": "token %s" % env.get("IBM_GHE_API_TOKEN")} + headers = {'Authorization': 'token %s' % env.get("IBM_GHE_API_TOKEN")} else: headers = {} response = requests.get(download_url, headers=headers, allow_redirects=True) if response.status_code == 200: - with open(os.path.join(download_dir, os.path.basename(url)), "wb") as f: + with open(os.path.join(download_dir, os.path.basename(url)), 'wb') as f: f.write(response.content) else: - print( - "{}: {:20s} --> {}".format( - response.status_code, os.path.basename(yaml_file), url - ) - ) + print("{}: {:20s} --> {}".format( + response.status_code, os.path.basename(yaml_file), url)) def main(): @@ -501,7 +419,7 @@ def main(): # delete_notebook(notebook_id) -if __name__ == "__main__": +if __name__ == '__main__': pprint(yaml_files) main() # download_notebooks_from_github() diff --git a/api/examples/pipelines_api.py b/api/examples/pipelines_api.py index ab18584b..57b0702a 100644 --- a/api/examples/pipelines_api.py +++ b/api/examples/pipelines_api.py @@ -9,64 +9,47 @@ import os import random import re -import swagger_client # noqa: F401 +import swagger_client import tarfile import tempfile import typing -import yaml # noqa: F401 from io import BytesIO -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration -from swagger_client.models import ( # noqa: F401 - ApiPipeline, - ApiGetTemplateResponse, - ApiListPipelinesResponse, - ApiGenerateCodeResponse, - ApiRunCodeResponse, - ApiPipelineExtended, - ApiPipelineCustom, - ApiPipelineCustomRunPayload, - ApiPipelineTask, - ApiComponent, - ApiNotebook, - ApiPipelineTaskArguments, - ApiPipelineDAG, - ApiPipelineInputs, - ApiParameter, -) -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.models import ApiPipeline, ApiGetTemplateResponse, ApiListPipelinesResponse, \ + ApiRunCodeResponse, ApiPipelineExtended, ApiPipelineCustom, ApiPipelineCustomRunPayload, ApiPipelineTask, \ + ApiComponent, ApiNotebook, ApiPipelineTaskArguments, ApiPipelineDAG, ApiPipelineInputs, ApiParameter +from swagger_client.rest import ApiException from sys import stderr from types import SimpleNamespace as custom_obj -from urllib3.response import HTTPResponse # noqa: F401 +from urllib3.response import HTTPResponse -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' # yaml_files = glob.glob("./../../pipelines/pipeline-samples/*/*.yaml") # yaml_files = glob.glob("./../../../kfp-tekton/samples/*/*.yaml") -yaml_files = glob.glob( - "./../../../kfp-tekton/sdk/python/tests/compiler/testdata/*.yaml" -)[:10] +yaml_files = glob.glob("./../../../kfp-tekton/sdk/python/tests/compiler/testdata/*.yaml")[:10] # yaml_files = sorted(glob.glob("./../../../katalog/pipeline-samples/*.yaml", recursive=True)) def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client def print_function_name_decorator(func): + def wrapper(*args, **kwargs): print() print(f"---[ {func.__name__}{str(args)[:50]}{str(kwargs)[0:50]} ]---") @@ -90,28 +73,21 @@ def create_tar_file(yamlfile_name): return tarfile_path -def upload_pipeline_template( - uploadfile_name, name: str = None, description: str = None, annotations: str = "" -) -> str: +def upload_pipeline_template(uploadfile_name, name: str = None, description: str = None, annotations: str = "") -> str: api_client = get_swagger_client() api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - pipeline: ApiPipeline = api_instance.upload_pipeline( - uploadfile=uploadfile_name, - name=name, - description=description, - annotations=annotations, - ) + pipeline: ApiPipeline = api_instance.upload_pipeline(uploadfile=uploadfile_name, + name=name, + description=description, + annotations=annotations) print(f"Uploaded '{pipeline.name}': {pipeline.id}") return pipeline.id except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> upload_pipeline: %s\n" % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> upload_pipeline: %s\n" % e, file=stderr) raise e return None @@ -139,17 +115,11 @@ def upload_pipeline_file(pipeline_id, file_path): api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - response = api_instance.upload_pipeline_file( - id=pipeline_id, uploadfile=file_path - ) + response = api_instance.upload_pipeline_file(id=pipeline_id, uploadfile=file_path) print(f"Upload file '{file_path}' to pipeline with ID '{pipeline_id}'") except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> upload_pipeline_file: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> upload_pipeline_file: %s\n" % e, file=stderr) raise e @@ -160,13 +130,11 @@ def download_pipeline_tgz(pipeline_id) -> str: api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_pipeline_files( - pipeline_id, _preload_content=False - ) + response: HTTPResponse = \ + api_instance.download_pipeline_files(pipeline_id, _preload_content=False) - attachment_header = response.info().get( - "Content-Disposition", f"attachment; filename={pipeline_id}.tgz" - ) + attachment_header = response.info().get("Content-Disposition", + f"attachment; filename={pipeline_id}.tgz") download_filename = re.sub("attachment; filename=", "", attachment_header) @@ -174,7 +142,7 @@ def download_pipeline_tgz(pipeline_id) -> str: os.makedirs(download_dir, exist_ok=True) tarfile_path = os.path.join(download_dir, download_filename) - with open(tarfile_path, "wb") as f: + with open(tarfile_path, 'wb') as f: f.write(response.read()) print(tarfile_path) @@ -182,11 +150,7 @@ def download_pipeline_tgz(pipeline_id) -> str: return tarfile_path except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> download_pipeline_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> download_pipeline_files: %s\n" % e, file=stderr) return "Download failed?" @@ -198,20 +162,14 @@ def verify_pipeline_download(pipeline_id: str) -> bool: api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - response: HTTPResponse = api_instance.download_pipeline_files( - pipeline_id, _preload_content=False - ) + response: HTTPResponse = api_instance.download_pipeline_files(pipeline_id, _preload_content=False) tgz_file = BytesIO(response.read()) with tarfile.open(fileobj=tgz_file) as tar: - file_contents = { - m.name: tar.extractfile(m).read().decode("utf-8") - for m in tar.getmembers() - } - - template_response: ApiGetTemplateResponse = api_instance.get_template( - pipeline_id - ) + file_contents = {m.name: tar.extractfile(m).read().decode("utf-8") + for m in tar.getmembers()} + + template_response: ApiGetTemplateResponse = api_instance.get_template(pipeline_id) template_text_from_api = template_response.template assert template_text_from_api == file_contents.get("pipeline.yaml") @@ -221,11 +179,7 @@ def verify_pipeline_download(pipeline_id: str) -> bool: return True except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> download_pipeline_files: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> download_pipeline_files: %s\n" % e, file=stderr) return False @@ -237,14 +191,10 @@ def approve_pipelines_for_publishing(pipeline_ids: [str]): api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - api_response = api_instance.approve_pipelines_for_publishing(pipeline_ids) + api_instance.approve_pipelines_for_publishing(pipeline_ids) except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> approve_pipelines_for_publishing: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> approve_pipelines_for_publishing: %s\n" % e, file=stderr) return None @@ -256,14 +206,10 @@ def set_featured_pipelines(pipeline_ids: [str]): api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - api_response = api_instance.set_featured_pipelines(pipeline_ids) + api_instance.set_featured_pipelines(pipeline_ids) except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> set_featured_pipelines: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> set_featured_pipelines: %s\n" % e, file=stderr) return None @@ -280,10 +226,7 @@ def get_pipeline(pipeline_id: str) -> ApiPipelineExtended: return pipeline_meta except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> get_pipeline: %s\n" % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> get_pipeline: %s\n" % e, file=stderr) return None @@ -296,12 +239,9 @@ def delete_pipeline(pipeline_id: str): try: api_instance.delete_pipeline(pipeline_id) - + except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> delete_pipeline: %s\n" % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> delete_pipeline: %s\n" % e, file=stderr) @print_function_name_decorator @@ -311,9 +251,7 @@ def get_template(template_id: str) -> str: api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - template_response: ApiGetTemplateResponse = api_instance.get_template( - template_id - ) + template_response: ApiGetTemplateResponse = api_instance.get_template(template_id) print(template_response.template) # yaml_dict = yaml.load(template_response.template, Loader=yaml.FullLoader) @@ -326,35 +264,25 @@ def get_template(template_id: str) -> str: return template_response.template except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> get_pipeline_template: %s\n" - % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> get_pipeline_template: %s\n" % e, file=stderr) return None @print_function_name_decorator -def run_pipeline( - pipeline_id: str, parameters: dict = None, run_name: str = None -) -> str: +def run_pipeline(pipeline_id: str, parameters: dict = None, run_name: str = None) -> str: api_client = get_swagger_client() api_instance = swagger_client.PipelineServiceApi(api_client=api_client) try: - run_code_response: ApiRunCodeResponse = api_instance.run_pipeline( - pipeline_id, parameters=parameters, run_name=run_name - ) + run_code_response: ApiRunCodeResponse = api_instance.run_pipeline(pipeline_id, parameters=parameters, + run_name=run_name) print(run_code_response.run_url) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling PipelineServiceApi -> run_pipeline: %s\n" % e, - file=stderr, - ) + print("Exception while calling PipelineServiceApi -> run_pipeline: %s\n" % e, file=stderr) return None @@ -368,44 +296,31 @@ def generate_custom_pipeline(sequential_only=False) -> ApiPipelineCustom: try: components: typing.List[ApiComponent] = random.sample( - list( - filter( - lambda n: "StudyJob" not in n.name, - components_api_instance.list_components().components, - ) - ), - 3, - ) + list(filter(lambda n: "StudyJob" not in n.name, + components_api_instance.list_components().components)), 3) # components = [] notebooks: typing.List[ApiNotebook] = random.sample( - notebooks_api_instance.list_notebooks().notebooks, 5 - ) + notebooks_api_instance.list_notebooks().notebooks, 5) tasks: typing.List[ApiPipelineTask] = [] for c in components: tasks.append( - ApiPipelineTask( - name=f"component task {c.name}", - artifact_type="component", - artifact_id=c.id, - arguments=ApiPipelineTaskArguments(parameters=c.parameters), - dependencies=[], - ) - ) + ApiPipelineTask(name=f"component task {c.name}", + artifact_type="component", + artifact_id=c.id, + arguments=ApiPipelineTaskArguments(parameters=c.parameters), + dependencies=[])) for n in notebooks: tasks.append( - ApiPipelineTask( - name=f"notebook task {n.name}", - artifact_type="notebook", - artifact_id=n.id, - arguments=ApiPipelineTaskArguments(parameters=n.parameters), - dependencies=[], - ) - ) + ApiPipelineTask(name=f"notebook task {n.name}", + artifact_type="notebook", + artifact_id=n.id, + arguments=ApiPipelineTaskArguments(parameters=n.parameters), + dependencies=[])) if sequential_only: for i in range(len(tasks) - 1): @@ -426,30 +341,22 @@ def generate_custom_pipeline(sequential_only=False) -> ApiPipelineCustom: param_name = re.sub(r"\W+", "_", p.name, flags=re.ASCII).lower() pipeline_param_name = f"{task_name_prefix}_{param_name}" p.value = "{{inputs.parameters." + pipeline_param_name + "}}" - pipeline_params.append( - ApiParameter(name=pipeline_param_name, value="some value") - ) + pipeline_params.append(ApiParameter(name=pipeline_param_name, value="some value")) api_pipeline_custom = ApiPipelineCustom( name="My custom pipeline", description="A randomly generated pipeline from notebooks and components", dag=ApiPipelineDAG(tasks=tasks), - inputs=ApiPipelineInputs(parameters=pipeline_params), - ) + inputs=ApiPipelineInputs(parameters=pipeline_params)) return api_pipeline_custom except ApiException as e: - print( - f"Exception while generating custom pipeline DAG with parameters: \n{str(e)}", - file=stderr, - ) + print(f"Exception while generating custom pipeline DAG with parameters: \n{str(e)}", file=stderr) @print_function_name_decorator -def run_custom_pipeline( - pipeline_template: dict, parameters: list = None, run_name: str = None -) -> str: +def run_custom_pipeline(pipeline_template: dict, parameters: list = None, run_name: str = None) -> str: api_client = get_swagger_client() api_instance = swagger_client.PipelineServiceApi(api_client=api_client) @@ -458,31 +365,23 @@ def run_custom_pipeline( # TODO: cleanup pipeline parameter, we should not support KFP Argo YAML if pipeline_template.get("spec", {}).get("templates"): # pipeline_dag = [t for t in pipeline_template["spec"]["templates"] if "dag" in t][0] - pipeline_dag = list( - filter(lambda t: "dag" in t, pipeline_template["spec"]["templates"]) - )[0] + pipeline_dag = list(filter(lambda t: "dag" in t, pipeline_template["spec"]["templates"]))[0] elif "dag" in pipeline_template: pipeline_dag = pipeline_template # custom_pipeline = ApiPipelineCustom.from_dict(pipeline_dag) mock_response = custom_obj(data=json.dumps(pipeline_dag)) - custom_pipeline = api_client.deserialize( - response=mock_response, response_type=ApiPipelineCustom - ) - run_custom_pipeline_payload = ApiPipelineCustomRunPayload( - custom_pipeline=custom_pipeline, run_parameters=parameters - ) - run_code_response: ApiRunCodeResponse = api_instance.run_custom_pipeline( - run_custom_pipeline_payload=run_custom_pipeline_payload, run_name=run_name - ) + custom_pipeline = api_client.deserialize(response=mock_response, response_type=ApiPipelineCustom) + run_custom_pipeline_payload = ApiPipelineCustomRunPayload(custom_pipeline=custom_pipeline, + run_parameters=parameters) + run_code_response: ApiRunCodeResponse = \ + api_instance.run_custom_pipeline(run_custom_pipeline_payload=run_custom_pipeline_payload, + run_name=run_name) print(run_code_response.run_url) return run_code_response.run_url except ApiException as e: - print( - "Exception while calling PipelineServiceApi -> run_pipeline: %s\n" % e, - file=stderr, - ) + print("Exception while calling PipelineServiceApi -> run_pipeline: %s\n" % e, file=stderr) return None @@ -496,23 +395,15 @@ def list_pipelines(filter_dict: dict = {}, sort_by: str = None) -> [ApiPipeline] try: filter_str = json.dumps(filter_dict) if filter_dict else None - api_response: ApiListPipelinesResponse = api_instance.list_pipelines( - filter=filter_str, sort_by=sort_by - ) + api_response: ApiListPipelinesResponse = api_instance.list_pipelines(filter=filter_str, sort_by=sort_by) for c in api_response.pipelines: - print( - "%s %s %s" - % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name) - ) + print("%s %s %s" % (c.id, c.created_at.strftime("%Y-%m-%d %H:%M:%S"), c.name)) return api_response.pipelines except ApiException as e: - print( - "Exception when calling PipelineServiceApi -> list_pipelines: %s\n" % e, - file=stderr, - ) + print("Exception when calling PipelineServiceApi -> list_pipelines: %s\n" % e, file=stderr) return [] @@ -542,9 +433,7 @@ def main(): description = "Some description" annotations_dict = {"platform": "Kubeflow", "license": "opensource"} annotations_str = json.dumps(annotations_dict) - pipeline_id = upload_pipeline_template( - tarfile_name, name, description, annotations_str - ) + pipeline_id = upload_pipeline_template(tarfile_name, name, description, annotations_str) p = get_pipeline(pipeline_id) assert p.description == description and p.annotations == annotations_dict @@ -567,16 +456,14 @@ def main(): verify_pipeline_download(pipeline_id) - pipelines = ( - list_pipelines(filter_dict={"name": "[Sample] Basic - Parallel execution"}) - or list_pipelines(filter_dict={"name": "[Sample] Basic - Parallel Join"}) - or list_pipelines(filter_dict={"name": "[Tutorial] DSL - Control structures"}) - or list_pipelines(filter_dict={"name": "test_parallel_join"}) - ) + pipelines = list_pipelines(filter_dict={"name": "[Sample] Basic - Parallel execution"}) or \ + list_pipelines(filter_dict={"name": "[Sample] Basic - Parallel Join"}) or \ + list_pipelines(filter_dict={"name": "[Tutorial] DSL - Control structures"}) or \ + list_pipelines(filter_dict={"name": "test_parallel_join"}) pipeline = pipelines[0] arguments = { "url1": "gs://ml-pipeline-playground/shakespeare1.txt", - "url2": "gs://ml-pipeline-playground/shakespeare2.txt", + "url2": "gs://ml-pipeline-playground/shakespeare2.txt" } run_pipeline(pipeline.id, arguments) @@ -591,6 +478,6 @@ def main(): delete_pipeline(pipeline.id) -if __name__ == "__main__": +if __name__ == '__main__': pprint(yaml_files) main() diff --git a/api/examples/runs_api.py b/api/examples/runs_api.py index a0f8c71a..477483aa 100644 --- a/api/examples/runs_api.py +++ b/api/examples/runs_api.py @@ -9,8 +9,8 @@ from kfp_server_api import ApiListExperimentsResponse from kfp_server_api import ApiListRunsResponse, ApiResourceType, ApiRunDetail from kfp_server_api.rest import ApiException -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from os import environ as env +from pprint import pprint # export AMBASSADOR_SERVICE_HOST=$(kubectl get nodes -o jsonpath='{.items[0]..addresses[?(@.type=="ExternalIP")].address}') @@ -32,7 +32,6 @@ def wrapper(*args, **kwargs): print(f"---[ {func.__name__}{args}{kwargs} ]---") print() return func(*args, **kwargs) - return wrapper @@ -47,27 +46,20 @@ def list_runs(experiment_name: str = None): # https://github.com/kubeflow/pipelines/blob/3e7a89e044d0ce448ce0b7b2c894a483487694a1/backend/api/filter.proto#L24-L63 experiment_filter_dict = { - "predicates": [ - { - "key": "name", - "op": "IS_SUBSTRING", # "EQUALS", - "string_value": experiment_name, - } - ] + "predicates": [{ + "key": "name", + "op": "IS_SUBSTRING", # "EQUALS", + "string_value": experiment_name + }] } - experiment_response: ApiListExperimentsResponse = ( - kfp_client._experiment_api.list_experiment( - page_size=100, - sort_by="created_at desc", - filter=json.dumps(experiment_filter_dict), - ) - ) + experiment_response: ApiListExperimentsResponse = kfp_client._experiment_api.\ + list_experiment(page_size=100, + sort_by="created_at desc", + filter=json.dumps(experiment_filter_dict)) if experiment_response.experiments: - experiments = [ - e for e in experiment_response.experiments if experiment_name in e.name - ] + experiments = [e for e in experiment_response.experiments if experiment_name in e.name] else: print(f"Experiment(s) with name '{experiment_name}' do(es) not exist.") @@ -75,35 +67,24 @@ def list_runs(experiment_name: str = None): if experiments: for experiment in experiments: - run_response: ApiListRunsResponse = kfp_client._run_api.list_runs( - page_size=100, - sort_by="created_at desc", - resource_reference_key_type=ApiResourceType.EXPERIMENT, - resource_reference_key_id=experiment.id, - ) + run_response: ApiListRunsResponse = \ + kfp_client._run_api.list_runs(page_size=100, + sort_by="created_at desc", + resource_reference_key_type=ApiResourceType.EXPERIMENT, + resource_reference_key_id=experiment.id) runs.extend(run_response.runs or []) else: - run_response: ApiListRunsResponse = kfp_client._run_api.list_runs( - page_size=100, sort_by="created_at desc" - ) + run_response: ApiListRunsResponse = \ + kfp_client._run_api.list_runs(page_size=100, sort_by="created_at desc") runs.extend(run_response.runs or []) runs = sorted(runs, key=lambda r: r.created_at, reverse=True) for i, r in enumerate(runs): # pprint(r) - print( - "%2i: %s %s %s (%s)" - % ( - i + 1, - r.id, - r.created_at.strftime("%Y-%m-%d %H:%M:%S"), - r.name, - r.status, - ) - ) + print("%2i: %s %s %s (%s)" % (i + 1, r.id, r.created_at.strftime("%Y-%m-%d %H:%M:%S"), r.name, r.status)) return runs @@ -124,21 +105,13 @@ def stop_run(run_id): run_detail: ApiRunDetail = kfp_client._run_api.get_run(run_id=run_id) if run_detail: # and run_detail.run.status in ["Failed", "Error"]: - workflow_manifest = json.loads( - run_detail.pipeline_runtime.workflow_manifest - ) + workflow_manifest = json.loads(run_detail.pipeline_runtime.workflow_manifest) # pods = filter(lambda d: d["type"] == 'Pod', list(workflow_manifest["status"]["nodes"].values())) - pods = [ - node - for node in list(workflow_manifest["status"]["nodes"].values()) - if node["type"] == "Pod" - ] + pods = [node for node in list(workflow_manifest["status"]["nodes"].values()) if node["type"] == "Pod"] if pods: print(f"{e.status}, {e.reason}: {pods[0]['message']}") else: - print( - f"Run with id '{run_id}' could not be terminated. No pods in 'Running' state?" - ) + print(f"Run with id '{run_id}' could not be terminated. No pods in 'Running' state?") else: print(e) @@ -164,26 +137,18 @@ def delete_run(run_id): run_detail: ApiRunDetail = kfp_client._run_api.get_run(run_id=run_id) if run_detail: # and run_detail.run.status in ["Failed", "Error"]: - workflow_manifest = json.loads( - run_detail.pipeline_runtime.workflow_manifest - ) + workflow_manifest = json.loads(run_detail.pipeline_runtime.workflow_manifest) # pods = filter(lambda d: d["type"] == 'Pod', list(workflow_manifest["status"]["nodes"].values())) - pods = [ - node - for node in list(workflow_manifest["status"]["nodes"].values()) - if node["type"] == "Pod" - ] + pods = [node for node in list(workflow_manifest["status"]["nodes"].values()) if node["type"] == "Pod"] if pods: print(pods[0]["message"]) else: - print( - f"Run with id '{run_id}' could not be deleted. No corresponding pods." - ) + print(f"Run with id '{run_id}' could not be deleted. No corresponding pods.") else: print(e) -if __name__ == "__main__": +if __name__ == '__main__': # runs = list_runs() # runs = list_runs(experiment_name="COMPONENT_RUNS") diff --git a/api/examples/settings_api.py b/api/examples/settings_api.py index 0015ba27..17162607 100644 --- a/api/examples/settings_api.py +++ b/api/examples/settings_api.py @@ -3,28 +3,26 @@ # SPDX-License-Identifier: Apache-2.0 from __future__ import print_function -import swagger_client # noqa: F401 +import swagger_client -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from pprint import pprint from swagger_client.api_client import ApiClient, Configuration from swagger_client.models import ApiSettings, ApiSettingsSection, ApiParameter -from swagger_client.rest import ApiException # noqa: F401 +from swagger_client.rest import ApiException from sys import stderr -from urllib3.response import HTTPResponse # noqa: F401 -host = "127.0.0.1" -port = "8080" +host = '127.0.0.1' +port = '8080' # host = env.get("MLX_API_SERVICE_HOST") # port = env.get("MLX_API_SERVICE_PORT") -api_base_path = "apis/v1alpha1" +api_base_path = 'apis/v1alpha1' def get_swagger_client(): config = Configuration() - config.host = f"http://{host}:{port}/{api_base_path}" + config.host = f'http://{host}:{port}/{api_base_path}' api_client = ApiClient(configuration=config) return api_client @@ -35,7 +33,6 @@ def wrapper(*args, **kwargs): print(f"---[ {func.__name__}{args}{kwargs} ]---") print() return func(*args, **kwargs) - return wrapper @@ -51,10 +48,7 @@ def get_app_settings(): return api_settings except ApiException as e: - print( - f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, - file=stderr, - ) + print(f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, file=stderr) raise e return None @@ -72,10 +66,7 @@ def modify_app_settings(dictionary: dict): return api_settings except ApiException as e: - print( - f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, - file=stderr, - ) + print(f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, file=stderr) raise e return None @@ -93,10 +84,7 @@ def set_app_settings(api_settings: ApiSettings): return api_settings except ApiException as e: - print( - f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, - file=stderr, - ) + print(f"Exception when calling {api_instance.__class__.__name__}: %s\n" % e, file=stderr) raise e return None @@ -105,22 +93,23 @@ def set_app_settings(api_settings: ApiSettings): def main(): settings = get_app_settings() - modify_app_settings({"Upload enabled": False, "API endpoint": "localhost:8080"}) + modify_app_settings({ + "Upload enabled": False, + "API endpoint": "localhost:8080" + }) settings.sections += [ ApiSettingsSection( name="General", description="General settings", settings=[ - ApiParameter( - "Color scheme", "Color scheme [blue, red, yellow]", "blue", "red" - ) - ], + ApiParameter("Color scheme", 'Color scheme [blue, red, yellow]', 'blue', 'red') + ] ) ] set_app_settings(settings) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/api/server/setup.py b/api/server/setup.py index 5070c386..dd85d1cc 100644 --- a/api/server/setup.py +++ b/api/server/setup.py @@ -27,10 +27,12 @@ keywords=["Swagger", "MLX API"], install_requires=REQUIRES, packages=find_packages(), - package_data={"": ["swagger/swagger.yaml"]}, + package_data={'': ['swagger/swagger.yaml']}, include_package_data=True, - entry_points={"console_scripts": ["swagger_server=swagger_server.__main__:main"]}, + entry_points={ + 'console_scripts': ['swagger_server=swagger_server.__main__:main']}, long_description="""\ Machine Learning Exchange API - """, + """ ) + diff --git a/api/server/swagger_server/__main__.py b/api/server/swagger_server/__main__.py index 61010798..632bd62a 100644 --- a/api/server/swagger_server/__main__.py +++ b/api/server/swagger_server/__main__.py @@ -4,13 +4,13 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import logging from datetime import datetime from flask import redirect, request from flask_cors import CORS -from os import environ as env # noqa: F401 +from os import environ as env from swagger_server import encoder from swagger_server import VERSION from waitress import serve @@ -18,34 +18,28 @@ def get_request_log_msg(): - return "(%03d) %s %s %s ..." % ( - current_thread().ident % 1000, - request.remote_addr, - request.method, - request.full_path, - ) + return '(%03d) %s %s %s ...' % (current_thread().ident % 1000, request.remote_addr, + request.method, request.full_path) def main(): - logging.basicConfig( - format="%(asctime)s.%(msecs)03d %(levelname)-7s [%(name)-.8s] %(message)s", - datefmt="%Y/%m/%d %H:%M:%S", - level=env.get("LOGLEVEL", logging.INFO), - ) + logging.basicConfig(format="%(asctime)s.%(msecs)03d %(levelname)-7s [%(name)-.8s] %(message)s", + datefmt="%Y/%m/%d %H:%M:%S", + level=env.get("LOGLEVEL", logging.INFO)) log = logging.getLogger("flaskapp") log.info("MLX API version: %s" % VERSION) - cx_app = connexion.App(__name__, specification_dir="./swagger/") - cx_app.add_api("swagger.yaml", arguments={"title": "MLX API"}) + cx_app = connexion.App(__name__, specification_dir='./swagger/') + cx_app.add_api('swagger.yaml', arguments={'title': 'MLX API'}) flask_app = cx_app.app flask_app.json_encoder = encoder.JSONEncoder log.info("Enable cross-origin support with 'flask-cors': origins='*'") - CORS(flask_app, origins="*") + CORS(flask_app, origins='*') start_times = dict() @@ -62,13 +56,7 @@ def after_request(response): elapsed_millis = time_delta.seconds * 1000 + time_delta.microseconds / 1000 outstanding_requests = len(start_times) log_func = get_log_method_by_response_status(response) - log_func( - "%s %s (%i ms) [%i]", - msg, - response.status, - elapsed_millis, - outstanding_requests, - ) + log_func('%s %s (%i ms) [%i]', msg, response.status, elapsed_millis, outstanding_requests) return response log_functions = [log.info, log.info, log.info, log.info, log.warning, log.error] @@ -86,5 +74,5 @@ def index(): serve(flask_app, host="0.0.0.0", port=8080, threads=32) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/api/server/swagger_server/code_templates/run_component.TEMPLATE.py b/api/server/swagger_server/code_templates/run_component.TEMPLATE.py index 5b64dfce..00884a7b 100644 --- a/api/server/swagger_server/code_templates/run_component.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/run_component.TEMPLATE.py @@ -1,5 +1,5 @@ # Copyright 2021 The MLX Contributors -# +# # SPDX-License-Identifier: Apache-2.0 from kfp import dsl @@ -17,7 +17,7 @@ name='${name}', description='${description}' ) -def kfp_component_pipeline(${pipeline_method_args}): # noqa: E999 +def kfp_component_pipeline(${pipeline_method_args}): from kfp import components @@ -45,7 +45,7 @@ def kfp_component_pipeline(${pipeline_method_args}): # noqa: E999 # TODO: specify pipeline argument values arguments = ${parameter_dict} -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('COMPONENT_RUNS') diff --git a/api/server/swagger_server/code_templates/run_dataset.TEMPLATE.py b/api/server/swagger_server/code_templates/run_dataset.TEMPLATE.py index f67aa780..35a736cc 100644 --- a/api/server/swagger_server/code_templates/run_dataset.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/run_dataset.TEMPLATE.py @@ -1,5 +1,5 @@ # Copyright 2021 The MLX Contributors -# +# # SPDX-License-Identifier: Apache-2.0 from kfp import dsl @@ -17,7 +17,7 @@ name='${name}', description='${description}' ) -def dataset_pipeline(${pipeline_method_args}): # noqa: E999 +def dataset_pipeline(${pipeline_method_args}): from kfp.components import load_component_from_url @@ -55,7 +55,7 @@ def dataset_pipeline(${pipeline_method_args}): # noqa: E999 # TODO: specify pipeline argument values arguments = ${parameter_dict} -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('DATASET_RUNS') diff --git a/api/server/swagger_server/code_templates/run_notebook.TEMPLATE.py b/api/server/swagger_server/code_templates/run_notebook.TEMPLATE.py index 743d1c27..71c1d1ac 100644 --- a/api/server/swagger_server/code_templates/run_notebook.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/run_notebook.TEMPLATE.py @@ -54,7 +54,7 @@ def notebook_pipeline(): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('NOTEBOOK_RUNS') diff --git a/api/server/swagger_server/code_templates/run_notebook_with_dataset.TEMPLATE.py b/api/server/swagger_server/code_templates/run_notebook_with_dataset.TEMPLATE.py index 390ad511..f57650f1 100644 --- a/api/server/swagger_server/code_templates/run_notebook_with_dataset.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/run_notebook_with_dataset.TEMPLATE.py @@ -60,7 +60,7 @@ def notebook_pipeline(): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('NOTEBOOK_RUNS') diff --git a/api/server/swagger_server/code_templates/run_pipeline.TEMPLATE.py b/api/server/swagger_server/code_templates/run_pipeline.TEMPLATE.py index b256db25..6bc67842 100644 --- a/api/server/swagger_server/code_templates/run_pipeline.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/run_pipeline.TEMPLATE.py @@ -17,7 +17,7 @@ name='${name}', description='${description}' ) -def custom_pipeline(${pipeline_method_args}): # noqa: E999 +def custom_pipeline(${pipeline_method_args}): ${pipeline_function_body} @@ -38,7 +38,7 @@ def custom_pipeline(${pipeline_method_args}): # noqa: E999 # TODO: specify pipeline argument values arguments = ${parameter_dict} -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('PIPELINE_RUNS') diff --git a/api/server/swagger_server/code_templates/serve_kfserving.TEMPLATE.py b/api/server/swagger_server/code_templates/serve_kfserving.TEMPLATE.py index d3b6ca42..c422a9aa 100644 --- a/api/server/swagger_server/code_templates/serve_kfserving.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/serve_kfserving.TEMPLATE.py @@ -56,6 +56,7 @@ def model_pipeline(model_id='${model_identifier}'): # Compile the pipeline ############################################################ + pipeline_function = model_pipeline pipeline_filename = path.join(gettempdir(), pipeline_function.__name__ + '.tar.gz') @@ -66,7 +67,7 @@ def model_pipeline(model_id='${model_identifier}'): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('MODEL_RUNS') diff --git a/api/server/swagger_server/code_templates/serve_knative.TEMPLATE.py b/api/server/swagger_server/code_templates/serve_knative.TEMPLATE.py index 02175821..d195f790 100644 --- a/api/server/swagger_server/code_templates/serve_knative.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/serve_knative.TEMPLATE.py @@ -1,6 +1,6 @@ # Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 +# +# SPDX-License-Identifier: Apache-2.0 from kfp import dsl from kfp_tekton.compiler import TektonCompiler @@ -73,7 +73,7 @@ def model_pipeline(model_id='${model_identifier}'): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('MODEL_RUNS') diff --git a/api/server/swagger_server/code_templates/serve_kubernetes.TEMPLATE.py b/api/server/swagger_server/code_templates/serve_kubernetes.TEMPLATE.py index 2384671a..41925851 100644 --- a/api/server/swagger_server/code_templates/serve_kubernetes.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/serve_kubernetes.TEMPLATE.py @@ -1,6 +1,6 @@ # Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 +# +# SPDX-License-Identifier: Apache-2.0 from kfp import dsl from kfp_tekton.compiler import TektonCompiler @@ -71,7 +71,7 @@ def model_pipeline(model_id='${model_identifier}'): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('MODEL_RUNS') diff --git a/api/server/swagger_server/code_templates/train_watsonml.TEMPLATE.py b/api/server/swagger_server/code_templates/train_watsonml.TEMPLATE.py index 8bf4697f..ce450816 100644 --- a/api/server/swagger_server/code_templates/train_watsonml.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/train_watsonml.TEMPLATE.py @@ -1,6 +1,6 @@ # Copyright 2021 The MLX Contributors -# -# SPDX-License-Identifier: Apache-2.0 +# +# SPDX-License-Identifier: Apache-2.0 from kfp import dsl from kfp_tekton.compiler import TektonCompiler @@ -80,7 +80,7 @@ def model_pipeline(model_id='${model_identifier}'): # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('MODEL_RUNS') diff --git a/api/server/swagger_server/code_templates/train_watsonml_w_credentials.TEMPLATE.py b/api/server/swagger_server/code_templates/train_watsonml_w_credentials.TEMPLATE.py index 1017a253..10c0668b 100644 --- a/api/server/swagger_server/code_templates/train_watsonml_w_credentials.TEMPLATE.py +++ b/api/server/swagger_server/code_templates/train_watsonml_w_credentials.TEMPLATE.py @@ -1,5 +1,5 @@ # Copyright 2021 The MLX Contributors -# +# # SPDX-License-Identifier: Apache-2.0 from kfp import dsl @@ -81,7 +81,7 @@ def model_pipeline(model_id='${model_identifier}', # Run the pipeline ############################################################ -client = TektonClient(${pipeline_server}) # noqa: E999 +client = TektonClient(${pipeline_server}) # Get or create an experiment and submit a pipeline run experiment = client.create_experiment('MODEL_RUNS') diff --git a/api/server/swagger_server/controllers/application_settings_controller.py b/api/server/swagger_server/controllers/application_settings_controller.py index cf193ffd..8bf36a56 100644 --- a/api/server/swagger_server/controllers/application_settings_controller.py +++ b/api/server/swagger_server/controllers/application_settings_controller.py @@ -2,13 +2,12 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 +import connexion from swagger_server.models.api_settings import ApiSettings # noqa: E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.models.dictionary import Dictionary # noqa: E501 -from swagger_server import util # noqa: F401 +from swagger_server import util def get_application_settings(): # noqa: E501 @@ -33,7 +32,7 @@ def modify_application_settings(dictionary): # noqa: E501 :rtype: ApiSettings """ if connexion.request.is_json: - dictionary = Dictionary.from_dict(connexion.request.get_json()) + dictionary = Dictionary.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -42,11 +41,11 @@ def set_application_settings(settings): # noqa: E501 Set and store the application settings. # noqa: E501 - :param settings: + :param settings: :type settings: dict | bytes :rtype: ApiSettings """ if connexion.request.is_json: - settings = ApiSettings.from_dict(connexion.request.get_json()) + settings = ApiSettings.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() diff --git a/api/server/swagger_server/controllers/catalog_service_controller.py b/api/server/swagger_server/controllers/catalog_service_controller.py index 81326583..dd7c98e3 100644 --- a/api/server/swagger_server/controllers/catalog_service_controller.py +++ b/api/server/swagger_server/controllers/catalog_service_controller.py @@ -2,26 +2,20 @@ # # SPDX-License-Identifier: Apache-2.0 -from swagger_server.models.api_catalog_upload import ApiCatalogUpload # noqa: F401, E501 -from swagger_server.models.api_catalog_upload_response import ( # noqa: F401 - ApiCatalogUploadResponse, -) -from swagger_server.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_server import util # noqa: F401 - - -def list_all_assets( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +from swagger_server.models.api_catalog_upload import ApiCatalogUpload # noqa: E501 +from swagger_server.models.api_catalog_upload_response import ApiCatalogUploadResponse # noqa: E501 +from swagger_server.models.api_list_catalog_items_response import ApiListCatalogItemsResponse # noqa: E501 +from swagger_server import util + + +def list_all_assets(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_all_assets # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str @@ -53,7 +47,7 @@ def upload_multiple_assets(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: ApiCatalogUpload :rtype: ApiCatalogUploadResponse diff --git a/api/server/swagger_server/controllers/component_service_controller.py b/api/server/swagger_server/controllers/component_service_controller.py index 0110570a..aefff472 100644 --- a/api/server/swagger_server/controllers/component_service_controller.py +++ b/api/server/swagger_server/controllers/component_service_controller.py @@ -2,23 +2,16 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 +import connexion from swagger_server.models.api_component import ApiComponent # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_components_response import ( # noqa: F401 - ApiListComponentsResponse, -) -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_components_response import ApiListComponentsResponse # noqa: E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 +from swagger_server import util def approve_components_for_publishing(component_ids): # noqa: E501 @@ -39,13 +32,13 @@ def create_component(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiComponent """ if connexion.request.is_json: - body = ApiComponent.from_dict(connexion.request.get_json()) + body = ApiComponent.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -54,7 +47,7 @@ def delete_component(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -67,7 +60,7 @@ def download_component_files(id, include_generated_code=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param include_generated_code: Include generated run script in download :type include_generated_code: bool @@ -82,7 +75,7 @@ def generate_component_code(id): # noqa: E501 Generate sample code to use component in a pipeline # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGenerateCodeResponse @@ -95,7 +88,7 @@ def get_component(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiComponent @@ -108,7 +101,7 @@ def get_component_template(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGetTemplateResponse @@ -116,16 +109,14 @@ def get_component_template(id): # noqa: E501 return util.invoke_controller_impl() -def list_components( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_components(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_components # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str @@ -142,9 +133,9 @@ def run_component(id, parameters, run_name=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str - :param parameters: + :param parameters: :type parameters: List[ApiParameter] :param run_name: name to identify the run on the Kubeflow Pipelines UI, defaults to component name :type run_name: str @@ -152,9 +143,7 @@ def run_component(id, parameters, run_name=None): # noqa: E501 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - parameters = [ - ApiParameter.from_dict(d) for d in connexion.request.get_json() - ] # noqa: E501 + parameters = [ApiParameter.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 return util.invoke_controller_impl() @@ -178,7 +167,7 @@ def upload_component(uploadfile, name=None): # noqa: E501 :param uploadfile: The component YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str :rtype: ApiComponent diff --git a/api/server/swagger_server/controllers/credential_service_controller.py b/api/server/swagger_server/controllers/credential_service_controller.py index c8e803ac..4958e965 100644 --- a/api/server/swagger_server/controllers/credential_service_controller.py +++ b/api/server/swagger_server/controllers/credential_service_controller.py @@ -2,15 +2,12 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 +import connexion from swagger_server.models.api_credential import ApiCredential # noqa: E501 -from swagger_server.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_list_credentials_response import ApiListCredentialsResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 +from swagger_server import util def create_credential(body): # noqa: E501 @@ -18,13 +15,13 @@ def create_credential(body): # noqa: E501 Creates a credential associated with a pipeline. # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiCredential """ if connexion.request.is_json: - body = ApiCredential.from_dict(connexion.request.get_json()) + body = ApiCredential.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -33,7 +30,7 @@ def delete_credential(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -46,7 +43,7 @@ def get_credential(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiCredential @@ -54,16 +51,14 @@ def get_credential(id): # noqa: E501 return util.invoke_controller_impl() -def list_credentials( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_credentials(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_credentials # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str diff --git a/api/server/swagger_server/controllers/dataset_service_controller.py b/api/server/swagger_server/controllers/dataset_service_controller.py index ebedd10b..513e3c77 100644 --- a/api/server/swagger_server/controllers/dataset_service_controller.py +++ b/api/server/swagger_server/controllers/dataset_service_controller.py @@ -2,23 +2,16 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 +import connexion from swagger_server.models.api_dataset import ApiDataset # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_datasets_response import ( # noqa: F401 - ApiListDatasetsResponse, -) -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_datasets_response import ApiListDatasetsResponse # noqa: E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 +from swagger_server import util def approve_datasets_for_publishing(dataset_ids): # noqa: E501 @@ -39,13 +32,13 @@ def create_dataset(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiDataset """ if connexion.request.is_json: - body = ApiDataset.from_dict(connexion.request.get_json()) + body = ApiDataset.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -54,7 +47,7 @@ def delete_dataset(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -67,7 +60,7 @@ def download_dataset_files(id, include_generated_code=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param include_generated_code: Include generated run script in download :type include_generated_code: bool @@ -82,7 +75,7 @@ def generate_dataset_code(id): # noqa: E501 Generate sample code to use dataset in a pipeline # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGenerateCodeResponse @@ -95,7 +88,7 @@ def get_dataset(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiDataset @@ -108,7 +101,7 @@ def get_dataset_template(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGetTemplateResponse @@ -116,16 +109,14 @@ def get_dataset_template(id): # noqa: E501 return util.invoke_controller_impl() -def list_datasets( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_datasets(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_datasets # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of 'field_name', 'field_name asc' or 'field_name desc'. Ascending by default. :type sort_by: str @@ -142,9 +133,9 @@ def run_dataset(id, parameters=None, run_name=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str - :param parameters: + :param parameters: :type parameters: list | bytes :param run_name: name to identify the run on the Kubeflow Pipelines UI, defaults to component name :type run_name: str @@ -152,9 +143,7 @@ def run_dataset(id, parameters=None, run_name=None): # noqa: E501 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - parameters = [ - ApiParameter.from_dict(d) for d in connexion.request.get_json() - ] # noqa: E501 + parameters = [ApiParameter.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 return util.invoke_controller_impl() @@ -178,7 +167,7 @@ def upload_dataset(uploadfile, name=None): # noqa: E501 :param uploadfile: The dataset YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str :rtype: ApiDataset diff --git a/api/server/swagger_server/controllers/health_check_controller.py b/api/server/swagger_server/controllers/health_check_controller.py index ff19d1a8..6497a961 100644 --- a/api/server/swagger_server/controllers/health_check_controller.py +++ b/api/server/swagger_server/controllers/health_check_controller.py @@ -2,11 +2,9 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_status import ApiStatus # noqa: E501 +from swagger_server import util def health_check(check_database=None, check_object_store=None): # noqa: E501 diff --git a/api/server/swagger_server/controllers/inference_service_controller.py b/api/server/swagger_server/controllers/inference_service_controller.py index 555120c4..88fcf20f 100644 --- a/api/server/swagger_server/controllers/inference_service_controller.py +++ b/api/server/swagger_server/controllers/inference_service_controller.py @@ -2,15 +2,12 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 +import connexion -from swagger_server.models.api_inferenceservice import ApiInferenceservice # noqa: F401, E501 -from swagger_server.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_inferenceservice import ApiInferenceservice # noqa: E501 +from swagger_server.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 +from swagger_server import util def create_service(body, namespace=None): # noqa: E501 @@ -18,15 +15,15 @@ def create_service(body, namespace=None): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes - :param namespace: + :param namespace: :type namespace: str :rtype: ApiInferenceservice """ if connexion.request.is_json: - body = ApiInferenceservice.from_dict(connexion.request.get_json()) + body = ApiInferenceservice.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -35,9 +32,9 @@ def get_inferenceservices(id, namespace=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiInferenceservice @@ -45,22 +42,20 @@ def get_inferenceservices(id, namespace=None): # noqa: E501 return util.invoke_controller_impl() -def list_inferenceservices( - page_token=None, page_size=None, sort_by=None, filter=None, namespace=None -): # noqa: E501 +def list_inferenceservices(page_token=None, page_size=None, sort_by=None, filter=None, namespace=None): # noqa: E501 """list_inferenceservices # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str :param filter: A string-serialized JSON dictionary with key-value pairs that correspond to the InferenceService's attribute names and their respective values to be filtered for. :type filter: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiListInferenceservicesResponse @@ -75,9 +70,9 @@ def upload_service(uploadfile, name=None, namespace=None): # noqa: E501 :param uploadfile: The inference service metadata to upload. Maximum size of 32MB is supported. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiInferenceservice diff --git a/api/server/swagger_server/controllers/model_service_controller.py b/api/server/swagger_server/controllers/model_service_controller.py index b7799f90..7bccf673 100644 --- a/api/server/swagger_server/controllers/model_service_controller.py +++ b/api/server/swagger_server/controllers/model_service_controller.py @@ -2,23 +2,16 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 - -from swagger_server.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_models_response import ( # noqa: F401 - ApiListModelsResponse, -) +import connexion + +from swagger_server.models.api_generate_model_code_response import ApiGenerateModelCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_models_response import ApiListModelsResponse # noqa: E501 from swagger_server.models.api_model import ApiModel # noqa: E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.models.dictionary import Dictionary # noqa: E501 -from swagger_server import util # noqa: F401 +from swagger_server import util def approve_models_for_publishing(model_ids): # noqa: E501 @@ -39,13 +32,13 @@ def create_model(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiModel """ if connexion.request.is_json: - body = ApiModel.from_dict(connexion.request.get_json()) + body = ApiModel.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -54,7 +47,7 @@ def delete_model(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -67,7 +60,7 @@ def download_model_files(id, include_generated_code=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param include_generated_code: Include generated run scripts in download :type include_generated_code: bool @@ -82,7 +75,7 @@ def generate_model_code(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGenerateModelCodeResponse @@ -95,7 +88,7 @@ def get_model(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiModel @@ -108,7 +101,7 @@ def get_model_template(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGetTemplateResponse @@ -116,16 +109,14 @@ def get_model_template(id): # noqa: E501 return util.invoke_controller_impl() -def list_models( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_models(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_models # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str @@ -137,14 +128,12 @@ def list_models( return util.invoke_controller_impl() -def run_model( - id, pipeline_stage, execution_platform, run_name=None, parameters=None -): # noqa: E501 +def run_model(id, pipeline_stage, execution_platform, run_name=None, parameters=None): # noqa: E501 """run_model # noqa: E501 - :param id: + :param id: :type id: str :param pipeline_stage: pipeline stage, either 'train' or 'serve' :type pipeline_stage: str @@ -158,7 +147,7 @@ def run_model( :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - parameters = Dictionary.from_dict(connexion.request.get_json()) + parameters = Dictionary.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -182,7 +171,7 @@ def upload_model(uploadfile, name=None): # noqa: E501 :param uploadfile: The model YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str :rtype: ApiModel diff --git a/api/server/swagger_server/controllers/notebook_service_controller.py b/api/server/swagger_server/controllers/notebook_service_controller.py index 8ce43006..e0d4ce2c 100644 --- a/api/server/swagger_server/controllers/notebook_service_controller.py +++ b/api/server/swagger_server/controllers/notebook_service_controller.py @@ -2,23 +2,16 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 - -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_notebooks_response import ( # noqa: F401 - ApiListNotebooksResponse, -) +import connexion + +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_notebooks_response import ApiListNotebooksResponse # noqa: E501 from swagger_server.models.api_notebook import ApiNotebook # noqa: E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.models.dictionary import Dictionary # noqa: E501 -from swagger_server import util # noqa: F401 +from swagger_server import util def approve_notebooks_for_publishing(notebook_ids): # noqa: E501 @@ -39,13 +32,13 @@ def create_notebook(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiNotebook """ if connexion.request.is_json: - body = ApiNotebook.from_dict(connexion.request.get_json()) + body = ApiNotebook.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -54,7 +47,7 @@ def delete_notebook(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -67,7 +60,7 @@ def download_notebook_files(id, include_generated_code=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param include_generated_code: Include generated run script in download :type include_generated_code: bool @@ -82,7 +75,7 @@ def generate_notebook_code(id): # noqa: E501 Generate sample code to use notebook in a pipeline # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGenerateCodeResponse @@ -95,7 +88,7 @@ def get_notebook(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiNotebook @@ -108,7 +101,7 @@ def get_notebook_template(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGetTemplateResponse @@ -116,16 +109,14 @@ def get_notebook_template(id): # noqa: E501 return util.invoke_controller_impl() -def list_notebooks( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_notebooks(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_notebooks # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str @@ -142,7 +133,7 @@ def run_notebook(id, run_name=None, parameters=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param run_name: name to identify the run on the Kubeflow Pipelines UI, defaults to notebook name :type run_name: str @@ -152,7 +143,7 @@ def run_notebook(id, run_name=None, parameters=None): # noqa: E501 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - parameters = Dictionary.from_dict(connexion.request.get_json()) + parameters = Dictionary.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -176,7 +167,7 @@ def upload_notebook(uploadfile, name=None, enterprise_github_token=None): # noq :param uploadfile: The notebook metadata YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str :param enterprise_github_token: Optional GitHub API token providing read-access to notebooks stored on Enterprise GitHub accounts. :type enterprise_github_token: str diff --git a/api/server/swagger_server/controllers/pipeline_service_controller.py b/api/server/swagger_server/controllers/pipeline_service_controller.py index 7f36252c..e567952b 100644 --- a/api/server/swagger_server/controllers/pipeline_service_controller.py +++ b/api/server/swagger_server/controllers/pipeline_service_controller.py @@ -2,26 +2,17 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import six # noqa: F401 - -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_pipelines_response import ( # noqa: F401 - ApiListPipelinesResponse, -) +import connexion + +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_pipelines_response import ApiListPipelinesResponse # noqa: E501 from swagger_server.models.api_pipeline import ApiPipeline # noqa: E501 -from swagger_server.models.api_pipeline_custom_run_payload import ( - ApiPipelineCustomRunPayload, -) -from swagger_server.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_pipeline_custom_run_payload import ApiPipelineCustomRunPayload # noqa: E501 +from swagger_server.models.api_pipeline_extended import ApiPipelineExtended # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.models.dictionary import Dictionary # noqa: E501 -from swagger_server import util # noqa: F401 +from swagger_server import util def approve_pipelines_for_publishing(pipeline_ids): # noqa: E501 @@ -42,13 +33,13 @@ def create_pipeline(body): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiPipeline """ if connexion.request.is_json: - body = ApiPipeline.from_dict(connexion.request.get_json()) + body = ApiPipeline.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -57,7 +48,7 @@ def delete_pipeline(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: None @@ -70,7 +61,7 @@ def download_pipeline_files(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: file | binary @@ -83,7 +74,7 @@ def get_pipeline(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiPipelineExtended @@ -96,7 +87,7 @@ def get_template(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGetTemplateResponse @@ -104,16 +95,14 @@ def get_template(id): # noqa: E501 return util.invoke_controller_impl() -def list_pipelines( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_pipelines(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_pipelines # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str @@ -138,9 +127,7 @@ def run_custom_pipeline(run_custom_pipeline_payload, run_name=None): # noqa: E5 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - run_custom_pipeline_payload = ApiPipelineCustomRunPayload.from_dict( - connexion.request.get_json() - ) + run_custom_pipeline_payload = ApiPipelineCustomRunPayload.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -149,7 +136,7 @@ def run_pipeline(id, run_name=None, parameters=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :param run_name: name to identify the run on the Kubeflow Pipelines UI, defaults to pipeline name :type run_name: str @@ -159,7 +146,7 @@ def run_pipeline(id, run_name=None, parameters=None): # noqa: E501 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - parameters = Dictionary.from_dict(connexion.request.get_json()) + parameters = Dictionary.from_dict(connexion.request.get_json()) # noqa: E501 return util.invoke_controller_impl() @@ -176,9 +163,7 @@ def set_featured_pipelines(pipeline_ids): # noqa: E501 return util.invoke_controller_impl() -def upload_pipeline( - uploadfile, name=None, description=None, annotations=None -): # noqa: E501 +def upload_pipeline(uploadfile, name=None, description=None, annotations=None): # noqa: E501 """upload_pipeline # noqa: E501 diff --git a/api/server/swagger_server/controllers_impl/__init__.py b/api/server/swagger_server/controllers_impl/__init__.py index 56a5f96d..8948eb13 100644 --- a/api/server/swagger_server/controllers_impl/__init__.py +++ b/api/server/swagger_server/controllers_impl/__init__.py @@ -6,7 +6,7 @@ from werkzeug.datastructures import FileStorage -from kfp_tekton.compiler._k8s_helper import sanitize_k8s_name +from kfp_tekton.compiler._k8s_helper import sanitize_k8s_name; from swagger_server.data_access.minio_client import extract_yaml_from_tarfile from swagger_server.models.api_parameter import ApiParameter from swagger_server.util import ApiError @@ -17,7 +17,6 @@ # TODO: move into controllers_impl/util.py ############################################################################### - def get_yaml_file_content_from_uploadfile(uploadfile: FileStorage): file_name = uploadfile.filename @@ -32,9 +31,7 @@ def get_yaml_file_content_from_uploadfile(uploadfile: FileStorage): else: raise ApiError( f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'." - f"Supported file extensions: .tar.gz, .gz, .yaml, .yml", - 501, - ) + f"Supported file extensions: .tar.gz, .gz, .yaml, .yml", 501) return yaml_file_content @@ -45,15 +42,11 @@ def validate_parameters(api_parameters: [ApiParameter], parameters: dict) -> (st unexpected_parameters = set(parameters.keys()) - set(acceptable_parameters) if unexpected_parameters: - return ( - f"Unexpected parameter(s): {list(unexpected_parameters)}. " - f"Acceptable parameter(s): {acceptable_parameters}", - 422, - ) + return f"Unexpected parameter(s): {list(unexpected_parameters)}. " \ + f"Acceptable parameter(s): {acceptable_parameters}", 422 - missing_parameters = [ - p.name for p in api_parameters if not p.default and p.name not in parameters - ] + missing_parameters = [p.name for p in api_parameters + if not p.default and p.name not in parameters] if missing_parameters: return f"Missing required parameter(s): {missing_parameters}", 422 @@ -64,10 +57,7 @@ def validate_parameters(api_parameters: [ApiParameter], parameters: dict) -> (st def validate_id(id: str) -> (str, int): if id != sanitize_k8s_name(id): - return ( - f"Identifiers must contain lower case alphanumeric characters or '-' only.", - 422, - ) + return f"Identifiers must contain lower case alphanumeric characters or '-' only.", 422 return None, 200 @@ -80,11 +70,9 @@ def download_file_content_from_url(url: str, bearer_token: str = None) -> bytes: request_headers.update({"Authorization": f"Bearer {bearer_token}"}) try: - raw_url = ( - url.replace("/blob/", "/") - .replace("/github.ibm.com/", "/raw.github.ibm.com/") + raw_url = url.replace("/blob/", "/") \ + .replace("/github.ibm.com/", "/raw.github.ibm.com/") \ .replace("/github.com/", "/raw.githubusercontent.com/") - ) response = requests.get(raw_url, allow_redirects=True, headers=request_headers) @@ -95,7 +83,5 @@ def download_file_content_from_url(url: str, bearer_token: str = None) -> bytes: except Exception as e: raise ApiError(f"Could not download file '{url}'. \n{str(e)}", 422) - raise ApiError( - f"Could not download file '{url}'. Reason: {response.reason}", - response.status_code, - ) + raise ApiError(f"Could not download file '{url}'. Reason: {response.reason}", + response.status_code) diff --git a/api/server/swagger_server/controllers_impl/application_settings_controller_impl.py b/api/server/swagger_server/controllers_impl/application_settings_controller_impl.py index 91ab7fce..ac2f2a6b 100644 --- a/api/server/swagger_server/controllers_impl/application_settings_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/application_settings_controller_impl.py @@ -1,20 +1,17 @@ # Copyright 2021 The MLX Contributors # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 -import yaml # noqa: F401 +import connexion +import yaml from os.path import abspath, join, dirname -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 from swagger_server.models.api_settings import ApiSettings # noqa: E501 -from swagger_server.models.api_settings_section import ApiSettingsSection # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 -from swagger_server import util # noqa: F401 +from swagger_server.models.api_settings_section import ApiSettingsSection # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 -SETTINGS_FILE = abspath( - join(dirname(__file__), "..", "..", "application_settings.yaml") -) +SETTINGS_FILE = abspath(join(dirname(__file__), "..", "..", "application_settings.yaml")) def get_application_settings(): # noqa: E501 @@ -52,7 +49,7 @@ def modify_application_settings(dictionary: dict): # noqa: E501 if setting.name in dictionary.keys(): setting.value = dictionary.get(setting.name) - with open(SETTINGS_FILE, "w") as f: + with open(SETTINGS_FILE, 'w') as f: yaml.dump(settings.to_dict(), f, default_flow_style=False) return settings, 200 @@ -71,7 +68,7 @@ def set_application_settings(settings): # noqa: E501 if connexion.request.is_json: settings = ApiSettings.from_dict(connexion.request.get_json()) - with open(SETTINGS_FILE, "w") as f: + with open(SETTINGS_FILE, 'w') as f: yaml.dump(settings.to_dict(), f, default_flow_style=False) return settings, 200 diff --git a/api/server/swagger_server/controllers_impl/catalog_service_controller_impl.py b/api/server/swagger_server/controllers_impl/catalog_service_controller_impl.py index 49ed3cb9..d6e3cdfa 100644 --- a/api/server/swagger_server/controllers_impl/catalog_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/catalog_service_controller_impl.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import traceback @@ -10,52 +10,29 @@ from swagger_server.models import ApiCatalogUpload, ApiCatalogUploadError from swagger_server.models import ApiCatalogUploadResponse, ApiListCatalogItemsResponse -from swagger_server.models import ( - ApiComponent, - ApiDataset, - ApiModel, - ApiNotebook, - ApiPipelineExtension, -) +from swagger_server.models import ApiComponent, ApiDataset, ApiModel, ApiNotebook, ApiPipelineExtension from swagger_server.controllers_impl import download_file_content_from_url -from swagger_server.controllers_impl.component_service_controller_impl import ( - list_components, - upload_component_from_url, -) -from swagger_server.controllers_impl.dataset_service_controller_impl import ( - list_datasets, - upload_dataset_from_url, -) -from swagger_server.controllers_impl.model_service_controller_impl import ( - list_models, - upload_model_from_url, -) -from swagger_server.controllers_impl.notebook_service_controller_impl import ( - list_notebooks, - upload_notebook_from_url, -) -from swagger_server.controllers_impl.pipeline_service_controller_impl import ( - list_pipelines, - upload_pipeline_from_url, -) +from swagger_server.controllers_impl.component_service_controller_impl import list_components, upload_component_from_url +from swagger_server.controllers_impl.dataset_service_controller_impl import list_datasets, upload_dataset_from_url +from swagger_server.controllers_impl.model_service_controller_impl import list_models, upload_model_from_url +from swagger_server.controllers_impl.notebook_service_controller_impl import list_notebooks, upload_notebook_from_url +from swagger_server.controllers_impl.pipeline_service_controller_impl import list_pipelines, upload_pipeline_from_url from swagger_server.util import ApiError -def list_all_assets( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_all_assets(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_all_assets :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary with key-value pairs that correspond to the ApiComponent's attribute names and their respective values to be filtered for. # noqa: E501 + :param filter: A string-serialized JSON dictionary with key-value pairs that correspond to the ApiComponent's attribute names and their respective values to be filtered for. :type filter: str :rtype: ApiListCatalogItemsResponse @@ -65,24 +42,22 @@ def list_all_assets( return {}, 204 # TODO: do not mis-use page_token as MySQL result offset - offset = int(page_token) if page_token and page_token.isdigit() else 0 + int(page_token) if page_token and page_token.isdigit() else 0 if page_size or page_token: - print( - f"WARNING: page_size and page_token are not implemented on {__file__}#list_all_assets()" - ) + print(f"WARNING: page_size and page_token are not implemented on {__file__}#list_all_assets()") list_methods = { "components": list_components, "datasets": list_datasets, "models": list_models, "notebooks": list_notebooks, - "pipelines": list_pipelines, + "pipelines": list_pipelines } api_response = ApiListCatalogItemsResponse( - components=[], datasets=[], models=[], notebooks=[], pipelines=[], total_size=0 - ) + components=[], datasets=[], models=[], notebooks=[], pipelines=[], + total_size=0) for asset_type, list_method in list_methods.items(): @@ -127,7 +102,7 @@ def upload_multiple_assets(body: ApiCatalogUpload): # noqa: E501 :rtype: ApiCatalogUploadResponse """ if connexion.request.is_json: - body = ApiCatalogUpload.from_dict(connexion.request.get_json()) + body = ApiCatalogUpload.from_dict(connexion.request.get_json()) # noqa: E501 return _upload_multiple_assets(body) @@ -151,54 +126,41 @@ def get_access_token_for_url(url: str) -> str: "datasets": upload_dataset_from_url, "models": upload_model_from_url, "notebooks": upload_notebook_from_url, - "pipelines": upload_pipeline_from_url, + "pipelines": upload_pipeline_from_url } api_response = ApiCatalogUploadResponse( - components=[], - datasets=[], - models=[], - notebooks=[], - pipelines=[], - total_created=0, - errors=[], - total_errors=0, - ) + components=[], datasets=[], models=[], notebooks=[], pipelines=[], + total_created=0, errors=[], total_errors=0) for asset_type, upload_method in upload_methods.items(): for asset in body.__getattribute__(asset_type) or []: try: api_object, status = upload_method( - url=asset.url, - name=asset.name, - access_token=get_access_token_for_url(asset.url), - ) + url=asset.url, name=asset.name, + access_token=get_access_token_for_url(asset.url)) if 200 <= status < 300: api_response.__getattribute__(asset_type).append(api_object) api_response.total_created += 1 else: # TODO: remove this? - api_error = ApiCatalogUploadError( - **asset.to_dict(), - error_message=f"THIS SHOULD NOT HAPPEN: {str(api_object).strip()}", - status_code=500, - ) + api_error = ApiCatalogUploadError(**asset.to_dict(), + error_message=f"THIS SHOULD NOT HAPPEN: {str(api_object).strip()}", + status_code=500) api_response.errors.append(api_error) print(f"THIS SHOULD NOT HAPPEN: {api_error}") print(traceback.format_exc()) except ApiError as e: - api_error = ApiCatalogUploadError( - **asset.to_dict(), - error_message=e.message, - status_code=e.http_status_code, - ) + api_error = ApiCatalogUploadError(**asset.to_dict(), + error_message=e.message, + status_code=e.http_status_code) api_response.errors.append(api_error) except Exception as e: - api_error = ApiCatalogUploadError( - **asset.to_dict(), error_message=str(e), status_code=500 - ) + api_error = ApiCatalogUploadError(**asset.to_dict(), + error_message=str(e), + status_code=500) api_response.errors.append(api_error) print(traceback.format_exc()) @@ -210,7 +172,7 @@ def get_access_token_for_url(url: str) -> str: "datasets": ApiDataset, "models": ApiModel, "notebooks": ApiNotebook, - "pipelines": ApiPipelineExtension, + "pipelines": ApiPipelineExtension } for asset_type, api_class in api_classes.items(): asset_list = api_response.__getattribute__(asset_type) @@ -218,12 +180,9 @@ def get_access_token_for_url(url: str) -> str: update_multiple(api_class, asset_ids, "publish_approved", publish_all) update_multiple(api_class, asset_ids, "featured", feature_all) - response_status = ( - 201 - if api_response.total_created > 0 and api_response.total_errors == 0 - else 207 - if api_response.total_created > 0 and api_response.total_errors > 0 - else max([e.status_code for e in api_response.errors]) - ) + response_status = \ + 201 if api_response.total_created > 0 and api_response.total_errors == 0 else \ + 207 if api_response.total_created > 0 and api_response.total_errors > 0 else \ + max([e.status_code for e in api_response.errors]) return api_response, response_status diff --git a/api/server/swagger_server/controllers_impl/component_service_controller_impl.py b/api/server/swagger_server/controllers_impl/component_service_controller_impl.py index be061aaf..d96ed37c 100644 --- a/api/server/swagger_server/controllers_impl/component_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/component_service_controller_impl.py @@ -2,55 +2,31 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import tarfile -import yaml # noqa: F401 +import yaml from datetime import datetime from io import BytesIO from typing import AnyStr from werkzeug.datastructures import FileStorage -from swagger_server.controllers_impl import ( - download_file_content_from_url, - get_yaml_file_content_from_uploadfile, - validate_parameters, -) -from swagger_server.data_access.minio_client import ( - store_file, - delete_objects, - get_file_content_and_url, - NoSuchKey, - enable_anonymous_read_access, - create_tarfile, -) -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, - update_multiple, -) -from swagger_server.gateways.kubeflow_pipeline_service import ( - generate_component_run_script, - run_component_in_experiment, - _host as KFP_HOST, -) +from swagger_server.controllers_impl import download_file_content_from_url, \ + get_yaml_file_content_from_uploadfile, validate_parameters +from swagger_server.data_access.minio_client import store_file, delete_objects, \ + get_file_content_and_url, NoSuchKey, enable_anonymous_read_access, create_tarfile +from swagger_server.data_access.mysql_client import store_data, generate_id, load_data, \ + delete_data, num_rows, update_multiple +from swagger_server.gateways.kubeflow_pipeline_service import generate_component_run_script, \ + run_component_in_experiment, _host as KFP_HOST from swagger_server.models.api_component import ApiComponent # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_components_response import ( # noqa: F401 - ApiListComponentsResponse, -) +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_components_response import ApiListComponentsResponse # noqa: E501 from swagger_server.models.api_metadata import ApiMetadata -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 def approve_components_for_publishing(component_ids): # noqa: E501 @@ -79,7 +55,7 @@ def create_component(body): # noqa: E501 :rtype: ApiComponent """ if connexion.request.is_json: - body = ApiComponent.from_dict(connexion.request.get_json()) + body = ApiComponent.from_dict(connexion.request.get_json()) # noqa: E501 api_component = body @@ -117,12 +93,9 @@ def download_component_files(id, include_generated_code=None): # noqa: E501 :rtype: file | binary """ - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"components/{id}/", - file_extensions=[".yaml", ".yml", ".py", ".md"], - keep_open=include_generated_code, - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"components/{id}/", + file_extensions=[".yaml", ".yml", ".py", ".md"], + keep_open=include_generated_code) if len(tar.members) == 0: return f"Could not find component with id '{id}'", 404 @@ -139,17 +112,13 @@ def download_component_files(id, include_generated_code=None): # noqa: E501 tarinfo = tarfile.TarInfo(name=file_name) tarinfo.size = len(file_content) - file_obj = BytesIO(file_content.encode("utf-8")) + file_obj = BytesIO(file_content.encode('utf-8')) tar.addfile(tarinfo, file_obj) tar.close() - return ( - bytes_io.getvalue(), - 200, - {"Content-Disposition": f"attachment; filename={id}.tgz"}, - ) + return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"} def generate_component_code(id): # noqa: E501 @@ -211,11 +180,9 @@ def get_component_template(id): # noqa: E501 :rtype: ApiGetTemplateResponse """ try: - template_yaml, url = get_file_content_and_url( - bucket_name="mlpipeline", - prefix=f"components/{id}/", - file_name="template.yaml", - ) + template_yaml, url = get_file_content_and_url(bucket_name="mlpipeline", + prefix=f"components/{id}/", + file_name="template.yaml") template_response = ApiGetTemplateResponse(template=template_yaml, url=url) return template_response, 200 @@ -229,18 +196,16 @@ def get_component_template(id): # noqa: E501 return str(e), 500 -def list_components( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_components(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_components :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListComponentsResponse @@ -254,13 +219,8 @@ def list_components( filter_dict = json.loads(filter) if filter else None - api_components: [ApiComponent] = load_data( - ApiComponent, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_components: [ApiComponent] = load_data(ApiComponent, filter_dict=filter_dict, sort_by=sort_by, + count=page_size, offset=offset) next_page_token = offset + page_size if len(api_components) == page_size else None @@ -269,11 +229,8 @@ def list_components( if total_size == next_page_token: next_page_token = None - comp_list = ApiListComponentsResponse( - components=api_components, - total_size=total_size, - next_page_token=next_page_token, - ) + comp_list = ApiListComponentsResponse(components=api_components, total_size=total_size, + next_page_token=next_page_token) return comp_list, 200 @@ -293,22 +250,16 @@ def run_component(id, parameters, run_name=None): # noqa: E501 return f"Kubeflow Pipeline host is 'UNAVAILABLE'", 503 if connexion.request.is_json: - parameters = [ - ApiParameter.from_dict(d) for d in connexion.request.get_json() - ] # noqa: E501 + parameters = [ApiParameter.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 - parameter_dict = { - p.name: p.value for p in parameters if p.value and p.value.strip() != "" - } + parameter_dict = {p.name: p.value for p in parameters if p.value and p.value.strip() != ""} api_component, status_code = get_component(id) if status_code > 200: return f"Component with id '{id}' does not exist", 404 - parameter_errors, status_code = validate_parameters( - api_component.parameters, parameter_dict - ) + parameter_errors, status_code = validate_parameters(api_component.parameters, parameter_dict) if parameter_errors: return parameter_errors, status_code @@ -318,9 +269,7 @@ def run_component(id, parameters, run_name=None): # noqa: E501 enable_anonymous_read_access(bucket_name="mlpipeline", prefix="components/*") try: - run_id = run_component_in_experiment( - api_component, api_template.url, parameter_dict, run_name - ) + run_id = run_component_in_experiment(api_component, api_template.url, parameter_dict, run_name) return ApiRunCodeResponse(run_url=f"/runs/details/{run_id}"), 200 except Exception as e: @@ -344,9 +293,7 @@ def set_featured_components(component_ids): # noqa: E501 return None, 200 -def upload_component( - uploadfile: FileStorage, name=None, existing_id=None -): # noqa: E501 +def upload_component(uploadfile: FileStorage, name=None, existing_id=None): # noqa: E501 """upload_component :param uploadfile: The component to upload. Maximum size of 32MB is supported. @@ -368,7 +315,7 @@ def upload_component_file(id, uploadfile): # noqa: E501 :param id: The id of the component. :type id: str - :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) # noqa: E501 + :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) :type uploadfile: werkzeug.datastructures.FileStorage :rtype: ApiComponent @@ -378,19 +325,13 @@ def upload_component_file(id, uploadfile): # noqa: E501 file_ext = file_name.split(".")[-1] if file_ext not in ["tgz", "gz", "yaml", "yml", "py", "md"]: - return ( - f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", - 501, - ) + return f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", 501 if file_ext in ["tgz", "gz", "yaml", "yml"]: delete_component(id) return upload_component(uploadfile, existing_id=id) else: - return ( - f"The API method 'upload_component_file' is not implemented for file type '{file_ext}'.", - 501, - ) + return f"The API method 'upload_component_file' is not implemented for file type '{file_ext}'.", 501 return "Not implemented (yet).", 501 @@ -416,7 +357,6 @@ def upload_component_from_url(url, name=None, access_token=None): # noqa: E501 # private helper methods, not swagger-generated ############################################################################### - def _upload_component_yaml(yaml_file_content: AnyStr, name=None, existing_id=None): yaml_dict = yaml.load(yaml_file_content, Loader=yaml.FullLoader) @@ -429,43 +369,29 @@ def _upload_component_yaml(yaml_file_content: AnyStr, name=None, existing_id=Non description = (yaml_dict.get("description") or name).strip()[:255] filter_categories = yaml_dict.get("filter_categories") or dict() - metadata = ApiMetadata( - annotations=template_metadata.get("annotations"), - labels=template_metadata.get("labels"), - tags=template_metadata.get("tags"), - ) - - parameters = [ - ApiParameter( - name=p.get("name"), - description=p.get("description"), - default=p.get("default"), - value=p.get("value"), - ) - for p in yaml_dict.get("inputs", []) - ] - - api_component = ApiComponent( - id=component_id, - created_at=created_at, - name=name, - description=description, - metadata=metadata, - parameters=parameters, - filter_categories=filter_categories, - ) + metadata = ApiMetadata(annotations=template_metadata.get("annotations"), + labels=template_metadata.get("labels"), + tags=template_metadata.get("tags")) + + parameters = [ApiParameter(name=p.get("name"), description=p.get("description"), + default=p.get("default"), value=p.get("value")) + for p in yaml_dict.get("inputs", [])] + + api_component = ApiComponent(id=component_id, + created_at=created_at, + name=name, + description=description, + metadata=metadata, + parameters=parameters, + filter_categories=filter_categories) uuid = store_data(api_component) api_component.id = uuid - store_file( - bucket_name="mlpipeline", - prefix=f"components/{component_id}/", - file_name="template.yaml", - file_content=yaml_file_content, - content_type="text/yaml", - ) + store_file(bucket_name="mlpipeline", prefix=f"components/{component_id}/", + file_name="template.yaml", file_content=yaml_file_content, + content_type="text/yaml") enable_anonymous_read_access(bucket_name="mlpipeline", prefix="components/*") diff --git a/api/server/swagger_server/controllers_impl/credential_service_controller_impl.py b/api/server/swagger_server/controllers_impl/credential_service_controller_impl.py index 73d20729..6897e865 100644 --- a/api/server/swagger_server/controllers_impl/credential_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/credential_service_controller_impl.py @@ -1,30 +1,17 @@ # Copyright 2021 The MLX Contributors # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json from datetime import datetime -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, -) -from swagger_server.gateways.kubernetes_service import ( - create_secret, - get_secret, - delete_secret, - list_secrets, - secret_name_prefix, -) +from swagger_server.data_access.mysql_client import store_data, generate_id, load_data, delete_data, num_rows +from swagger_server.gateways.kubernetes_service import create_secret, get_secret, delete_secret, list_secrets,\ + secret_name_prefix from swagger_server.models.api_credential import ApiCredential # noqa: E501 -from swagger_server.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_list_credentials_response import ApiListCredentialsResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 def create_credential(body): # noqa: E501 @@ -32,7 +19,7 @@ def create_credential(body): # noqa: E501 Creates a credential associated with a pipeline. # noqa: E501 - :param body: + :param body: :type body: dict | bytes :rtype: ApiCredential @@ -42,9 +29,7 @@ def create_credential(body): # noqa: E501 api_credential: ApiCredential = body - api_credential.id = ( - api_credential.id or f"{secret_name_prefix}-{generate_id(length=16)}".lower() - ) + api_credential.id = api_credential.id or f"{secret_name_prefix}-{generate_id(length=16)}".lower() api_credential.created_at = datetime.now() error = store_data(api_credential) @@ -53,14 +38,9 @@ def create_credential(body): # noqa: E501 return error, 400 # TODO: do we need to generate some token or return something generated by K8s? - secret = create_secret( - api_credential.id, - { - key: value - for key, value in api_credential.to_dict().items() - if key not in ["id", "created_at"] - }, - ) + secret = create_secret(api_credential.id, + {key: value for key, value in api_credential.to_dict().items() + if key not in ["id", "created_at"]}) # TODO: remove credential if kubernetes secret was not created @@ -97,23 +77,21 @@ def get_credential(id): # noqa: E501 api_credential = api_credentials[0] - secret = get_secret(id) + get_secret(id) return api_credential, 200 -def list_credentials( - page_token=None, page_size=None, sort_by=None, filter=None -): +def list_credentials(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_credentials :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListCredentialsResponse @@ -127,13 +105,8 @@ def list_credentials( filter_dict = json.loads(filter) if filter else None - api_credentials: [ApiCredential] = load_data( - ApiCredential, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_credentials: [ApiCredential] = load_data(ApiCredential, filter_dict=filter_dict, sort_by=sort_by, + count=page_size, offset=offset) next_page_token = offset + page_size if len(api_credentials) == page_size else None @@ -145,9 +118,6 @@ def list_credentials( secrets = list_secrets(name_prefix=secret_name_prefix) # TODO: consolidate kubernetes secrets with MLX registered credentials (i.e. add status field?) - comp_list = ApiListCredentialsResponse( - credentials=api_credentials, - total_size=total_size, - next_page_token=next_page_token, - ) - return comp_list, 200 + comp_list = ApiListCredentialsResponse(credentials=api_credentials, total_size=total_size, + next_page_token=next_page_token) + return comp_list, 200 \ No newline at end of file diff --git a/api/server/swagger_server/controllers_impl/dataset_service_controller_impl.py b/api/server/swagger_server/controllers_impl/dataset_service_controller_impl.py index d2e61d74..53980883 100644 --- a/api/server/swagger_server/controllers_impl/dataset_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/dataset_service_controller_impl.py @@ -2,55 +2,31 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import tarfile -import yaml # noqa: F401 +import yaml from datetime import datetime from io import BytesIO from typing import AnyStr from werkzeug.datastructures import FileStorage -from swagger_server.controllers_impl import ( - download_file_content_from_url, - get_yaml_file_content_from_uploadfile, - validate_id, -) -from swagger_server.data_access.minio_client import ( - store_file, - delete_objects, - get_file_content_and_url, - NoSuchKey, - enable_anonymous_read_access, - create_tarfile, -) -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, - update_multiple, -) -from swagger_server.gateways.kubeflow_pipeline_service import ( - generate_dataset_run_script, - run_dataset_in_experiment, - _host as KFP_HOST, -) +from swagger_server.controllers_impl import download_file_content_from_url, \ + get_yaml_file_content_from_uploadfile, validate_id +from swagger_server.data_access.minio_client import store_file, delete_objects, \ + get_file_content_and_url, NoSuchKey, enable_anonymous_read_access, create_tarfile +from swagger_server.data_access.mysql_client import store_data, generate_id, \ + load_data, delete_data, num_rows, update_multiple +from swagger_server.gateways.kubeflow_pipeline_service import generate_dataset_run_script, \ + run_dataset_in_experiment, _host as KFP_HOST from swagger_server.models.api_dataset import ApiDataset # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_datasets_response import ( # noqa: F401 - ApiListDatasetsResponse, -) +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_datasets_response import ApiListDatasetsResponse # noqa: E501 from swagger_server.models.api_metadata import ApiMetadata -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 def approve_datasets_for_publishing(dataset_ids): # noqa: E501 @@ -79,7 +55,7 @@ def create_dataset(body): # noqa: E501 :rtype: ApiDataset """ if connexion.request.is_json: - body = ApiDataset.from_dict(connexion.request.get_json()) + body = ApiDataset.from_dict(connexion.request.get_json()) # noqa: E501 api_dataset = body @@ -117,12 +93,9 @@ def download_dataset_files(id, include_generated_code=None): # noqa: E501 :rtype: file | binary """ - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"datasets/{id}/", - file_extensions=[".yaml", ".yml", ".py", ".md"], - keep_open=include_generated_code, - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"datasets/{id}/", + file_extensions=[".yaml", ".yml", ".py", ".md"], + keep_open=include_generated_code) if len(tar.members) == 0: return f"Could not find dataset with id '{id}'", 404 @@ -139,17 +112,13 @@ def download_dataset_files(id, include_generated_code=None): # noqa: E501 tarinfo = tarfile.TarInfo(name=file_name) tarinfo.size = len(file_content) - file_obj = BytesIO(file_content.encode("utf-8")) + file_obj = BytesIO(file_content.encode('utf-8')) tar.addfile(tarinfo, file_obj) tar.close() - return ( - bytes_io.getvalue(), - 200, - {"Content-Disposition": f"attachment; filename={id}.tgz"}, - ) + return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"} def generate_dataset_code(id): # noqa: E501 @@ -211,11 +180,9 @@ def get_dataset_template(id): # noqa: E501 :rtype: ApiGetTemplateResponse """ try: - template_yaml, url = get_file_content_and_url( - bucket_name="mlpipeline", - prefix=f"datasets/{id}/", - file_name="template.yaml", - ) + template_yaml, url = get_file_content_and_url(bucket_name="mlpipeline", + prefix=f"datasets/{id}/", + file_name="template.yaml") template_response = ApiGetTemplateResponse(template=template_yaml, url=url) return template_response, 200 @@ -229,18 +196,16 @@ def get_dataset_template(id): # noqa: E501 return str(e), 500 -def list_datasets( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_datasets(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_datasets :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListDatasetsResponse @@ -254,13 +219,8 @@ def list_datasets( filter_dict = json.loads(filter) if filter else None - api_datasets: [ApiDataset] = load_data( - ApiDataset, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_datasets: [ApiDataset] = load_data(ApiDataset, filter_dict=filter_dict, sort_by=sort_by, + count=page_size, offset=offset) next_page_token = offset + page_size if len(api_datasets) == page_size else None @@ -269,9 +229,8 @@ def list_datasets( if total_size == next_page_token: next_page_token = None - comp_list = ApiListDatasetsResponse( - datasets=api_datasets, total_size=total_size, next_page_token=next_page_token - ) + comp_list = ApiListDatasetsResponse(datasets=api_datasets, total_size=total_size, + next_page_token=next_page_token) return comp_list, 200 @@ -291,18 +250,14 @@ def run_dataset(id, parameters, run_name=None): # noqa: E501 return f"Kubeflow Pipeline host is 'UNAVAILABLE'", 503 if connexion.request.is_json: - parameters = [ - ApiParameter.from_dict(d) for d in connexion.request.get_json() - ] # noqa: E501 + parameters = [ApiParameter.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 api_dataset, status_code = get_dataset(id) if status_code > 200: return f"Component with id '{id}' does not exist", 404 - parameter_dict = { - p.name: p.value for p in parameters if p.value and p.value.strip() != "" - } + parameter_dict = {p.name: p.value for p in parameters if p.value and p.value.strip() != ""} # parameter_errors, status_code = validate_parameters(api_dataset.parameters, parameter_dict) @@ -314,9 +269,9 @@ def run_dataset(id, parameters, run_name=None): # noqa: E501 enable_anonymous_read_access(bucket_name="mlpipeline", prefix="datasets/*") try: - run_id = run_dataset_in_experiment( - api_dataset, api_template.url, run_name=run_name, parameters=parameter_dict - ) + run_id = run_dataset_in_experiment(api_dataset, api_template.url, + run_name=run_name, + parameters=parameter_dict) return ApiRunCodeResponse(run_url=f"/runs/details/{run_id}"), 200 except Exception as e: @@ -343,7 +298,7 @@ def set_featured_datasets(dataset_ids): # noqa: E501 def upload_dataset(uploadfile: FileStorage, name=None, existing_id=None): # noqa: E501 """upload_dataset - :param uploadfile: The dataset YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. # noqa: E501 + :param uploadfile: The dataset YAML file to upload. Can be a GZip-compressed TAR file (.tgz, .tar.gz) or a YAML file (.yaml, .yml). Maximum size is 32MB. :type uploadfile: werkzeug.datastructures.FileStorage :param name: :type name: str @@ -362,7 +317,7 @@ def upload_dataset_file(id, uploadfile): # noqa: E501 :param id: The id of the dataset. :type id: str - :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) # noqa: E501 + :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) :type uploadfile: werkzeug.datastructures.FileStorage :rtype: ApiDataset @@ -372,19 +327,13 @@ def upload_dataset_file(id, uploadfile): # noqa: E501 file_ext = file_name.split(".")[-1] if file_ext not in ["tgz", "gz", "yaml", "yml", "py", "md"]: - return ( - f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", - 501, - ) + return f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", 501 if file_ext in ["tgz", "gz", "yaml", "yml"]: delete_dataset(id) return upload_dataset(uploadfile, existing_id=id) else: - return ( - f"The API method 'upload_dataset_file' is not implemented for file type '{file_ext}'.", - 501, - ) + return f"The API method 'upload_dataset_file' is not implemented for file type '{file_ext}'.", 501 return "Not implemented (yet).", 501 @@ -410,7 +359,6 @@ def upload_dataset_from_url(url, name=None, access_token=None): # noqa: E501 # private helper methods, not swagger-generated ############################################################################### - def _upload_dataset_yaml(yaml_file_content: AnyStr, name=None, existing_id=None): yaml_dict = yaml.load(yaml_file_content, Loader=yaml.FullLoader) @@ -438,7 +386,7 @@ def _upload_dataset_yaml(yaml_file_content: AnyStr, name=None, existing_id=None) domain = yaml_dict["domain"] format_type = yaml_dict["format"][0]["type"] size = yaml_dict["content"][0].get("size") - version = yaml_dict["version"] + yaml_dict["version"] filter_categories = yaml_dict.get("filter_categories") or dict() # # extract number of records and convert thousand separators based on Locale @@ -453,19 +401,15 @@ def _upload_dataset_yaml(yaml_file_content: AnyStr, name=None, existing_id=None) # number_of_records = int(num_records_number_str) number_of_records = yaml_dict["content"][0].get("records", 0) - related_assets = [ - a["application"].get("asset_id") - for a in yaml_dict.get("related_assets", []) - if "MLX" in a.get("application", {}).get("name", "") - and "asset_id" in a.get("application", {}) - ] + related_assets = [a["application"].get("asset_id") + for a in yaml_dict.get("related_assets", []) + if "MLX" in a.get("application", {}).get("name", "") + and "asset_id" in a.get("application", {})] template_metadata = yaml_dict.get("metadata") or dict() - metadata = ApiMetadata( - annotations=template_metadata.get("annotations"), - labels=template_metadata.get("labels"), - tags=template_metadata.get("tags") or yaml_dict.get("seo_tags"), - ) + metadata = ApiMetadata(annotations=template_metadata.get("annotations"), + labels=template_metadata.get("labels"), + tags=template_metadata.get("tags") or yaml_dict.get("seo_tags")) # TODO: add "version" to ApiDataset @@ -481,20 +425,16 @@ def _upload_dataset_yaml(yaml_file_content: AnyStr, name=None, existing_id=None) license=license_name, metadata=metadata, related_assets=related_assets, - filter_categories=filter_categories, + filter_categories=filter_categories ) uuid = store_data(api_dataset) api_dataset.id = uuid - store_file( - bucket_name="mlpipeline", - prefix=f"datasets/{api_dataset.id}/", - file_name="template.yaml", - file_content=yaml_file_content, - content_type="text/yaml", - ) + store_file(bucket_name="mlpipeline", prefix=f"datasets/{api_dataset.id}/", + file_name="template.yaml", file_content=yaml_file_content, + content_type="text/yaml") enable_anonymous_read_access(bucket_name="mlpipeline", prefix="datasets/*") diff --git a/api/server/swagger_server/controllers_impl/inference_service_controller_impl.py b/api/server/swagger_server/controllers_impl/inference_service_controller_impl.py index 23d7576e..176e823f 100644 --- a/api/server/swagger_server/controllers_impl/inference_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/inference_service_controller_impl.py @@ -2,10 +2,8 @@ # # SPDX-License-Identifier: Apache-2.0 -from swagger_server.models.api_inferenceservice import ApiInferenceservice # noqa: F401, E501 -from swagger_server.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) +from swagger_server.models.api_inferenceservice import ApiInferenceservice # noqa: E501 +from swagger_server.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse # noqa: E501 from swagger_server.gateways.kfserving_client import get_all_services from swagger_server.gateways.kfserving_client import post_service @@ -19,9 +17,9 @@ def get_inferenceservices(id, namespace=None): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiInferenceservice @@ -29,47 +27,33 @@ def get_inferenceservices(id, namespace=None): # noqa: E501 log = logging.getLogger("inf_serv") # Attempt to find the id in a model mesh predictor try: - single_service = get_all_services( - id, - namespace=namespace, - group="serving.kserve.io", - version="v1alpha1", - plural="predictors", - ) + single_service = get_all_services(id, namespace=namespace, group="serving.kserve.io", version="v1alpha1", plural="predictors") return single_service, 200 except: pass # Attempt to find the id in a kserve inferenceservice try: - single_service = get_all_services( - id, - namespace=namespace, - group="serving.kserve.io", - version="v1beta1", - plural="inferenceservices", - ) + single_service = get_all_services(id, namespace=namespace, group="serving.kserve.io", version="v1beta1", plural="inferenceservices") return single_service, 200 except Exception as err: log.exception("Error when trying to find an inferenceservice: ") return str(err), 500 -def list_inferenceservices( - page_token=None, page_size=None, sort_by=None, filter=None, namespace=None -): # noqa: E501 +def list_inferenceservices(page_token=None, page_size=None, sort_by=None, filter=None, namespace=None): # noqa: E501 """list_inferenceservices # noqa: E501 - :param page_token: + :param page_token: :type page_token: str - :param page_size: + :param page_size: :type page_size: int :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name desc\" Ascending by default. :type sort_by: str :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiListInferenceservicesResponse @@ -77,19 +61,9 @@ def list_inferenceservices( log = logging.getLogger("inf_serv") try: # Combine the list of items from the modelmesh predictors and kserve inferenceservices - all_mm_services = get_all_services( - namespace=namespace, - group="serving.kserve.io", - version="v1alpha1", - plural="predictors", - ) - all_k_services = get_all_services( - namespace=namespace, - group="serving.kserve.io", - version="v1beta1", - plural="inferenceservices", - ) - all_mm_services["items"] = all_mm_services["items"] + all_k_services["items"] + all_mm_services = get_all_services(namespace=namespace, group="serving.kserve.io", version="v1alpha1", plural="predictors") + all_k_services = get_all_services(namespace=namespace, group="serving.kserve.io", version="v1beta1", plural="inferenceservices") + all_mm_services['items'] = all_mm_services['items'] + all_k_services['items'] return all_mm_services, 200 except Exception as err: log.exception("Error when trying to list inferenceservices: ") @@ -101,9 +75,9 @@ def create_service(body, namespace=None): # noqa: E501 # noqa: E501 - :param body: + :param body: :type body: dict | bytes - :param namespace: + :param namespace: :type namespace: str :rtype: ApiInferenceservice @@ -124,19 +98,18 @@ def upload_service(uploadfile, name=None, namespace=None): # noqa: E501 :param uploadfile: The component to upload. Maximum size of 32MB is supported. :type uploadfile: werkzeug.datastructures.FileStorage - :param name: + :param name: :type name: str - :param namespace: + :param namespace: :type namespace: str :rtype: ApiComponent """ log = logging.getLogger("inf_serv") try: - uploaded_service = from_client_upload_service( - upload_file=uploadfile, namespace=namespace - ) + uploaded_service = from_client_upload_service(upload_file=uploadfile, namespace=namespace) return uploaded_service, 200 except Exception as err: log.exception("Error when deploying an inferenceservice: ") return str(err), 500 + diff --git a/api/server/swagger_server/controllers_impl/model_service_controller_impl.py b/api/server/swagger_server/controllers_impl/model_service_controller_impl.py index 07175e56..803b0630 100644 --- a/api/server/swagger_server/controllers_impl/model_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/model_service_controller_impl.py @@ -2,10 +2,10 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import tarfile -import yaml # noqa: F401 +import yaml from datetime import datetime from io import BytesIO @@ -14,39 +14,18 @@ from swagger_server.controllers_impl import download_file_content_from_url, validate_id from swagger_server.controllers_impl import get_yaml_file_content_from_uploadfile -from swagger_server.data_access.minio_client import ( - store_file, - delete_objects, - get_file_content_and_url, - enable_anonymous_read_access, - create_tarfile, - NoSuchKey, -) -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, - update_multiple, -) -from swagger_server.gateways.kubeflow_pipeline_service import ( - generate_model_run_script, - run_model_in_experiment, - _host as KFP_HOST, -) -from swagger_server.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_models_response import ( # noqa: F401 - ApiListModelsResponse, -) +from swagger_server.data_access.minio_client import store_file, delete_objects, \ + get_file_content_and_url, enable_anonymous_read_access, create_tarfile, NoSuchKey +from swagger_server.data_access.mysql_client import store_data, generate_id, \ + load_data, delete_data, num_rows, update_multiple +from swagger_server.gateways.kubeflow_pipeline_service import generate_model_run_script,\ + run_model_in_experiment, _host as KFP_HOST +from swagger_server.models.api_generate_model_code_response import ApiGenerateModelCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_models_response import ApiListModelsResponse # noqa: E501 from swagger_server.models.api_model import ApiModel # noqa: E501 from swagger_server.models.api_model_script import ApiModelScript # noqa: E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 def approve_models_for_publishing(model_ids): # noqa: E501 @@ -75,7 +54,7 @@ def create_model(body): # noqa: E501 :rtype: ApiModel """ if connexion.request.is_json: - body = ApiModel.from_dict(connexion.request.get_json()) + body = ApiModel.from_dict(connexion.request.get_json()) # noqa: E501 api_model = body @@ -114,20 +93,15 @@ def download_model_files(id, include_generated_code=None): # noqa: E501 :rtype: file | binary """ - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"models/{id}/", - file_extensions=[".yaml", ".yml", ".py", ".md"], - keep_open=include_generated_code, - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"models/{id}/", + file_extensions=[".yaml", ".yml", ".py", ".md"], + keep_open=include_generated_code) if len(tar.members) == 0: return f"Could not find model with id '{id}'", 404 if include_generated_code: - generate_code_response: ApiGenerateModelCodeResponse = generate_model_code(id)[ - 0 - ] + generate_code_response: ApiGenerateModelCodeResponse = generate_model_code(id)[0] for s in generate_code_response.scripts: file_name = f"run_{s.pipeline_stage}_{s.execution_platform}.py" @@ -137,7 +111,7 @@ def download_model_files(id, include_generated_code=None): # noqa: E501 file_content = s.script_code file_size = len(file_content) - file_obj = BytesIO(file_content.encode("utf-8")) + file_obj = BytesIO(file_content.encode('utf-8')) tarinfo = tarfile.TarInfo(name=file_name) tarinfo.size = file_size @@ -145,11 +119,7 @@ def download_model_files(id, include_generated_code=None): # noqa: E501 tar.close() - return ( - bytes_io.getvalue(), - 200, - {"Content-Disposition": f"attachment; filename={id}.tgz"}, - ) + return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"} def generate_model_code(id): # noqa: E501 @@ -157,7 +127,7 @@ def generate_model_code(id): # noqa: E501 # noqa: E501 - :param id: + :param id: :type id: str :rtype: ApiGenerateModelCodeResponse @@ -174,14 +144,10 @@ def generate_model_code(id): # noqa: E501 source_combinations = [] if api_model.trainable: - source_combinations.extend( - [("train", p) for p in api_model.trainable_tested_platforms] - ) + source_combinations.extend([("train", p) for p in api_model.trainable_tested_platforms]) if api_model.servable: - source_combinations.extend( - [("serve", p) for p in api_model.servable_tested_platforms] - ) + source_combinations.extend([("serve", p) for p in api_model.servable_tested_platforms]) for stage, platform in source_combinations: # TODO: re-enable check for uploaded script, until then save time by not doing Minio lookup @@ -193,9 +159,9 @@ def generate_model_code(id): # noqa: E501 if not source_code: source_code = generate_model_run_script(api_model, stage, platform) - api_model_script = ApiModelScript( - pipeline_stage=stage, execution_platform=platform, script_code=source_code - ) + api_model_script = ApiModelScript(pipeline_stage=stage, + execution_platform=platform, + script_code=source_code) generate_code_response.scripts.append(api_model_script) @@ -228,9 +194,9 @@ def get_model_template(id): # noqa: E501 """ try: - template_yaml, url = get_file_content_and_url( - bucket_name="mlpipeline", prefix=f"models/{id}/", file_name="template.yaml" - ) + template_yaml, url = get_file_content_and_url(bucket_name="mlpipeline", + prefix=f"models/{id}/", + file_name="template.yaml") template_response = ApiGetTemplateResponse(template=template_yaml) return template_response, 200 @@ -244,18 +210,16 @@ def get_model_template(id): # noqa: E501 return str(e), 500 -def list_models( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_models(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_models :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListModelsResponse @@ -269,13 +233,11 @@ def list_models( filter_dict = json.loads(filter) if filter else None - api_models: [ApiModel] = load_data( - ApiModel, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_models: [ApiModel] = load_data(ApiModel, + filter_dict=filter_dict, + sort_by=sort_by, + count=page_size, + offset=offset) next_page_token = offset + page_size if len(api_models) == page_size else None @@ -284,16 +246,12 @@ def list_models( if total_size == next_page_token: next_page_token = None - model_list = ApiListModelsResponse( - models=api_models, total_size=total_size, next_page_token=next_page_token - ) + model_list = ApiListModelsResponse(models=api_models, total_size=total_size, next_page_token=next_page_token) return model_list, 200 -def run_model( - id, pipeline_stage, execution_platform, run_name=None, parameters: dict = None -): # noqa: E501 +def run_model(id, pipeline_stage, execution_platform, run_name=None, parameters: dict = None): # noqa: E501 """run_model :param id: @@ -317,17 +275,13 @@ def run_model( if status_code > 200: return f"Model with id '{id}' does not exist", 404 - parameter_errors, status_code = _validate_run_parameters( - api_model, pipeline_stage, execution_platform, parameters - ) + parameter_errors, status_code = _validate_run_parameters(api_model, pipeline_stage, execution_platform, parameters) if parameter_errors: return parameter_errors, status_code try: - run_id = run_model_in_experiment( - api_model, pipeline_stage, execution_platform, run_name, parameters - ) + run_id = run_model_in_experiment(api_model, pipeline_stage, execution_platform, run_name, parameters) return ApiRunCodeResponse(run_url=f"/runs/details/{run_id}"), 200 except Exception as e: @@ -373,7 +327,7 @@ def upload_model_file(id, uploadfile): # noqa: E501 :param id: The model identifier. :type id: str - :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) # noqa: E501 + :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) :type uploadfile: werkzeug.datastructures.FileStorage :rtype: ApiModel @@ -382,19 +336,13 @@ def upload_model_file(id, uploadfile): # noqa: E501 file_ext = file_name.split(".")[-1] if file_ext not in ["tgz", "gz", "yaml", "yml", "py", "md"]: - return ( - f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", - 501, - ) + return f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", 501 if file_ext in ["tgz", "gz", "yaml", "yml"]: delete_model(id) return upload_model(uploadfile, existing_id=id) else: - return ( - f"The API method 'upload_model_file' is not implemented for file type '{file_ext}'.", - 501, - ) + return f"The API method 'upload_model_file' is not implemented for file type '{file_ext}'.", 501 return "Something went wrong?", 500 @@ -420,7 +368,6 @@ def upload_model_from_url(url, name=None, access_token=None): # noqa: E501 # private helper methods, not swagger-generated ############################################################################### - def _upload_model_yaml(yaml_file_content: AnyStr, name=None, existing_id=None): model_def = yaml.load(yaml_file_content, Loader=yaml.FullLoader) @@ -431,9 +378,7 @@ def _upload_model_yaml(yaml_file_content: AnyStr, name=None, existing_id=None): return errors, status api_model = ApiModel( - id=existing_id - or model_def.get("model_identifier") - or generate_id(name=name or model_def["name"]), + id=existing_id or model_def.get("model_identifier") or generate_id(name=name or model_def["name"]), created_at=datetime.now(), name=name or model_def["name"], description=model_def["description"].strip(), @@ -442,99 +387,59 @@ def _upload_model_yaml(yaml_file_content: AnyStr, name=None, existing_id=None): framework=model_def["framework"], filter_categories=model_def.get("filter_categories") or dict(), trainable=model_def.get("train", {}).get("trainable") or False, - trainable_tested_platforms=model_def.get("train", {}).get("tested_platforms") - or [], - trainable_credentials_required=model_def.get("train", {}).get( - "credentials_required" - ) - or False, + trainable_tested_platforms=model_def.get("train", {}).get("tested_platforms") or [], + trainable_credentials_required=model_def.get("train", {}).get("credentials_required") or False, trainable_parameters=model_def.get("train", {}).get("input_params") or [], servable=model_def.get("serve", {}).get("servable") or False, - servable_tested_platforms=model_def.get("serve", {}).get("tested_platforms") - or [], - servable_credentials_required=model_def.get("serve", {}).get( - "credentials_required" - ) - or False, - servable_parameters=model_def.get("serve", {}).get("input_params") or [], - ) + servable_tested_platforms=model_def.get("serve", {}).get("tested_platforms") or [], + servable_credentials_required=model_def.get("serve", {}).get("credentials_required") or False, + servable_parameters=model_def.get("serve", {}).get("input_params") or []) # convert comma-separate strings to lists if type(api_model.trainable_tested_platforms) == str: - api_model.trainable_tested_platforms = ( - api_model.trainable_tested_platforms.replace(", ", ",").split(",") - ) + api_model.trainable_tested_platforms = api_model.trainable_tested_platforms.replace(", ", ",").split(",") if type(api_model.servable_tested_platforms) == str: - api_model.servable_tested_platforms = ( - api_model.servable_tested_platforms.replace(", ", ",").split(",") - ) + api_model.servable_tested_platforms = api_model.servable_tested_platforms.replace(", ", ",").split(",") uuid = store_data(api_model) api_model.id = uuid - store_file( - bucket_name="mlpipeline", - prefix=f"models/{api_model.id}/", - file_name="template.yaml", - file_content=yaml_file_content, - content_type="text/yaml", - ) + store_file(bucket_name="mlpipeline", prefix=f"models/{api_model.id}/", + file_name="template.yaml", file_content=yaml_file_content, + content_type="text/yaml") enable_anonymous_read_access(bucket_name="mlpipeline", prefix="models/*") return api_model, 201 -def _validate_run_parameters( - api_model: ApiModel, pipeline_stage: str, execution_platform: str, parameters=dict() -): +def _validate_run_parameters(api_model: ApiModel, pipeline_stage: str, execution_platform: str, parameters=dict()): if pipeline_stage == "train": if not api_model.trainable: return f"Model '{api_model.id}' is not trainable", 422 if execution_platform not in api_model.trainable_tested_platforms: - return ( - f"'{execution_platform}' is not a tested platform to {pipeline_stage} model '{api_model.id}'. " - f"Tested platforms: {api_model.trainable_tested_platforms}", - 422, - ) - - if ( - api_model.trainable_credentials_required - and not {"github_url", "github_token"} <= parameters.keys() - ): - return ( - f"'github_url' and 'github_token' are required to {pipeline_stage} model '{api_model.id}'", - 422, - ) + return f"'{execution_platform}' is not a tested platform to {pipeline_stage} model '{api_model.id}'. " \ + f"Tested platforms: {api_model.trainable_tested_platforms}", 422 + + if api_model.trainable_credentials_required and not {"github_url", "github_token"} <= parameters.keys(): + return f"'github_url' and 'github_token' are required to {pipeline_stage} model '{api_model.id}'", 422 elif pipeline_stage == "serve": if not api_model.servable: return f"Model '{api_model.id}' is not servable", 422 if execution_platform not in api_model.servable_tested_platforms: - return ( - f"'{execution_platform}' is not a tested platform to {pipeline_stage} model '{api_model.id}'. " - f"Tested platforms: {api_model.servable_tested_platforms}", - 422, - ) - - if ( - api_model.servable_credentials_required - and not {"github_url", "github_token"} <= parameters.keys() - ): - return ( - f"'github_url' and 'github_token' are required to {pipeline_stage} model '{api_model.id}'", - 422, - ) + return f"'{execution_platform}' is not a tested platform to {pipeline_stage} model '{api_model.id}'. " \ + f"Tested platforms: {api_model.servable_tested_platforms}", 422 + + if api_model.servable_credentials_required and not {"github_url", "github_token"} <= parameters.keys(): + return f"'github_url' and 'github_token' are required to {pipeline_stage} model '{api_model.id}'", 422 else: - return ( - f"Invalid pipeline_stage: '{pipeline_stage}'. Must be one of ['train', 'serve']", - 422, - ) + return f"Invalid pipeline_stage: '{pipeline_stage}'. Must be one of ['train', 'serve']", 422 return None, 200 diff --git a/api/server/swagger_server/controllers_impl/notebook_service_controller_impl.py b/api/server/swagger_server/controllers_impl/notebook_service_controller_impl.py index c52e653f..f442dfef 100644 --- a/api/server/swagger_server/controllers_impl/notebook_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/notebook_service_controller_impl.py @@ -2,60 +2,35 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import requests import tarfile -import yaml # noqa: F401 +import yaml from datetime import datetime from io import BytesIO -from os import environ as env # noqa: F401 +from os import environ as env from typing import AnyStr from urllib.parse import urlparse from werkzeug.datastructures import FileStorage -from swagger_server.controllers_impl import ( # noqa: F401 - download_file_content_from_url, - get_yaml_file_content_from_uploadfile, - validate_parameters, - validate_id, -) -from swagger_server.data_access.minio_client import ( - store_file, - delete_objects, - get_file_content_and_url, - enable_anonymous_read_access, - NoSuchKey, - create_tarfile, - get_object_url, -) -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, - update_multiple, -) -from swagger_server.gateways.kubeflow_pipeline_service import ( - generate_notebook_run_script, - run_notebook_in_experiment, - _host as KFP_HOST, -) -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_notebooks_response import ( # noqa: F401 - ApiListNotebooksResponse, -) +from swagger_server.controllers_impl import download_file_content_from_url, \ + get_yaml_file_content_from_uploadfile, validate_id +from swagger_server.data_access.minio_client import store_file, delete_objects, \ + get_file_content_and_url, enable_anonymous_read_access, NoSuchKey, \ + create_tarfile, get_object_url +from swagger_server.data_access.mysql_client import store_data, generate_id, \ + load_data, delete_data, num_rows, update_multiple +from swagger_server.gateways.kubeflow_pipeline_service import generate_notebook_run_script,\ + run_notebook_in_experiment, _host as KFP_HOST +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_notebooks_response import ApiListNotebooksResponse # noqa: E501 from swagger_server.models.api_metadata import ApiMetadata from swagger_server.models.api_notebook import ApiNotebook # noqa: E501 -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 from swagger_server.util import ApiError @@ -88,7 +63,7 @@ def create_notebook(body): # noqa: E501 :rtype: ApiNotebook """ if connexion.request.is_json: - body = ApiNotebook.from_dict(connexion.request.get_json()) + body = ApiNotebook.from_dict(connexion.request.get_json()) # noqa: E501 api_notebook = body @@ -125,12 +100,9 @@ def download_notebook_files(id, include_generated_code=None): # noqa: E501 :rtype: file | binary """ - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"notebooks/{id}/", - file_extensions=[".yaml", ".yml", ".py", ".md"], - keep_open=include_generated_code, - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"notebooks/{id}/", + file_extensions=[".yaml", ".yml", ".py", ".md"], + keep_open=include_generated_code) if len(tar.members) == 0: return f"Could not find notebook with id '{id}'", 404 @@ -147,17 +119,13 @@ def download_notebook_files(id, include_generated_code=None): # noqa: E501 tarinfo = tarfile.TarInfo(name=file_name) tarinfo.size = len(file_content) - file_obj = BytesIO(file_content.encode("utf-8")) + file_obj = BytesIO(file_content.encode('utf-8')) tar.addfile(tarinfo, file_obj) tar.close() - return ( - bytes_io.getvalue(), - 200, - {"Content-Disposition": f"attachment; filename={id}.tgz"}, - ) + return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"} def generate_notebook_code(id): # noqa: E501 @@ -216,11 +184,8 @@ def get_notebook_template(id): # noqa: E501 :rtype: ApiGetTemplateResponse """ try: - template_yaml, url = get_file_content_and_url( - bucket_name="mlpipeline", - prefix=f"notebooks/{id}/", - file_name="template.yaml", - ) + template_yaml, url = get_file_content_and_url(bucket_name="mlpipeline", prefix=f"notebooks/{id}/", + file_name="template.yaml") template_response = ApiGetTemplateResponse(template=template_yaml, url=url) return template_response, 200 @@ -234,18 +199,16 @@ def get_notebook_template(id): # noqa: E501 return str(e), 500 -def list_notebooks( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_notebooks(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_notebooks :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListNotebooksResponse @@ -259,13 +222,8 @@ def list_notebooks( filter_dict = json.loads(filter) if filter else None - api_notebooks: [ApiNotebook] = load_data( - ApiNotebook, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_notebooks: [ApiNotebook] = load_data(ApiNotebook, filter_dict=filter_dict, sort_by=sort_by, + count=page_size, offset=offset) next_page_token = offset + page_size if len(api_notebooks) == page_size else None @@ -274,9 +232,8 @@ def list_notebooks( if total_size == next_page_token: next_page_token = None - notebooks = ApiListNotebooksResponse( - notebooks=api_notebooks, total_size=total_size, next_page_token=next_page_token - ) + notebooks = ApiListNotebooksResponse(notebooks=api_notebooks, total_size=total_size, + next_page_token=next_page_token) return notebooks, 200 @@ -296,7 +253,7 @@ def run_notebook(id, run_name=None, parameters: dict = None): # noqa: E501 return f"Kubeflow Pipeline host is 'UNAVAILABLE'", 503 if not parameters and connexion.request.is_json: - parameter_dict = dict(connexion.request.get_json()) + parameter_dict = dict(connexion.request.get_json()) # noqa: E501 else: parameter_dict = parameters @@ -318,32 +275,25 @@ def run_notebook(id, run_name=None, parameters: dict = None): # noqa: E501 enable_anonymous_read_access(bucket_name="mlpipeline", prefix="notebooks/*") try: - run_id = run_notebook_in_experiment( - notebook=api_notebook, parameters=parameter_dict, run_name=run_name - ) + run_id = run_notebook_in_experiment(notebook=api_notebook, + parameters=parameter_dict, + run_name=run_name) # expected output notebook based on: # https://github.com/elyra-ai/kfp-notebook/blob/c8f1298/etc/docker-scripts/bootstrapper.py#L188-L190 - notebook_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_extensions=[".ipynb"], - ) + notebook_url = get_object_url(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_extensions=[".ipynb"]) # TODO: create a "sandboxed" notebook in a subfolder since Elyra overwrites # the original notebook instead of creating an "-output.ipynb" file: # https://github.com/elyra-ai/kfp-notebook/blob/c8f1298/etc/docker-scripts/bootstrapper.py#L205 - notebook_output_url = notebook_url.replace(".ipynb", "-output.ipynb") + notebook_url.replace(".ipynb", "-output.ipynb") # instead return link to the generated output .html for the time being notebook_output_html = notebook_url.replace(".ipynb", ".html") - return ( - ApiRunCodeResponse( - run_url=f"/runs/details/{run_id}", - run_output_location=notebook_output_html, - ), - 200, - ) + return ApiRunCodeResponse(run_url=f"/runs/details/{run_id}", + run_output_location=notebook_output_html), 200 except Exception as e: return f"Error while trying to run notebook {id}: {e}", 500 @@ -366,9 +316,7 @@ def set_featured_notebooks(notebook_ids): # noqa: E501 return None, 200 -def upload_notebook( - uploadfile: FileStorage, name=None, enterprise_github_token=None, existing_id=None -): # noqa: E501 +def upload_notebook(uploadfile: FileStorage, name=None, enterprise_github_token=None, existing_id=None): # noqa: E501 """upload_notebook :param uploadfile: The notebook to upload. Maximum size of 32MB is supported. @@ -392,7 +340,7 @@ def upload_notebook_file(id, uploadfile): # noqa: E501 :param id: The id of the notebook. :type id: str - :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) # noqa: E501 + :param uploadfile: The file to upload, overwriting existing. Can be a GZip-compressed TAR file (.tgz), a YAML file (.yaml), Python script (.py), or Markdown file (.md) :type uploadfile: werkzeug.datastructures.FileStorage :rtype: ApiNotebook @@ -402,19 +350,13 @@ def upload_notebook_file(id, uploadfile): # noqa: E501 file_ext = file_name.split(".")[-1] if file_ext not in ["tgz", "gz", "yaml", "yml", "py", "md"]: - return ( - f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", - 501, - ) + return f"File extension not supported: '{file_ext}', uploadfile: '{file_name}'.", 501 if file_ext in ["tgz", "gz", "yaml", "yml"]: delete_notebook(id) return upload_notebook(uploadfile, existing_id=id) else: - return ( - f"The API method 'upload_notebook_file' is not implemented for file type '{file_ext}'.", - 501, - ) + return f"The API method 'upload_notebook_file' is not implemented for file type '{file_ext}'.", 501 return "Not implemented (yet).", 501 @@ -440,10 +382,7 @@ def upload_notebook_from_url(url, name=None, access_token=None): # noqa: E501 # private helper methods, not swagger-generated ############################################################################### - -def _upload_notebook_yaml( - yaml_file_content: AnyStr, name=None, access_token=None, existing_id=None -): +def _upload_notebook_yaml(yaml_file_content: AnyStr, name=None, access_token=None, existing_id=None): yaml_dict = yaml.load(yaml_file_content, Loader=yaml.FullLoader) @@ -454,11 +393,7 @@ def _upload_notebook_yaml( if errors: return errors, status - notebook_id = ( - existing_id - or yaml_dict.get("id") - or generate_id(name=name or yaml_dict["name"]) - ) + notebook_id = existing_id or yaml_dict.get("id") or generate_id(name=name or yaml_dict["name"]) created_at = datetime.now() name = name or yaml_dict["name"] description = yaml_dict["description"].strip() @@ -466,11 +401,9 @@ def _upload_notebook_yaml( requirements = yaml_dict["implementation"]["github"].get("requirements") filter_categories = yaml_dict.get("filter_categories") or dict() - metadata = ApiMetadata( - annotations=template_metadata.get("annotations"), - labels=template_metadata.get("labels"), - tags=template_metadata.get("tags"), - ) + metadata = ApiMetadata(annotations=template_metadata.get("annotations"), + labels=template_metadata.get("labels"), + tags=template_metadata.get("tags")) notebook_content = _download_notebook(url, enterprise_github_api_token=access_token) @@ -479,35 +412,27 @@ def _upload_notebook_yaml( # kfp-notebook has inputs and outputs ? parameters = dict() - api_notebook = ApiNotebook( - id=notebook_id, - created_at=created_at, - name=name, - description=description, - url=url, - metadata=metadata, - parameters=parameters, - filter_categories=filter_categories, - ) + api_notebook = ApiNotebook(id=notebook_id, + created_at=created_at, + name=name, + description=description, + url=url, + metadata=metadata, + parameters=parameters, + filter_categories=filter_categories) uuid = store_data(api_notebook) api_notebook.id = uuid - store_file( - bucket_name="mlpipeline", - prefix=f"notebooks/{notebook_id}/", - file_name="template.yaml", - file_content=yaml_file_content, - content_type="text/yaml", - ) - - s3_url = store_file( - bucket_name="mlpipeline", - prefix=f"notebooks/{notebook_id}/", - file_name=url.split("/")[-1].split("?")[0], - file_content=json.dumps(notebook_content).encode(), - ) + store_file(bucket_name="mlpipeline", prefix=f"notebooks/{notebook_id}/", + file_name="template.yaml", file_content=yaml_file_content, + content_type="text/yaml") + + s3_url = store_file(bucket_name="mlpipeline", + prefix=f"notebooks/{notebook_id}/", + file_name=url.split("/")[-1].split("?")[0], + file_content=json.dumps(notebook_content).encode()) if requirements: @@ -520,30 +445,17 @@ def _upload_notebook_yaml( # TODO: remove this after fixing the Elyra-AI/KFP-Notebook runner so that # Elyra should install its own requirements in addition to the provided requirements requirements_elyra_url = "https://github.com/elyra-ai/kfp-notebook/blob/master/etc/requirements-elyra.txt" - requirements_elyra_txt = download_file_content_from_url( - requirements_elyra_url - ).decode() - requirements_elyra = "\n".join( - [ - line - for line in requirements_elyra_txt.split("\n") - if not line.startswith("#") - ] - ) - - requirements_all = ( - f"# Required packages for {api_notebook.name}:\n" - f"{requirements_txt}\n" - f"# Requirements from {requirements_elyra_url}:\n" - f"{requirements_elyra}" - ) - - store_file( - bucket_name="mlpipeline", - prefix=f"notebooks/{notebook_id}/", - file_name="requirements.txt", - file_content=requirements_all.encode(), - ) + requirements_elyra_txt = download_file_content_from_url(requirements_elyra_url).decode() + requirements_elyra = "\n".join([line for line in requirements_elyra_txt.split("\n") + if not line.startswith("#")]) + + requirements_all = f"# Required packages for {api_notebook.name}:\n" \ + f"{requirements_txt}\n" \ + f"# Requirements from {requirements_elyra_url}:\n" \ + f"{requirements_elyra}" + + store_file(bucket_name="mlpipeline", prefix=f"notebooks/{notebook_id}/", + file_name="requirements.txt", file_content=requirements_all.encode()) # if the url included an access token, replace the original url with the s3 url if "?token=" in url or "github.ibm.com" in url: @@ -560,23 +472,14 @@ def _download_notebook(url: str, enterprise_github_api_token: str) -> dict: if "ibm.com" in url and "?token=" not in url: if not enterprise_github_api_token and not ghe_api_token: - raise ApiError( - f"Must provide API token to access notebooks on Enterprise GitHub: {url}", - 422, - ) + raise ApiError(f"Must provide API token to access notebooks on Enterprise GitHub: {url}", 422) else: - request_headers.update( - { - "Authorization": f"token {enterprise_github_api_token or ghe_api_token}" - } - ) + request_headers.update({'Authorization': f'token {enterprise_github_api_token or ghe_api_token}'}) try: - raw_url = ( - url.replace("/github.ibm.com/", "/raw.github.ibm.com/") - .replace("/github.com/", "/raw.githubusercontent.com/") - .replace("/blob/", "/") - ) + raw_url = url.replace("/github.ibm.com/", "/raw.github.ibm.com/")\ + .replace("/github.com/", "/raw.githubusercontent.com/")\ + .replace("/blob/", "/") response = requests.get(raw_url, allow_redirects=True, headers=request_headers) if response.ok: @@ -586,10 +489,8 @@ def _download_notebook(url: str, enterprise_github_api_token: str) -> dict: except Exception as e: raise ApiError(f"Could not download notebook file '{url}'. \n{str(e)}", 422) - raise ApiError( - f"Could not download notebook file '{url}'. Reason: {response.reason}", - response.status_code, - ) + raise ApiError(f"Could not download notebook file '{url}'. Reason: {response.reason}", + response.status_code) def _extract_notebook_parameters(notebook_dict: dict) -> [ApiParameter]: diff --git a/api/server/swagger_server/controllers_impl/pipeline_service_controller_impl.py b/api/server/swagger_server/controllers_impl/pipeline_service_controller_impl.py index 6ab93ed6..3240bb17 100644 --- a/api/server/swagger_server/controllers_impl/pipeline_service_controller_impl.py +++ b/api/server/swagger_server/controllers_impl/pipeline_service_controller_impl.py @@ -2,11 +2,11 @@ # # SPDX-License-Identifier: Apache-2.0 -import connexion # noqa: F401 +import connexion import json import os import typing -import yaml # noqa: F401 +import yaml from datetime import datetime from collections import Counter @@ -14,49 +14,22 @@ from swagger_server.controllers_impl import download_file_content_from_url from swagger_server.controllers_impl import get_yaml_file_content_from_uploadfile -from swagger_server.data_access.minio_client import ( - store_file, - delete_object, - delete_objects, - get_file_content_and_url, - NoSuchKey, - enable_anonymous_read_access, - create_tarfile, -) -from swagger_server.data_access.mysql_client import ( - store_data, - generate_id, - load_data, - delete_data, - num_rows, - update_multiple, -) -from swagger_server.gateways.kubeflow_pipeline_service import ( - upload_pipeline_to_kfp, - delete_kfp_pipeline, - run_pipeline_in_experiment, - run_custom_pipeline_in_experiment, - _host as KFP_HOST, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_pipelines_response import ( # noqa: F401 - ApiListPipelinesResponse, -) +from swagger_server.data_access.minio_client import store_file, delete_object, \ + delete_objects, get_file_content_and_url, NoSuchKey, \ + enable_anonymous_read_access, create_tarfile +from swagger_server.data_access.mysql_client import store_data, generate_id, load_data, \ + delete_data, num_rows, update_multiple +from swagger_server.gateways.kubeflow_pipeline_service import upload_pipeline_to_kfp,\ + delete_kfp_pipeline, run_pipeline_in_experiment, run_custom_pipeline_in_experiment, \ + _host as KFP_HOST +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_pipelines_response import ApiListPipelinesResponse # noqa: E501 from swagger_server.models.api_pipeline import ApiPipeline # noqa: E501 -from swagger_server.models import ( - ApiPipelineCustomRunPayload, - ApiPipelineTask, -) # , ApiPipelineDAG +from swagger_server.models import ApiPipelineCustomRunPayload, ApiPipelineTask # , ApiPipelineDAG from swagger_server.models.api_parameter import ApiParameter -from swagger_server.models.api_pipeline_extension import ( - ApiPipelineExtension, -) -from swagger_server.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 +from swagger_server.models.api_pipeline_extension import ApiPipelineExtension # noqa: E501 +from swagger_server.models.api_pipeline_extended import ApiPipelineExtended # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 from tempfile import mkstemp @@ -92,7 +65,7 @@ def create_pipeline(body): # noqa: E501 :rtype: ApiPipeline """ if connexion.request.is_json: - body = ApiPipeline.from_dict(connexion.request.get_json()) + body = ApiPipeline.from_dict(connexion.request.get_json()) # noqa: E501 return "Not implemented, yet", 501 @@ -112,9 +85,7 @@ def delete_pipeline(id): # noqa: E501 if id == "*": delete_objects(bucket_name="mlpipeline", prefix=f"pipelines/") else: - delete_object( - bucket_name="mlpipeline", prefix="pipelines", file_name=f"{id}" - ) + delete_object(bucket_name="mlpipeline", prefix="pipelines", file_name=f"{id}") else: # wildcard '*' deletes (and recreates) entire table, not desired for pipelines table, KFP API does not accept "*" if id != "*": @@ -137,21 +108,14 @@ def download_pipeline_files(id): # noqa: E501 :rtype: file """ - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"pipelines/{id}", - file_extensions=[""], - keep_open=False, - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"pipelines/{id}", + file_extensions=[""], + keep_open=False) if len(tar.members) == 0: return f"Could not find pipeline with id '{id}'", 404 - return ( - bytes_io.getvalue(), - 200, - {"Content-Disposition": f"attachment; filename={id}.tgz"}, - ) + return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"} def get_pipeline(id): # noqa: E501 @@ -162,9 +126,7 @@ def get_pipeline(id): # noqa: E501 :rtype: ApiPipelineExtended """ - api_pipelines: [ApiPipelineExtended] = load_data( - ApiPipelineExtended, filter_dict={"id": id} - ) + api_pipelines: [ApiPipelineExtended] = load_data(ApiPipelineExtended, filter_dict={"id": id}) if not api_pipelines: return "Not found", 404 @@ -183,9 +145,7 @@ def get_template(id): # noqa: E501 :rtype: ApiGetTemplateResponse """ try: - template_yaml, url = get_file_content_and_url( - bucket_name="mlpipeline", prefix="pipelines", file_name=id - ) + template_yaml, url = get_file_content_and_url(bucket_name="mlpipeline", prefix="pipelines", file_name=id) template_response = ApiGetTemplateResponse(template=template_yaml, url=url) return template_response, 200 @@ -199,18 +159,16 @@ def get_template(id): # noqa: E501 return str(e), 500 -def list_pipelines( - page_token=None, page_size=None, sort_by=None, filter=None -): # noqa: E501 +def list_pipelines(page_token=None, page_size=None, sort_by=None, filter=None): # noqa: E501 """list_pipelines :param page_token: :type page_token: str :param page_size: :type page_size: int - :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. # noqa: E501 + :param sort_by: Can be format of \"field_name\", \"field_name asc\" or \"field_name des\" Ascending by default. :type sort_by: str - :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. # noqa: E501 + :param filter: A string-serialized JSON dictionary containing key-value pairs with name of the object property to apply filter on and the value of the respective property. :type filter: str :rtype: ApiListPipelinesResponse @@ -229,13 +187,8 @@ def list_pipelines( if "filter_categories" in filter_dict: del filter_dict["filter_categories"] - api_pipelines: [ApiPipeline] = load_data( - ApiPipelineExtended, - filter_dict=filter_dict, - sort_by=sort_by, - count=page_size, - offset=offset, - ) + api_pipelines: [ApiPipeline] = load_data(ApiPipelineExtended, filter_dict=filter_dict, + sort_by=sort_by, count=page_size, offset=offset) next_page_token = offset + page_size if len(api_pipelines) == page_size else None @@ -244,9 +197,8 @@ def list_pipelines( if total_size == next_page_token: next_page_token = None - pipeline_list = ApiListPipelinesResponse( - pipelines=api_pipelines, total_size=total_size, next_page_token=next_page_token - ) + pipeline_list = ApiListPipelinesResponse(pipelines=api_pipelines, total_size=total_size, + next_page_token=next_page_token) return pipeline_list, 200 @@ -263,58 +215,39 @@ def run_custom_pipeline(run_custom_pipeline_payload, run_name=None): # noqa: E5 :rtype: ApiRunCodeResponse """ if connexion.request.is_json: - run_custom_pipeline_payload = ApiPipelineCustomRunPayload.from_dict( - connexion.request.get_json() - ) + run_custom_pipeline_payload = ApiPipelineCustomRunPayload.from_dict(connexion.request.get_json()) # noqa: E501 run_parameters = run_custom_pipeline_payload.run_parameters or {} custom_pipeline = run_custom_pipeline_payload.custom_pipeline # ensure unique task names task_names = [t.name for t in custom_pipeline.dag.tasks] - duplicate_task_names = [ - name for name, count in Counter(task_names).items() if count > 1 - ] + duplicate_task_names = [name for name, count in Counter(task_names).items() if count > 1] assert not duplicate_task_names, f"duplicate task names: {duplicate_task_names}" # validate pipeline dependencies - pipeline_tasks_by_name: typing.Dict[str, ApiPipelineTask] = { - t.name: t for t in custom_pipeline.dag.tasks - } + pipeline_tasks_by_name: typing.Dict[str, ApiPipelineTask] = {t.name: t for t in custom_pipeline.dag.tasks} for t in pipeline_tasks_by_name.values(): for required_task_name in t.dependencies or []: - assert ( - required_task_name in pipeline_tasks_by_name - ), f"missing task '{required_task_name}', as dependency for task '{t.name}'" + assert required_task_name in pipeline_tasks_by_name, \ + f"missing task '{required_task_name}', as dependency for task '{t.name}'" # validate input parameters - missing_run_parameters = { - p.name - for p in custom_pipeline.inputs.parameters - if p.default is None and p.value is None - } - run_parameters.keys() - assert ( - not missing_run_parameters - ), f"missing parameters to run pipeline: {missing_run_parameters}" + missing_run_parameters = {p.name for p in custom_pipeline.inputs.parameters + if p.default is None and p.value is None} - run_parameters.keys() + assert not missing_run_parameters, f"missing parameters to run pipeline: {missing_run_parameters}" # make sure we enable anonymous read access to pipeline task components - for artifact_type in set( - [t.artifact_type for t in pipeline_tasks_by_name.values()] - ): - enable_anonymous_read_access( - bucket_name="mlpipeline", prefix=f"{artifact_type}s/*" - ) + for artifact_type in set([t.artifact_type for t in pipeline_tasks_by_name.values()]): + enable_anonymous_read_access(bucket_name="mlpipeline", prefix=f"{artifact_type}s/*") try: - run_id = run_custom_pipeline_in_experiment( - custom_pipeline, run_name, run_parameters - ) + run_id = run_custom_pipeline_in_experiment(custom_pipeline, run_name, run_parameters) return ApiRunCodeResponse(run_url=f"/runs/details/{run_id}"), 200 except Exception as e: # TODO: remove traceback? import traceback - print(traceback.format_exc()) return f"Error while trying to run custom pipeline '{run_name}': {e}", 500 @@ -335,7 +268,7 @@ def run_pipeline(id, run_name=None, parameters=None): # noqa: E501 return f"Kubeflow Pipeline host is 'UNAVAILABLE'", 503 if not parameters and connexion.request.is_json: - parameter_dict = dict(connexion.request.get_json()) + parameter_dict = dict(connexion.request.get_json()) # noqa: E501 else: parameter_dict = parameters @@ -380,9 +313,7 @@ def set_featured_pipelines(pipeline_ids): # noqa: E501 return None, 200 -def upload_pipeline( - uploadfile, name=None, description=None, labels=None, annotations=None -): # noqa: E501 +def upload_pipeline(uploadfile, name=None, description=None, labels=None, annotations=None): # noqa: E501 """upload_pipeline :param uploadfile: The pipeline to upload. Maximum size of 32MB is supported. @@ -391,18 +322,16 @@ def upload_pipeline( :type name: str :param description: A description for this pipeline, optional :type description: str - :param labels: A string representation of a JSON dictionary of labels describing this pipeline, optional.See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels # noqa: E501 + :param labels: A string representation of a JSON dictionary of labels describing this pipeline, optional.See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels :type labels: str - :param annotations: A string representation of a JSON dictionary of annotations describing this pipeline, optional.See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations # noqa: E501 + :param annotations: A string representation of a JSON dictionary of annotations describing this pipeline, optional.See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations :type annotations: str :rtype: ApiPipelineExtended """ yaml_file_content = get_yaml_file_content_from_uploadfile(uploadfile) - return _upload_pipeline_yaml( - yaml_file_content, name, description, labels, annotations - ) + return _upload_pipeline_yaml(yaml_file_content, name, description, labels, annotations) def upload_pipeline_from_url(url, name=None, access_token=None): # noqa: E501 @@ -426,14 +355,7 @@ def upload_pipeline_from_url(url, name=None, access_token=None): # noqa: E501 # private helper methods, not swagger-generated ############################################################################### - -def _upload_pipeline_yaml( - yaml_file_content: AnyStr, - name=None, - description=None, - labels=None, - annotations=None, -): +def _upload_pipeline_yaml(yaml_file_content: AnyStr, name=None, description=None, labels=None, annotations=None): (fd, filename) = mkstemp(suffix=".yaml") @@ -443,9 +365,7 @@ def _upload_pipeline_yaml( if KFP_HOST == "UNAVAILABLE": # when running inside Docker Compose w/out KFP we store pipelines ourselves - api_pipeline: ApiPipeline = _store_pipeline( - yaml_file_content, name, description - ) + api_pipeline: ApiPipeline = _store_pipeline(yaml_file_content, name, description) else: # when deployed on top of KFP, we let KFP store pipelines @@ -455,25 +375,17 @@ def _upload_pipeline_yaml( yaml_dict = yaml.load(yaml_file_content, Loader=yaml.FullLoader) template_metadata = yaml_dict.get("metadata") or dict() annotations = template_metadata.get("annotations", {}) - pipeline_spec = json.loads( - annotations.get("pipelines.kubeflow.org/pipeline_spec", "{}") - ) - description = ( - description or pipeline_spec.get("description", "").strip() - ) + pipeline_spec = json.loads(annotations.get("pipelines.kubeflow.org/pipeline_spec", "{}")) + description = description or pipeline_spec.get("description", "").strip() - api_pipeline: ApiPipeline = upload_pipeline_to_kfp( - filename, name, description - ) + api_pipeline: ApiPipeline = upload_pipeline_to_kfp(filename, name, description) store_data(ApiPipelineExtension(id=api_pipeline.id)) if annotations: if type(annotations) == str: annotations = json.loads(annotations) - update_multiple( - ApiPipelineExtension, [api_pipeline.id], "annotations", annotations - ) + update_multiple(ApiPipelineExtension, [api_pipeline.id], "annotations", annotations) api_pipeline_extended, _ = get_pipeline(api_pipeline.id) @@ -491,9 +403,7 @@ def _store_pipeline(yaml_file_content: AnyStr, name=None, description=None): template_metadata = yaml_dict.get("metadata") or dict() annotations = template_metadata.get("annotations", {}) - pipeline_spec = json.loads( - annotations.get("pipelines.kubeflow.org/pipeline_spec", "{}") - ) + pipeline_spec = json.loads(annotations.get("pipelines.kubeflow.org/pipeline_spec", "{}")) name = name or template_metadata["name"] description = description or pipeline_spec.get("description", "").strip() @@ -501,36 +411,24 @@ def _store_pipeline(yaml_file_content: AnyStr, name=None, description=None): pipeline_id = "-".join([generate_id(length=l) for l in [8, 4, 4, 4, 12]]) created_at = datetime.now() - parameters = [ - ApiParameter( - name=p.get("name"), - description=p.get("description"), - default=p.get("default"), - value=p.get("value"), - ) - for p in yaml_dict["spec"].get("params", {}) - ] - - api_pipeline = ApiPipeline( - id=pipeline_id, - created_at=created_at, - name=name, - description=description, - parameters=parameters, - namespace=namespace, - ) + parameters = [ApiParameter(name=p.get("name"), description=p.get("description"), + default=p.get("default"), value=p.get("value")) + for p in yaml_dict["spec"].get("params", {})] + + api_pipeline = ApiPipeline(id=pipeline_id, + created_at=created_at, + name=name, + description=description, + parameters=parameters, + namespace=namespace) uuid = store_data(api_pipeline) api_pipeline.id = uuid - store_file( - bucket_name="mlpipeline", - prefix=f"pipelines/", - file_name=f"{pipeline_id}", - file_content=yaml_file_content, - content_type="text/yaml", - ) + store_file(bucket_name="mlpipeline", prefix=f"pipelines/", + file_name=f"{pipeline_id}", file_content=yaml_file_content, + content_type="text/yaml") enable_anonymous_read_access(bucket_name="mlpipeline", prefix="pipelines/*") @@ -543,17 +441,11 @@ def _validate_parameters(api_pipeline: ApiPipeline, parameters: dict) -> (str, i unexpected_parameters = set(parameters.keys()) - set(acceptable_parameters) if unexpected_parameters: - return ( - f"Unexpected parameter(s): {list(unexpected_parameters)}. " - f"Acceptable parameter(s): {acceptable_parameters}", - 422, - ) - - missing_parameters = [ - p.name - for p in api_pipeline.parameters - if not (p.default or p.value) and p.name not in parameters - ] + return f"Unexpected parameter(s): {list(unexpected_parameters)}. " \ + f"Acceptable parameter(s): {acceptable_parameters}", 422 + + missing_parameters = [p.name for p in api_pipeline.parameters + if not (p.default or p.value) and p.name not in parameters] # TODO: figure out a way to determine if a pipeline parameter is required or not. # just testing for default value is not an indicator diff --git a/api/server/swagger_server/data_access/minio_client.py b/api/server/swagger_server/data_access/minio_client.py index a83fe6d5..13ae6feb 100644 --- a/api/server/swagger_server/data_access/minio_client.py +++ b/api/server/swagger_server/data_access/minio_client.py @@ -10,7 +10,7 @@ from io import BytesIO from minio import Minio from minio.error import NoSuchKey, NoSuchBucketPolicy, ResponseError -from pprint import pprint # noqa: F401 +from pprint import pprint from swagger_server.util import ApiError from tarfile import TarFile from urllib3 import Timeout @@ -18,12 +18,10 @@ _namespace = os.environ.get("POD_NAMESPACE", "kubeflow") -_host = os.environ.get( - "MINIO_SERVICE_SERVICE_HOST", "minio-service.%s.svc.cluster.local" % _namespace -) +_host = os.environ.get("MINIO_SERVICE_SERVICE_HOST", "minio-service.%s.svc.cluster.local" % _namespace) _port = os.environ.get("MINIO_SERVICE_SERVICE_PORT", "9000") -_access_key = "minio" -_secret_key = "minio123" +_access_key = 'minio' +_secret_key = 'minio123' _bucket_policy_sid = "AllowPublicReadAccess" @@ -32,15 +30,16 @@ "Action": ["s3:GetObject"], "Effect": "Allow", "Principal": {"AWS": ["*"]}, - "Resource": [], + "Resource": [] +} +_bucket_policy_template = { + "Version": "2012-10-17", + "Statement": [_bucket_policy_stmt] } -_bucket_policy_template = {"Version": "2012-10-17", "Statement": [_bucket_policy_stmt]} def _get_minio_client(timeout=None): - client = Minio( - f"{_host}:{_port}", access_key=_access_key, secret_key=_secret_key, secure=False - ) + client = Minio(f"{_host}:{_port}", access_key=_access_key, secret_key=_secret_key, secure=False) if timeout != Timeout.DEFAULT_TIMEOUT: client._http.connection_pool_kw["timeout"] = timeout @@ -54,13 +53,7 @@ def health_check(): return True -def store_file( - bucket_name, - prefix, - file_name, - file_content, - content_type="application/octet-stream", -) -> str: +def store_file(bucket_name, prefix, file_name, file_content, content_type="application/octet-stream") -> str: client = _get_minio_client() f = tempfile.TemporaryFile() f.write(file_content) @@ -83,9 +76,7 @@ def store_tgz(bucket_name, prefix, tgz_file: FileStorage): if file_ext in [".yaml", ".yml", ".md", ".py"]: object_name = f"{prefix.rstrip('/')}/{member.name}" f = tar.extractfile(member) - client.put_object( - bucket_name, object_name, f, f.raw.size, "text/plain" - ) # f.read() + client.put_object(bucket_name, object_name, f, f.raw.size, "text/plain") # f.read() f.close() tar.close() @@ -94,9 +85,7 @@ def store_tgz(bucket_name, prefix, tgz_file: FileStorage): return True -def extract_yaml_from_tarfile( - uploadfile: FileStorage, filename_filter: str = "", reset_after_read=False -) -> str: +def extract_yaml_from_tarfile(uploadfile: FileStorage, filename_filter: str = "", reset_after_read=False) -> str: tar = tarfile.open(fileobj=uploadfile.stream, mode="r:gz") for member in tar.getmembers(): @@ -115,9 +104,7 @@ def extract_yaml_from_tarfile( yaml_file_content = f.read() if reset_after_read: - uploadfile.stream.seek( - 0 - ) # reset the upload file stream, we might need to re-read later + uploadfile.stream.seek(0) # reset the upload file stream, we might need to re-read later f.close() tar.close() @@ -126,9 +113,7 @@ def extract_yaml_from_tarfile( return None -def create_tarfile( - bucket_name: str, prefix: str, file_extensions: [str], keep_open=False -) -> (TarFile, BytesIO): +def create_tarfile(bucket_name: str, prefix: str, file_extensions: [str], keep_open=False) -> (TarFile, BytesIO): client = _get_minio_client() objects = client.list_objects(bucket_name, prefix=prefix, recursive=True) @@ -163,12 +148,10 @@ def get_file_content_and_url(bucket_name, prefix, file_name) -> (str, str): object_name = f"{prefix.rstrip('/')}/{file_name}" file_content = client.get_object(bucket_name, object_name) object_url = f"http://{_host}:{_port}/{bucket_name}/{object_name}" - return file_content.data.decode("utf-8"), object_url + return file_content.data.decode('utf-8'), object_url -def retrieve_file_content_and_url( - bucket_name, prefix, file_extensions: [str], file_name_filter="" -) -> [(str, str)]: +def retrieve_file_content_and_url(bucket_name, prefix, file_extensions: [str], file_name_filter="") -> [(str, str)]: client = _get_minio_client() objects = client.list_objects(bucket_name, prefix=prefix, recursive=True) @@ -180,18 +163,14 @@ def retrieve_file_content_and_url( if file_ext in file_extensions and file_name_filter in o.object_name: file_content = client.get_object(bucket_name, o.object_name) object_url = f"http://{_host}:{_port}/{bucket_name}/{o.object_name}" - files_w_url.append((file_content.data.decode("utf-8"), object_url)) + files_w_url.append((file_content.data.decode('utf-8'), object_url)) return files_w_url -def retrieve_file_content( - bucket_name, prefix, file_extensions: [str], file_name_filter: str = "" -): +def retrieve_file_content(bucket_name, prefix, file_extensions: [str], file_name_filter: str = ""): - files_w_url = retrieve_file_content_and_url( - bucket_name, prefix, file_extensions, file_name_filter - ) + files_w_url = retrieve_file_content_and_url(bucket_name, prefix, file_extensions, file_name_filter) if files_w_url: (file_content, url) = files_w_url[0] # TODO: return first result only? @@ -200,13 +179,9 @@ def retrieve_file_content( return None -def get_object_url( - bucket_name, prefix, file_extensions: [str], file_name_filter: str = "" -): +def get_object_url(bucket_name, prefix, file_extensions: [str], file_name_filter: str = ""): - files_w_url = retrieve_file_content_and_url( - bucket_name, prefix, file_extensions, file_name_filter - ) + files_w_url = retrieve_file_content_and_url(bucket_name, prefix, file_extensions, file_name_filter) if files_w_url: (file_content, url) = files_w_url[0] # TODO: return first result only? @@ -235,9 +210,7 @@ def delete_objects(bucket_name, prefix): objects = client.list_objects(bucket_name, prefix=prefix, recursive=True) object_names = [obj.object_name for obj in objects if not obj.is_dir] maybe_errors = client.remove_objects(bucket_name, object_names) - actual_errors = [ - (e.object_name, e.error_code, e.error_message) for e in maybe_errors - ] + actual_errors = [(e.object_name, e.error_code, e.error_message) for e in maybe_errors] if actual_errors: pprint(actual_errors) @@ -262,9 +235,8 @@ def _update_bucket_policy(bucket_name: str, prefix: str): except NoSuchBucketPolicy: bucket_policy = dict(_bucket_policy_template) - getobject_stmts = [ - s for s in bucket_policy["Statement"] if s.get("Sid") == _bucket_policy_sid - ] or [s for s in bucket_policy["Statement"] if "s3:GetObject" in s["Action"]] + getobject_stmts = [s for s in bucket_policy["Statement"] if s.get("Sid") == _bucket_policy_sid] or \ + [s for s in bucket_policy["Statement"] if "s3:GetObject" in s["Action"]] if not getobject_stmts: bucket_policy["Statement"].append(_bucket_policy_stmt) @@ -274,9 +246,7 @@ def _update_bucket_policy(bucket_name: str, prefix: str): new_resource = f"arn:aws:s3:::{bucket_name}/{prefix}" - if new_resource not in resources and not any( - [r.strip("*") in new_resource for r in resources] - ): + if new_resource not in resources and not any([r.strip("*") in new_resource for r in resources]): resources.append(new_resource) new_policy_str = json.dumps(bucket_policy) @@ -286,9 +256,9 @@ def _update_bucket_policy(bucket_name: str, prefix: str): except ResponseError as e: - if e.code == "XMinioPolicyNesting": + if e.code == 'XMinioPolicyNesting': raise ApiError( f"{e.message.split('.')[0]}." f" New policy: '{new_policy_str}'." - f" Existing policy: '{client.get_bucket_policy(bucket_name)}'" - ) + f" Existing policy: '{client.get_bucket_policy(bucket_name)}'") + diff --git a/api/server/swagger_server/data_access/mysql_client.py b/api/server/swagger_server/data_access/mysql_client.py index 402c2ad6..fe25bb8f 100644 --- a/api/server/swagger_server/data_access/mysql_client.py +++ b/api/server/swagger_server/data_access/mysql_client.py @@ -11,11 +11,11 @@ from kfp_tekton.compiler._k8s_helper import sanitize_k8s_name from mysql.connector import connect, errorcode, Error from mysql.connector.errors import IntegrityError -from os import environ as env # noqa: F401 +from os import environ as env from random import choice -from string import ascii_letters, digits, hexdigits # noqa: F401 +from string import hexdigits from swagger_server.models.base_model_ import Model -from swagger_server.models import * # noqa: F403 required for dynamic Api ...Extension class loading during View-table creation +from swagger_server.models import * # required for dynamic Api ...Extension class loading during View-table creation from swagger_server.util import _deserialize, ApiError from typing import List @@ -23,20 +23,20 @@ _namespace = env.get("POD_NAMESPACE", "kubeflow") _host = env.get("MYSQL_SERVICE_HOST", "mysql.%s.svc.cluster.local" % _namespace) _port = env.get("MYSQL_SERVICE_PORT", "3306") -_database = "mlpipeline" -_user = "root" +_database = 'mlpipeline' +_user = 'root' existing_tables = dict() # map Python data types of the Swagger model object's attributes to MySQL column types type_map = { - str: "varchar(255)", - int: "int(11)", - bool: "tinyint(1)", - list: "longtext", - dict: "longtext", - Model: "longtext", - datetime: "bigint(20)", + str: 'varchar(255)', + int: 'int(11)', + bool: 'tinyint(1)', + list: 'longtext', + dict: 'longtext', + Model: 'longtext', + datetime: 'bigint(20)' } # some attributes do not comply to the defaults in the type_map (KFP idiosyncrasy) custom_col_types = { @@ -49,42 +49,35 @@ }, } # add custom column types for sub-classes of ApiAsset -for asset_type in ApiAsset.__subclasses__(): # noqa: F405 +for asset_type in ApiAsset.__subclasses__(): custom_col_types[asset_type.__name__] = custom_col_types["ApiAsset"] # add custom column types for sub-class(es) of ApiPipeline custom_col_types["ApiPipelineExtended"] = custom_col_types["ApiPipeline"] # some Swagger attributes names have special MySQL column names (KFP idiosyncrasy) -attribute_name_to_column_name = {"id": "UUID", "created_at": "CreatedAtInSec"} -column_name_to_attribute_name = { - v: k for (k, v) in attribute_name_to_column_name.items() -} # Note: overrides duplicates +attribute_name_to_column_name = { + 'id': 'UUID', + 'created_at': 'CreatedAtInSec' +} +column_name_to_attribute_name = {v: k for (k, v) in attribute_name_to_column_name.items()} # Note: overrides duplicates ############################################################################## # methods to convert between Swagger and MySQL ############################################################################## - -def _convert_value_to_mysql( - value, python_type: type, mysql_type_override: str = None, quote_str=False -): +def _convert_value_to_mysql(value, python_type: type, mysql_type_override: str = None, quote_str=False): # turn child attributes of type swagger._base_model.Model into dicts def to_dict(v): return v.to_dict() if hasattr(v, "to_dict") else v - if ( - type(python_type) == typing._GenericAlias - ): # or str(python_type).startswith("typing."): + if type(python_type) == typing._GenericAlias: # or str(python_type).startswith("typing."): python_type = eval(python_type._name.lower()) - if ( - value - and not issubclass(type(value), python_type) - and not (isinstance(value, dict) and issubclass(python_type, Model)) - ): + if value and not issubclass(type(value), python_type) \ + and not (isinstance(value, dict) and issubclass(python_type, Model)): err_msg = f"The type '{type(value)}' does not match expected target type '{python_type}' for value '{value}'" raise ApiError(err_msg, 422) @@ -106,14 +99,8 @@ def to_dict(v): elif python_type == list: # or isinstance(value, list): mysql_value = json.dumps(list(map(to_dict, value))) - elif ( - python_type == dict - or issubclass(python_type, Model) - and isinstance(value, dict) - ): - mysql_value = json.dumps( - dict(map(lambda item: (item[0], to_dict(item[1])), value.items())) - ) + elif python_type == dict or issubclass(python_type, Model) and isinstance(value, dict): + mysql_value = json.dumps(dict(map(lambda item: (item[0], to_dict(item[1])), value.items()))) elif python_type == datetime: # or isinstance(value, datetime): mysql_value = int(value.timestamp()) @@ -135,10 +122,9 @@ def _convert_value_to_python(value, target_type: type): return datetime.fromtimestamp(value) elif isinstance(value, str) and ( - type(target_type) == typing._GenericAlias or issubclass(target_type, Model) - ): + type(target_type) == typing._GenericAlias or issubclass(target_type, Model)): - json_dict = json.loads(value or "{}") + json_dict = json.loads(value or '{}') swaggered_value = _deserialize(json_dict, target_type) return swaggered_value @@ -148,16 +134,14 @@ def _convert_value_to_python(value, target_type: type): def _convert_attr_name_to_col_name(swagger_attr_name: str): - return attribute_name_to_column_name.get(swagger_attr_name) or inflection.camelize( - swagger_attr_name - ) + return attribute_name_to_column_name.get(swagger_attr_name) \ + or inflection.camelize(swagger_attr_name) def _convert_col_name_to_attr_name(mysql_column_name: str): - return column_name_to_attribute_name.get( - mysql_column_name - ) or inflection.underscore(mysql_column_name) + return column_name_to_attribute_name.get(mysql_column_name) \ + or inflection.underscore(mysql_column_name) def _get_table_name(swagger_object_or_class) -> str: @@ -179,25 +163,22 @@ def _get_table_name(swagger_object_or_class) -> str: # general helper methods ############################################################################## - def generate_id(name: str = None, length: int = 36) -> str: if name: # return name.lower().replace(" ", "-").replace("---", "-").replace("-–-", "–") return sanitize_k8s_name(name) else: # return ''.join([choice(ascii_letters + digits + '-') for n in range(length)]) - return "".join([choice(hexdigits) for n in range(length)]).lower() + return ''.join([choice(hexdigits) for n in range(length)]).lower() ############################################################################## # helper methods to create MySQL tables ############################################################################## - def _get_column_type(swagger_field_name, swagger_field_type, swagger_class) -> str: - return custom_col_types.get(swagger_class.__name__, {}).get( - swagger_field_name - ) or _get_mysql_type_declaration(swagger_field_type) + return custom_col_types.get(swagger_class.__name__, {}).get(swagger_field_name) or \ + _get_mysql_type_declaration(swagger_field_type) def _get_mysql_type_declaration(python_class_or_type) -> str: @@ -212,25 +193,19 @@ def _get_mysql_type_declaration(python_class_or_type) -> str: if clazz in type_map: return type_map[clazz] - elif isinstance(python_class_or_type, Model) or issubclass( - python_class_or_type, Model - ): + elif isinstance(python_class_or_type, Model) or issubclass(python_class_or_type, Model): clazz = Model if clazz in type_map: return type_map[clazz] - raise ValueError( - f"Cannot find MySQL data type for Python type {python_class_or_type}" - ) + raise ValueError(f"Cannot find MySQL data type for Python type {python_class_or_type}") def _get_mysql_default_value_declaration(default_value): if default_value: - raise ValueError( - "DEFAULT value not implemented for MySQL CREATE TABLE statement," - f" default: '{default_value}'" - ) + raise ValueError("DEFAULT value not implemented for MySQL CREATE TABLE statement," + f" default: '{default_value}'") # TODO: generate MySQL default value declaration return default_value or "NOT NULL" @@ -265,9 +240,7 @@ def _get_create_table_statement(swagger_class) -> str: create_table_stmt.append(f" PRIMARY KEY (`{id_field_name}`)") else: - raise ValueError( - "CREATE TABLE statement requires PRIMARY KEY field. Expected 'id'" - ) + raise ValueError("CREATE TABLE statement requires PRIMARY KEY field. Expected 'id'") if "name" in sig.parameters.keys(): name_field = _convert_attr_name_to_col_name("name") @@ -289,20 +262,16 @@ def _get_create_view_statement(swagger_class) -> str: base_table_name = view_name.replace("_extended", "") extension_table_name = view_name.replace("s_extended", "_extensions") - extension_swagger_class = eval( - swagger_class.__name__.replace("Extended", "Extension") - ) + extension_swagger_class = eval(swagger_class.__name__.replace("Extended", "Extension")) ext_sig = inspect.signature(extension_swagger_class.__init__) b_id_col_name = _convert_attr_name_to_col_name("id") e_id_col_name = _convert_attr_name_to_col_name("id") - e_non_id_col_names = [ - _convert_attr_name_to_col_name(p.name) - for _, p in ext_sig.parameters.items() - if p.name not in ["id", "self"] - ] + e_non_id_col_names = [_convert_attr_name_to_col_name(p.name) + for _, p in ext_sig.parameters.items() + if p.name not in ["id", "self"]] e_non_id_col_list = ", ".join([f"e.`{cn}`" for cn in e_non_id_col_names]) @@ -323,7 +292,6 @@ def _get_create_view_statement(swagger_class) -> str: # helper methods to create SQL (query) statement ############################################################################## - def _get_where_clause(swagger_class, filter_dict=dict()) -> str: if not filter_dict: @@ -336,9 +304,7 @@ def _get_where_clause(swagger_class, filter_dict=dict()) -> str: for attribute_name, attribute_value in filter_dict.items(): if attribute_name not in sig.parameters.keys(): - raise ValueError( - f"{swagger_class} does not have an '{attribute_name}' attribute." - ) + raise ValueError(f"{swagger_class} does not have an '{attribute_name}' attribute.") attribute_type = sig.parameters[attribute_name].annotation column_type = _get_column_type(attribute_name, attribute_type, swagger_class) @@ -346,9 +312,7 @@ def _get_where_clause(swagger_class, filter_dict=dict()) -> str: if column_type == "json" and type(attribute_value) == dict: for key, value in attribute_value.items(): - predicates.append( - f"json_contains(json_extract({column_name}, '$.{key}'), '{json.dumps(value)}')" - ) + predicates.append(f"json_contains(json_extract({column_name}, '$.{key}'), '{json.dumps(value)}')") # where json_contains(json_extract(FilterCategories, '$.platform'), '"kubernetes"') # where json_contains(json_extract(FilterCategories, '$.platform'), '["kubernetes", "kfserving"]') @@ -379,9 +343,7 @@ def _get_where_clause(swagger_class, filter_dict=dict()) -> str: else: # CAUTION: assuming everything else is string type - column_value = _convert_value_to_mysql( - attribute_value, attribute_type, quote_str=True - ) + column_value = _convert_value_to_mysql(attribute_value, attribute_type, quote_str=True) # if type(column_value) == str: # quote_str=True # column_value = f"'{column_value}'" @@ -428,21 +390,12 @@ def _get_limit_clause(count, offset): # methods to connect to MySQL and execute db operations ############################################################################## - def _get_connection(timeout: int = 10): - return connect( - host=_host, - port=_port, - user=_user, - database=_database, - connection_timeout=timeout, - ) + return connect(host=_host, port=_port, user=_user, database=_database, connection_timeout=timeout) -def _verify_or_create_table( - table_name: str, swagger_class_or_object, validate_schema=True -) -> bool: +def _verify_or_create_table(table_name: str, swagger_class_or_object, validate_schema=True) -> bool: if table_name not in existing_tables: @@ -460,25 +413,17 @@ def _verify_or_create_table( if not table_exists: if swagger_class.__name__.endswith("Extended"): # first, create the table that is being "extended" (only required if KFP did not create it) - base_swagger_class = eval( - swagger_class.__name__.replace("Extended", "") - ) + base_swagger_class = eval(swagger_class.__name__.replace("Extended", "")) base_table_name = _get_table_name(base_swagger_class) create_table_stmt = _get_create_table_statement(base_swagger_class) - base_table_created = _run_create_table_statement( - base_table_name, create_table_stmt - ) + base_table_created = _run_create_table_statement(base_table_name, create_table_stmt) existing_tables[base_table_name] = base_table_created # second, create the table with the additional columns - extension_swagger_class = eval( - swagger_class.__name__.replace("Extended", "Extension") - ) + extension_swagger_class = eval(swagger_class.__name__.replace("Extended", "Extension")) extension_table_name = _get_table_name(extension_swagger_class) create_table_stmt = _get_create_table_statement(extension_swagger_class) - ext_table_created = _run_create_table_statement( - extension_table_name, create_table_stmt - ) + ext_table_created = _run_create_table_statement(extension_table_name, create_table_stmt) existing_tables[extension_table_name] = ext_table_created # third, create the table-view that extends the base table with the additional columns from the ext table @@ -487,9 +432,7 @@ def _verify_or_create_table( existing_tables[table_name] = view_created else: create_table_stmt = _get_create_table_statement(swagger_class) - table_created = _run_create_table_statement( - table_name, create_table_stmt - ) + table_created = _run_create_table_statement(table_name, create_table_stmt) existing_tables[table_name] = table_created return True @@ -511,11 +454,9 @@ def _validate_schema(table_name: str, swagger_class): swagger_columns_w_type.append((col_name, col_type)) - query = ( - f"SELECT COLUMN_NAME, SUBSTR(COLUMN_TYPE,1,64) as COLUMN_TYPE " - f" FROM INFORMATION_SCHEMA.COLUMNS " - f" WHERE TABLE_SCHEMA = '{_database}' AND TABLE_NAME = '{table_name}'" - ) + query = f"SELECT COLUMN_NAME, SUBSTR(COLUMN_TYPE,1,64) as COLUMN_TYPE " \ + f" FROM INFORMATION_SCHEMA.COLUMNS " \ + f" WHERE TABLE_SCHEMA = '{_database}' AND TABLE_NAME = '{table_name}'" cnx = _get_connection() cursor = cnx.cursor(buffered=True) @@ -535,9 +476,7 @@ def _validate_schema(table_name: str, swagger_class): cursor.close() cnx.close() - if table_columns_w_type and set(table_columns_w_type) != set( - swagger_columns_w_type - ): + if table_columns_w_type and set(table_columns_w_type) != set(swagger_columns_w_type): if isinstance(swagger_class, Model): swagger_class = type(swagger_class) @@ -545,15 +484,13 @@ def _validate_schema(table_name: str, swagger_class): cols_found = "\n - ".join([f"'{n}' {t}" for n, t in table_columns_w_type]) cols_expect = "\n - ".join([f"'{n}' {t}" for n, t in swagger_columns_w_type]) - err_msg = ( - f"The MySQL table '{_database}.{table_name}' does not match Swagger" - f" class '{swagger_class.__name__}'.\n" - f" Found table with columns:\n" - f" - {cols_found}.\n" - f" Expected table with columns:\n" - f" - {cols_expect}.\n" + err_msg = f"The MySQL table '{_database}.{table_name}' does not match Swagger" \ + f" class '{swagger_class.__name__}'.\n" \ + f" Found table with columns:\n" \ + f" - {cols_found}.\n" \ + f" Expected table with columns:\n" \ + f" - {cols_expect}.\n" \ f" Delete and recreate the table by calling the API endpoint 'DELETE /{table_name}/*'" - ) raise ApiError(err_msg) @@ -567,7 +504,7 @@ def _run_create_table_statement(table_name, table_description: tuple) -> bool: cursor = cnx.cursor(buffered=True) try: - print(f"Creating table '{table_name}': ", end="") + print(f"Creating table '{table_name}': ", end='') cursor.execute(table_description) cnx.commit() print("OK") @@ -593,7 +530,6 @@ def _run_create_table_statement(table_name, table_description: tuple) -> bool: # _host = "123.34.13.12" - def health_check(): cnx = _get_connection(timeout=1) cnx.connect() @@ -608,17 +544,15 @@ def num_rows(swagger_class: type) -> int: _verify_or_create_table(table_name, swagger_class) - query = ( - f"SELECT TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES " - f"WHERE TABLE_SCHEMA = '{_database}' AND TABLE_NAME = '{table_name}'" - ) + query = f"SELECT TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES " \ + f"WHERE TABLE_SCHEMA = '{_database}' AND TABLE_NAME = '{table_name}'" cnx = _get_connection() cursor = cnx.cursor() try: cursor.execute(query) - (num_records,) = cursor.fetchone() + num_records, = cursor.fetchone() except Error as err: print(err.msg) @@ -641,9 +575,7 @@ def store_data(swagger_object: Model) -> str: # TODO: remove generate_id() calls in controller_impl methods, do it here if "id" in swagger_fields and not swagger_object.id: - swagger_object.id = generate_id( - swagger_object.name if "name" in swagger_fields else None - ) + swagger_object.id = generate_id(swagger_object.name if "name" in swagger_fields else None) # TODO: remove creating a new data in controller_impl methods, do it here if "created_at" in swagger_fields and not swagger_object.created_at: @@ -662,13 +594,11 @@ def store_data(swagger_object: Model) -> str: column_values.append(col_value) column_names_str = ", ".join(column_names) - values_list_str = ("%s," * len(column_values)).rstrip(",") + values_list_str = ('%s,' * len(column_values)).rstrip(',') - insert_stmt = ( - f"INSERT INTO {table_name} " - f"({column_names_str}) " - f"VALUES ({values_list_str})" - ) + insert_stmt = (f"INSERT INTO {table_name} " + f"({column_names_str}) " + f"VALUES ({values_list_str})") cnx = _get_connection() cnx.autocommit = True @@ -705,17 +635,13 @@ def update_multiple(swagger_class: type, ids: List[str], attribute_name: str, va sig = inspect.signature(swagger_class.__init__) if attribute_name not in sig.parameters.keys(): - raise ValueError( - f"{swagger_class} does not have an attribute with name '{attribute_name}'." - ) + raise ValueError(f"{swagger_class} does not have an attribute with name '{attribute_name}'.") if ids and "id" not in sig.parameters.keys(): raise ValueError(f"{swagger_class} does not have an 'id' attribute.") update_column_name = _convert_attr_name_to_col_name(attribute_name) - update_column_value = _convert_value_to_mysql( - value, sig.parameters.get(attribute_name).annotation, quote_str=False - ) + update_column_value = _convert_value_to_mysql(value, sig.parameters.get(attribute_name).annotation, quote_str=False) # if type(update_column_value) == str: # update_column_value = f"'{update_column_value}'" @@ -762,9 +688,7 @@ def delete_data(swagger_class: type, id: str) -> bool: sig = inspect.signature(swagger_class.__init__) if not id: - raise ValueError( - f"Must specify 'id' column value to delete row from table '{table_name}'" - ) + raise ValueError(f"Must specify 'id' column value to delete row from table '{table_name}'") elif "id" not in sig.parameters.keys(): raise ValueError(f"{swagger_class} does not have an 'id' attribute.") @@ -809,13 +733,7 @@ def delete_data(swagger_class: type, id: str) -> bool: return True # TODO: determine return value -def load_data( - swagger_class: type, - filter_dict: dict = None, - sort_by: str = None, - count: int = 100, - offset: int = 0, -) -> [Model]: +def load_data(swagger_class: type, filter_dict: dict = None, sort_by: str = None, count: int = 100, offset: int = 0) -> [Model]: table_name = _get_table_name(swagger_class) @@ -837,25 +755,18 @@ def load_data( try: cursor.execute(query) - swagger_attr_names = [ - _convert_col_name_to_attr_name(c) for c in cursor.column_names - ] + swagger_attr_names = [_convert_col_name_to_attr_name(c) for c in cursor.column_names] - assert set(swagger_attr_names) <= set(sig.parameters.keys()), ( - f"Mismatch between database schema and API spec for {table_name}. " - f"Expected columns: {[_convert_attr_name_to_col_name(k) for k in sig.parameters.keys() if k != 'self']}. " + assert set(swagger_attr_names) <= set(sig.parameters.keys()), \ + f"Mismatch between database schema and API spec for {table_name}. " \ + f"Expected columns: {[_convert_attr_name_to_col_name(k) for k in sig.parameters.keys() if k != 'self']}. " \ f"Database columns: {cursor.column_names}" - ) - swagger_attr_types = [ - sig.parameters.get(a).annotation for a in swagger_attr_names - ] + swagger_attr_types = [sig.parameters.get(a).annotation for a in swagger_attr_names] for row_values in cursor: value_type_tuples = zip(list(row_values), swagger_attr_types) - swagger_attr_values = [ - _convert_value_to_python(v, t) for v, t in value_type_tuples - ] + swagger_attr_values = [_convert_value_to_python(v, t) for v, t in value_type_tuples] swagger_attr_dict = dict(zip(swagger_attr_names, swagger_attr_values)) swagger_object = swagger_class(**swagger_attr_dict) diff --git a/api/server/swagger_server/encoder.py b/api/server/swagger_server/encoder.py index 0156fd01..a5d1d7a7 100644 --- a/api/server/swagger_server/encoder.py +++ b/api/server/swagger_server/encoder.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 from connexion.apps.flask_app import FlaskJSONEncoder -import six # noqa: F401 +import six from swagger_server.models.base_model_ import Model diff --git a/api/server/swagger_server/gateways/kfserving_client.py b/api/server/swagger_server/gateways/kfserving_client.py index 9abe68f8..8a33ec84 100644 --- a/api/server/swagger_server/gateways/kfserving_client.py +++ b/api/server/swagger_server/gateways/kfserving_client.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 -import yaml # noqa: F401 +import yaml from kubernetes import client, config @@ -12,7 +12,7 @@ def get_all_services(name=None, namespace=None, group=None, version=None, plural api = client.CustomObjectsApi() if not namespace: - namespace = "default" + namespace = 'default' if name is None: resource = api.list_namespaced_custom_object( @@ -32,21 +32,19 @@ def get_all_services(name=None, namespace=None, group=None, version=None, plural return resource -def post_service( - inferenceservice=None, namespace=None, group=None, version=None, plural=None -): +def post_service(inferenceservice=None, namespace=None, group=None, version=None, plural=None): config.load_incluster_config() api = client.CustomObjectsApi() service_dict = inferenceservice.to_dict() # Get resource information from the dict - version_split = service_dict["apiVersion"].split("/") + version_split = service_dict['apiVersion'].split("/") group = version_split[0] version = version_split[1] - plural = service_dict["kind"].lower() + "s" + plural = service_dict['kind'].lower() + "s" if not namespace: - namespace = service_dict["metadata"].get("namespace", "default") + namespace = service_dict['metadata'].get('namespace', 'default') # create the resource ns_obj = api.create_namespaced_custom_object( @@ -59,22 +57,20 @@ def post_service( return ns_obj -def from_client_upload_service( - upload_file=None, namespace=None, group=None, version=None, plural=None -): +def from_client_upload_service(upload_file=None, namespace=None, group=None, version=None, plural=None): config.load_incluster_config() api = client.CustomObjectsApi() yaml_object = yaml.safe_load(upload_file) # Get resource information from the yaml - name = yaml_object["metadata"]["name"] - version_split = yaml_object["apiVersion"].split("/") + yaml_object['metadata']['name'] + version_split = yaml_object['apiVersion'].split("/") group = version_split[0] version = version_split[1] - plural = yaml_object["kind"].lower() + "s" + plural = yaml_object['kind'].lower() + "s" if not namespace: - namespace = yaml_object["metadata"].get("namespace", "default") + namespace = yaml_object['metadata'].get('namespace', 'default') # create the resource ns_obj = api.create_namespaced_custom_object( @@ -84,4 +80,4 @@ def from_client_upload_service( plural=plural, body=yaml_object, ) - return ns_obj + return ns_obj \ No newline at end of file diff --git a/api/server/swagger_server/gateways/kubeflow_pipeline_service.py b/api/server/swagger_server/gateways/kubeflow_pipeline_service.py index df2d7745..5e2e624a 100644 --- a/api/server/swagger_server/gateways/kubeflow_pipeline_service.py +++ b/api/server/swagger_server/gateways/kubeflow_pipeline_service.py @@ -6,7 +6,7 @@ import json import os import re -import yaml # noqa: F401 +import yaml from datetime import datetime @@ -17,21 +17,15 @@ from kfp_server_api import ApiPipeline as KfpPipeline from kfp_server_api.rest import ApiException as PipelineApiException -from os import environ as env # noqa: F401 +from os import environ as env from os.path import abspath, join, dirname from string import Template from swagger_server.data_access.mysql_client import generate_id -from swagger_server.data_access.minio_client import ( - get_object_url, - create_tarfile, - store_file, - _host as minio_host, - _port as minio_port, - _access_key as minio_access_key, - _secret_key as minio_secret_key, - retrieve_file_content, -) +from swagger_server.data_access.minio_client import get_object_url,\ + create_tarfile, store_file, _host as minio_host, _port as minio_port,\ + _access_key as minio_access_key, _secret_key as minio_secret_key,\ + retrieve_file_content from swagger_server.models import ApiDataset from swagger_server.models.api_component import ApiComponent from swagger_server.models.api_model import ApiModel @@ -47,28 +41,20 @@ CODE_TEMPLATE_DIR = abspath(join(dirname(__file__), "..", "code_templates")) _namespace = env.get("POD_NAMESPACE", "kubeflow") -_host = env.get( - "ML_PIPELINE_SERVICE_HOST", "ml-pipeline.%s.svc.cluster.local" % _namespace -) +_host = env.get("ML_PIPELINE_SERVICE_HOST", "ml-pipeline.%s.svc.cluster.local" % _namespace) _port = env.get("ML_PIPELINE_SERVICE_PORT", "8888") _api_base_path = env.get("ML_PIPELINE_SERVICE_API_BASE_PATH", "") -_pipeline_service_url = env.get( - "ML_PIPELINE_SERVICE_URL", f"{_host}:{_port}/{_api_base_path}".rstrip("/") -) +_pipeline_service_url = env.get("ML_PIPELINE_SERVICE_URL", f"{_host}:{_port}/{_api_base_path}".rstrip("/")) -def upload_pipeline_to_kfp( - uploadfile: str, name: str = None, description: str = None -) -> ApiPipeline: +def upload_pipeline_to_kfp(uploadfile: str, name: str = None, description: str = None) -> ApiPipeline: kfp_client = KfpClient() try: - kfp_pipeline: KfpPipeline = kfp_client.upload_pipeline( - pipeline_package_path=uploadfile, - pipeline_name=name, - description=description, - ) + kfp_pipeline: KfpPipeline = kfp_client.upload_pipeline(pipeline_package_path=uploadfile, + pipeline_name=name, + description=description) api_pipeline: ApiPipeline = ApiPipeline.from_dict(kfp_pipeline.to_dict()) api_pipeline.status = kfp_pipeline.error return api_pipeline @@ -76,15 +62,11 @@ def upload_pipeline_to_kfp( except PipelineApiException as e: kfp_host = _pipeline_service_url - print( - f"Error calling PipelineServiceApi ({kfp_host}) -> upload_pipeline(name='{name}'): {e}" - ) + print(f"Error calling PipelineServiceApi ({kfp_host}) -> upload_pipeline(name='{name}'): {e}") error_body = json.loads(e.body) or {"error_message": str(e)} error_msg = error_body["error_message"] - status_code = ( - 409 if "already exist. Please specify a new name" in error_msg else e.status - ) + status_code = 409 if "already exist. Please specify a new name" in error_msg else e.status raise ApiError(error_msg, status_code) @@ -105,13 +87,8 @@ def delete_kfp_pipeline(pipeline_id: str): except PipelineApiException as e: kfp_host = api_instance.api_client.configuration.host - print( - f"Exception when calling PipelineServiceApi ({kfp_host}) -> delete_pipeline: %s\n" - % e - ) - raise ApiError( - message=f"{e.body}\nKFP URL: {kfp_host}", http_status_code=e.status or 422 - ) + print(f"Exception when calling PipelineServiceApi ({kfp_host}) -> delete_pipeline: %s\n" % e) + raise ApiError(message=f"{e.body}\nKFP URL: {kfp_host}", http_status_code=e.status or 422) def quote_string_value(value): @@ -129,9 +106,7 @@ def generate_method_arg_from_parameter(parameter): if parameter.value or parameter.default: value = quote_string_value(parameter.value or parameter.default) arg = f"{param_name}={value}" - elif ( - parameter.value == "" or parameter.default == "" - ): # TODO: should empty string != None ? + elif parameter.value == '' or parameter.default == '': # TODO: should empty string != None ? arg = f"{param_name}=''" else: arg = param_name @@ -149,12 +124,8 @@ def generate_pipeline_method_args(parameters: [ApiParameter]) -> str: return ",\n ".join(args) -def generate_component_run_script( - component: ApiComponent, - component_template_url, - run_parameters=dict(), - run_name: str = None, -): +def generate_component_run_script(component: ApiComponent, component_template_url, run_parameters=dict(), + run_name: str = None): name = component.name + " " + generate_id(length=4) description = component.description.strip() @@ -163,25 +134,19 @@ def generate_component_run_script( parameter_names = ",".join([sanitize(p.name) for p in component.parameters]) - parameter_dict = json.dumps( - { - sanitize(p.name): run_parameters.get(p.name) or p.default or "" - for p in component.parameters - }, - indent=4, - ).replace('"', "'") + parameter_dict = json.dumps({sanitize(p.name): run_parameters.get(p.name) or p.default or "" + for p in component.parameters}, + indent=4).replace('"', "'") - pipeline_server = ( - "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - ) + pipeline_server = "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - run_name = (run_name or "").replace("'", '"') or component.name + run_name = (run_name or "").replace("'", "\"") or component.name substitutions = dict(locals()) template_file = f"run_component.TEMPLATE.py" - with open(join(CODE_TEMPLATE_DIR, template_file), "r") as f: + with open(join(CODE_TEMPLATE_DIR, template_file), 'r') as f: template_raw = f.read() template_rendered = Template(template_raw).substitute(substitutions) @@ -191,9 +156,7 @@ def generate_component_run_script( return run_script -def generate_custom_pipeline_function_body( - custom_pipeline: ApiPipelineCustom, hide_secrets=True -): +def generate_custom_pipeline_function_body(custom_pipeline: ApiPipelineCustom, hide_secrets=True): function_body = """ from kfp import components @@ -213,35 +176,22 @@ def generate_custom_pipeline_function_body( if task.artifact_type == "notebook": component_s3_prefix = f"components/jupyter/" - notebook_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"notebooks/{task.artifact_id}/", - file_extensions=[".ipynb"], - ) + notebook_url = get_object_url(bucket_name="mlpipeline", + prefix=f"notebooks/{task.artifact_id}/", + file_extensions=[".ipynb"]) if not notebook_url: raise ApiError(f"Could not find notebook '{task.artifact_id}'") - task_parameters = ( - list(task.arguments.parameters) - if task.arguments and task.arguments.parameters - else [] - ) + task_parameters = list(task.arguments.parameters) if task.arguments and task.arguments.parameters else [] for p in task_parameters: if type(p.value) == str and p.value.startswith("{{inputs.parameters."): - raise ApiError( - "Referencing '{{inputs.parameters.*}}' is not supported for notebook parameter" - f" values: {task.to_dict()}", - 422, - ) - - notebook_parameters = { - p.name: p.value or p.default for p in task_parameters - } - notebook_parameters_str = ( - json.dumps(notebook_parameters) if notebook_parameters else "" - ) + raise ApiError("Referencing '{{inputs.parameters.*}}' is not supported for notebook parameter" + f" values: {task.to_dict()}", 422) + + notebook_parameters = {p.name: p.value or p.default for p in task_parameters} + notebook_parameters_str = json.dumps(notebook_parameters) if notebook_parameters else "" jupyter_component_parameters = { "notebook_url": notebook_url, @@ -251,25 +201,23 @@ def generate_custom_pipeline_function_body( "bucket_name": "", "object_name": "", "access_key": "", - "secret_access_key": "", + "secret_access_key": "" } if not hide_secrets: output_folder = f"notebooks/{task.artifact_id}/runs/{datetime.now().strftime('%Y%m%d-%H%M%S')}" notebook_file_name = notebook_url.split("/")[-1] - output_file_name = notebook_file_name.replace(r".ipynb", "_out.ipynb") + output_file_name = notebook_file_name.replace(r'.ipynb', '_out.ipynb') output_file_path = f"{output_folder}/{output_file_name}" output_bucket = "mlpipeline" - jupyter_component_parameters.update( - { - "endpoint_url": "minio-service:9000", # f"{minio_host}:{minio_port}", - "bucket_name": output_bucket, - "object_name": output_file_path, - "access_key": minio_access_key, - "secret_access_key": minio_secret_key, - } - ) + jupyter_component_parameters.update({ + "endpoint_url": "minio-service:9000", # f"{minio_host}:{minio_port}", + "bucket_name": output_bucket, + "object_name": output_file_path, + "access_key": minio_access_key, + "secret_access_key": minio_secret_key + }) for name, value in jupyter_component_parameters.items(): parameters.append(f"{name} = '{value}'") @@ -278,42 +226,24 @@ def generate_custom_pipeline_function_body( component_s3_prefix = f"components/{task.artifact_id}/" # replace parameter values that reference pipeline input parameters {{inputs.parameters.parameter_name}} - task_parameters = ( - list(task.arguments.parameters) - if task.arguments and task.arguments.parameters - else [] - ) - - missing_parameter_values = [ - p.name - for p in task_parameters - if not p.value - and not p.default - and p.description - and p.description.title().startswith("Required") - ] + task_parameters = list(task.arguments.parameters) if task.arguments and task.arguments.parameters else [] + + missing_parameter_values = [p.name for p in task_parameters + if not p.value and not p.default and p.description + and p.description.title().startswith("Required")] if missing_parameter_values: - raise ApiError( - f"Missing required task parameters {missing_parameter_values}", 422 - ) + raise ApiError(f"Missing required task parameters {missing_parameter_values}", 422) for p in task_parameters: if type(p.value) == str and p.value.startswith("{{inputs.parameters."): - match = re.match( - r"{{inputs.parameters.(?P\w+)}}", - p.value, - ) + match = re.match(r"{{inputs.parameters.(?P\w+)}}", p.value) if not match: - raise ApiError( - f"Cannot match pipeline input.parameter '{p.value}'", 422 - ) + raise ApiError(f"Cannot match pipeline input.parameter '{p.value}'", 422) - pipeline_param_ref = match.groupdict().get( - "pipeline_parameter_name" - ) + pipeline_param_ref = match.groupdict().get("pipeline_parameter_name") parameters.append(f"{p.name} = {pipeline_param_ref}") else: @@ -321,19 +251,14 @@ def generate_custom_pipeline_function_body( parameters.append(arg) else: - raise ApiError( - f"Unknown or unsupported artifact_type '{task.artifact_type}':\n'{task}'", - 422, - ) + raise ApiError(f"Unknown or unsupported artifact_type '{task.artifact_type}':\n'{task}'", 422) comp_name = "comp_" + re.sub(r"\W+", "_", task.name, flags=re.ASCII).lower() op_name = "op_" + re.sub(r"\W+", "_", task.name, flags=re.ASCII).lower() - template_url = get_object_url( - bucket_name="mlpipeline", - prefix=component_s3_prefix, - file_extensions=[".yaml", ".yml"], - ) + template_url = get_object_url(bucket_name="mlpipeline", + prefix=component_s3_prefix, + file_extensions=[".yaml", ".yml"]) if not template_url: raise ApiError(f"Could not find component template '{component_s3_prefix}'") @@ -342,7 +267,7 @@ def generate_custom_pipeline_function_body( "comp_name": comp_name, "op_name": op_name, "template_url": template_url, - "component_args": ", ".join(parameters), + "component_args": ", ".join(parameters) } template_rendered = Template(component_template_raw).substitute(substitutions) function_body += template_rendered @@ -350,48 +275,30 @@ def generate_custom_pipeline_function_body( for task in custom_pipeline.dag.tasks: for required_task_name in task.dependencies or []: substitutions = { - "op_name": "op_" - + re.sub(r"\W+", "_", task.name, flags=re.ASCII).lower(), - "required_op_name": "op_" - + re.sub(r"\W+", "_", required_task_name, flags=re.ASCII).lower(), + "op_name": "op_" + re.sub(r"\W+", "_", task.name, flags=re.ASCII).lower(), + "required_op_name": "op_" + re.sub(r"\W+", "_", required_task_name, flags=re.ASCII).lower() } - template_rendered = Template(op_dependency_template_raw).substitute( - substitutions - ) + template_rendered = Template(op_dependency_template_raw).substitute(substitutions) function_body += template_rendered return function_body -def generate_custom_pipeline_run_script( - custom_pipeline: ApiPipelineCustom, - run_parameters=dict(), - run_name: str = None, - hide_secrets=True, -): +def generate_custom_pipeline_run_script(custom_pipeline: ApiPipelineCustom, run_parameters=dict(), + run_name: str = None, hide_secrets=True): name = custom_pipeline.name description = (custom_pipeline.description or "").strip() - pipeline_method_args = generate_pipeline_method_args( - custom_pipeline.inputs.parameters - ) + pipeline_method_args = generate_pipeline_method_args(custom_pipeline.inputs.parameters) - parameter_dict = json.dumps( - { - p.name: run_parameters.get(p.name) or p.value or p.default # or "" - for p in custom_pipeline.inputs.parameters - }, - indent=4, - ).replace(": null", ": None") + parameter_dict = json.dumps({p.name: run_parameters.get(p.name) or p.value or p.default # or "" + for p in custom_pipeline.inputs.parameters}, + indent=4).replace(': null', ': None') - pipeline_function_body = generate_custom_pipeline_function_body( - custom_pipeline, hide_secrets - ) + pipeline_function_body = generate_custom_pipeline_function_body(custom_pipeline, hide_secrets) - pipeline_server = ( - "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - ) + pipeline_server = "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" run_name = run_name or custom_pipeline.name @@ -399,7 +306,7 @@ def generate_custom_pipeline_run_script( template_file = f"run_pipeline.TEMPLATE.py" - with open(join(CODE_TEMPLATE_DIR, template_file), "r") as f: + with open(join(CODE_TEMPLATE_DIR, template_file), 'r') as f: template_raw = f.read() template_rendered = Template(template_raw).substitute(substitutions) @@ -409,13 +316,8 @@ def generate_custom_pipeline_run_script( return run_script -def generate_dataset_run_script( - dataset: ApiDataset, - dataset_template_url, - run_parameters=dict(), - run_name: str = None, - fail_on_missing_prereqs=False, -): +def generate_dataset_run_script(dataset: ApiDataset, dataset_template_url, run_parameters=dict(), + run_name: str = None, fail_on_missing_prereqs=False): name = f"{dataset.name} ({generate_id(length=4)})" description = dataset.description.strip().replace("'", "\\'") @@ -424,10 +326,8 @@ def generate_dataset_run_script( # dataset_parameters = dataset.parameters # TODO: ApiParameters should not be defined here - dataset_parameters = [ - ApiParameter(name="action", default="create"), - ApiParameter(name="namespace", default=_namespace), - ] + dataset_parameters = [ApiParameter(name="action", default="create"), + ApiParameter(name="namespace", default=_namespace)] pipeline_method_args = generate_pipeline_method_args(dataset_parameters) @@ -436,26 +336,23 @@ def generate_dataset_run_script( # TODO: the action parameter is required by DLF-to-PVC op, so it should not be dynamically generated here parameter_dict = { "action": "create", - "namespace": run_parameters.get("namespace", _namespace), + "namespace": run_parameters.get("namespace", _namespace) } - # see component name at https://github.com/machine-learning-exchange/mlx/blob/main/components/component-samples/dax-to-dlf/component.yaml#L1 # noqa: E501 + # see component name at + # https://github.com/machine-learning-exchange/mlx/blob/main/components/component-samples/dax-to-dlf/component.yaml#L1 dax_to_dlf_component_id = generate_id(name="Generate Dataset Metadata") - # see component name at https://github.com/machine-learning-exchange/mlx/blob/main/components/component-samples/dlf/component.yaml#L1 # noqa: E501 + # see component name at https://github.com/machine-learning-exchange/mlx/blob/main/components/component-samples/dlf/component.yaml#L1 dlf_to_pvc_component_id = generate_id(name="Create Dataset Volume") - dax_to_dlf_component_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"components/{dax_to_dlf_component_id}/", - file_extensions=[".yaml"], - ) + dax_to_dlf_component_url = get_object_url(bucket_name="mlpipeline", + prefix=f"components/{dax_to_dlf_component_id}/", + file_extensions=[".yaml"]) - dlf_to_pvc_component_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"components/{dlf_to_pvc_component_id}/", - file_extensions=[".yaml"], - ) + dlf_to_pvc_component_url = get_object_url(bucket_name="mlpipeline", + prefix=f"components/{dlf_to_pvc_component_id}/", + file_extensions=[".yaml"]) if fail_on_missing_prereqs: @@ -467,17 +364,15 @@ def generate_dataset_run_script( namespace = run_parameters.get("namespace", _namespace) - pipeline_server = ( - "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - ) + pipeline_server = "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - run_name = (run_name or "").replace("'", '"') or dataset.name + run_name = (run_name or "").replace("'", "\"") or dataset.name substitutions = dict(locals()) template_file = f"run_dataset.TEMPLATE.py" - with open(join(CODE_TEMPLATE_DIR, template_file), "r") as f: + with open(join(CODE_TEMPLATE_DIR, template_file), 'r') as f: template_raw = f.read() template_rendered = Template(template_raw).substitute(substitutions) @@ -487,43 +382,27 @@ def generate_dataset_run_script( return run_script -def generate_model_run_script( - model: ApiModel, - pipeline_stage: str, - execution_platform: str, - run_name: str = None, - parameters=dict(), - hide_secrets=True, -): - - if ( - pipeline_stage == "serve" - and model.servable_credentials_required - or pipeline_stage == "train" - and model.trainable_credentials_required - ): - - template_file = ( - f"{pipeline_stage}_{execution_platform.lower()}_w_credentials.TEMPLATE.py" - ) +def generate_model_run_script(model: ApiModel, pipeline_stage: str, execution_platform: str, + run_name: str = None, parameters=dict(), hide_secrets=True): + + if pipeline_stage == "serve" and model.servable_credentials_required or \ + pipeline_stage == "train" and model.trainable_credentials_required: + + template_file = f"{pipeline_stage}_{execution_platform.lower()}_w_credentials.TEMPLATE.py" else: template_file = f"{pipeline_stage}_{execution_platform.lower()}.TEMPLATE.py" - with open(join(CODE_TEMPLATE_DIR, template_file), "r") as f: + with open(join(CODE_TEMPLATE_DIR, template_file), 'r') as f: template_raw = f.read() - pipeline_server = ( - "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" - ) + pipeline_server = "" if "POD_NAMESPACE" in os.environ else f"'{_pipeline_service_url}'" substitutions = { "model_identifier": model.id, "pipeline_server": pipeline_server, # "model_name": "maintenance-model-pg", # TODO: generate_id(name=model.name), "run_name": run_name or model.id, - "generated_secret": "" - if hide_secrets - else f"secret-{generate_id(length=8).lower()}", + "generated_secret": "" if hide_secrets else f"secret-{generate_id(length=8).lower()}" } model_parameters = [] @@ -544,65 +423,51 @@ def generate_model_run_script( return run_script -def generate_notebook_run_script( - api_notebook: ApiNotebook, - parameters: dict = {}, - run_name: str = None, - hide_secrets: bool = True, -): +def generate_notebook_run_script(api_notebook: ApiNotebook, + parameters: dict = {}, + run_name: str = None, + hide_secrets: bool = True): if "dataset_pvc" in parameters: template_file = "run_notebook_with_dataset.TEMPLATE.py" else: template_file = "run_notebook.TEMPLATE.py" - with open(join(CODE_TEMPLATE_DIR, template_file), "r") as f: + with open(join(CODE_TEMPLATE_DIR, template_file), 'r') as f: template_raw = f.read() notebook_file = api_notebook.url.split("/")[-1] - requirements_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_extensions=[".txt"], - file_name_filter="requirements", - ) + requirements_url = get_object_url(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_extensions=[".txt"], + file_name_filter="requirements") - cos_dependencies_archive_url = get_object_url( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_extensions=[".tar.gz"], - file_name_filter="elyra-dependencies-archive", - ) + cos_dependencies_archive_url = get_object_url(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_extensions=[".tar.gz"], + file_name_filter="elyra-dependencies-archive") if not cos_dependencies_archive_url: - tar, bytes_io = create_tarfile( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_extensions=[".ipynb"], - ) + tar, bytes_io = create_tarfile(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_extensions=[".ipynb"]) - cos_dependencies_archive_url = store_file( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_name="elyra-dependencies-archive.tar.gz", - file_content=bytes_io.getvalue(), - ) + cos_dependencies_archive_url = store_file(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_name="elyra-dependencies-archive.tar.gz", + file_content=bytes_io.getvalue()) cos_dependencies_archive = cos_dependencies_archive_url.split("/")[-1] # TODO: move this into a ApiNotebook.image as opposed to parsing yaml here - yaml_file_content = retrieve_file_content( - bucket_name="mlpipeline", - prefix=f"notebooks/{api_notebook.id}/", - file_extensions=[".yaml", ".yml"], - ) + yaml_file_content = retrieve_file_content(bucket_name="mlpipeline", + prefix=f"notebooks/{api_notebook.id}/", + file_extensions=[".yaml", ".yml"]) metadata_yaml = yaml.load(yaml_file_content, Loader=yaml.FullLoader) - image = metadata_yaml["implementation"]["github"].get( - "image", "tensorflow/tensorflow:latest" - ) + image = metadata_yaml["implementation"]["github"].get("image", "tensorflow/tensorflow:latest") # TODO: elyra-ai/kfp-notebook generates output notebook as: "-output.ipynb" # https://github.com/elyra-ai/kfp-notebook/blob/c8f1298/etc/docker-scripts/bootstrapper.py#L188-L190 @@ -613,7 +478,7 @@ def generate_notebook_run_script( # output_file_url = f"http://{minio_host}:{minio_port}/mlpipeline/{output_file_path}" # TODO: do we really need this url: - # client = TektonClient(${pipeline_server}) # noqa: E999 + # client = TektonClient(${pipeline_server}) # vs: # client = TektonClient() # ... kfp.Client can figure out the in-cluster IP and port automatically @@ -632,63 +497,44 @@ def generate_notebook_run_script( "requirements_url": requirements_url or "", "image": image, "pipeline_server": kfp_url, - "run_name": run_name or api_notebook.name, + "run_name": run_name or api_notebook.name } # TODO: make the `dataset_pvc` and `mount_path` parameters part of the Swagger spec? if "dataset_pvc" in parameters: - substitutions.update( - { - "dataset_pvc": parameters["dataset_pvc"], - "mount_path": parameters.get("mount_path", "/tmp/data"), - } - ) + substitutions.update({ + "dataset_pvc": parameters["dataset_pvc"], + "mount_path": parameters.get("mount_path", "/tmp/data") + }) if not hide_secrets: - substitutions.update( - { - "cos_endpoint": f"http://{minio_host}:{minio_port}/minio", - "cos_username": minio_access_key, - "cos_password": minio_secret_key, - } - ) + substitutions.update({ + "cos_endpoint": f"http://{minio_host}:{minio_port}/minio", + "cos_username": minio_access_key, + "cos_password": minio_secret_key + }) run_script = Template(template_raw).substitute(substitutions) return run_script -def run_component_in_experiment( - component: ApiComponent, - component_template_url: str, - parameters: dict, - run_name: str = None, - wait_for_status: bool = False, -): +def run_component_in_experiment(component: ApiComponent, component_template_url: str, parameters: dict, + run_name: str = None, wait_for_status: bool = False): - source_code = generate_component_run_script( - component, component_template_url, parameters, run_name - ) + source_code = generate_component_run_script(component, component_template_url, parameters, run_name) return run_code_in_experiment(source_code, wait_for_status) -def run_custom_pipeline_in_experiment( - custom_pipeline: ApiPipelineCustom, - run_name: str, - parameters: dict, - wait_for_status: bool = False, -): +def run_custom_pipeline_in_experiment(custom_pipeline: ApiPipelineCustom, run_name: str, parameters: dict, + wait_for_status: bool = False): try: - source_code = generate_custom_pipeline_run_script( - custom_pipeline, parameters, run_name, hide_secrets=False - ) + source_code = generate_custom_pipeline_run_script(custom_pipeline, parameters, run_name, hide_secrets=False) except Exception as e: # TODO: remove this debug logging for development only - print( - f"Error trying to generate code for custom pipeline run '{run_name or custom_pipeline.name}': {e}" - ) + print(f"Error trying to generate code for custom pipeline run '{run_name or custom_pipeline.name}': {e}") print(custom_pipeline) print(parameters) raise e @@ -697,21 +543,17 @@ def run_custom_pipeline_in_experiment( run_id = run_code_in_experiment(source_code, wait_for_status) except SyntaxError as e: - print( - f"SyntaxError trying to run pipeline DSL '{run_name or custom_pipeline.name}': {e}" - ) + print(f"SyntaxError trying to run pipeline DSL '{run_name or custom_pipeline.name}': {e}") print(source_code) print("Custom pipeline payload:") print(custom_pipeline) - raise ApiError( - f"SyntaxError trying to run pipeline DSL: {e.msg}\n" f"{source_code}", 500 - ) + raise ApiError(f"SyntaxError trying to run pipeline DSL: {e.msg}\n" + f"{source_code}", + 500) except Exception as e: # TODO: remove this debug logging for development only - print( - f"Error trying to run custom pipeline code '{run_name or custom_pipeline.name}': {e}" - ) + print(f"Error trying to run custom pipeline code '{run_name or custom_pipeline.name}': {e}") print(custom_pipeline) print(source_code) raise e @@ -725,107 +567,61 @@ def run_custom_pipeline_in_experiment( return run_id -def run_dataset_in_experiment( - dataset: ApiDataset, - dataset_template_url: str, - parameters: dict = {}, - run_name: str = None, - wait_for_status: bool = False, -): +def run_dataset_in_experiment(dataset: ApiDataset, dataset_template_url: str, parameters: dict = {}, + run_name: str = None, wait_for_status: bool = False): - source_code = generate_dataset_run_script( - dataset, - dataset_template_url, - parameters, - run_name, - fail_on_missing_prereqs=True, - ) + source_code = generate_dataset_run_script(dataset, dataset_template_url, parameters, run_name, + fail_on_missing_prereqs=True) return run_code_in_experiment(source_code, wait_for_status) -def run_model_in_experiment( - model: ApiModel, - pipeline_stage: str, - execution_platform: str, - run_name: str = None, - parameters: dict = None, - wait_for_status: bool = False, -): - - source_code = generate_model_run_script( - model, - pipeline_stage, - execution_platform.lower(), - run_name, - parameters, - hide_secrets=False, - ) +def run_model_in_experiment(model: ApiModel, pipeline_stage: str, execution_platform: str, run_name: str = None, + parameters: dict = None, wait_for_status: bool = False): + + source_code = generate_model_run_script(model, pipeline_stage, execution_platform.lower(), run_name, parameters, + hide_secrets=False) return run_code_in_experiment(source_code, wait_for_status) -def run_notebook_in_experiment( - notebook: ApiNotebook, - parameters: dict, - run_name: str, - wait_for_status: bool = False, -): +def run_notebook_in_experiment(notebook: ApiNotebook, parameters: dict, run_name: str, + wait_for_status: bool = False): - source_code = generate_notebook_run_script( - notebook, parameters, run_name, hide_secrets=False - ) + source_code = generate_notebook_run_script(notebook, parameters, run_name, hide_secrets=False) return run_code_in_experiment(source_code, wait_for_status) -def run_pipeline_in_experiment( - api_pipeline: ApiPipeline, - parameters: dict = None, - run_name: str = None, - namespace: str = None, - wait_for_status: bool = False, -): +def run_pipeline_in_experiment(api_pipeline: ApiPipeline, parameters: dict = None, run_name: str = None, + namespace: str = None, wait_for_status: bool = False): try: client = KfpClient() # if not namespace: ... client._context_setting['namespace'] and client.get_kfp_healthz().multi_user is True: - experiment = client.create_experiment("PIPELINE_RUNS", namespace=namespace) - run_result = client.run_pipeline( - experiment_id=experiment.id, - job_name=run_name or api_pipeline.name, - params=parameters, - pipeline_id=api_pipeline.id, - ) + experiment = client.create_experiment('PIPELINE_RUNS', namespace=namespace) + run_result = client.run_pipeline(experiment_id=experiment.id, + job_name=run_name or api_pipeline.name, + params=parameters, + pipeline_id=api_pipeline.id) run_id = run_result.id if wait_for_status: run_details = wait_for_run_status(client, run_id, 10) - run_status = json.loads(run_details.pipeline_runtime.workflow_manifest)[ - "status" - ] - - if ( - run_status - and run_status.get("phase", "").lower() in ["failed", "error"] - and run_status.get("message") - ): - raise RuntimeError( - f"Run {run_id} failed with error: {run_status['message']}" - ) + run_status = json.loads(run_details.pipeline_runtime.workflow_manifest)["status"] + + if run_status \ + and run_status.get("phase", "").lower() in ["failed", "error"] \ + and run_status.get("message"): + raise RuntimeError(f"Run {run_id} failed with error: {run_status['message']}") return run_id except Exception as e: - print( - f"Exception trying to run pipeline {api_pipeline.id} '{api_pipeline.name}'" - f" with parameters {parameters}:" - f" %s\n" % e - ) - raise ApiError( - message=f"{e.body}\nKFP URL: {_pipeline_service_url}", - http_status_code=e.status or 422, - ) + print(f"Exception trying to run pipeline {api_pipeline.id} '{api_pipeline.name}'" + f" with parameters {parameters}:" + f" %s\n" % e) + raise ApiError(message=f"{e.body}\nKFP URL: {_pipeline_service_url}", http_status_code=e.status or 422) return None @@ -839,14 +635,8 @@ def run_code_in_experiment(source_code: str, wait_for_status=False) -> str: except SyntaxError as e: print(f"SyntaxError trying to run_code_in_experiment: {e}") - print( - "\n".join( - [ - "{}{:3d}: {}".format(">" if n + 1 == e.lineno else " ", n + 1, l) - for n, l in enumerate(source_code.splitlines()) - ] - ) - ) + print("\n".join(["{}{:3d}: {}".format(">" if n + 1 == e.lineno else " ", n + 1, l) + for n, l in enumerate(source_code.splitlines())])) # raise ApiError(f"SyntaxError trying to run_code_in_experiment: {e.msg}\n" # f"{source_code}", 500) # don't reveal internal code template to users @@ -858,21 +648,15 @@ def run_code_in_experiment(source_code: str, wait_for_status=False) -> str: if wait_for_status: - client: KfpClient = exec_locals["client"] + client: KfpClient = exec_locals['client'] run_details = wait_for_run_status(client, run_id, 10) - run_status = json.loads(run_details.pipeline_runtime.workflow_manifest)[ - "status" - ] - - if ( - run_status - and run_status.get("phase", "").lower() in ["failed", "error"] - and run_status.get("message") - ): - - raise RuntimeError( - f"Run {run_id} failed with error: {run_status['message']}" - ) + run_status = json.loads(run_details.pipeline_runtime.workflow_manifest)["status"] + + if run_status \ + and run_status.get("phase", "").lower() in ["failed", "error"] \ + and run_status.get("message"): + + raise RuntimeError(f"Run {run_id} failed with error: {run_status['message']}") return run_id diff --git a/api/server/swagger_server/gateways/kubernetes_service.py b/api/server/swagger_server/gateways/kubernetes_service.py index 11755819..600d267b 100644 --- a/api/server/swagger_server/gateways/kubernetes_service.py +++ b/api/server/swagger_server/gateways/kubernetes_service.py @@ -6,8 +6,8 @@ import subprocess from base64 import b64decode -from os import environ as env # noqa: F401 -from pprint import pprint # noqa: F401 +from os import environ as env +from pprint import pprint from swagger_server.util import ApiError @@ -18,22 +18,14 @@ def create_secret(secret_name: str, secret_contents: dict): try: - command = [ - "kubectl", - "-n", - _namespace, - "create", - "secret", - "generic", - secret_name, - ] + command = ['kubectl', '-n', _namespace, 'create', 'secret', 'generic', secret_name] for key, value in secret_contents.items(): if type(value) == dict: raise ApiError(f"Secret values must not be of type 'dict'") if type(value) == list: value = ",".join([str(v) for v in value]) if type(value) == str and " " in value: - value = f'"{value}"' + value = f"\"{value}\"" command.append(f"--from-literal={key}={value or ''}") output = subprocess.run(command, capture_output=True, check=True, timeout=10) pprint(output.stdout.decode()) @@ -48,10 +40,8 @@ def delete_secret(secret_name): return delete_all_secrets() output = None try: - delete_command = ["kubectl", "delete", "-n", _namespace, "secret", secret_name] - output = subprocess.run( - delete_command, capture_output=True, check=True, timeout=10 - ) + delete_command = ['kubectl', 'delete', '-n', _namespace, 'secret', secret_name] + output = subprocess.run(delete_command, capture_output=True, check=True, timeout=10) print(f"Credential {secret_name} was deleted") except Exception as e: if output and output.stderr: @@ -69,19 +59,8 @@ def delete_all_secrets(name_prefix=secret_name_prefix): def get_secret(secret_name, decode=False) -> dict: output = None try: - get_command = [ - "kubectl", - "-n", - _namespace, - "-o", - "json", - "get", - "secret", - secret_name, - ] - output = subprocess.run( - get_command, capture_output=True, check=True, timeout=10 - ) + get_command = ['kubectl', '-n', _namespace, '-o', 'json', 'get', 'secret', secret_name] + output = subprocess.run(get_command, capture_output=True, check=True, timeout=10) secret_data = json.loads(output.stdout.decode()) or {} secret = secret_data.get("data") if decode: @@ -97,16 +76,11 @@ def get_secret(secret_name, decode=False) -> dict: def list_secrets(name_prefix=secret_name_prefix, decode=False) -> [dict]: output = None try: - list_command = ["kubectl", "-n", _namespace, "-o", "json", "get", "secrets"] - output = subprocess.run( - list_command, capture_output=True, check=True, timeout=10 - ) + list_command = ['kubectl', '-n', _namespace, '-o', 'json', 'get', 'secrets'] + output = subprocess.run(list_command, capture_output=True, check=True, timeout=10) secrets_data = json.loads(output.stdout.decode()) or {} - mlx_secrets = [ - d - for d in secrets_data.get("items") or [] - if d["metadata"]["name"].startswith(name_prefix) - ] + mlx_secrets = [d for d in secrets_data.get("items") or [] + if d["metadata"]["name"].startswith(name_prefix)] if decode: for s in mlx_secrets: for k, v in s["data"].items(): diff --git a/api/server/swagger_server/models/__init__.py b/api/server/swagger_server/models/__init__.py index 4d693f2f..1b79a5d3 100644 --- a/api/server/swagger_server/models/__init__.py +++ b/api/server/swagger_server/models/__init__.py @@ -5,7 +5,6 @@ # flake8: noqa from __future__ import absolute_import - # import models into model package from swagger_server.models.any_value import AnyValue from swagger_server.models.api_access_token import ApiAccessToken @@ -15,31 +14,20 @@ from swagger_server.models.api_model import ApiModel from swagger_server.models.api_notebook import ApiNotebook from swagger_server.models.api_pipeline import ApiPipeline - # import ApiAsset(s) before ApiCatalog... classes to prevent circular import errors from swagger_server.models.api_catalog_upload import ApiCatalogUpload from swagger_server.models.api_catalog_upload_item import ApiCatalogUploadItem from swagger_server.models.api_credential import ApiCredential from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse -from swagger_server.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) +from swagger_server.models.api_generate_model_code_response import ApiGenerateModelCodeResponse from swagger_server.models.api_get_template_response import ApiGetTemplateResponse from swagger_server.models.api_inferenceservice import ApiInferenceservice -from swagger_server.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_server.models.api_list_catalog_upload_errors import ( - ApiListCatalogUploadErrors, -) +from swagger_server.models.api_list_catalog_items_response import ApiListCatalogItemsResponse +from swagger_server.models.api_list_catalog_upload_errors import ApiListCatalogUploadErrors from swagger_server.models.api_list_components_response import ApiListComponentsResponse -from swagger_server.models.api_list_credentials_response import ( # noqa: F401 - ApiListCredentialsResponse, -) +from swagger_server.models.api_list_credentials_response import ApiListCredentialsResponse from swagger_server.models.api_list_datasets_response import ApiListDatasetsResponse -from swagger_server.models.api_list_inferenceservices_response import ( # noqa: F401 - ApiListInferenceservicesResponse, -) +from swagger_server.models.api_list_inferenceservices_response import ApiListInferenceservicesResponse from swagger_server.models.api_list_models_response import ApiListModelsResponse from swagger_server.models.api_list_notebooks_response import ApiListNotebooksResponse from swagger_server.models.api_list_pipelines_response import ApiListPipelinesResponse @@ -49,9 +37,7 @@ from swagger_server.models.api_model_script import ApiModelScript from swagger_server.models.api_parameter import ApiParameter from swagger_server.models.api_pipeline_custom import ApiPipelineCustom -from swagger_server.models.api_pipeline_custom_run_payload import ( - ApiPipelineCustomRunPayload, -) +from swagger_server.models.api_pipeline_custom_run_payload import ApiPipelineCustomRunPayload from swagger_server.models.api_pipeline_dag import ApiPipelineDAG from swagger_server.models.api_pipeline_extension import ApiPipelineExtension from swagger_server.models.api_pipeline_inputs import ApiPipelineInputs diff --git a/api/server/swagger_server/models/any_value.py b/api/server/swagger_server/models/any_value.py index 624ed613..e6fe3345 100644 --- a/api/server/swagger_server/models/any_value.py +++ b/api/server/swagger_server/models/any_value.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class AnyValue(Model): @@ -19,13 +19,17 @@ class AnyValue(Model): """ def __init__(self): # noqa: E501 - """AnyValue - a model defined in Swagger""" - self.swagger_types = {} + """AnyValue - a model defined in Swagger - self.attribute_map = {} + """ + self.swagger_types = { + } + + self.attribute_map = { + } @classmethod - def from_dict(cls, dikt) -> "AnyValue": + def from_dict(cls, dikt) -> 'AnyValue': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_access_token.py b/api/server/swagger_server/models/api_access_token.py index 4cab8d2f..2b296e84 100644 --- a/api/server/swagger_server/models/api_access_token.py +++ b/api/server/swagger_server/models/api_access_token.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiAccessToken(Model): @@ -26,15 +26,21 @@ def __init__(self, api_token: str = None, url_host: str = None): # noqa: E501 :param url_host: The url_host of this ApiAccessToken. # noqa: E501 :type url_host: str """ - self.swagger_types = {"api_token": str, "url_host": str} + self.swagger_types = { + 'api_token': str, + 'url_host': str + } - self.attribute_map = {"api_token": "api_token", "url_host": "url_host"} + self.attribute_map = { + 'api_token': 'api_token', + 'url_host': 'url_host' + } self._api_token = api_token self._url_host = url_host @classmethod - def from_dict(cls, dikt) -> "ApiAccessToken": + def from_dict(cls, dikt) -> 'ApiAccessToken': """Returns the dict as a model :param dikt: A dict. @@ -65,9 +71,7 @@ def api_token(self, api_token: str): :type api_token: str """ if api_token is None: - raise ValueError( - "Invalid value for `api_token`, must not be `None`" - ) + raise ValueError("Invalid value for `api_token`, must not be `None`") # noqa: E501 self._api_token = api_token @@ -92,8 +96,6 @@ def url_host(self, url_host: str): :type url_host: str """ if url_host is None: - raise ValueError( - "Invalid value for `url_host`, must not be `None`" - ) + raise ValueError("Invalid value for `url_host`, must not be `None`") # noqa: E501 self._url_host = url_host diff --git a/api/server/swagger_server/models/api_asset.py b/api/server/swagger_server/models/api_asset.py index c740ed89..c1a81ffd 100644 --- a/api/server/swagger_server/models/api_asset.py +++ b/api/server/swagger_server/models/api_asset.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiAsset(Model): @@ -18,17 +18,7 @@ class ApiAsset(Model): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - featured: bool = None, - publish_approved: bool = None, - related_assets: List[str] = None, - filter_categories: Dict[str, str] = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, featured: bool = None, publish_approved: bool = None, related_assets: List[str] = None, filter_categories: Dict[str, str] = None): # noqa: E501 """ApiAsset - a model defined in Swagger :param id: The id of this ApiAsset. # noqa: E501 @@ -49,25 +39,25 @@ def __init__( :type filter_categories: Dict[str, str] """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "featured": bool, - "publish_approved": bool, - "related_assets": List[str], - "filter_categories": Dict[str, str], + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'featured': bool, + 'publish_approved': bool, + 'related_assets': List[str], + 'filter_categories': Dict[str, str] } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories' } self._id = id @@ -80,7 +70,7 @@ def __init__( self._filter_categories = filter_categories @classmethod - def from_dict(cls, dikt) -> "ApiAsset": + def from_dict(cls, dikt) -> 'ApiAsset': """Returns the dict as a model :param dikt: A dict. @@ -151,9 +141,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -176,9 +164,7 @@ def description(self, description: str): :type description: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description diff --git a/api/server/swagger_server/models/api_catalog_upload.py b/api/server/swagger_server/models/api_catalog_upload.py index 1dea7ef1..bb9f1992 100644 --- a/api/server/swagger_server/models/api_catalog_upload.py +++ b/api/server/swagger_server/models/api_catalog_upload.py @@ -11,7 +11,7 @@ from swagger_server.models.api_access_token import ApiAccessToken from swagger_server.models.api_catalog_upload_item import ApiCatalogUploadItem from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiCatalogUpload(Model): @@ -20,15 +20,7 @@ class ApiCatalogUpload(Model): Do not edit the class manually. """ - def __init__( - self, - api_access_tokens: List[ApiAccessToken] = None, - components: List[ApiCatalogUploadItem] = None, - datasets: List[ApiCatalogUploadItem] = None, - models: List[ApiCatalogUploadItem] = None, - notebooks: List[ApiCatalogUploadItem] = None, - pipelines: List[ApiCatalogUploadItem] = None, - ): # noqa: E501 + def __init__(self, api_access_tokens: List[ApiAccessToken] = None, components: List[ApiCatalogUploadItem] = None, datasets: List[ApiCatalogUploadItem] = None, models: List[ApiCatalogUploadItem] = None, notebooks: List[ApiCatalogUploadItem] = None, pipelines: List[ApiCatalogUploadItem] = None): # noqa: E501 """ApiCatalogUpload - a model defined in Swagger :param api_access_tokens: The api_access_tokens of this ApiCatalogUpload. # noqa: E501 @@ -45,21 +37,21 @@ def __init__( :type pipelines: List[ApiCatalogUploadItem] """ self.swagger_types = { - "api_access_tokens": List[ApiAccessToken], - "components": List[ApiCatalogUploadItem], - "datasets": List[ApiCatalogUploadItem], - "models": List[ApiCatalogUploadItem], - "notebooks": List[ApiCatalogUploadItem], - "pipelines": List[ApiCatalogUploadItem], + 'api_access_tokens': List[ApiAccessToken], + 'components': List[ApiCatalogUploadItem], + 'datasets': List[ApiCatalogUploadItem], + 'models': List[ApiCatalogUploadItem], + 'notebooks': List[ApiCatalogUploadItem], + 'pipelines': List[ApiCatalogUploadItem] } self.attribute_map = { - "api_access_tokens": "api_access_tokens", - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", + 'api_access_tokens': 'api_access_tokens', + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines' } self._api_access_tokens = api_access_tokens @@ -70,7 +62,7 @@ def __init__( self._pipelines = pipelines @classmethod - def from_dict(cls, dikt) -> "ApiCatalogUpload": + def from_dict(cls, dikt) -> 'ApiCatalogUpload': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_catalog_upload_error.py b/api/server/swagger_server/models/api_catalog_upload_error.py index f21bf688..0ffcc01b 100644 --- a/api/server/swagger_server/models/api_catalog_upload_error.py +++ b/api/server/swagger_server/models/api_catalog_upload_error.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiCatalogUploadError(Model): @@ -18,13 +18,7 @@ class ApiCatalogUploadError(Model): Do not edit the class manually. """ - def __init__( - self, - name: str = None, - url: str = None, - error_message: str = None, - status_code: int = None, - ): # noqa: E501 + def __init__(self, name: str = None, url: str = None, error_message: str = None, status_code: int = None): # noqa: E501 """ApiCatalogUploadError - a model defined in Swagger :param name: The name of this ApiCatalogUploadError. # noqa: E501 @@ -37,17 +31,17 @@ def __init__( :type status_code: int """ self.swagger_types = { - "name": str, - "url": str, - "error_message": str, - "status_code": int, + 'name': str, + 'url': str, + 'error_message': str, + 'status_code': int } self.attribute_map = { - "name": "name", - "url": "url", - "error_message": "error_message", - "status_code": "status_code", + 'name': 'name', + 'url': 'url', + 'error_message': 'error_message', + 'status_code': 'status_code' } self._name = name @@ -56,7 +50,7 @@ def __init__( self._status_code = status_code @classmethod - def from_dict(cls, dikt) -> "ApiCatalogUploadError": + def from_dict(cls, dikt) -> 'ApiCatalogUploadError': """Returns the dict as a model :param dikt: A dict. @@ -108,9 +102,7 @@ def url(self, url: str): :type url: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url diff --git a/api/server/swagger_server/models/api_catalog_upload_item.py b/api/server/swagger_server/models/api_catalog_upload_item.py index 3408cac5..015cff6a 100644 --- a/api/server/swagger_server/models/api_catalog_upload_item.py +++ b/api/server/swagger_server/models/api_catalog_upload_item.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiCatalogUploadItem(Model): @@ -26,15 +26,21 @@ def __init__(self, name: str = None, url: str = None): # noqa: E501 :param url: The url of this ApiCatalogUploadItem. # noqa: E501 :type url: str """ - self.swagger_types = {"name": str, "url": str} + self.swagger_types = { + 'name': str, + 'url': str + } - self.attribute_map = {"name": "name", "url": "url"} + self.attribute_map = { + 'name': 'name', + 'url': 'url' + } self._name = name self._url = url @classmethod - def from_dict(cls, dikt) -> "ApiCatalogUploadItem": + def from_dict(cls, dikt) -> 'ApiCatalogUploadItem': """Returns the dict as a model :param dikt: A dict. @@ -86,8 +92,6 @@ def url(self, url: str): :type url: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url diff --git a/api/server/swagger_server/models/api_catalog_upload_response.py b/api/server/swagger_server/models/api_catalog_upload_response.py index be42a63e..d6d5a197 100644 --- a/api/server/swagger_server/models/api_catalog_upload_response.py +++ b/api/server/swagger_server/models/api_catalog_upload_response.py @@ -8,16 +8,9 @@ from typing import List, Dict # noqa: F401 -from swagger_server.models import ( - ApiComponent, - ApiDataset, - ApiModel, - ApiNotebook, - ApiPipeline, - ApiCatalogUploadError, -) +from swagger_server.models import ApiComponent, ApiDataset, ApiModel, ApiNotebook, ApiPipeline, ApiCatalogUploadError from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiCatalogUploadResponse(Model): @@ -26,19 +19,7 @@ class ApiCatalogUploadResponse(Model): Do not edit the class manually. """ - def __init__( - self, - components: List[ApiComponent] = None, - datasets: List[ApiDataset] = None, - models: List[ApiModel] = None, - notebooks: List[ApiNotebook] = None, - pipelines: List[ApiPipeline] = None, - total_size: int = None, - next_page_token: str = None, - errors: List[ApiCatalogUploadError] = None, - total_errors: int = None, - total_created: int = None, - ): # noqa: E501 + def __init__(self, components: List[ApiComponent] = None, datasets: List[ApiDataset] = None, models: List[ApiModel] = None, notebooks: List[ApiNotebook] = None, pipelines: List[ApiPipeline] = None, total_size: int = None, next_page_token: str = None, errors: List[ApiCatalogUploadError] = None, total_errors: int = None, total_created: int = None): # noqa: E501 """ApiCatalogUploadResponse - a model defined in Swagger :param components: The components of this ApiCatalogUploadResponse. # noqa: E501 @@ -63,29 +44,29 @@ def __init__( :type total_created: int """ self.swagger_types = { - "components": List[ApiComponent], - "datasets": List[ApiDataset], - "models": List[ApiModel], - "notebooks": List[ApiNotebook], - "pipelines": List[ApiPipeline], - "total_size": int, - "next_page_token": str, - "errors": List[ApiCatalogUploadError], - "total_errors": int, - "total_created": int, + 'components': List[ApiComponent], + 'datasets': List[ApiDataset], + 'models': List[ApiModel], + 'notebooks': List[ApiNotebook], + 'pipelines': List[ApiPipeline], + 'total_size': int, + 'next_page_token': str, + 'errors': List[ApiCatalogUploadError], + 'total_errors': int, + 'total_created': int } self.attribute_map = { - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", - "errors": "errors", - "total_errors": "total_errors", - "total_created": "total_created", + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token', + 'errors': 'errors', + 'total_errors': 'total_errors', + 'total_created': 'total_created' } self._components = components @@ -100,7 +81,7 @@ def __init__( self._total_created = total_created @classmethod - def from_dict(cls, dikt) -> "ApiCatalogUploadResponse": + def from_dict(cls, dikt) -> 'ApiCatalogUploadResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_component.py b/api/server/swagger_server/models/api_component.py index e4cd0bb2..5be8b6fd 100644 --- a/api/server/swagger_server/models/api_component.py +++ b/api/server/swagger_server/models/api_component.py @@ -11,7 +11,7 @@ from swagger_server.models.api_asset import ApiAsset from swagger_server.models.api_metadata import ApiMetadata # noqa: F401,E501 from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiComponent(ApiAsset): @@ -20,19 +20,7 @@ class ApiComponent(ApiAsset): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - featured: bool = None, - publish_approved: bool = None, - related_assets: List[str] = None, - filter_categories: Dict[str, str] = None, - metadata: ApiMetadata = None, - parameters: List[ApiParameter] = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, featured: bool = None, publish_approved: bool = None, related_assets: List[str] = None, filter_categories: Dict[str, str] = None, metadata: ApiMetadata = None, parameters: List[ApiParameter] = None): # noqa: E501 """ApiComponent - a model defined in Swagger :param id: The id of this ApiComponent. # noqa: E501 @@ -57,29 +45,29 @@ def __init__( :type parameters: List[ApiParameter] """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "featured": bool, - "publish_approved": bool, - "related_assets": List[str], - "filter_categories": Dict[str, str], - "metadata": ApiMetadata, - "parameters": List[ApiParameter], + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'featured': bool, + 'publish_approved': bool, + 'related_assets': List[str], + 'filter_categories': Dict[str, str], + 'metadata': ApiMetadata, + 'parameters': List[ApiParameter] } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "metadata": "metadata", - "parameters": "parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'metadata': 'metadata', + 'parameters': 'parameters' } self._id = id @@ -94,7 +82,7 @@ def __init__( self._parameters = parameters @classmethod - def from_dict(cls, dikt) -> "ApiComponent": + def from_dict(cls, dikt) -> 'ApiComponent': """Returns the dict as a model :param dikt: A dict. @@ -165,9 +153,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -190,9 +176,7 @@ def description(self, description: str): :type description: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description diff --git a/api/server/swagger_server/models/api_credential.py b/api/server/swagger_server/models/api_credential.py index 8fe75d46..458a5db8 100644 --- a/api/server/swagger_server/models/api_credential.py +++ b/api/server/swagger_server/models/api_credential.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiCredential(Model): @@ -18,15 +18,7 @@ class ApiCredential(Model): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - pipeline_id: str = None, - project_id: str = None, - api_key: str = None, - data_assets: List[str] = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, pipeline_id: str = None, project_id: str = None, api_key: str = None, data_assets: List[str] = None): # noqa: E501 """ApiCredential - a model defined in Swagger :param id: The id of this ApiCredential. # noqa: E501 @@ -43,21 +35,21 @@ def __init__( :type data_assets: List[str] """ self.swagger_types = { - "id": str, - "created_at": datetime, - "pipeline_id": str, - "project_id": str, - "api_key": str, - "data_assets": List[str], + 'id': str, + 'created_at': datetime, + 'pipeline_id': str, + 'project_id': str, + 'api_key': str, + 'data_assets': List[str] } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "pipeline_id": "pipeline_id", - "project_id": "project_id", - "api_key": "api_key", - "data_assets": "data_assets", + 'id': 'id', + 'created_at': 'created_at', + 'pipeline_id': 'pipeline_id', + 'project_id': 'project_id', + 'api_key': 'api_key', + 'data_assets': 'data_assets' } self._id = id @@ -68,7 +60,7 @@ def __init__( self._data_assets = data_assets @classmethod - def from_dict(cls, dikt) -> "ApiCredential": + def from_dict(cls, dikt) -> 'ApiCredential': """Returns the dict as a model :param dikt: A dict. @@ -139,9 +131,7 @@ def pipeline_id(self, pipeline_id: str): :type pipeline_id: str """ if pipeline_id is None: - raise ValueError( - "Invalid value for `pipeline_id`, must not be `None`" - ) + raise ValueError("Invalid value for `pipeline_id`, must not be `None`") # noqa: E501 self._pipeline_id = pipeline_id @@ -164,9 +154,7 @@ def project_id(self, project_id: str): :type project_id: str """ if project_id is None: - raise ValueError( - "Invalid value for `project_id`, must not be `None`" - ) + raise ValueError("Invalid value for `project_id`, must not be `None`") # noqa: E501 self._project_id = project_id diff --git a/api/server/swagger_server/models/api_dataset.py b/api/server/swagger_server/models/api_dataset.py index 70fb6e4b..81570794 100644 --- a/api/server/swagger_server/models/api_dataset.py +++ b/api/server/swagger_server/models/api_dataset.py @@ -11,7 +11,7 @@ from swagger_server.models.api_asset import ApiAsset from swagger_server.models.api_metadata import ApiMetadata # noqa: F401,E501 from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiDataset(ApiAsset): @@ -20,23 +20,7 @@ class ApiDataset(ApiAsset): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - featured: bool = None, - publish_approved: bool = None, - related_assets: List[str] = None, - filter_categories: Dict[str, str] = None, - domain: str = None, - format: str = None, - size: str = None, - number_of_records: int = None, - license: str = None, - metadata: ApiMetadata = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, featured: bool = None, publish_approved: bool = None, related_assets: List[str] = None, filter_categories: Dict[str, str] = None, domain: str = None, format: str = None, size: str = None, number_of_records: int = None, license: str = None, metadata: ApiMetadata = None): # noqa: E501 """ApiDataset - a model defined in Swagger :param id: The id of this ApiDataset. # noqa: E501 @@ -69,37 +53,37 @@ def __init__( :type metadata: ApiMetadata """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "featured": bool, - "publish_approved": bool, - "related_assets": List[str], - "filter_categories": Dict[str, str], - "domain": str, - "format": str, - "size": str, - "number_of_records": int, - "license": str, - "metadata": ApiMetadata, + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'featured': bool, + 'publish_approved': bool, + 'related_assets': List[str], + 'filter_categories': Dict[str, str], + 'domain': str, + 'format': str, + 'size': str, + 'number_of_records': int, + 'license': str, + 'metadata': ApiMetadata } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "domain": "domain", - "format": "format", - "size": "size", - "number_of_records": "number_of_records", - "license": "license", - "metadata": "metadata", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'domain': 'domain', + 'format': 'format', + 'size': 'size', + 'number_of_records': 'number_of_records', + 'license': 'license', + 'metadata': 'metadata' } self._id = id @@ -118,7 +102,7 @@ def __init__( self._metadata = metadata @classmethod - def from_dict(cls, dikt) -> "ApiDataset": + def from_dict(cls, dikt) -> 'ApiDataset': """Returns the dict as a model :param dikt: A dict. @@ -189,9 +173,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -214,9 +196,7 @@ def description(self, description: str): :type description: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description diff --git a/api/server/swagger_server/models/api_generate_code_response.py b/api/server/swagger_server/models/api_generate_code_response.py index 03ccfc3c..28173af5 100644 --- a/api/server/swagger_server/models/api_generate_code_response.py +++ b/api/server/swagger_server/models/api_generate_code_response.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiGenerateCodeResponse(Model): @@ -24,14 +24,18 @@ def __init__(self, script: str = None): # noqa: E501 :param script: The script of this ApiGenerateCodeResponse. # noqa: E501 :type script: str """ - self.swagger_types = {"script": str} + self.swagger_types = { + 'script': str + } - self.attribute_map = {"script": "script"} + self.attribute_map = { + 'script': 'script' + } self._script = script @classmethod - def from_dict(cls, dikt) -> "ApiGenerateCodeResponse": + def from_dict(cls, dikt) -> 'ApiGenerateCodeResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_generate_model_code_response.py b/api/server/swagger_server/models/api_generate_model_code_response.py index 8c97013c..61ae250b 100644 --- a/api/server/swagger_server/models/api_generate_model_code_response.py +++ b/api/server/swagger_server/models/api_generate_model_code_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_model_script import ApiModelScript # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiGenerateModelCodeResponse(Model): @@ -25,14 +25,18 @@ def __init__(self, scripts: List[ApiModelScript] = None): # noqa: E501 :param scripts: The scripts of this ApiGenerateModelCodeResponse. # noqa: E501 :type scripts: List[ApiModelScript] """ - self.swagger_types = {"scripts": List[ApiModelScript]} + self.swagger_types = { + 'scripts': List[ApiModelScript] + } - self.attribute_map = {"scripts": "scripts"} + self.attribute_map = { + 'scripts': 'scripts' + } self._scripts = scripts @classmethod - def from_dict(cls, dikt) -> "ApiGenerateModelCodeResponse": + def from_dict(cls, dikt) -> 'ApiGenerateModelCodeResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_get_template_response.py b/api/server/swagger_server/models/api_get_template_response.py index cf6076be..b2f88976 100644 --- a/api/server/swagger_server/models/api_get_template_response.py +++ b/api/server/swagger_server/models/api_get_template_response.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiGetTemplateResponse(Model): @@ -26,15 +26,21 @@ def __init__(self, template: str = None, url: str = None): # noqa: E501 :param url: The url of this ApiGetTemplateResponse. # noqa: E501 :type url: str """ - self.swagger_types = {"template": str, "url": str} + self.swagger_types = { + 'template': str, + 'url': str + } - self.attribute_map = {"template": "template", "url": "url"} + self.attribute_map = { + 'template': 'template', + 'url': 'url' + } self._template = template self._url = url @classmethod - def from_dict(cls, dikt) -> "ApiGetTemplateResponse": + def from_dict(cls, dikt) -> 'ApiGetTemplateResponse': """Returns the dict as a model :param dikt: A dict. @@ -71,7 +77,7 @@ def template(self, template: str): def url(self) -> str: """Gets the url of this ApiGetTemplateResponse. - The URL to download the template text from S3 storage (Minio) + The URL to download the template text from S3 storage (Minio) # noqa: E501 :return: The url of this ApiGetTemplateResponse. :rtype: str @@ -82,7 +88,7 @@ def url(self) -> str: def url(self, url: str): """Sets the url of this ApiGetTemplateResponse. - The URL to download the template text from S3 storage (Minio) + The URL to download the template text from S3 storage (Minio) # noqa: E501 :param url: The url of this ApiGetTemplateResponse. :type url: str diff --git a/api/server/swagger_server/models/api_inferenceservice.py b/api/server/swagger_server/models/api_inferenceservice.py index 0d379fe0..f3a6f5a5 100644 --- a/api/server/swagger_server/models/api_inferenceservice.py +++ b/api/server/swagger_server/models/api_inferenceservice.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.any_value import AnyValue # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiInferenceservice(Model): @@ -19,13 +19,7 @@ class ApiInferenceservice(Model): Do not edit the class manually. """ - def __init__( - self, - api_version: str = None, - kind: str = None, - metadata: AnyValue = None, - spec: AnyValue = None, - ): # noqa: E501 + def __init__(self, api_version: str = None, kind: str = None, metadata: AnyValue = None, spec: AnyValue = None): # noqa: E501 """ApiInferenceservice - a model defined in Swagger :param api_version: The api_version of this ApiInferenceservice. # noqa: E501 @@ -38,17 +32,17 @@ def __init__( :type spec: AnyValue """ self.swagger_types = { - "api_version": str, - "kind": str, - "metadata": AnyValue, - "spec": AnyValue, + 'api_version': str, + 'kind': str, + 'metadata': AnyValue, + 'spec': AnyValue } self.attribute_map = { - "api_version": "apiVersion", - "kind": "kind", - "metadata": "metadata", - "spec": "spec", + 'api_version': 'apiVersion', + 'kind': 'kind', + 'metadata': 'metadata', + 'spec': 'spec' } self._api_version = api_version @@ -57,7 +51,7 @@ def __init__( self._spec = spec @classmethod - def from_dict(cls, dikt) -> "ApiInferenceservice": + def from_dict(cls, dikt) -> 'ApiInferenceservice': """Returns the dict as a model :param dikt: A dict. @@ -86,9 +80,7 @@ def api_version(self, api_version: str): :type api_version: str """ if api_version is None: - raise ValueError( - "Invalid value for `api_version`, must not be `None`" - ) + raise ValueError("Invalid value for `api_version`, must not be `None`") # noqa: E501 self._api_version = api_version @@ -111,9 +103,7 @@ def kind(self, kind: str): :type kind: str """ if kind is None: - raise ValueError( - "Invalid value for `kind`, must not be `None`" - ) + raise ValueError("Invalid value for `kind`, must not be `None`") # noqa: E501 self._kind = kind diff --git a/api/server/swagger_server/models/api_list_catalog_items_response.py b/api/server/swagger_server/models/api_list_catalog_items_response.py index fb23a580..3566fb7c 100644 --- a/api/server/swagger_server/models/api_list_catalog_items_response.py +++ b/api/server/swagger_server/models/api_list_catalog_items_response.py @@ -14,7 +14,7 @@ from swagger_server.models.api_notebook import ApiNotebook from swagger_server.models.api_pipeline import ApiPipeline from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListCatalogItemsResponse(Model): @@ -23,16 +23,7 @@ class ApiListCatalogItemsResponse(Model): Do not edit the class manually. """ - def __init__( - self, - components: List[ApiComponent] = None, - datasets: List[ApiDataset] = None, - models: List[ApiModel] = None, - notebooks: List[ApiNotebook] = None, - pipelines: List[ApiPipeline] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, components: List[ApiComponent] = None, datasets: List[ApiDataset] = None, models: List[ApiModel] = None, notebooks: List[ApiNotebook] = None, pipelines: List[ApiPipeline] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListCatalogItemsResponse - a model defined in Swagger :param components: The components of this ApiListCatalogItemsResponse. # noqa: E501 @@ -51,23 +42,23 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "components": List[ApiComponent], - "datasets": List[ApiDataset], - "models": List[ApiModel], - "notebooks": List[ApiNotebook], - "pipelines": List[ApiPipeline], - "total_size": int, - "next_page_token": str, + 'components': List[ApiComponent], + 'datasets': List[ApiDataset], + 'models': List[ApiModel], + 'notebooks': List[ApiNotebook], + 'pipelines': List[ApiPipeline], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "components": "components", - "datasets": "datasets", - "models": "models", - "notebooks": "notebooks", - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'components': 'components', + 'datasets': 'datasets', + 'models': 'models', + 'notebooks': 'notebooks', + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._components = components @@ -79,7 +70,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListCatalogItemsResponse": + def from_dict(cls, dikt) -> 'ApiListCatalogItemsResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_catalog_upload_errors.py b/api/server/swagger_server/models/api_list_catalog_upload_errors.py index 5ddca074..12903407 100644 --- a/api/server/swagger_server/models/api_list_catalog_upload_errors.py +++ b/api/server/swagger_server/models/api_list_catalog_upload_errors.py @@ -10,7 +10,7 @@ from swagger_server.models.api_catalog_upload_error import ApiCatalogUploadError from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListCatalogUploadErrors(Model): @@ -19,9 +19,7 @@ class ApiListCatalogUploadErrors(Model): Do not edit the class manually. """ - def __init__( - self, errors: List[ApiCatalogUploadError] = None, total_errors: int = None - ): # noqa: E501 + def __init__(self, errors: List[ApiCatalogUploadError] = None, total_errors: int = None): # noqa: E501 """ApiListCatalogUploadErrors - a model defined in Swagger :param errors: The errors of this ApiListCatalogUploadErrors. # noqa: E501 @@ -30,17 +28,20 @@ def __init__( :type total_errors: int """ self.swagger_types = { - "errors": List[ApiCatalogUploadError], - "total_errors": int, + 'errors': List[ApiCatalogUploadError], + 'total_errors': int } - self.attribute_map = {"errors": "errors", "total_errors": "total_errors"} + self.attribute_map = { + 'errors': 'errors', + 'total_errors': 'total_errors' + } self._errors = errors self._total_errors = total_errors @classmethod - def from_dict(cls, dikt) -> "ApiListCatalogUploadErrors": + def from_dict(cls, dikt) -> 'ApiListCatalogUploadErrors': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_components_response.py b/api/server/swagger_server/models/api_list_components_response.py index a5d05109..89761c03 100644 --- a/api/server/swagger_server/models/api_list_components_response.py +++ b/api/server/swagger_server/models/api_list_components_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_component import ApiComponent # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListComponentsResponse(Model): @@ -19,12 +19,7 @@ class ApiListComponentsResponse(Model): Do not edit the class manually. """ - def __init__( - self, - components: List[ApiComponent] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, components: List[ApiComponent] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListComponentsResponse - a model defined in Swagger :param components: The components of this ApiListComponentsResponse. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "components": List[ApiComponent], - "total_size": int, - "next_page_token": str, + 'components': List[ApiComponent], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "components": "components", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'components': 'components', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._components = components @@ -51,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListComponentsResponse": + def from_dict(cls, dikt) -> 'ApiListComponentsResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_credentials_response.py b/api/server/swagger_server/models/api_list_credentials_response.py index a8422c12..26179aa3 100644 --- a/api/server/swagger_server/models/api_list_credentials_response.py +++ b/api/server/swagger_server/models/api_list_credentials_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_credential import ApiCredential # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListCredentialsResponse(Model): @@ -19,12 +19,7 @@ class ApiListCredentialsResponse(Model): Do not edit the class manually. """ - def __init__( - self, - credentials: List[ApiCredential] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, credentials: List[ApiCredential] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListCredentialsResponse - a model defined in Swagger :param credentials: The credentials of this ApiListCredentialsResponse. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "credentials": List[ApiCredential], - "total_size": int, - "next_page_token": str, + 'credentials': List[ApiCredential], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "credentials": "credentials", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'credentials': 'credentials', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._credentials = credentials @@ -51,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListCredentialsResponse": + def from_dict(cls, dikt) -> 'ApiListCredentialsResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_datasets_response.py b/api/server/swagger_server/models/api_list_datasets_response.py index 85748b81..80112d81 100644 --- a/api/server/swagger_server/models/api_list_datasets_response.py +++ b/api/server/swagger_server/models/api_list_datasets_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_dataset import ApiDataset # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListDatasetsResponse(Model): @@ -19,12 +19,7 @@ class ApiListDatasetsResponse(Model): Do not edit the class manually. """ - def __init__( - self, - datasets: List[ApiDataset] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, datasets: List[ApiDataset] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListDatasetsResponse - a model defined in Swagger :param datasets: The datasets of this ApiListDatasetsResponse. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "datasets": List[ApiDataset], - "total_size": int, - "next_page_token": str, + 'datasets': List[ApiDataset], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "datasets": "datasets", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'datasets': 'datasets', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._datasets = datasets @@ -51,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListDatasetsResponse": + def from_dict(cls, dikt) -> 'ApiListDatasetsResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_inferenceservices_response.py b/api/server/swagger_server/models/api_list_inferenceservices_response.py index 643eae1e..9d1c6f75 100644 --- a/api/server/swagger_server/models/api_list_inferenceservices_response.py +++ b/api/server/swagger_server/models/api_list_inferenceservices_response.py @@ -9,10 +9,8 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_inferenceservice import ( - ApiInferenceservice, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_inferenceservice import ApiInferenceservice # noqa: F401,E501 +from swagger_server import util class ApiListInferenceservicesResponse(Model): @@ -21,12 +19,7 @@ class ApiListInferenceservicesResponse(Model): Do not edit the class manually. """ - def __init__( - self, - inferenceservices: List[ApiInferenceservice] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, inferenceservices: List[ApiInferenceservice] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListInferenceservicesResponse - a model defined in Swagger :param inferenceservices: The inferenceservices of this ApiListInferenceservicesResponse. # noqa: E501 @@ -37,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "inferenceservices": List[ApiInferenceservice], - "total_size": int, - "next_page_token": str, + 'inferenceservices': List[ApiInferenceservice], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "inferenceservices": "Inferenceservices", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'inferenceservices': 'Inferenceservices', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._inferenceservices = inferenceservices @@ -53,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListInferenceservicesResponse": + def from_dict(cls, dikt) -> 'ApiListInferenceservicesResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_models_response.py b/api/server/swagger_server/models/api_list_models_response.py index bdf0cf40..887ab3ee 100644 --- a/api/server/swagger_server/models/api_list_models_response.py +++ b/api/server/swagger_server/models/api_list_models_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_model import ApiModel # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListModelsResponse(Model): @@ -19,12 +19,7 @@ class ApiListModelsResponse(Model): Do not edit the class manually. """ - def __init__( - self, - models: List[ApiModel] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, models: List[ApiModel] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListModelsResponse - a model defined in Swagger :param models: The models of this ApiListModelsResponse. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "models": List[ApiModel], - "total_size": int, - "next_page_token": str, + 'models': List[ApiModel], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "models": "models", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'models': 'models', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._models = models @@ -51,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListModelsResponse": + def from_dict(cls, dikt) -> 'ApiListModelsResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_notebooks_response.py b/api/server/swagger_server/models/api_list_notebooks_response.py index fd7badcb..7ea029a3 100644 --- a/api/server/swagger_server/models/api_list_notebooks_response.py +++ b/api/server/swagger_server/models/api_list_notebooks_response.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_notebook import ApiNotebook # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiListNotebooksResponse(Model): @@ -19,12 +19,7 @@ class ApiListNotebooksResponse(Model): Do not edit the class manually. """ - def __init__( - self, - notebooks: List[ApiNotebook] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, notebooks: List[ApiNotebook] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListNotebooksResponse - a model defined in Swagger :param notebooks: The notebooks of this ApiListNotebooksResponse. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "notebooks": List[ApiNotebook], - "total_size": int, - "next_page_token": str, + 'notebooks': List[ApiNotebook], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "notebooks": "notebooks", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'notebooks': 'notebooks', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._notebooks = notebooks @@ -51,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListNotebooksResponse": + def from_dict(cls, dikt) -> 'ApiListNotebooksResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_list_pipelines_response.py b/api/server/swagger_server/models/api_list_pipelines_response.py index 36023bd5..8798f916 100644 --- a/api/server/swagger_server/models/api_list_pipelines_response.py +++ b/api/server/swagger_server/models/api_list_pipelines_response.py @@ -9,10 +9,8 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_pipeline_extended import ApiPipelineExtended # noqa: F401,E501 +from swagger_server import util class ApiListPipelinesResponse(Model): @@ -21,12 +19,7 @@ class ApiListPipelinesResponse(Model): Do not edit the class manually. """ - def __init__( - self, - pipelines: List[ApiPipelineExtended] = None, - total_size: int = None, - next_page_token: str = None, - ): # noqa: E501 + def __init__(self, pipelines: List[ApiPipelineExtended] = None, total_size: int = None, next_page_token: str = None): # noqa: E501 """ApiListPipelinesResponse - a model defined in Swagger :param pipelines: The pipelines of this ApiListPipelinesResponse. # noqa: E501 @@ -37,15 +30,15 @@ def __init__( :type next_page_token: str """ self.swagger_types = { - "pipelines": List[ApiPipelineExtended], - "total_size": int, - "next_page_token": str, + 'pipelines': List[ApiPipelineExtended], + 'total_size': int, + 'next_page_token': str } self.attribute_map = { - "pipelines": "pipelines", - "total_size": "total_size", - "next_page_token": "next_page_token", + 'pipelines': 'pipelines', + 'total_size': 'total_size', + 'next_page_token': 'next_page_token' } self._pipelines = pipelines @@ -53,7 +46,7 @@ def __init__( self._next_page_token = next_page_token @classmethod - def from_dict(cls, dikt) -> "ApiListPipelinesResponse": + def from_dict(cls, dikt) -> 'ApiListPipelinesResponse': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_metadata.py b/api/server/swagger_server/models/api_metadata.py index fed24dd5..9c8ea775 100644 --- a/api/server/swagger_server/models/api_metadata.py +++ b/api/server/swagger_server/models/api_metadata.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiMetadata(Model): @@ -18,12 +18,7 @@ class ApiMetadata(Model): Do not edit the class manually. """ - def __init__( - self, - annotations: Dict[str, str] = None, - labels: Dict[str, str] = None, - tags: List[str] = None, - ): # noqa: E501 + def __init__(self, annotations: Dict[str, str] = None, labels: Dict[str, str] = None, tags: List[str] = None): # noqa: E501 """ApiMetadata - a model defined in Swagger :param annotations: The annotations of this ApiMetadata. # noqa: E501 @@ -34,15 +29,15 @@ def __init__( :type tags: List[str] """ self.swagger_types = { - "annotations": Dict[str, str], - "labels": Dict[str, str], - "tags": List[str], + 'annotations': Dict[str, str], + 'labels': Dict[str, str], + 'tags': List[str] } self.attribute_map = { - "annotations": "annotations", - "labels": "labels", - "tags": "tags", + 'annotations': 'annotations', + 'labels': 'labels', + 'tags': 'tags' } self._annotations = annotations @@ -50,7 +45,7 @@ def __init__( self._tags = tags @classmethod - def from_dict(cls, dikt) -> "ApiMetadata": + def from_dict(cls, dikt) -> 'ApiMetadata': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_model.py b/api/server/swagger_server/models/api_model.py index 5b7b0bff..4d24d76b 100644 --- a/api/server/swagger_server/models/api_model.py +++ b/api/server/swagger_server/models/api_model.py @@ -9,11 +9,9 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.api_asset import ApiAsset -from swagger_server.models.api_model_framework import ( - ApiModelFramework, # noqa: F401 -) +from swagger_server.models.api_model_framework import ApiModelFramework # noqa: F401,E501 from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiModel(ApiAsset): @@ -22,28 +20,7 @@ class ApiModel(ApiAsset): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - featured: bool = None, - publish_approved: bool = None, - related_assets: List[str] = None, - filter_categories: Dict[str, str] = None, - domain: str = None, - labels: Dict[str, str] = None, - framework: ApiModelFramework = None, - trainable: bool = None, - trainable_tested_platforms: List[str] = None, - trainable_credentials_required: bool = None, - trainable_parameters: List[ApiParameter] = None, - servable: bool = None, - servable_tested_platforms: List[str] = None, - servable_credentials_required: bool = None, - servable_parameters: List[ApiParameter] = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, featured: bool = None, publish_approved: bool = None, related_assets: List[str] = None, filter_categories: Dict[str, str] = None, domain: str = None, labels: Dict[str, str] = None, framework: ApiModelFramework = None, trainable: bool = None, trainable_tested_platforms: List[str] = None, trainable_credentials_required: bool = None, trainable_parameters: List[ApiParameter] = None, servable: bool = None, servable_tested_platforms: List[str] = None, servable_credentials_required: bool = None, servable_parameters: List[ApiParameter] = None): # noqa: E501 """ApiModel - a model defined in Swagger :param id: The id of this ApiModel. # noqa: E501 @@ -86,47 +63,47 @@ def __init__( :type servable_parameters: List[ApiParameter] """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "featured": bool, - "publish_approved": bool, - "related_assets": List[str], - "filter_categories": Dict[str, str], - "domain": str, - "labels": Dict[str, str], - "framework": ApiModelFramework, - "trainable": bool, - "trainable_tested_platforms": List[str], - "trainable_credentials_required": bool, - "trainable_parameters": List[ApiParameter], - "servable": bool, - "servable_tested_platforms": List[str], - "servable_credentials_required": bool, - "servable_parameters": List[ApiParameter], + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'featured': bool, + 'publish_approved': bool, + 'related_assets': List[str], + 'filter_categories': Dict[str, str], + 'domain': str, + 'labels': Dict[str, str], + 'framework': ApiModelFramework, + 'trainable': bool, + 'trainable_tested_platforms': List[str], + 'trainable_credentials_required': bool, + 'trainable_parameters': List[ApiParameter], + 'servable': bool, + 'servable_tested_platforms': List[str], + 'servable_credentials_required': bool, + 'servable_parameters': List[ApiParameter] } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "domain": "domain", - "labels": "labels", - "framework": "framework", - "trainable": "trainable", - "trainable_tested_platforms": "trainable_tested_platforms", - "trainable_credentials_required": "trainable_credentials_required", - "trainable_parameters": "trainable_parameters", - "servable": "servable", - "servable_tested_platforms": "servable_tested_platforms", - "servable_credentials_required": "servable_credentials_required", - "servable_parameters": "servable_parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'domain': 'domain', + 'labels': 'labels', + 'framework': 'framework', + 'trainable': 'trainable', + 'trainable_tested_platforms': 'trainable_tested_platforms', + 'trainable_credentials_required': 'trainable_credentials_required', + 'trainable_parameters': 'trainable_parameters', + 'servable': 'servable', + 'servable_tested_platforms': 'servable_tested_platforms', + 'servable_credentials_required': 'servable_credentials_required', + 'servable_parameters': 'servable_parameters' } self._id = id @@ -150,7 +127,7 @@ def __init__( self._servable_parameters = servable_parameters @classmethod - def from_dict(cls, dikt) -> "ApiModel": + def from_dict(cls, dikt) -> 'ApiModel': """Returns the dict as a model :param dikt: A dict. @@ -221,9 +198,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -246,9 +221,7 @@ def description(self, description: str): :type description: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -397,9 +370,7 @@ def framework(self, framework: ApiModelFramework): :type framework: ApiModelFramework """ if framework is None: - raise ValueError( - "Invalid value for `framework`, must not be `None`" - ) + raise ValueError("Invalid value for `framework`, must not be `None`") # noqa: E501 self._framework = framework diff --git a/api/server/swagger_server/models/api_model_framework.py b/api/server/swagger_server/models/api_model_framework.py index 91abbd35..d20cbb33 100644 --- a/api/server/swagger_server/models/api_model_framework.py +++ b/api/server/swagger_server/models/api_model_framework.py @@ -9,10 +9,8 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_model_framework_runtimes import ( - ApiModelFrameworkRuntimes, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_model_framework_runtimes import ApiModelFrameworkRuntimes # noqa: F401,E501 +from swagger_server import util class ApiModelFramework(Model): @@ -21,12 +19,7 @@ class ApiModelFramework(Model): Do not edit the class manually. """ - def __init__( - self, - name: str = None, - version: str = None, - runtimes: ApiModelFrameworkRuntimes = None, - ): # noqa: E501 + def __init__(self, name: str = None, version: str = None, runtimes: ApiModelFrameworkRuntimes = None): # noqa: E501 """ApiModelFramework - a model defined in Swagger :param name: The name of this ApiModelFramework. # noqa: E501 @@ -37,15 +30,15 @@ def __init__( :type runtimes: ApiModelFrameworkRuntimes """ self.swagger_types = { - "name": str, - "version": str, - "runtimes": ApiModelFrameworkRuntimes, + 'name': str, + 'version': str, + 'runtimes': ApiModelFrameworkRuntimes } self.attribute_map = { - "name": "name", - "version": "version", - "runtimes": "runtimes", + 'name': 'name', + 'version': 'version', + 'runtimes': 'runtimes' } self._name = name @@ -53,7 +46,7 @@ def __init__( self._runtimes = runtimes @classmethod - def from_dict(cls, dikt) -> "ApiModelFramework": + def from_dict(cls, dikt) -> 'ApiModelFramework': """Returns the dict as a model :param dikt: A dict. @@ -82,9 +75,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/api/server/swagger_server/models/api_model_framework_runtimes.py b/api/server/swagger_server/models/api_model_framework_runtimes.py index dedb227f..48e7ccf5 100644 --- a/api/server/swagger_server/models/api_model_framework_runtimes.py +++ b/api/server/swagger_server/models/api_model_framework_runtimes.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiModelFrameworkRuntimes(Model): @@ -26,15 +26,21 @@ def __init__(self, name: str = None, version: str = None): # noqa: E501 :param version: The version of this ApiModelFrameworkRuntimes. # noqa: E501 :type version: str """ - self.swagger_types = {"name": str, "version": str} + self.swagger_types = { + 'name': str, + 'version': str + } - self.attribute_map = {"name": "name", "version": "version"} + self.attribute_map = { + 'name': 'name', + 'version': 'version' + } self._name = name self._version = version @classmethod - def from_dict(cls, dikt) -> "ApiModelFrameworkRuntimes": + def from_dict(cls, dikt) -> 'ApiModelFrameworkRuntimes': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_model_script.py b/api/server/swagger_server/models/api_model_script.py index 73158281..d8d72b7f 100644 --- a/api/server/swagger_server/models/api_model_script.py +++ b/api/server/swagger_server/models/api_model_script.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiModelScript(Model): @@ -18,12 +18,7 @@ class ApiModelScript(Model): Do not edit the class manually. """ - def __init__( - self, - pipeline_stage: str = None, - execution_platform: str = None, - script_code: str = None, - ): # noqa: E501 + def __init__(self, pipeline_stage: str = None, execution_platform: str = None, script_code: str = None): # noqa: E501 """ApiModelScript - a model defined in Swagger :param pipeline_stage: The pipeline_stage of this ApiModelScript. # noqa: E501 @@ -34,15 +29,15 @@ def __init__( :type script_code: str """ self.swagger_types = { - "pipeline_stage": str, - "execution_platform": str, - "script_code": str, + 'pipeline_stage': str, + 'execution_platform': str, + 'script_code': str } self.attribute_map = { - "pipeline_stage": "pipeline_stage", - "execution_platform": "execution_platform", - "script_code": "script_code", + 'pipeline_stage': 'pipeline_stage', + 'execution_platform': 'execution_platform', + 'script_code': 'script_code' } self._pipeline_stage = pipeline_stage @@ -50,7 +45,7 @@ def __init__( self._script_code = script_code @classmethod - def from_dict(cls, dikt) -> "ApiModelScript": + def from_dict(cls, dikt) -> 'ApiModelScript': """Returns the dict as a model :param dikt: A dict. @@ -81,9 +76,7 @@ def pipeline_stage(self, pipeline_stage: str): :type pipeline_stage: str """ if pipeline_stage is None: - raise ValueError( - "Invalid value for `pipeline_stage`, must not be `None`" - ) + raise ValueError("Invalid value for `pipeline_stage`, must not be `None`") # noqa: E501 self._pipeline_stage = pipeline_stage @@ -108,9 +101,7 @@ def execution_platform(self, execution_platform: str): :type execution_platform: str """ if execution_platform is None: - raise ValueError( - "Invalid value for `execution_platform`, must not be `None`" - ) + raise ValueError("Invalid value for `execution_platform`, must not be `None`") # noqa: E501 self._execution_platform = execution_platform @@ -135,8 +126,6 @@ def script_code(self, script_code: str): :type script_code: str """ if script_code is None: - raise ValueError( - "Invalid value for `script_code`, must not be `None`" - ) + raise ValueError("Invalid value for `script_code`, must not be `None`") # noqa: E501 self._script_code = script_code diff --git a/api/server/swagger_server/models/api_notebook.py b/api/server/swagger_server/models/api_notebook.py index 683201e9..b54f9bae 100644 --- a/api/server/swagger_server/models/api_notebook.py +++ b/api/server/swagger_server/models/api_notebook.py @@ -11,7 +11,7 @@ from swagger_server.models.api_asset import ApiAsset from swagger_server.models.api_metadata import ApiMetadata # noqa: F401,E501 from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiNotebook(ApiAsset): @@ -20,20 +20,7 @@ class ApiNotebook(ApiAsset): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - featured: bool = None, - publish_approved: bool = None, - related_assets: List[str] = None, - filter_categories: Dict[str, str] = None, - url: str = None, - metadata: ApiMetadata = None, - parameters: List[ApiParameter] = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, featured: bool = None, publish_approved: bool = None, related_assets: List[str] = None, filter_categories: Dict[str, str] = None, url: str = None, metadata: ApiMetadata = None, parameters: List[ApiParameter] = None): # noqa: E501 """ApiNotebook - a model defined in Swagger :param id: The id of this ApiNotebook. # noqa: E501 @@ -60,31 +47,31 @@ def __init__( :type parameters: List[ApiParameter] """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "featured": bool, - "publish_approved": bool, - "related_assets": List[str], - "filter_categories": Dict[str, str], - "url": str, - "metadata": ApiMetadata, - "parameters": List[ApiParameter], + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'featured': bool, + 'publish_approved': bool, + 'related_assets': List[str], + 'filter_categories': Dict[str, str], + 'url': str, + 'metadata': ApiMetadata, + 'parameters': List[ApiParameter] } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "featured": "featured", - "publish_approved": "publish_approved", - "related_assets": "related_assets", - "filter_categories": "filter_categories", - "url": "url", - "metadata": "metadata", - "parameters": "parameters", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'featured': 'featured', + 'publish_approved': 'publish_approved', + 'related_assets': 'related_assets', + 'filter_categories': 'filter_categories', + 'url': 'url', + 'metadata': 'metadata', + 'parameters': 'parameters' } self._id = id @@ -100,7 +87,7 @@ def __init__( self._parameters = parameters @classmethod - def from_dict(cls, dikt) -> "ApiNotebook": + def from_dict(cls, dikt) -> 'ApiNotebook': """Returns the dict as a model :param dikt: A dict. @@ -171,9 +158,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -196,9 +181,7 @@ def description(self, description: str): :type description: str """ if description is None: - raise ValueError( - "Invalid value for `description`, must not be `None`" - ) + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 self._description = description @@ -307,9 +290,7 @@ def url(self, url: str): :type url: str """ if url is None: - raise ValueError( - "Invalid value for `url`, must not be `None`" - ) + raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 self._url = url diff --git a/api/server/swagger_server/models/api_parameter.py b/api/server/swagger_server/models/api_parameter.py index 62fe0a85..e2372164 100644 --- a/api/server/swagger_server/models/api_parameter.py +++ b/api/server/swagger_server/models/api_parameter.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.any_value import AnyValue # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiParameter(Model): @@ -19,13 +19,7 @@ class ApiParameter(Model): Do not edit the class manually. """ - def __init__( - self, - name: str = None, - description: str = None, - default: AnyValue = None, - value: AnyValue = None, - ): # noqa: E501 + def __init__(self, name: str = None, description: str = None, default: AnyValue = None, value: AnyValue = None): # noqa: E501 """ApiParameter - a model defined in Swagger :param name: The name of this ApiParameter. # noqa: E501 @@ -38,17 +32,17 @@ def __init__( :type value: AnyValue """ self.swagger_types = { - "name": str, - "description": str, - "default": AnyValue, - "value": AnyValue, + 'name': str, + 'description': str, + 'default': AnyValue, + 'value': AnyValue } self.attribute_map = { - "name": "name", - "description": "description", - "default": "default", - "value": "value", + 'name': 'name', + 'description': 'description', + 'default': 'default', + 'value': 'value' } self._name = name @@ -57,7 +51,7 @@ def __init__( self._value = value @classmethod - def from_dict(cls, dikt) -> "ApiParameter": + def from_dict(cls, dikt) -> 'ApiParameter': """Returns the dict as a model :param dikt: A dict. @@ -86,9 +80,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/api/server/swagger_server/models/api_pipeline.py b/api/server/swagger_server/models/api_pipeline.py index b77c3227..7bb1a140 100644 --- a/api/server/swagger_server/models/api_pipeline.py +++ b/api/server/swagger_server/models/api_pipeline.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipeline(Model): @@ -19,17 +19,7 @@ class ApiPipeline(Model): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - parameters: List[ApiParameter] = None, - status: str = None, - default_version_id: str = None, - namespace: str = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, parameters: List[ApiParameter] = None, status: str = None, default_version_id: str = None, namespace: str = None): # noqa: E501 """ApiPipeline - a model defined in Swagger :param id: The id of this ApiPipeline. # noqa: E501 @@ -50,25 +40,25 @@ def __init__( :type namespace: str """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "parameters": List[ApiParameter], - "status": str, - "default_version_id": str, - "namespace": str, + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'parameters': List[ApiParameter], + 'status': str, + 'default_version_id': str, + 'namespace': str } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "parameters": "parameters", - "status": "status", - "default_version_id": "default_version_id", - "namespace": "namespace", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'parameters': 'parameters', + 'status': 'status', + 'default_version_id': 'default_version_id', + 'namespace': 'namespace' } self._id = id @@ -81,7 +71,7 @@ def __init__( self._namespace = namespace @classmethod - def from_dict(cls, dikt) -> "ApiPipeline": + def from_dict(cls, dikt) -> 'ApiPipeline': """Returns the dict as a model :param dikt: A dict. @@ -223,8 +213,7 @@ def status(self, status: str): def default_version_id(self) -> str: """Gets the default_version_id of this ApiPipeline. - The default version of the pipeline. As of now, the latest version is used as default. # noqa: E501 - (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 + The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 :return: The default_version_id of this ApiPipeline. :rtype: str @@ -235,8 +224,7 @@ def default_version_id(self) -> str: def default_version_id(self, default_version_id: str): """Sets the default_version_id of this ApiPipeline. - The default version of the pipeline. As of now, the latest version is used as default. # noqa: E501 - (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 + The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 :param default_version_id: The default_version_id of this ApiPipeline. :type default_version_id: str diff --git a/api/server/swagger_server/models/api_pipeline_custom.py b/api/server/swagger_server/models/api_pipeline_custom.py index ddf58051..50e910d3 100644 --- a/api/server/swagger_server/models/api_pipeline_custom.py +++ b/api/server/swagger_server/models/api_pipeline_custom.py @@ -10,10 +10,8 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_pipeline_dag import ApiPipelineDAG # noqa: F401,E501 -from swagger_server.models.api_pipeline_inputs import ( - ApiPipelineInputs, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_pipeline_inputs import ApiPipelineInputs # noqa: F401,E501 +from swagger_server import util class ApiPipelineCustom(Model): @@ -22,13 +20,7 @@ class ApiPipelineCustom(Model): Do not edit the class manually. """ - def __init__( - self, - dag: ApiPipelineDAG = None, - inputs: ApiPipelineInputs = None, - name: str = None, - description: str = None, - ): # noqa: E501 + def __init__(self, dag: ApiPipelineDAG = None, inputs: ApiPipelineInputs = None, name: str = None, description: str = None): # noqa: E501 """ApiPipelineCustom - a model defined in Swagger :param dag: The dag of this ApiPipelineCustom. # noqa: E501 @@ -41,17 +33,17 @@ def __init__( :type description: str """ self.swagger_types = { - "dag": ApiPipelineDAG, - "inputs": ApiPipelineInputs, - "name": str, - "description": str, + 'dag': ApiPipelineDAG, + 'inputs': ApiPipelineInputs, + 'name': str, + 'description': str } self.attribute_map = { - "dag": "dag", - "inputs": "inputs", - "name": "name", - "description": "description", + 'dag': 'dag', + 'inputs': 'inputs', + 'name': 'name', + 'description': 'description' } self._dag = dag @@ -60,7 +52,7 @@ def __init__( self._description = description @classmethod - def from_dict(cls, dikt) -> "ApiPipelineCustom": + def from_dict(cls, dikt) -> 'ApiPipelineCustom': """Returns the dict as a model :param dikt: A dict. @@ -89,9 +81,7 @@ def dag(self, dag: ApiPipelineDAG): :type dag: ApiPipelineDAG """ if dag is None: - raise ValueError( - "Invalid value for `dag`, must not be `None`" - ) + raise ValueError("Invalid value for `dag`, must not be `None`") # noqa: E501 self._dag = dag @@ -137,9 +127,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/api/server/swagger_server/models/api_pipeline_custom_run_payload.py b/api/server/swagger_server/models/api_pipeline_custom_run_payload.py index d5081ab4..51c3c65e 100644 --- a/api/server/swagger_server/models/api_pipeline_custom_run_payload.py +++ b/api/server/swagger_server/models/api_pipeline_custom_run_payload.py @@ -9,11 +9,9 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_pipeline_custom import ( - ApiPipelineCustom, -) +from swagger_server.models.api_pipeline_custom import ApiPipelineCustom # noqa: F401,E501 from swagger_server.models.dictionary import Dictionary # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipelineCustomRunPayload(Model): @@ -22,11 +20,7 @@ class ApiPipelineCustomRunPayload(Model): Do not edit the class manually. """ - def __init__( - self, - custom_pipeline: ApiPipelineCustom = None, - run_parameters: Dictionary = None, - ): # noqa: E501 + def __init__(self, custom_pipeline: ApiPipelineCustom = None, run_parameters: Dictionary = None): # noqa: E501 """ApiPipelineCustomRunPayload - a model defined in Swagger :param custom_pipeline: The custom_pipeline of this ApiPipelineCustomRunPayload. # noqa: E501 @@ -35,20 +29,20 @@ def __init__( :type run_parameters: Dictionary """ self.swagger_types = { - "custom_pipeline": ApiPipelineCustom, - "run_parameters": Dictionary, + 'custom_pipeline': ApiPipelineCustom, + 'run_parameters': Dictionary } self.attribute_map = { - "custom_pipeline": "custom_pipeline", - "run_parameters": "run_parameters", + 'custom_pipeline': 'custom_pipeline', + 'run_parameters': 'run_parameters' } self._custom_pipeline = custom_pipeline self._run_parameters = run_parameters @classmethod - def from_dict(cls, dikt) -> "ApiPipelineCustomRunPayload": + def from_dict(cls, dikt) -> 'ApiPipelineCustomRunPayload': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_pipeline_dag.py b/api/server/swagger_server/models/api_pipeline_dag.py index 2f40b963..c70b9f65 100644 --- a/api/server/swagger_server/models/api_pipeline_dag.py +++ b/api/server/swagger_server/models/api_pipeline_dag.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_pipeline_task import ApiPipelineTask # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipelineDAG(Model): @@ -25,14 +25,18 @@ def __init__(self, tasks: List[ApiPipelineTask] = None): # noqa: E501 :param tasks: The tasks of this ApiPipelineDAG. # noqa: E501 :type tasks: List[ApiPipelineTask] """ - self.swagger_types = {"tasks": List[ApiPipelineTask]} + self.swagger_types = { + 'tasks': List[ApiPipelineTask] + } - self.attribute_map = {"tasks": "tasks"} + self.attribute_map = { + 'tasks': 'tasks' + } self._tasks = tasks @classmethod - def from_dict(cls, dikt) -> "ApiPipelineDAG": + def from_dict(cls, dikt) -> 'ApiPipelineDAG': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_pipeline_extended.py b/api/server/swagger_server/models/api_pipeline_extended.py index 95c7aec3..7977d84b 100644 --- a/api/server/swagger_server/models/api_pipeline_extended.py +++ b/api/server/swagger_server/models/api_pipeline_extended.py @@ -8,13 +8,10 @@ from typing import List, Dict # noqa: F401 -from swagger_server.models.base_model_ import Model # noqa: F401 from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 from swagger_server.models.api_pipeline import ApiPipeline # noqa: F401,E501 -from swagger_server.models.api_pipeline_extension import ( - ApiPipelineExtension, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_pipeline_extension import ApiPipelineExtension # noqa: F401,E501 +from swagger_server import util class ApiPipelineExtended(ApiPipeline, ApiPipelineExtension): @@ -23,20 +20,7 @@ class ApiPipelineExtended(ApiPipeline, ApiPipelineExtension): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - created_at: datetime = None, - name: str = None, - description: str = None, - parameters: List[ApiParameter] = None, - status: str = None, - default_version_id: str = None, - namespace: str = None, - annotations: Dict[str, str] = None, - featured: bool = None, - publish_approved: bool = None, - ): # noqa: E501 + def __init__(self, id: str = None, created_at: datetime = None, name: str = None, description: str = None, parameters: List[ApiParameter] = None, status: str = None, default_version_id: str = None, namespace: str = None, annotations: Dict[str, str] = None, featured: bool = None, publish_approved: bool = None): # noqa: E501 """ApiPipelineExtended - a model defined in Swagger :param id: The id of this ApiPipelineExtended. # noqa: E501 @@ -63,31 +47,31 @@ def __init__( :type publish_approved: bool """ self.swagger_types = { - "id": str, - "created_at": datetime, - "name": str, - "description": str, - "parameters": List[ApiParameter], - "status": str, - "default_version_id": str, - "namespace": str, - "annotations": Dict[str, str], - "featured": bool, - "publish_approved": bool, + 'id': str, + 'created_at': datetime, + 'name': str, + 'description': str, + 'parameters': List[ApiParameter], + 'status': str, + 'default_version_id': str, + 'namespace': str, + 'annotations': Dict[str, str], + 'featured': bool, + 'publish_approved': bool } self.attribute_map = { - "id": "id", - "created_at": "created_at", - "name": "name", - "description": "description", - "parameters": "parameters", - "status": "status", - "default_version_id": "default_version_id", - "namespace": "namespace", - "annotations": "annotations", - "featured": "featured", - "publish_approved": "publish_approved", + 'id': 'id', + 'created_at': 'created_at', + 'name': 'name', + 'description': 'description', + 'parameters': 'parameters', + 'status': 'status', + 'default_version_id': 'default_version_id', + 'namespace': 'namespace', + 'annotations': 'annotations', + 'featured': 'featured', + 'publish_approved': 'publish_approved' } self._id = id @@ -103,7 +87,7 @@ def __init__( self._publish_approved = publish_approved @classmethod - def from_dict(cls, dikt) -> "ApiPipelineExtended": + def from_dict(cls, dikt) -> 'ApiPipelineExtended': """Returns the dict as a model :param dikt: A dict. @@ -245,8 +229,7 @@ def from_dict(cls, dikt) -> "ApiPipelineExtended": # def default_version_id(self) -> str: # """Gets the default_version_id of this ApiPipelineExtended. # - # The default version of the pipeline. As of now, the latest version is used as default. # noqa: E501 - # (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 + # The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 # # :return: The default_version_id of this ApiPipelineExtended. # :rtype: str @@ -257,8 +240,7 @@ def from_dict(cls, dikt) -> "ApiPipelineExtended": # def default_version_id(self, default_version_id: str): # """Sets the default_version_id of this ApiPipelineExtended. # - # The default version of the pipeline. As of now, the latest version is used as default. # noqa: E501 - # (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 + # The default version of the pipeline. As of now, the latest version is used as default. (In the future, if desired by customers, we can allow them to set default version.) # noqa: E501 # # :param default_version_id: The default_version_id of this ApiPipelineExtended. # :type default_version_id: str diff --git a/api/server/swagger_server/models/api_pipeline_extension.py b/api/server/swagger_server/models/api_pipeline_extension.py index 6e0307bf..5499cd2f 100644 --- a/api/server/swagger_server/models/api_pipeline_extension.py +++ b/api/server/swagger_server/models/api_pipeline_extension.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipelineExtension(Model): @@ -18,13 +18,7 @@ class ApiPipelineExtension(Model): Do not edit the class manually. """ - def __init__( - self, - id: str = None, - annotations: Dict[str, str] = None, - featured: bool = None, - publish_approved: bool = None, - ): # noqa: E501 + def __init__(self, id: str = None, annotations: Dict[str, str] = None, featured: bool = None, publish_approved: bool = None): # noqa: E501 """ApiPipelineExtension - a model defined in Swagger :param id: The id of this ApiPipelineExtension. # noqa: E501 @@ -37,17 +31,17 @@ def __init__( :type publish_approved: bool """ self.swagger_types = { - "id": str, - "annotations": Dict[str, str], - "featured": bool, - "publish_approved": bool, + 'id': str, + 'annotations': Dict[str, str], + 'featured': bool, + 'publish_approved': bool } self.attribute_map = { - "id": "id", - "annotations": "annotations", - "featured": "featured", - "publish_approved": "publish_approved", + 'id': 'id', + 'annotations': 'annotations', + 'featured': 'featured', + 'publish_approved': 'publish_approved' } self._id = id @@ -56,7 +50,7 @@ def __init__( self._publish_approved = publish_approved @classmethod - def from_dict(cls, dikt) -> "ApiPipelineExtension": + def from_dict(cls, dikt) -> 'ApiPipelineExtension': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_pipeline_inputs.py b/api/server/swagger_server/models/api_pipeline_inputs.py index abeb988f..a3aa055b 100644 --- a/api/server/swagger_server/models/api_pipeline_inputs.py +++ b/api/server/swagger_server/models/api_pipeline_inputs.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipelineInputs(Model): @@ -25,14 +25,18 @@ def __init__(self, parameters: List[ApiParameter] = None): # noqa: E501 :param parameters: The parameters of this ApiPipelineInputs. # noqa: E501 :type parameters: List[ApiParameter] """ - self.swagger_types = {"parameters": List[ApiParameter]} + self.swagger_types = { + 'parameters': List[ApiParameter] + } - self.attribute_map = {"parameters": "parameters"} + self.attribute_map = { + 'parameters': 'parameters' + } self._parameters = parameters @classmethod - def from_dict(cls, dikt) -> "ApiPipelineInputs": + def from_dict(cls, dikt) -> 'ApiPipelineInputs': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_pipeline_task.py b/api/server/swagger_server/models/api_pipeline_task.py index d805df03..71716700 100644 --- a/api/server/swagger_server/models/api_pipeline_task.py +++ b/api/server/swagger_server/models/api_pipeline_task.py @@ -9,10 +9,8 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_pipeline_task_arguments import ( - ApiPipelineTaskArguments, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_pipeline_task_arguments import ApiPipelineTaskArguments # noqa: F401,E501 +from swagger_server import util class ApiPipelineTask(Model): @@ -21,14 +19,7 @@ class ApiPipelineTask(Model): Do not edit the class manually. """ - def __init__( - self, - name: str = None, - artifact_type: str = None, - artifact_id: str = None, - arguments: ApiPipelineTaskArguments = None, - dependencies: List[str] = None, - ): # noqa: E501 + def __init__(self, name: str = None, artifact_type: str = None, artifact_id: str = None, arguments: ApiPipelineTaskArguments = None, dependencies: List[str] = None): # noqa: E501 """ApiPipelineTask - a model defined in Swagger :param name: The name of this ApiPipelineTask. # noqa: E501 @@ -43,19 +34,19 @@ def __init__( :type dependencies: List[str] """ self.swagger_types = { - "name": str, - "artifact_type": str, - "artifact_id": str, - "arguments": ApiPipelineTaskArguments, - "dependencies": List[str], + 'name': str, + 'artifact_type': str, + 'artifact_id': str, + 'arguments': ApiPipelineTaskArguments, + 'dependencies': List[str] } self.attribute_map = { - "name": "name", - "artifact_type": "artifact_type", - "artifact_id": "artifact_id", - "arguments": "arguments", - "dependencies": "dependencies", + 'name': 'name', + 'artifact_type': 'artifact_type', + 'artifact_id': 'artifact_id', + 'arguments': 'arguments', + 'dependencies': 'dependencies' } self._name = name @@ -65,7 +56,7 @@ def __init__( self._dependencies = dependencies @classmethod - def from_dict(cls, dikt) -> "ApiPipelineTask": + def from_dict(cls, dikt) -> 'ApiPipelineTask': """Returns the dict as a model :param dikt: A dict. @@ -117,9 +108,7 @@ def artifact_type(self, artifact_type: str): :type artifact_type: str """ if artifact_type is None: - raise ValueError( - "Invalid value for `artifact_type`, must not be `None`" - ) + raise ValueError("Invalid value for `artifact_type`, must not be `None`") # noqa: E501 self._artifact_type = artifact_type @@ -144,9 +133,7 @@ def artifact_id(self, artifact_id: str): :type artifact_id: str """ if artifact_id is None: - raise ValueError( - "Invalid value for `artifact_id`, must not be `None`" - ) + raise ValueError("Invalid value for `artifact_id`, must not be `None`") # noqa: E501 self._artifact_id = artifact_id diff --git a/api/server/swagger_server/models/api_pipeline_task_arguments.py b/api/server/swagger_server/models/api_pipeline_task_arguments.py index 21a112d6..c3b3a960 100644 --- a/api/server/swagger_server/models/api_pipeline_task_arguments.py +++ b/api/server/swagger_server/models/api_pipeline_task_arguments.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiPipelineTaskArguments(Model): @@ -25,14 +25,18 @@ def __init__(self, parameters: List[ApiParameter] = None): # noqa: E501 :param parameters: The parameters of this ApiPipelineTaskArguments. # noqa: E501 :type parameters: List[ApiParameter] """ - self.swagger_types = {"parameters": List[ApiParameter]} + self.swagger_types = { + 'parameters': List[ApiParameter] + } - self.attribute_map = {"parameters": "parameters"} + self.attribute_map = { + 'parameters': 'parameters' + } self._parameters = parameters @classmethod - def from_dict(cls, dikt) -> "ApiPipelineTaskArguments": + def from_dict(cls, dikt) -> 'ApiPipelineTaskArguments': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_run_code_response.py b/api/server/swagger_server/models/api_run_code_response.py index 33e77bb7..e788d5d3 100644 --- a/api/server/swagger_server/models/api_run_code_response.py +++ b/api/server/swagger_server/models/api_run_code_response.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiRunCodeResponse(Model): @@ -18,9 +18,7 @@ class ApiRunCodeResponse(Model): Do not edit the class manually. """ - def __init__( - self, run_url: str = None, run_output_location: str = None - ): # noqa: E501 + def __init__(self, run_url: str = None, run_output_location: str = None): # noqa: E501 """ApiRunCodeResponse - a model defined in Swagger :param run_url: The run_url of this ApiRunCodeResponse. # noqa: E501 @@ -28,18 +26,21 @@ def __init__( :param run_output_location: The run_output_location of this ApiRunCodeResponse. # noqa: E501 :type run_output_location: str """ - self.swagger_types = {"run_url": str, "run_output_location": str} + self.swagger_types = { + 'run_url': str, + 'run_output_location': str + } self.attribute_map = { - "run_url": "run_url", - "run_output_location": "run_output_location", + 'run_url': 'run_url', + 'run_output_location': 'run_output_location' } self._run_url = run_url self._run_output_location = run_output_location @classmethod - def from_dict(cls, dikt) -> "ApiRunCodeResponse": + def from_dict(cls, dikt) -> 'ApiRunCodeResponse': """Returns the dict as a model :param dikt: A dict. @@ -70,9 +71,7 @@ def run_url(self, run_url: str): :type run_url: str """ if run_url is None: - raise ValueError( - "Invalid value for `run_url`, must not be `None`" - ) + raise ValueError("Invalid value for `run_url`, must not be `None`") # noqa: E501 self._run_url = run_url diff --git a/api/server/swagger_server/models/api_settings.py b/api/server/swagger_server/models/api_settings.py index f6db5587..a10445c4 100644 --- a/api/server/swagger_server/models/api_settings.py +++ b/api/server/swagger_server/models/api_settings.py @@ -9,10 +9,8 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server.models.api_settings_section import ( # noqa: F401 - ApiSettingsSection, -) -from swagger_server import util # noqa: F401 +from swagger_server.models.api_settings_section import ApiSettingsSection # noqa: F401,E501 +from swagger_server import util class ApiSettings(Model): @@ -27,14 +25,18 @@ def __init__(self, sections: List[ApiSettingsSection] = None): # noqa: E501 :param sections: The sections of this ApiSettings. # noqa: E501 :type sections: List[ApiSettingsSection] """ - self.swagger_types = {"sections": List[ApiSettingsSection]} + self.swagger_types = { + 'sections': List[ApiSettingsSection] + } - self.attribute_map = {"sections": "sections"} + self.attribute_map = { + 'sections': 'sections' + } self._sections = sections @classmethod - def from_dict(cls, dikt) -> "ApiSettings": + def from_dict(cls, dikt) -> 'ApiSettings': """Returns the dict as a model :param dikt: A dict. @@ -65,8 +67,6 @@ def sections(self, sections: List[ApiSettingsSection]): :type sections: List[ApiSettingsSection] """ if sections is None: - raise ValueError( - "Invalid value for `sections`, must not be `None`" - ) + raise ValueError("Invalid value for `sections`, must not be `None`") # noqa: E501 self._sections = sections diff --git a/api/server/swagger_server/models/api_settings_section.py b/api/server/swagger_server/models/api_settings_section.py index 1ed40b6c..2e66ec8f 100644 --- a/api/server/swagger_server/models/api_settings_section.py +++ b/api/server/swagger_server/models/api_settings_section.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.api_parameter import ApiParameter # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiSettingsSection(Model): @@ -19,12 +19,7 @@ class ApiSettingsSection(Model): Do not edit the class manually. """ - def __init__( - self, - name: str = None, - description: str = None, - settings: List[ApiParameter] = None, - ): # noqa: E501 + def __init__(self, name: str = None, description: str = None, settings: List[ApiParameter] = None): # noqa: E501 """ApiSettingsSection - a model defined in Swagger :param name: The name of this ApiSettingsSection. # noqa: E501 @@ -35,15 +30,15 @@ def __init__( :type settings: List[ApiParameter] """ self.swagger_types = { - "name": str, - "description": str, - "settings": List[ApiParameter], + 'name': str, + 'description': str, + 'settings': List[ApiParameter] } self.attribute_map = { - "name": "name", - "description": "description", - "settings": "settings", + 'name': 'name', + 'description': 'description', + 'settings': 'settings' } self._name = name @@ -51,7 +46,7 @@ def __init__( self._settings = settings @classmethod - def from_dict(cls, dikt) -> "ApiSettingsSection": + def from_dict(cls, dikt) -> 'ApiSettingsSection': """Returns the dict as a model :param dikt: A dict. @@ -82,9 +77,7 @@ def name(self, name: str): :type name: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`" - ) + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name diff --git a/api/server/swagger_server/models/api_status.py b/api/server/swagger_server/models/api_status.py index 4c57c32a..3940b3a0 100644 --- a/api/server/swagger_server/models/api_status.py +++ b/api/server/swagger_server/models/api_status.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.protobuf_any import ProtobufAny # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiStatus(Model): @@ -19,9 +19,7 @@ class ApiStatus(Model): Do not edit the class manually. """ - def __init__( - self, error: str = None, code: int = None, details: List[ProtobufAny] = None - ): # noqa: E501 + def __init__(self, error: str = None, code: int = None, details: List[ProtobufAny] = None): # noqa: E501 """ApiStatus - a model defined in Swagger :param error: The error of this ApiStatus. # noqa: E501 @@ -31,16 +29,24 @@ def __init__( :param details: The details of this ApiStatus. # noqa: E501 :type details: List[ProtobufAny] """ - self.swagger_types = {"error": str, "code": int, "details": List[ProtobufAny]} - - self.attribute_map = {"error": "error", "code": "code", "details": "details"} + self.swagger_types = { + 'error': str, + 'code': int, + 'details': List[ProtobufAny] + } + + self.attribute_map = { + 'error': 'error', + 'code': 'code', + 'details': 'details' + } self._error = error self._code = code self._details = details @classmethod - def from_dict(cls, dikt) -> "ApiStatus": + def from_dict(cls, dikt) -> 'ApiStatus': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/api_url.py b/api/server/swagger_server/models/api_url.py index f67d8f8b..22f73acf 100644 --- a/api/server/swagger_server/models/api_url.py +++ b/api/server/swagger_server/models/api_url.py @@ -9,7 +9,7 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model -from swagger_server import util # noqa: F401 +from swagger_server import util class ApiUrl(Model): @@ -24,14 +24,18 @@ def __init__(self, pipeline_url: str = None): # noqa: E501 :param pipeline_url: The pipeline_url of this ApiUrl. # noqa: E501 :type pipeline_url: str """ - self.swagger_types = {"pipeline_url": str} + self.swagger_types = { + 'pipeline_url': str + } - self.attribute_map = {"pipeline_url": "pipeline_url"} + self.attribute_map = { + 'pipeline_url': 'pipeline_url' + } self._pipeline_url = pipeline_url @classmethod - def from_dict(cls, dikt) -> "ApiUrl": + def from_dict(cls, dikt) -> 'ApiUrl': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/base_model_.py b/api/server/swagger_server/models/base_model_.py index f4b06491..1ab4b66a 100644 --- a/api/server/swagger_server/models/base_model_.py +++ b/api/server/swagger_server/models/base_model_.py @@ -1,15 +1,15 @@ # Copyright 2021 The MLX Contributors # # SPDX-License-Identifier: Apache-2.0 -import pprint # noqa: F401 +import pprint -import six # noqa: F401 +import six import typing from datetime import datetime -from swagger_server import util # noqa: F401 +from swagger_server import util -T = typing.TypeVar("T") +T = typing.TypeVar('T') class Model(object): @@ -36,20 +36,18 @@ def to_dict(self): for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value) - ) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") - else item, - value.items(), - ) - ) + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) elif isinstance(value, datetime): result[attr] = value.isoformat() else: diff --git a/api/server/swagger_server/models/dictionary.py b/api/server/swagger_server/models/dictionary.py index 7439ee7b..652bea8b 100644 --- a/api/server/swagger_server/models/dictionary.py +++ b/api/server/swagger_server/models/dictionary.py @@ -10,7 +10,7 @@ from swagger_server.models.base_model_ import Model from swagger_server.models.any_value import AnyValue # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class Dictionary(Model): @@ -20,13 +20,17 @@ class Dictionary(Model): """ def __init__(self): # noqa: E501 - """Dictionary - a model defined in Swagger""" - self.swagger_types = {} + """Dictionary - a model defined in Swagger - self.attribute_map = {} + """ + self.swagger_types = { + } + + self.attribute_map = { + } @classmethod - def from_dict(cls, dikt) -> "Dictionary": + def from_dict(cls, dikt) -> 'Dictionary': """Returns the dict as a model :param dikt: A dict. diff --git a/api/server/swagger_server/models/protobuf_any.py b/api/server/swagger_server/models/protobuf_any.py index 4b0ebf4d..4ec50087 100644 --- a/api/server/swagger_server/models/protobuf_any.py +++ b/api/server/swagger_server/models/protobuf_any.py @@ -9,10 +9,9 @@ from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model - # from swagger_server.models.byte_array import ByteArray # noqa: F401,E501 import re # noqa: F401,E501 -from swagger_server import util # noqa: F401 +from swagger_server import util class ProtobufAny(Model): @@ -29,15 +28,21 @@ def __init__(self, type_url: str = None, value: object = None): # noqa: E501 :param value: The value of this ProtobufAny. # noqa: E501 :type value: ByteArray """ - self.swagger_types = {"type_url": str, "value": object} + self.swagger_types = { + 'type_url': str, + 'value': object + } - self.attribute_map = {"type_url": "type_url", "value": "value"} + self.attribute_map = { + 'type_url': 'type_url', + 'value': 'value' + } self._type_url = type_url self._value = value @classmethod - def from_dict(cls, dikt) -> "ProtobufAny": + def from_dict(cls, dikt) -> 'ProtobufAny': """Returns the dict as a model :param dikt: A dict. @@ -90,12 +95,7 @@ def value(self, value: object): :param value: The value of this ProtobufAny. :type value: ByteArray """ - if value is not None and not re.search( - r"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$", - value, - ): # noqa: E501 - raise ValueError( - "Invalid value for `value`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`" # noqa: E501 - ) + if value is not None and not re.search(r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', value): # noqa: E501 + raise ValueError("Invalid value for `value`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501 self._value = value diff --git a/api/server/swagger_server/test/__init__.py b/api/server/swagger_server/test/__init__.py index 8d5141ab..798bcf62 100644 --- a/api/server/swagger_server/test/__init__.py +++ b/api/server/swagger_server/test/__init__.py @@ -3,16 +3,17 @@ # SPDX-License-Identifier: Apache-2.0 import logging -import connexion # noqa: F401 +import connexion from flask_testing import TestCase from swagger_server.encoder import JSONEncoder class BaseTestCase(TestCase): + def create_app(self): - logging.getLogger("connexion.operation").setLevel("ERROR") - app = connexion.App(__name__, specification_dir="../swagger/") + logging.getLogger('connexion.operation').setLevel('ERROR') + app = connexion.App(__name__, specification_dir='../swagger/') app.app.json_encoder = JSONEncoder - app.add_api("swagger.yaml") + app.add_api('swagger.yaml') return app.app diff --git a/api/server/swagger_server/test/test_application_settings_controller.py b/api/server/swagger_server/test/test_application_settings_controller.py index ba5afd03..417a234b 100644 --- a/api/server/swagger_server/test/test_application_settings_controller.py +++ b/api/server/swagger_server/test/test_application_settings_controller.py @@ -5,11 +5,10 @@ from __future__ import absolute_import -from flask import json # noqa: F401 -from six import BytesIO # noqa: F401 +from flask import json from swagger_server.models.api_settings import ApiSettings # noqa: E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.models.dictionary import Dictionary # noqa: E501 from swagger_server.test import BaseTestCase @@ -18,34 +17,45 @@ class TestApplicationSettingsController(BaseTestCase): """ApplicationSettingsController integration test stubs""" def test_get_application_settings(self): - """Test case for get_application_settings""" - response = self.client.open("/apis/v1alpha1/settings", method="GET") - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + """Test case for get_application_settings + + + """ + response = self.client.open( + '/apis/v1alpha1/settings', + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_modify_application_settings(self): - """Test case for modify_application_settings""" + """Test case for modify_application_settings + + + """ dictionary = Dictionary() response = self.client.open( - "/apis/v1alpha1/settings", - method="PUT", + '/apis/v1alpha1/settings', + method='PUT', data=json.dumps(dictionary), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_application_settings(self): - """Test case for set_application_settings""" + """Test case for set_application_settings + + + """ settings = ApiSettings() response = self.client.open( - "/apis/v1alpha1/settings", - method="POST", + '/apis/v1alpha1/settings', + method='POST', data=json.dumps(settings), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_catalog_service_controller.py b/api/server/swagger_server/test/test_catalog_service_controller.py index 21d409ae..6918042f 100644 --- a/api/server/swagger_server/test/test_catalog_service_controller.py +++ b/api/server/swagger_server/test/test_catalog_service_controller.py @@ -5,14 +5,11 @@ from __future__ import absolute_import -from flask import json # noqa: F401 -from six import BytesIO # noqa: F401 - -from swagger_server.models.api_catalog_upload import ApiCatalogUpload # noqa: F401, E501 -from swagger_server.models.api_list_catalog_items_response import ( # noqa: F401 - ApiListCatalogItemsResponse, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from flask import json + +from swagger_server.models.api_catalog_upload import ApiCatalogUpload # noqa: E501 +from swagger_server.models.api_list_catalog_items_response import ApiListCatalogItemsResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -20,31 +17,36 @@ class TestCatalogServiceController(BaseTestCase): """CatalogServiceController integration test stubs""" def test_list_all_assets(self): - """Test case for list_all_assets""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "sort_by_example"), - ("filter", "filter_example"), - ] + """Test case for list_all_assets + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'sort_by_example'), + ('filter', 'filter_example')] response = self.client.open( - "/apis/v1alpha1/catalog", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/catalog', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_multiple_assets(self): - """Test case for upload_multiple_assets""" + """Test case for upload_multiple_assets + + + """ body = [ApiCatalogUpload()] response = self.client.open( - "/apis/v1alpha1/catalog", - method="POST", + '/apis/v1alpha1/catalog', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_component_service_controller.py b/api/server/swagger_server/test/test_component_service_controller.py index 73bd2908..7ff43896 100644 --- a/api/server/swagger_server/test/test_component_service_controller.py +++ b/api/server/swagger_server/test/test_component_service_controller.py @@ -11,18 +11,12 @@ from six import BytesIO from swagger_server.models.api_component import ApiComponent # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_components_response import ( # noqa: F401 - ApiListComponentsResponse, -) -from swagger_server.models.api_parameter import ApiParameter # noqa: F401, E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_components_response import ApiListComponentsResponse # noqa: E501 +from swagger_server.models.api_parameter import ApiParameter # noqa: E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -30,133 +24,167 @@ class TestComponentServiceController(BaseTestCase): """ComponentServiceController integration test stubs""" def test_approve_components_for_publishing(self): - """Test case for approve_components_for_publishing""" + """Test case for approve_components_for_publishing + + + """ component_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/components/publish_approved", - method="POST", + '/apis/v1alpha1/components/publish_approved', + method='POST', data=json.dumps(component_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_create_component(self): - """Test case for create_component""" + """Test case for create_component + + + """ body = ApiComponent() response = self.client.open( - "/apis/v1alpha1/components", - method="POST", + '/apis/v1alpha1/components', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_component(self): - """Test case for delete_component""" + """Test case for delete_component + + + """ response = self.client.open( - "/apis/v1alpha1/components/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_download_component_files(self): """Test case for download_component_files Returns the component artifacts compressed into a .tgz (.tar.gz) file. """ - query_string = [("include_generated_code", False)] + query_string = [('include_generated_code', False)] response = self.client.open( - "/apis/v1alpha1/components/{id}/download".format(id="id_example"), - method="GET", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components/{id}/download'.format(id='id_example'), + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_generate_component_code(self): - """Test case for generate_component_code""" + """Test case for generate_component_code + + + """ response = self.client.open( - "/apis/v1alpha1/components/{id}/generate_code".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components/{id}/generate_code'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_component(self): - """Test case for get_component""" + """Test case for get_component + + + """ response = self.client.open( - "/apis/v1alpha1/components/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_component_template(self): - """Test case for get_component_template""" + """Test case for get_component_template + + + """ response = self.client.open( - "/apis/v1alpha1/components/{id}/templates".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components/{id}/templates'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_components(self): - """Test case for list_components""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + """Test case for list_components + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/components", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/components', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_run_component(self): - """Test case for run_component""" + """Test case for run_component + + + """ parameters = [ApiParameter()] - query_string = [("run_name", "run_name_example")] + query_string = [('run_name', 'run_name_example')] response = self.client.open( - "/apis/v1alpha1/components/{id}/run".format(id="id_example"), - method="POST", + '/apis/v1alpha1/components/{id}/run'.format(id='id_example'), + method='POST', data=json.dumps(parameters), - content_type="application/json", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_featured_components(self): - """Test case for set_featured_components""" + """Test case for set_featured_components + + + """ component_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/components/featured", - method="POST", + '/apis/v1alpha1/components/featured', + method='POST', data=json.dumps(component_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_component(self): - """Test case for upload_component""" - query_string = [("name", "name_example")] - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_component + + + """ + query_string = [('name', 'name_example')] + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/components/upload", - method="POST", + '/apis/v1alpha1/components/upload', + method='POST', data=data, - content_type="multipart/form-data", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_component_file(self): - """Test case for upload_component_file""" - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_component_file + + + """ + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/components/{id}/upload".format(id="id_example"), - method="POST", + '/apis/v1alpha1/components/{id}/upload'.format(id='id_example'), + method='POST', data=data, - content_type="multipart/form-data", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_credential_service_controller.py b/api/server/swagger_server/test/test_credential_service_controller.py index 3172fc2d..b1eca184 100644 --- a/api/server/swagger_server/test/test_credential_service_controller.py +++ b/api/server/swagger_server/test/test_credential_service_controller.py @@ -5,12 +5,11 @@ from __future__ import absolute_import -from flask import json # noqa: F401 -from six import BytesIO # noqa: F401 +from flask import json -from swagger_server.models.api_component import ApiComponent # noqa: F401, E501 +from swagger_server.models.api_component import ApiComponent # noqa: E501 from swagger_server.models.api_credential import ApiCredential # noqa: E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -18,32 +17,42 @@ class TestCredentialServiceController(BaseTestCase): """CredentialServiceController integration test stubs""" def test_create_credentials(self): - """Test case for create_credentials""" + """Test case for create_credentials + + + """ body = ApiCredential() response = self.client.open( - "/apis/v1alpha1/credentials", - method="POST", + '/apis/v1alpha1/credentials', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_credential(self): - """Test case for delete_credential""" + """Test case for delete_credential + + + """ response = self.client.open( - "/apis/v1alpha1/credentials/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/credentials/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_credential(self): - """Test case for get_credential""" + """Test case for get_credential + + + """ response = self.client.open( - "/apis/v1alpha1/credentials/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/credentials/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_dataset_service_controller.py b/api/server/swagger_server/test/test_dataset_service_controller.py index 75432cad..cb8a9780 100644 --- a/api/server/swagger_server/test/test_dataset_service_controller.py +++ b/api/server/swagger_server/test/test_dataset_service_controller.py @@ -9,16 +9,10 @@ from six import BytesIO from swagger_server.models.api_dataset import ApiDataset # noqa: E501 -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_datasets_response import ( # noqa: F401 - ApiListDatasetsResponse, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_datasets_response import ApiListDatasetsResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -26,120 +20,151 @@ class TestDatasetServiceController(BaseTestCase): """DatasetServiceController integration test stubs""" def test_approve_datasets_for_publishing(self): - """Test case for approve_datasets_for_publishing""" + """Test case for approve_datasets_for_publishing + + + """ dataset_ids = [list[str]()] response = self.client.open( - "/apis/v1alpha1/datasets/publish_approved", - method="POST", + '/apis/v1alpha1/datasets/publish_approved', + method='POST', data=json.dumps(dataset_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_create_dataset(self): - """Test case for create_dataset""" + """Test case for create_dataset + + + """ body = ApiDataset() response = self.client.open( - "/apis/v1alpha1/datasets", - method="POST", + '/apis/v1alpha1/datasets', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_dataset(self): - """Test case for delete_dataset""" + """Test case for delete_dataset + + + """ response = self.client.open( - "/apis/v1alpha1/datasets/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_download_dataset_files(self): """Test case for download_dataset_files Returns the dataset artifacts compressed into a .tgz (.tar.gz) file. """ - query_string = [("include_generated_code", False)] + query_string = [('include_generated_code', False)] response = self.client.open( - "/apis/v1alpha1/datasets/{id}/download".format(id="id_example"), - method="GET", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets/{id}/download'.format(id='id_example'), + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_generate_dataset_code(self): - """Test case for generate_dataset_code""" + """Test case for generate_dataset_code + + + """ response = self.client.open( - "/apis/v1alpha1/datasets/{id}/generate_code".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets/{id}/generate_code'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_dataset(self): - """Test case for get_dataset""" + """Test case for get_dataset + + + """ response = self.client.open( - "/apis/v1alpha1/datasets/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_dataset_template(self): - """Test case for get_dataset_template""" + """Test case for get_dataset_template + + + """ response = self.client.open( - "/apis/v1alpha1/datasets/{id}/templates".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets/{id}/templates'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_datasets(self): - """Test case for list_datasets""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + """Test case for list_datasets + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/datasets", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/datasets', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_featured_datasets(self): - """Test case for set_featured_datasets""" + """Test case for set_featured_datasets + + + """ dataset_ids = [list[str]()] response = self.client.open( - "/apis/v1alpha1/datasets/featured", - method="POST", + '/apis/v1alpha1/datasets/featured', + method='POST', data=json.dumps(dataset_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_dataset(self): - """Test case for upload_dataset""" - query_string = [("name", "name_example")] - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_dataset + + + """ + query_string = [('name', 'name_example')] + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/datasets/upload", - method="POST", + '/apis/v1alpha1/datasets/upload', + method='POST', data=data, - content_type="multipart/form-data", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_dataset_file(self): - """Test case for upload_dataset_file""" - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_dataset_file + + + """ + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/datasets/{id}/upload".format(id="id_example"), - method="POST", + '/apis/v1alpha1/datasets/{id}/upload'.format(id='id_example'), + method='POST', data=data, - content_type="multipart/form-data", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_health_check_controller.py b/api/server/swagger_server/test/test_health_check_controller.py index b8fbb487..54d78886 100644 --- a/api/server/swagger_server/test/test_health_check_controller.py +++ b/api/server/swagger_server/test/test_health_check_controller.py @@ -5,10 +5,8 @@ from __future__ import absolute_import -from flask import json # noqa: F401 -from six import BytesIO # noqa: F401 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -20,14 +18,16 @@ def test_health_check(self): Checks if the server is running """ - query_string = [("check_database", True), ("check_object_store", True)] + query_string = [('check_database', True), + ('check_object_store', True)] response = self.client.open( - "/apis/v1alpha1/health_check", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/health_check', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_inference_service_controller.py b/api/server/swagger_server/test/test_inference_service_controller.py index 281e24fa..c7ec8fb2 100644 --- a/api/server/swagger_server/test/test_inference_service_controller.py +++ b/api/server/swagger_server/test/test_inference_service_controller.py @@ -5,10 +5,8 @@ from __future__ import absolute_import -from flask import json # noqa: F401 -from six import BytesIO # noqa: F401 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -16,31 +14,33 @@ class TestInferenceServiceController(BaseTestCase): """InferenceServiceController integration test stubs""" def test_get_service(self): - """Test case for get_service""" + """Test case for get_service + + + """ response = self.client.open( - "/apis/v1alpha1/inferenceservices/{id}".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/inferenceservices/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_services(self): """Test case for list_services Gets all KFServing services """ - query_string = [ - ("namespace", "namespace_example"), - ("label", "label_example"), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + query_string = [('namespace', 'namespace_example'), + ('label', 'label_example'), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/inferenceservices", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/inferenceservices', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_model_service_controller.py b/api/server/swagger_server/test/test_model_service_controller.py index e393ebad..eb07f4f1 100644 --- a/api/server/swagger_server/test/test_model_service_controller.py +++ b/api/server/swagger_server/test/test_model_service_controller.py @@ -10,18 +10,12 @@ from flask import json from six import BytesIO -from swagger_server.models.api_generate_model_code_response import ( # noqa: F401 - ApiGenerateModelCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_models_response import ( # noqa: F401 - ApiListModelsResponse, -) +from swagger_server.models.api_generate_model_code_response import ApiGenerateModelCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_models_response import ApiListModelsResponse # noqa: E501 from swagger_server.models.api_model import ApiModel # noqa: E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -29,133 +23,166 @@ class TestModelServiceController(BaseTestCase): """ModelServiceController integration test stubs""" def test_approve_models_for_publishing(self): - """Test case for approve_models_for_publishing""" + """Test case for approve_models_for_publishing + + + """ model_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/models/publish_approved", - method="POST", + '/apis/v1alpha1/models/publish_approved', + method='POST', data=json.dumps(model_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_create_model(self): - """Test case for create_model""" + """Test case for create_model + + + """ body = ApiModel() response = self.client.open( - "/apis/v1alpha1/models", - method="POST", + '/apis/v1alpha1/models', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_model(self): - """Test case for delete_model""" + """Test case for delete_model + + + """ response = self.client.open( - "/apis/v1alpha1/models/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_download_model_files(self): """Test case for download_model_files Returns the model artifacts compressed into a .tgz (.tar.gz) file. """ - query_string = [("include_generated_code", False)] + query_string = [('include_generated_code', False)] response = self.client.open( - "/apis/v1alpha1/models/{id}/download".format(id="id_example"), - method="GET", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}/download'.format(id='id_example'), + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_generate_model_code(self): - """Test case for generate_model_code""" + """Test case for generate_model_code + + + """ response = self.client.open( - "/apis/v1alpha1/models/{id}/generate_code".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}/generate_code'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_model(self): - """Test case for get_model""" + """Test case for get_model + + + """ response = self.client.open( - "/apis/v1alpha1/models/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_model_template(self): - """Test case for get_model_template""" + """Test case for get_model_template + + + """ response = self.client.open( - "/apis/v1alpha1/models/{id}/templates".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}/templates'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_models(self): - """Test case for list_models""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + """Test case for list_models + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/models", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_run_model(self): - """Test case for run_model""" - query_string = [ - ("pipeline_stage", "pipeline_stage_example"), - ("execution_platform", "execution_platform_example"), - ("run_name", "run_name_example"), - ] + """Test case for run_model + + + """ + query_string = [('pipeline_stage', 'pipeline_stage_example'), + ('execution_platform', 'execution_platform_example'), + ('run_name', 'run_name_example')] response = self.client.open( - "/apis/v1alpha1/models/{id}/run".format(id="id_example"), - method="POST", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/models/{id}/run'.format(id='id_example'), + method='POST', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_featured_models(self): - """Test case for set_featured_models""" + """Test case for set_featured_models + + + """ model_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/models/featured", - method="POST", + '/apis/v1alpha1/models/featured', + method='POST', data=json.dumps(model_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_model(self): - """Test case for upload_model""" - query_string = [("name", "name_example")] - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_model + + + """ + query_string = [('name', 'name_example')] + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/models/upload", - method="POST", + '/apis/v1alpha1/models/upload', + method='POST', data=data, - content_type="multipart/form-data", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_model_file(self): - """Test case for upload_model_file""" - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_model_file + + + """ + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/models/{id}/upload".format(id="id_example"), - method="POST", + '/apis/v1alpha1/models/{id}/upload'.format(id='id_example'), + method='POST', data=data, - content_type="multipart/form-data", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_notebook_service_controller.py b/api/server/swagger_server/test/test_notebook_service_controller.py index e4580f27..7afeb672 100644 --- a/api/server/swagger_server/test/test_notebook_service_controller.py +++ b/api/server/swagger_server/test/test_notebook_service_controller.py @@ -10,18 +10,12 @@ from flask import json from six import BytesIO -from swagger_server.models.api_generate_code_response import ( # noqa: F401 - ApiGenerateCodeResponse, -) -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_notebooks_response import ( # noqa: F401 - ApiListNotebooksResponse, -) +from swagger_server.models.api_generate_code_response import ApiGenerateCodeResponse # noqa: E501 +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_notebooks_response import ApiListNotebooksResponse # noqa: E501 from swagger_server.models.api_notebook import ApiNotebook # noqa: E501 -from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: F401, E501 -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_run_code_response import ApiRunCodeResponse # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -29,130 +23,164 @@ class TestNotebookServiceController(BaseTestCase): """NotebookServiceController integration test stubs""" def test_approve_notebooks_for_publishing(self): - """Test case for approve_notebooks_for_publishing""" + """Test case for approve_notebooks_for_publishing + + + """ notebook_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/notebooks/publish_approved", - method="POST", + '/apis/v1alpha1/notebooks/publish_approved', + method='POST', data=json.dumps(notebook_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_create_notebook(self): - """Test case for create_notebook""" + """Test case for create_notebook + + + """ body = ApiNotebook() response = self.client.open( - "/apis/v1alpha1/notebooks", - method="POST", + '/apis/v1alpha1/notebooks', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_notebook(self): - """Test case for delete_notebook""" + """Test case for delete_notebook + + + """ response = self.client.open( - "/apis/v1alpha1/notebooks/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_download_notebook_files(self): """Test case for download_notebook_files Returns the notebook artifacts compressed into a .tgz (.tar.gz) file. """ - query_string = [("include_generated_code", False)] + query_string = [('include_generated_code', False)] response = self.client.open( - "/apis/v1alpha1/notebooks/{id}/download".format(id="id_example"), - method="GET", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}/download'.format(id='id_example'), + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_generate_notebook_code(self): - """Test case for generate_notebook_code""" + """Test case for generate_notebook_code + + + """ response = self.client.open( - "/apis/v1alpha1/notebooks/{id}/generate_code".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}/generate_code'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_notebook(self): - """Test case for get_notebook""" + """Test case for get_notebook + + + """ response = self.client.open( - "/apis/v1alpha1/notebooks/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_notebook_template(self): - """Test case for get_notebook_template""" + """Test case for get_notebook_template + + + """ response = self.client.open( - "/apis/v1alpha1/notebooks/{id}/templates".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}/templates'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_notebooks(self): - """Test case for list_notebooks""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + """Test case for list_notebooks + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/notebooks", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_run_notebook(self): - """Test case for run_notebook""" - query_string = [("run_name", "run_name_example")] + """Test case for run_notebook + + + """ + query_string = [('run_name', 'run_name_example')] response = self.client.open( - "/apis/v1alpha1/notebooks/{id}/run".format(id="id_example"), - method="POST", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/notebooks/{id}/run'.format(id='id_example'), + method='POST', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_featured_notebooks(self): - """Test case for set_featured_notebooks""" + """Test case for set_featured_notebooks + + + """ notebook_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/notebooks/featured", - method="POST", + '/apis/v1alpha1/notebooks/featured', + method='POST', data=json.dumps(notebook_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_notebook(self): - """Test case for upload_notebook""" - query_string = [("name", "name_example")] - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_notebook + + + """ + query_string = [('name', 'name_example')] + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/notebooks/upload", - method="POST", + '/apis/v1alpha1/notebooks/upload', + method='POST', data=data, - content_type="multipart/form-data", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_notebook_file(self): - """Test case for upload_notebook_file""" - data = dict(uploadfile=(BytesIO(b"some file data"), "file.txt")) + """Test case for upload_notebook_file + + + """ + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt')) response = self.client.open( - "/apis/v1alpha1/notebooks/{id}/upload".format(id="id_example"), - method="POST", + '/apis/v1alpha1/notebooks/{id}/upload'.format(id='id_example'), + method='POST', data=data, - content_type="multipart/form-data", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/test/test_pipeline_service_controller.py b/api/server/swagger_server/test/test_pipeline_service_controller.py index 18f5f7fe..7de7e4ee 100644 --- a/api/server/swagger_server/test/test_pipeline_service_controller.py +++ b/api/server/swagger_server/test/test_pipeline_service_controller.py @@ -10,17 +10,11 @@ from flask import json from six import BytesIO -from swagger_server.models.api_get_template_response import ( # noqa: F401 - ApiGetTemplateResponse, -) -from swagger_server.models.api_list_pipelines_response import ( # noqa: F401 - ApiListPipelinesResponse, -) +from swagger_server.models.api_get_template_response import ApiGetTemplateResponse # noqa: E501 +from swagger_server.models.api_list_pipelines_response import ApiListPipelinesResponse # noqa: E501 from swagger_server.models.api_pipeline import ApiPipeline # noqa: E501 -from swagger_server.models.api_pipeline_extended import ( # noqa: F401 - ApiPipelineExtended, -) -from swagger_server.models.api_status import ApiStatus # noqa: F401, E501 +from swagger_server.models.api_pipeline_extended import ApiPipelineExtended # noqa: E501 +from swagger_server.models.api_status import ApiStatus # noqa: E501 from swagger_server.test import BaseTestCase @@ -28,33 +22,43 @@ class TestPipelineServiceController(BaseTestCase): """PipelineServiceController integration test stubs""" def test_approve_pipelines_for_publishing(self): - """Test case for approve_pipelines_for_publishing""" + """Test case for approve_pipelines_for_publishing + + + """ pipeline_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/pipelines/publish_approved", - method="POST", + '/apis/v1alpha1/pipelines/publish_approved', + method='POST', data=json.dumps(pipeline_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_create_pipeline(self): - """Test case for create_pipeline""" + """Test case for create_pipeline + + + """ body = ApiPipeline() response = self.client.open( - "/apis/v1alpha1/pipelines", - method="POST", + '/apis/v1alpha1/pipelines', + method='POST', data=json.dumps(body), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_delete_pipeline(self): - """Test case for delete_pipeline""" + """Test case for delete_pipeline + + + """ response = self.client.open( - "/apis/v1alpha1/pipelines/{id}".format(id="id_example"), method="DELETE" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/pipelines/{id}'.format(id='id_example'), + method='DELETE') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_download_pipeline_files(self): """Test case for download_pipeline_files @@ -62,71 +66,82 @@ def test_download_pipeline_files(self): Returns the pipeline YAML compressed into a .tgz (.tar.gz) file. """ response = self.client.open( - "/apis/v1alpha1/pipelines/{id}/download".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/pipelines/{id}/download'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_pipeline(self): - """Test case for get_pipeline""" + """Test case for get_pipeline + + + """ response = self.client.open( - "/apis/v1alpha1/pipelines/{id}".format(id="id_example"), method="GET" - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/pipelines/{id}'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_get_template(self): - """Test case for get_template""" + """Test case for get_template + + + """ response = self.client.open( - "/apis/v1alpha1/pipelines/{id}/templates".format(id="id_example"), - method="GET", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/pipelines/{id}/templates'.format(id='id_example'), + method='GET') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_list_pipelines(self): - """Test case for list_pipelines""" - query_string = [ - ("page_token", "page_token_example"), - ("page_size", 56), - ("sort_by", "name"), - ("filter", '{"name": "test"}'), - ] + """Test case for list_pipelines + + + """ + query_string = [('page_token', 'page_token_example'), + ('page_size', 56), + ('sort_by', 'name'), + ('filter', '{"name": "test"}')] response = self.client.open( - "/apis/v1alpha1/pipelines", method="GET", query_string=query_string - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + '/apis/v1alpha1/pipelines', + method='GET', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_set_featured_pipelines(self): - """Test case for set_featured_pipelines""" + """Test case for set_featured_pipelines + + + """ pipeline_ids = [List[str]()] response = self.client.open( - "/apis/v1alpha1/pipelines/featured", - method="POST", + '/apis/v1alpha1/pipelines/featured', + method='POST', data=json.dumps(pipeline_ids), - content_type="application/json", - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='application/json') + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) def test_upload_pipeline(self): - """Test case for upload_pipeline""" - query_string = [ - ("name", "name_example"), - ("description", "description_example"), - ] - data = dict( - uploadfile=(BytesIO(b"some file data"), "file.txt"), - annotations="annotations_example", - ) + """Test case for upload_pipeline + + + """ + query_string = [('name', 'name_example'), + ('description', 'description_example')] + data = dict(uploadfile=(BytesIO(b'some file data'), 'file.txt'), + annotations='annotations_example') response = self.client.open( - "/apis/v1alpha1/pipelines/upload", - method="POST", + '/apis/v1alpha1/pipelines/upload', + method='POST', data=data, - content_type="multipart/form-data", - query_string=query_string, - ) - self.assert200(response, "Response body is : " + response.data.decode("utf-8")) + content_type='multipart/form-data', + query_string=query_string) + self.assert200(response, + 'Response body is : ' + response.data.decode('utf-8')) -if __name__ == "__main__": +if __name__ == '__main__': import unittest - unittest.main() diff --git a/api/server/swagger_server/util.py b/api/server/swagger_server/util.py index 0094dabf..49778b06 100644 --- a/api/server/swagger_server/util.py +++ b/api/server/swagger_server/util.py @@ -5,7 +5,7 @@ import datetime import logging -import six # noqa: F401 +import six import typing from flask import request @@ -37,11 +37,11 @@ def _deserialize(data, klass): # AttributeError: module 'typing' has no attribute 'GenericMeta': https://github.com/zalando/connexion/issues/739#issuecomment-437398835 # elif type(klass) == typing.GenericMeta: elif type(klass) == typing._GenericAlias: # Python >= 3.7 - if klass._name == "List": + if klass._name == 'List': return _deserialize_list(data, klass.__args__[0]) - if klass._name == "Dict": + if klass._name == 'Dict': return _deserialize_dict(data, klass.__args__[1]) - elif hasattr(klass, "__origin__") and hasattr(klass, "__extra__"): # Python <= 3.6 + elif hasattr(klass, '__origin__') and hasattr(klass, '__extra__'): # Python <= 3.6 if klass.__extra__ == list: return _deserialize_list(data, klass.__args__[0]) if klass.__extra__ == dict: @@ -86,7 +86,6 @@ def deserialize_date(string): """ try: from dateutil.parser import parse - return parse(string).date() except ImportError: return string @@ -104,7 +103,6 @@ def deserialize_datetime(string): """ try: from dateutil.parser import parse - return parse(string) except ImportError: return string @@ -124,11 +122,9 @@ def deserialize_model(data, klass): return data for attr, attr_type in six.iteritems(instance.swagger_types): - if ( - data is not None - and instance.attribute_map[attr] in data - and isinstance(data, (list, dict)) - ): + if data is not None \ + and instance.attribute_map[attr] in data \ + and isinstance(data, (list, dict)): value = data[instance.attribute_map[attr]] setattr(instance, attr, _deserialize(value, attr_type)) @@ -145,7 +141,8 @@ def _deserialize_list(data, boxed_type): :return: deserialized list. :rtype: list """ - return [_deserialize(sub_data, boxed_type) for sub_data in data] + return [_deserialize(sub_data, boxed_type) + for sub_data in data] def _deserialize_dict(data, boxed_type): @@ -158,15 +155,16 @@ def _deserialize_dict(data, boxed_type): :return: deserialized dict. :rtype: dict """ - return {k: _deserialize(v, boxed_type) for k, v in six.iteritems(data)} + return {k: _deserialize(v, boxed_type) + for k, v in six.iteritems(data)} ####################################################################### # non-generated methods # ####################################################################### - class ApiError(Exception): + def __init__(self, message, http_status_code=500): self.message = message self.http_status_code = http_status_code @@ -184,11 +182,9 @@ def __repr__(self): def should_cache(controller_name, method_name): - return ( - request.method == "GET" - and method_name != "health_check" - and "inference_service" not in controller_name - ) + return request.method == "GET" \ + and method_name != "health_check" \ + and "inference_service" not in controller_name def invoke_controller_impl(controller_name=None, parameters=None, method_name=None): @@ -235,7 +231,7 @@ def delete_component(id): # replace 'None' values with None, happens when client sets a parameter to None (a JSON serialization quirk) for k, v in parameters.items(): - if type(v) == str and v == "None": + if type(v) == str and v == 'None': parameters[k] = None # remove parameters with None values, otherwise the default values of method signature will not take effect @@ -243,13 +239,13 @@ def delete_component(id): if v is None: del parameters[k] - module_name_parts = controller_name.split(".") + module_name_parts = controller_name.split('.') - if module_name_parts[1] == "controllers": - module_name_parts[1] = "controllers_impl" - module_name_parts[2] = module_name_parts[2] + "_impl" + if module_name_parts[1] == 'controllers': + module_name_parts[1] = 'controllers_impl' + module_name_parts[2] = module_name_parts[2] + '_impl' - module_name = ".".join(module_name_parts) + module_name = '.'.join(module_name_parts) try: controller_impl_module = importlib.import_module(module_name) @@ -261,10 +257,7 @@ def delete_component(id): except AttributeError: traceback.print_exc() - return ( - f"The method '{method_name}' does not exist in module '{module_name}'", - 501, - ) + return f"The method '{method_name}' does not exist in module '{module_name}'", 501 if impl_func: try: @@ -282,12 +275,7 @@ def delete_component(id): log_msg = get_request_log_msg() logging.getLogger("GETcache").info(f"{log_msg} added to cache") - if request.method in ( - "DELETE", - "POST", - "PATCH", - "PUT", - ) and not method_name.startswith("run_"): + if request.method in ("DELETE", "POST", "PATCH", "PUT") and not method_name.startswith("run_"): # any modifying method clears all cached entries, to avoid loopholes like delete '*', # upload has no 'id', catalog modifies other asset types (represented by controller class), ... response_cache.clear() @@ -310,4 +298,4 @@ def delete_component(id): return f"{e.__class__.__name__}: {str(e)}", 500 else: - return f"Method not found: {module_name}.{method_name}()", 501 + return f'Method not found: {module_name}.{method_name}()', 501 diff --git a/bootstrapper/start.py b/bootstrapper/start.py index 8da27ead..919b14ef 100644 --- a/bootstrapper/start.py +++ b/bootstrapper/start.py @@ -9,14 +9,11 @@ import shutil -internal_github_raw_url = os.getenv( - "internal_github_raw_url", - "https://raw.githubusercontent.com/machine-learning-exchange/mlx/main/", -) +internal_github_raw_url = os.getenv("internal_github_raw_url", "https://raw.githubusercontent.com/machine-learning-exchange/mlx/main/") api_url = os.getenv("mlx_api", "mlx-api") token = os.getenv("enterprise_github_token", "") -repo_name = "mlx" -asset_categories = ["pipelines", "components", "models", "notebooks", "datasets"] +repo_name = 'mlx' +asset_categories = ['pipelines', 'components', 'models', 'notebooks', 'datasets'] def get_github_files(asset_name, asset_list): @@ -24,58 +21,57 @@ def get_github_files(asset_name, asset_list): for asset in asset_list: if token: headers = { - "Accept": "application/vnd.github.v3.raw", - "Authorization": "token " + token, + 'Accept': 'application/vnd.github.v3.raw', + 'Authorization': 'token ' + token } else: headers = {} - if "://" not in asset["source"] and token: - r = requests.get(internal_github_raw_url + asset["source"], headers=headers) - elif "raw.github.ibm.com" in asset["source"] and token: - r = requests.get(asset["source"], headers=headers) - elif "://" in asset["source"]: - r = requests.get(asset["source"]) + if '://' not in asset['source'] and token: + r = requests.get(internal_github_raw_url + asset['source'], headers=headers) + elif 'raw.github.ibm.com' in asset['source'] and token: + r = requests.get(asset['source'], headers=headers) + elif '://' in asset['source']: + r = requests.get(asset['source']) else: continue - if asset_name != "components": - filename = os.path.basename(asset["source"]) + if asset_name != 'components': + filename = os.path.basename(asset['source']) else: - filename = asset["name"].replace(" ", "-") + ".yaml" + filename = asset['name'].replace(" ", "-") + '.yaml' with open(os.path.join(asset_name, filename), "w") as file: file.write(r.text) - asset["download"] = "true" + asset['download'] = 'true' def upload_asset(asset_name, asset_list): for asset in asset_list: - if asset.get("download", "") == "true": - if asset_name != "components": - filename = os.path.basename(asset["source"]) + if asset.get('download', '') == 'true': + if asset_name != 'components': + filename = os.path.basename(asset['source']) else: - filename = asset["name"].replace(" ", "-") + ".yaml" + filename = asset['name'].replace(" ", "-") + '.yaml' tarname = filename.replace(".yaml", ".tgz") tarfile_path = os.path.join(asset_name, tarname) with tarfile.open(tarfile_path, "w:gz") as tar: tar.add(os.path.join(asset_name, filename), arcname=filename) tar.close() - params = {"name": asset.get("name", "")} - if asset_name == "notebooks" and "://" not in asset["source"] and token: - data = {"enterprise_github_token": token} + params = { + 'name': asset.get('name', '') + } + if asset_name == 'notebooks' and '://' not in asset['source'] and token: + data = { + 'enterprise_github_token': token + } else: data = {} - with open(os.path.join(asset_name, tarname), "rb") as f: - r = requests.post( - "http://" + api_url + "/apis/v1alpha1/" + asset_name + "/upload", - params=params, - files={"uploadfile": f}, - data=data, - ) + with open(os.path.join(asset_name, tarname), 'rb') as f: + r = requests.post("http://" + api_url + '/apis/v1alpha1/' + asset_name + '/upload', params=params, files={'uploadfile': f}, data=data) print(r.text) def cleanup_assets(asset_name): - r = requests.delete("http://" + api_url + "/apis/v1alpha1/" + asset_name + "/*") + r = requests.delete("http://" + api_url + '/apis/v1alpha1/' + asset_name + '/*') print(r.text) @@ -83,119 +79,93 @@ def get_github_dir_files(asset_name, asset_list): os.makedirs(asset_name, exist_ok=True) if token: headers = { - "Accept": "application/vnd.github.v3.raw", - "Authorization": "token " + token, + 'Accept': 'application/vnd.github.v3.raw', + 'Authorization': 'token ' + token } - internal_github_url = internal_github_raw_url.replace( - "raw.", token + "@" - ).replace("/master/", "") - command = ["git", "clone", internal_github_url, repo_name] + internal_github_url = internal_github_raw_url.replace('raw.', token + '@').replace('/master/', '') + command = ['git', 'clone', internal_github_url, repo_name] subprocess.run(command, check=True) for asset in asset_list: - if "://" not in asset["source"] and token: - shutil.copytree( - repo_name + "/" + asset["source"], - asset_name + "/" + asset["name"].replace(" ", "-"), - ) - asset["url"] = internal_github_url + "/" + asset["source"] - asset["download"] = "true" - elif "://" in asset["source"]: - source_pieces = asset["source"].split("/") - github_url = "/".join(source_pieces[0:5]) + if '://' not in asset['source'] and token: + shutil.copytree(repo_name + '/' + asset['source'], asset_name + '/' + asset['name'].replace(" ", "-")) + asset['url'] = internal_github_url + '/' + asset['source'] + asset['download'] = 'true' + elif '://' in asset['source']: + source_pieces = asset['source'].split('/') + github_url = '/'.join(source_pieces[0:5]) github_repo = source_pieces[4] - source_dir = "/".join(source_pieces[7:]) - command = ["git", "clone", github_url, github_repo] - if github_repo not in os.listdir("."): + source_dir = '/'.join(source_pieces[7:]) + command = ['git', 'clone', github_url, github_repo] + if github_repo not in os.listdir('.'): subprocess.run(command, check=True) - shutil.copytree( - github_repo + "/" + source_dir, - asset_name + "/" + asset["name"].replace(" ", "-"), - ) - asset["url"] = asset["source"] - asset["download"] = "true" + shutil.copytree(github_repo + '/' + source_dir, asset_name + '/' + asset['name'].replace(" ", "-")) + asset['url'] = asset['source'] + asset['download'] = 'true' def upload_dir_asset(asset_name, asset_list): for asset in asset_list: - if asset.get("download", "") == "true": - dirname = asset["name"].replace(" ", "-") - tarname = dirname + ".tgz" + if asset.get('download', '') == 'true': + dirname = asset['name'].replace(" ", "-") + tarname = dirname + '.tgz' tarfile_path = os.path.join(asset_name, tarname) with tarfile.open(tarfile_path, "w:gz") as tar: for filename in os.listdir(os.path.join(asset_name, dirname)): - if filename.endswith(".yaml") or filename.endswith(".yml"): - tar.add( - os.path.join(asset_name, dirname, filename), - arcname=filename, - ) + if filename.endswith('.yaml') or filename.endswith('.yml'): + tar.add(os.path.join(asset_name, dirname, filename), arcname=filename) tar.close() - with open(os.path.join(asset_name, tarname), "rb") as f: - params = {"name": asset.get("name", ""), "url": asset.get("url", "")} - r = requests.post( - "http://" + api_url + "/apis/v1alpha1/" + asset_name + "/upload", - files={"uploadfile": f}, - params=params, - ) + with open(os.path.join(asset_name, tarname), 'rb') as f: + params = { + 'name': asset.get('name', ''), + 'url': asset.get('url', '') + } + r = requests.post("http://" + api_url + '/apis/v1alpha1/' + asset_name + '/upload', files={'uploadfile': f}, params=params) print(r.text) def feature_default_assets(): for category in asset_categories: - data = ["*"] - r = requests.post( - "http://" + api_url + "/apis/v1alpha1/" + category + "/publish_approved", - json=data, - ) + data = ['*'] + r = requests.post("http://" + api_url + '/apis/v1alpha1/' + category + '/publish_approved', json=data) print(r.text) - r = requests.post( - "http://" + api_url + "/apis/v1alpha1/" + category + "/featured", json=data - ) + r = requests.post("http://" + api_url + '/apis/v1alpha1/' + category + '/featured', json=data) print(r.text) -if __name__ == "__main__": +if __name__ == '__main__': with open("/etc/config.json", "r") as f: samples = json.load(f) f.close() - if os.getenv("cleanup", "") == "true": + if os.getenv('cleanup', '') == 'true': for category in asset_categories: cleanup_assets(category) - get_github_files("pipelines", samples["pipelines"]) - get_github_files("components", samples["components"]) - get_github_files("models", samples["models"]) - get_github_files("notebooks", samples["notebooks"]) - get_github_files("datasets", samples["datasets"]) + get_github_files('pipelines', samples['pipelines']) + get_github_files('components', samples['components']) + get_github_files('models', samples['models']) + get_github_files('notebooks', samples['notebooks']) + get_github_files('datasets', samples['datasets']) if api_url: - for asset in samples["pipelines"]: - if asset.get("download", "") == "true": - filename = os.path.basename(asset["source"]) - tarname = filename + ".tar.gz" - command = [ - "dsl-compile", - "--py", - os.path.join("pipelines", filename), - "--output", - os.path.join("pipelines", tarname), - ] + for asset in samples['pipelines']: + if asset.get('download', '') == 'true': + filename = os.path.basename(asset['source']) + tarname = filename + '.tar.gz' + command = ['dsl-compile', '--py', os.path.join('pipelines', filename), '--output', os.path.join('pipelines', tarname)] subprocess.run(command, check=True) - with open(os.path.join("pipelines", tarname), "rb") as f: + with open(os.path.join('pipelines', tarname), 'rb') as f: params = { - "name": asset.get("name", ""), - "description": asset.get("description", ""), + 'name': asset.get('name', ''), + 'description': asset.get('description', '') + } + data = { + 'annotations': json.dumps(asset.get('annotations', {})) } - data = {"annotations": json.dumps(asset.get("annotations", {}))} - r = requests.post( - "http://" + api_url + "/apis/v1alpha1/pipelines/upload", - files={"uploadfile": f}, - params=params, - data=data, - ) + r = requests.post("http://" + api_url + '/apis/v1alpha1/pipelines/upload', files={'uploadfile': f}, params=params, data=data) print(r.text) - upload_asset("components", samples["components"]) - upload_asset("models", samples["models"]) - upload_asset("notebooks", samples["notebooks"]) - upload_asset("datasets", samples["datasets"]) + upload_asset('components', samples['components']) + upload_asset('models', samples['models']) + upload_asset('notebooks', samples['notebooks']) + upload_asset('datasets', samples['datasets']) feature_default_assets() diff --git a/tools/python/regenerate_catalog_upload_json.py b/tools/python/regenerate_catalog_upload_json.py index 6b988126..66e60b2f 100755 --- a/tools/python/regenerate_catalog_upload_json.py +++ b/tools/python/regenerate_catalog_upload_json.py @@ -7,7 +7,7 @@ from __future__ import print_function import json -import yaml # noqa: F401 +import yaml from glob import glob from os.path import abspath, dirname, relpath @@ -25,9 +25,7 @@ project_dir = dirname(script_path) katalog_dir = f"{project_dir}/../katalog" # TODO: don't assume user cloned katalog and mlx repos into same parent folder -katalog_url = ( - "https://raw.githubusercontent.com/machine-learning-exchange/katalog/main/" -) +katalog_url = "https://raw.githubusercontent.com/machine-learning-exchange/katalog/main/" catalog_upload_json_files = [ f"{project_dir}/bootstrapper/catalog_upload.json", @@ -39,11 +37,8 @@ def get_list_of_yaml_files_in_katalog(asset_type: str): yaml_files = glob(f"{katalog_dir}/{asset_type}-samples/**/*.yaml", recursive=True) - yaml_files = [ - filepath - for filepath in yaml_files - if not any(word in filepath for word in ["template", "test", "src"]) - ] + yaml_files = [filepath for filepath in yaml_files + if not any(word in filepath for word in ["template", "test", "src"])] return sorted(yaml_files) @@ -61,17 +56,15 @@ def generate_katalog_dict() -> dict: with open(yaml_file) as f: yaml_dict = yaml.load(f, Loader=yaml.FullLoader) - asset_name = ( - yaml_dict.get("name") - or yaml_dict.get("metadata", {}) - .get("name", "") - .replace("-", " ") - .title() - or "" - ) + asset_name = yaml_dict.get("name") or \ + yaml_dict.get("metadata", {}).get("name", "").replace("-", " ").title() \ + or "" asset_url = katalog_url + relpath(yaml_file, katalog_dir) - katalog_asset_item = {"name": asset_name, "url": asset_url} + katalog_asset_item = { + "name": asset_name, + "url": asset_url + } katalog_asset_list.append(katalog_asset_item) @@ -105,6 +98,6 @@ def main(): print("Done. Use git diff to evaluate if and which changes are desired!") -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/tools/python/update_doc_table.py b/tools/python/update_doc_table.py index ebc8a60b..710cb2f6 100755 --- a/tools/python/update_doc_table.py +++ b/tools/python/update_doc_table.py @@ -15,7 +15,9 @@ from glob import glob from os.path import abspath, dirname, split -md_file_path_expressions = ["/docs/*.md"] +md_file_path_expressions = [ + "/docs/*.md" +] script_folder = abspath(dirname(__file__)) project_root_dir = abspath(dirname(dirname(script_folder))) @@ -28,10 +30,8 @@ def find_md_files() -> [str]: print(" " + path_expr.lstrip("/")) print("") - md_files_list_of_lists = [ - glob(project_root_dir + path_expr, recursive=True) - for path_expr in md_file_path_expressions - ] + md_files_list_of_lists = [glob(project_root_dir + path_expr, recursive=True) + for path_expr in md_file_path_expressions] return sorted(list(itertools.chain(*md_files_list_of_lists))) @@ -54,12 +54,14 @@ def update_doc_table() -> [str]: md_file_paths = find_md_files() # 2. extract all descriptions using headers (first line) from files - descriptions = [get_header_from_md_file(file) for file in md_file_paths] + descriptions = [ + get_header_from_md_file(file) + for file in md_file_paths + ] # 3. format filenames as Markdown hyperlinks: [name](url) - md_filenames = [ - "[" + split(file)[1] + "](./" + split(file)[1] + ")" for file in md_file_paths - ] + md_filenames = ["[" + split(file)[1] + "](./" + split(file)[1] + ")" + for file in md_file_paths] table = [] table.append( @@ -70,14 +72,16 @@ def update_doc_table() -> [str]: ) for i in range(len(md_filenames)): - if "README.md" in md_filenames[i]: + if("README.md" in md_filenames[i]): continue - table.append(f"| {md_filenames[i]} | {descriptions[i]} |") + table.append( + f"| {md_filenames[i]} | {descriptions[i]} |" + ) f = open("./docs/README.md", "w") f.write("\n".join(table)) f.close() -if __name__ == "__main__": +if __name__ == '__main__': update_doc_table() diff --git a/tools/python/verify_doc_links.py b/tools/python/verify_doc_links.py index 9c168dac..fb66650b 100755 --- a/tools/python/verify_doc_links.py +++ b/tools/python/verify_doc_links.py @@ -10,16 +10,14 @@ import requests from glob import glob -from os import environ as env # noqa: F401 +from os import environ as env from os.path import abspath, dirname, exists, relpath from random import randint from time import sleep from urllib3.util.url import parse_url from urllib3.exceptions import LocationParseError -GITHUB_REPO = env.get( - "GITHUB_REPO", "https://github.com/machine-learning-exchange/mlx/" -) +GITHUB_REPO = env.get("GITHUB_REPO", "https://github.com/machine-learning-exchange/mlx/") md_file_path_expressions = [ "/**/*.md", @@ -35,9 +33,7 @@ project_root_dir = abspath(dirname(dirname(script_folder))) github_repo_master_path = "{}/blob/master".format(GITHUB_REPO.rstrip("/")) -parallel_requests = ( - 60 # GitHub rate limiting is 60 requests per minute, then we sleep a bit -) +parallel_requests = 60 # GitHub rate limiting is 60 requests per minute, then we sleep a bit url_status_cache = dict() @@ -49,23 +45,18 @@ def find_md_files() -> [str]: print(" " + path_expr.lstrip("/")) print("") - list_of_lists = [ - glob(project_root_dir + path_expr, recursive=True) - for path_expr in md_file_path_expressions - ] + list_of_lists = [glob(project_root_dir + path_expr, recursive=True) + for path_expr in md_file_path_expressions] flattened_list = list(itertools.chain(*list_of_lists)) - filtered_list = [ - path for path in flattened_list if not any(s in path for s in excluded_paths) - ] + filtered_list = [path for path in flattened_list + if not any(s in path for s in excluded_paths)] return sorted(filtered_list) -def get_links_from_md_file( - md_file_path: str, -) -> [(int, str, str)]: # -> [(line, link_text, URL)] +def get_links_from_md_file(md_file_path: str) -> [(int, str, str)]: # -> [(line, link_text, URL)] with open(md_file_path, "r") as f: try: @@ -80,41 +71,26 @@ def get_links_from_md_file( md_file_content = re.sub( r"\[([^]]+)\]\((?!http|#|/)([^)]+)\)", r"[\1]({}/{}/\2)".format(github_repo_master_path, folder).replace("/./", "/"), - md_file_content, - ) + md_file_content) # replace links that are relative to the project root, i.e. [link text](/sdk/FEATURES.md) md_file_content = re.sub( r"\[([^]]+)\]\(/([^)]+)\)", r"[\1]({}/\2)".format(github_repo_master_path), - md_file_content, - ) + md_file_content) # find all the links line_text_url = [] for line_number, line_text in enumerate(md_file_content.splitlines()): # find markdown-styled links [text](url) - for (link_text, url) in re.findall( - r"\[([^]]+)\]\((%s[^)]+)\)" % "http", line_text - ): + for (link_text, url) in re.findall(r"\[([^]]+)\]\((%s[^)]+)\)" % "http", line_text): line_text_url.append((line_number + 1, link_text, url)) # find plain http(s)-style links for url in re.findall(r"[\n\r\s\"'](https?://[^\s]+)[\n\r\s\"']", line_text): - if not any( - s in url - for s in [ - "localhost", - "...", - "lorem", - "ipsum", - "/path/to/", - "address", - "port", - "${OS}", - ] - ): + if not any(s in url for s in + ["localhost", "...", "lorem", "ipsum", "/path/to/", "address", "port", "${OS}"]): try: parse_url(url) line_text_url.append((line_number + 1, "", url)) @@ -125,9 +101,7 @@ def get_links_from_md_file( return line_text_url -def test_url( - file: str, line: int, text: str, url: str -) -> (str, int, str, str, int): # (file, line, text, url, status) +def test_url(file: str, line: int, text: str, url: str) -> (str, int, str, str, int): # (file, line, text, url, status) short_url = url.split("#", maxsplit=1)[0] @@ -142,18 +116,12 @@ def test_url( status = 404 else: try: - status = requests.head( - short_url, allow_redirects=True, timeout=5 - ).status_code + status = requests.head(short_url, allow_redirects=True, timeout=5).status_code if status == 405: # method not allowed, use GET instead of HEAD - status = requests.get( - short_url, allow_redirects=True, timeout=5 - ).status_code + status = requests.get(short_url, allow_redirects=True, timeout=5).status_code if status == 429: # GitHub rate limiting, try again after 1 minute sleep(randint(60, 90)) - status = requests.head( - short_url, allow_redirects=True, timeout=5 - ).status_code + status = requests.head(short_url, allow_redirects=True, timeout=5).status_code except requests.exceptions.Timeout as e: status = 408 except requests.exceptions.RequestException as e: @@ -166,14 +134,10 @@ def test_url( return file, line, text, url, status -def verify_urls_concurrently( - file_line_text_url: [(str, int, str, str)] -) -> [(str, int, str, str)]: +def verify_urls_concurrently(file_line_text_url: [(str, int, str, str)]) -> [(str, int, str, str)]: file_line_text_url_status = [] - with concurrent.futures.ThreadPoolExecutor( - max_workers=parallel_requests - ) as executor: + with concurrent.futures.ThreadPoolExecutor(max_workers=parallel_requests) as executor: check_urls = ( executor.submit(test_url, file, line, text, url) for (file, line, text, url) in file_line_text_url @@ -186,12 +150,8 @@ def verify_urls_concurrently( print(str(type(e))) file_line_text_url_status.append((file, line, text, url, 500)) finally: - print( - "{}/{}".format( - len(file_line_text_url_status), len(file_line_text_url) - ), - end="\r", - ) + print("{}/{}".format(len(file_line_text_url_status), + len(file_line_text_url)), end="\r") return file_line_text_url_status @@ -212,42 +172,31 @@ def verify_doc_links() -> [(str, int, str, str)]: file_line_text_url_status = verify_urls_concurrently(file_line_text_url) # 4. filter for the invalid URLs (status 404: "Not Found") to be reported - file_line_text_url_404 = [ - (f, l, t, u, s) for (f, l, t, u, s) in file_line_text_url_status if s == 404 - ] + file_line_text_url_404 = [(f, l, t, u, s) + for (f, l, t, u, s) in file_line_text_url_status + if s == 404] # 5. print some stats for confidence - print( - "{} {} links ({} unique URLs) in {} Markdown files.\n".format( - "Checked" if file_line_text_url_404 else "Verified", - len(file_line_text_url_status), - len(url_status_cache), - len(md_file_paths), - ) - ) + print("{} {} links ({} unique URLs) in {} Markdown files.\n".format( + "Checked" if file_line_text_url_404 else "Verified", + len(file_line_text_url_status), + len(url_status_cache), + len(md_file_paths))) # 6. report invalid links, exit with error for CI/CD if file_line_text_url_404: for (file, line, text, url, status) in file_line_text_url_404: - print( - "{}:{}: {} -> {}".format( - relpath(file, project_root_dir), - line, - url.replace(github_repo_master_path, ""), - status, - ) - ) + print("{}:{}: {} -> {}".format( + relpath(file, project_root_dir), line, + url.replace(github_repo_master_path, ""), status)) # print a summary line for clear error discovery at the bottom of Travis job log - print( - "\nERROR: Found {} invalid Markdown links".format( - len(file_line_text_url_404) - ) - ) + print("\nERROR: Found {} invalid Markdown links".format( + len(file_line_text_url_404))) exit(1) -if __name__ == "__main__": +if __name__ == '__main__': verify_doc_links() diff --git a/tools/python/verify_npm_packages.py b/tools/python/verify_npm_packages.py index 85cb317b..d67d5686 100755 --- a/tools/python/verify_npm_packages.py +++ b/tools/python/verify_npm_packages.py @@ -82,22 +82,15 @@ def verify_npm_packages(): packages_outdated = f"\n\nFound outdated npm packages\n" packages_up_to_date = "All packages up to date" - check_vulnerabilities = ( - run("npm audit", cwd="./dashboard/origin-mlx/", stdout=PIPE, shell=True) - .stdout.decode("utf-8") - .split("\n") - ) - vulnerabilities = [ - word for word in check_vulnerabilities if "vulnerabilities" in word - ] - packages_vulnerable = f"""\nFound vulnerable packages\n\n{colorText.RED}{vulnerabilities[0]}{colorText.END}\n - \rRun {colorText.BLUE}make update_npm_packages{colorText.END} to secure/update\n""" + check_vulnerabilities = run("npm audit", cwd="./dashboard/origin-mlx/", stdout=PIPE, shell=True + ).stdout.decode("utf-8").split('\n') + vulnerabilities = [word for word in check_vulnerabilities if 'vulnerabilities' in word] + packages_vulnerable = f'''\nFound vulnerable packages\n\n{colorText.RED}{vulnerabilities[0]}{colorText.END}\n + \rRun {colorText.BLUE}make update_npm_packages{colorText.END} to secure/update\n''' packages_safe = "\nNo vulnerabilities found" - print(packages_up_to_date) if check_outdated.returncode == 0 else print( - packages_outdated - ) - print("-" * 40) + print(packages_up_to_date) if check_outdated.returncode == 0 else print(packages_outdated) + print('-' * 40) if "0 vulnerabilities" not in vulnerabilities[0]: print(packages_vulnerable)