@@ -49,12 +49,12 @@ def delete(self, drop_data=False):
4949 # Project export
5050 ########################################################
5151
52- def get_export_stream (self , options = {} ):
52+ def get_export_stream (self , options = None ):
5353 """
5454 Return a stream of the exported project
5555 You need to close the stream after download. Failure to do so will result in the DSSClient becoming unusable.
5656
57- :param dict options: Dictionary of export options. The following options are available:
57+ :param dict options: Dictionary of export options (defaults to `{}`) . The following options are available:
5858
5959 * exportUploads (boolean): Exports the data of Uploaded datasets - default False
6060 * exportManagedFS (boolean): Exports the data of managed Filesystem datasets - default False
@@ -70,15 +70,31 @@ def get_export_stream(self, options = {}):
7070 :returns: a file-like obbject that is a stream of the export archive
7171 :rtype: file-like
7272 """
73+ if options is None :
74+ options = {}
7375 return self .client ._perform_raw (
7476 "POST" , "/projects/%s/export" % self .project_key , body = options ).raw
7577
76- def export_to_file (self , path , options = {} ):
78+ def export_to_file (self , path , options = None ):
7779 """
7880 Export the project to a file
7981
8082 :param str path: the path of the file in which the exported project should be saved
83+ :param dict options: Dictionary of export options (defaults to `{}`). The following options are available:
84+
85+ * exportUploads (boolean): Exports the data of Uploaded datasets - default False
86+ * exportManagedFS (boolean): Exports the data of managed Filesystem datasets - default False
87+ * exportAnalysisModels (boolean): Exports the models trained in analysis - default False
88+ * exportSavedModels (boolean): Exports the models trained in saved models - default False
89+ * exportManagedFolders (boolean): Exports the data of managed folders - default False
90+ * exportAllInputDatasets (boolean): Exports the data of all input datasets - default False
91+ * exportAllDatasets (boolean): Exports the data of all datasets - default False
92+ * exportAllInputManagedFolders (boolean): Exports the data of all input managed folders - default False
93+ * exportGitRepositoy (boolean): Exports the Git repository history - default False
94+ * exportInsightsData (boolean): Exports the data of static insights - default False
8195 """
96+ if options is None :
97+ options = {}
8298 with open (path , 'wb' ) as f :
8399 export_stream = self .client ._perform_raw (
84100 "POST" , "/projects/%s/export" % self .project_key , body = options )
@@ -98,7 +114,7 @@ def duplicate(self, target_project_key,
98114 export_saved_models = True ,
99115 export_git_repository = True ,
100116 export_insights_data = True ,
101- remapping = {} ,
117+ remapping = None ,
102118 target_project_folder = None ):
103119 """
104120 Duplicate the project
@@ -110,13 +126,14 @@ def duplicate(self, target_project_key,
110126 :param bool export_saved_models:
111127 :param bool export_git_repository:
112128 :param bool export_insights_data:
113- :param dict remapping: dict of connections to be remapped for the new project
129+ :param dict remapping: dict of connections to be remapped for the new project (defaults to `{}`)
114130 :param target_project_folder: the project folder where to put the duplicated project
115131 :type target_project_folder: A :class:`dataikuapi.dss.projectfolder.DSSProjectFolder
116132 :returns: A dict containing the original and duplicated project's keys
117133 :rtype: :class:`ProjectDuplicateResult`
118134 """
119-
135+ if remapping is None :
136+ remapping = {}
120137 obj = {
121138 "targetProjectName" : target_project_name ,
122139 "targetProjectKey" : target_project_key ,
@@ -211,7 +228,7 @@ def get_dataset(self, dataset_name):
211228 return DSSDataset (self .client , self .project_key , dataset_name )
212229
213230 def create_dataset (self , dataset_name , type ,
214- params = {} , formatType = None , formatParams = {} ):
231+ params = None , formatType = None , formatParams = None ):
215232 """
216233 Create a new dataset in the project, and return a handle to interact with it.
217234
@@ -225,13 +242,17 @@ def create_dataset(self, dataset_name, type,
225242
226243 :param string dataset_name: the name for the new dataset
227244 :param string type: the type of the dataset
228- :param dict params: the parameters for the type, as a JSON object
245+ :param dict params: the parameters for the type, as a JSON object (defaults to `{}`)
229246 :param string formatType: an optional format to create the dataset with (only for file-oriented datasets)
230- :param string formatParams: the parameters to the format, as a JSON object (only for file-oriented datasets)
247+ :param dict formatParams: the parameters to the format, as a JSON object (only for file-oriented datasets, default to `{}` )
231248
232249 Returns:
233250 A :class:`dataikuapi.dss.dataset.DSSDataset` dataset handle
234251 """
252+ if params is None :
253+ params = {}
254+ if formatParams is None :
255+ formatParams = {}
235256 obj = {
236257 "name" : dataset_name ,
237258 "projectKey" : self .project_key ,
@@ -676,18 +697,20 @@ def get_scenario(self, scenario_id):
676697 """
677698 return DSSScenario (self .client , self .project_key , scenario_id )
678699
679- def create_scenario (self , scenario_name , type , definition = { 'params' : {}} ):
700+ def create_scenario (self , scenario_name , type , definition = None ):
680701 """
681702 Create a new scenario in the project, and return a handle to interact with it
682703
683704 :param str scenario_name: The name for the new scenario. This does not need to be unique
684705 (although this is strongly recommended)
685706 :param str type: The type of the scenario. MUst be one of 'step_based' or 'custom_python'
686- :param object definition: the JSON definition of the scenario. Use ``get_definition(with_status=False)`` on an
687- existing ``DSSScenario`` object in order to get a sample definition object
707+ :param dict definition: the JSON definition of the scenario. Use ``get_definition(with_status=False)`` on an
708+ existing ``DSSScenario`` object in order to get a sample definition object (defaults to `{'params': {}}`)
688709
689710 :returns: a :class:`.scenario.DSSScenario` handle to interact with the newly-created scenario
690711 """
712+ if definition is None :
713+ definition = {'params' : {}}
691714 definition ['type' ] = type
692715 definition ['name' ] = scenario_name
693716 scenario_id = self .client ._perform_json ("POST" , "/projects/%s/scenarios/" % self .project_key ,
@@ -790,12 +813,14 @@ def get_tags(self):
790813 """
791814 return self .client ._perform_json ("GET" , "/projects/%s/tags" % self .project_key )
792815
793- def set_tags (self , tags = {} ):
816+ def set_tags (self , tags = None ):
794817 """
795818 Set the tags of this project.
796- @ param obj : must be a modified version of the object returned by list_tags
819+ : param dict tags : must be a modified version of the object returned by list_tags (defaults to `{}`)
797820 """
798- return self .client ._perform_empty ("PUT" , "/projects/%s/tags" % self .project_key , body = tags )
821+ if tags is None :
822+ tags = {}
823+ return self .client ._perform_empty ("PUT" , "/projects/%s/tags" % self .project_key , body = tags )
799824
800825
801826 ########################################################
0 commit comments