Skip to content

Commit 39e4372

Browse files
committed
Making file_path optional required an additional fix to also only conditionally pass it along to perform_api_call. Renamed file_path to source_file_path and added a description to hopefully make it more clear what is expected as input to the function.
1 parent 4ce6d82 commit 39e4372

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

openml/apiconnector.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,9 +926,20 @@ def upload_dataset(self, description, file_path=None):
926926
return return_code, dataset_xml
927927

928928
def upload_flow(self, description, file_path=None):
929+
"""
930+
The 'description' is binary data of an XML file according to the XSD Schema (OUTDATED!):
931+
https://github.com/openml/website/blob/master/openml_OS/views/pages/rest_api/xsd/openml.implementation.upload.xsd
932+
933+
(optional) file_path is the absolute path to the file that is the flow (eg. a script)
934+
"""
929935
try:
930936
data = {'description': description}
931-
return_code, dataset_xml = self._perform_api_call("/flow/", data=data, file_dictionary={'source': file_path})
937+
file_dictionary = None
938+
939+
if(file_path != None):
940+
file_dictionary={'source': file_path}
941+
942+
return_code, dataset_xml = self._perform_api_call("/flow/", data=data, file_dictionary=file_dictionary)
932943

933944
except URLError as e:
934945
# TODO logger.debug

0 commit comments

Comments
 (0)