INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Try in order:
def _auth( self, username, password, pkey, key_filenames, allow_agent, look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host, passphrase, ): """ Try, in order: - The key(s) passed in, i...
Sets the language of this KernelPushRequest.
def language(self, language): """Sets the language of this KernelPushRequest. The language that the kernel is written in # noqa: E501 :param language: The language of this KernelPushRequest. # noqa: E501 :type: str """ if language is None: raise ValueError...
Sets the kernel_type of this KernelPushRequest.
def kernel_type(self, kernel_type): """Sets the kernel_type of this KernelPushRequest. The type of kernel. Cannot be changed once the kernel has been created # noqa: E501 :param kernel_type: The kernel_type of this KernelPushRequest. # noqa: E501 :type: str """ if ker...
Download competition leaderboard # noqa: E501
def competition_download_leaderboard(self, id, **kwargs): # noqa: E501 """Download competition leaderboard # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competition_download_leade...
VIew competition leaderboard # noqa: E501
def competition_view_leaderboard(self, id, **kwargs): # noqa: E501 """VIew competition leaderboard # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competition_view_leaderboard(id, a...
Download competition data file # noqa: E501
def competitions_data_download_file(self, id, file_name, **kwargs): # noqa: E501 """Download competition data file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competitions_data_...
List competition data files # noqa: E501
def competitions_data_list_files(self, id, **kwargs): # noqa: E501 """List competition data files # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competitions_data_list_files(id, as...
List competitions # noqa: E501
def competitions_list(self, **kwargs): # noqa: E501 """List competitions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competitions_list(async_req=True) >>> result = threa...
List competition submissions # noqa: E501
def competitions_submissions_list(self, id, **kwargs): # noqa: E501 """List competition submissions # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.competitions_submissions_list(id,...
Submit to competition # noqa: E501
def competitions_submissions_submit(self, blob_file_tokens, submission_description, id, **kwargs): # noqa: E501 """Submit to competition # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = ...
Upload competition submission file # noqa: E501
def competitions_submissions_upload(self, file, guid, content_length, last_modified_date_utc, **kwargs): # noqa: E501 """Upload competition submission file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
Generate competition submission URL # noqa: E501
def competitions_submissions_url(self, id, content_length, last_modified_date_utc, **kwargs): # noqa: E501 """Generate competition submission URL # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> ...
Create a new dataset # noqa: E501
def datasets_create_new(self, dataset_new_request, **kwargs): # noqa: E501 """Create a new dataset # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_create_new(dataset_new_re...
Create a new dataset version # noqa: E501
def datasets_create_version(self, owner_slug, dataset_slug, dataset_new_version_request, **kwargs): # noqa: E501 """Create a new dataset version # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> t...
Create a new dataset version by id # noqa: E501
def datasets_create_version_by_id(self, id, dataset_new_version_request, **kwargs): # noqa: E501 """Create a new dataset version by id # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = ap...
Download dataset file # noqa: E501
def datasets_download(self, owner_slug, dataset_slug, **kwargs): # noqa: E501 """Download dataset file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_download(owner_slug, ...
Download dataset file # noqa: E501
def datasets_download_file(self, owner_slug, dataset_slug, file_name, **kwargs): # noqa: E501 """Download dataset file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_downl...
List datasets # noqa: E501
def datasets_list(self, **kwargs): # noqa: E501 """List datasets # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_list(async_req=True) >>> result = thread.get() ...
List dataset files # noqa: E501
def datasets_list_files(self, owner_slug, dataset_slug, **kwargs): # noqa: E501 """List dataset files # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_list_files(owner_slug,...
Get dataset creation status # noqa: E501
def datasets_status(self, owner_slug, dataset_slug, **kwargs): # noqa: E501 """Get dataset creation status # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_status(owner_slug...
Get URL and token to start uploading a data file # noqa: E501
def datasets_upload_file(self, file_name, content_length, last_modified_date_utc, **kwargs): # noqa: E501 """Get URL and token to start uploading a data file # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
Show details about a dataset # noqa: E501
def datasets_view(self, owner_slug, dataset_slug, **kwargs): # noqa: E501 """Show details about a dataset # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.datasets_view(owner_slug, d...
Download the latest output from a kernel # noqa: E501
def kernel_output(self, user_name, kernel_slug, **kwargs): # noqa: E501 """Download the latest output from a kernel # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernel_output(use...
Pull the latest code from a kernel # noqa: E501
def kernel_pull(self, user_name, kernel_slug, **kwargs): # noqa: E501 """Pull the latest code from a kernel # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernel_pull(user_name, ke...
Push a new kernel version. Can be used to create a new kernel and update an existing one. # noqa: E501
def kernel_push(self, kernel_push_request, **kwargs): # noqa: E501 """Push a new kernel version. Can be used to create a new kernel and update an existing one. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=Tr...
Get the status of the latest kernel version # noqa: E501
def kernel_status(self, user_name, kernel_slug, **kwargs): # noqa: E501 """Get the status of the latest kernel version # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernel_status(...
List kernels # noqa: E501
def kernels_list(self, **kwargs): # noqa: E501 """List kernels # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.kernels_list(async_req=True) >>> result = thread.get() ...
authenticate the user with the Kaggle API. This method will generate a configuration first checking the environment for credential variables and falling back to looking for the. kaggle/ kaggle. json configuration file.
def authenticate(self): """authenticate the user with the Kaggle API. This method will generate a configuration, first checking the environment for credential variables, and falling back to looking for the .kaggle/kaggle.json configuration file. """ config_data ...
read_config_environment is the second effort to get a username and key to authenticate to the Kaggle API. The environment keys are equivalent to the kaggle. json file but with KAGGLE_ prefix to define a unique namespace.
def read_config_environment(self, config_data=None, quiet=False): """read_config_environment is the second effort to get a username and key to authenticate to the Kaggle API. The environment keys are equivalent to the kaggle.json file, but with "KAGGLE_" prefix to define a uniqu...
the final step of the authenticate steps where we load the values from config_data into the Configuration object.
def _load_config(self, config_data): """the final step of the authenticate steps, where we load the values from config_data into the Configuration object. Parameters ========== config_data: a dictionary with configuration values (keys) to read ...
read_config_file is the first effort to get a username and key to authenticate to the Kaggle API. Since we can get the username and password from the environment it s not required.
def read_config_file(self, config_data=None, quiet=False): """read_config_file is the first effort to get a username and key to authenticate to the Kaggle API. Since we can get the username and password from the environment, it's not required. Parameters ========== ...
read in the configuration file a json file defined at self. config
def _read_config_file(self): """read in the configuration file, a json file defined at self.config""" try: with open(self.config, 'r') as f: config_data = json.load(f) except FileNotFoundError: config_data = {} return config_data
write config data to file.
def _write_config_file(self, config_data, indent=2): """write config data to file. Parameters ========== config_data: the Configuration object to save a username and password, if defined indent: number of tab indentations to use when writing j...
a client helper function to set a configuration value meaning reading in the configuration file ( if it exists ) saving a new config value and then writing back
def set_config_value(self, name, value, quiet=False): """a client helper function to set a configuration value, meaning reading in the configuration file (if it exists), saving a new config value, and then writing back Parameters ========== name: the name ...
unset a configuration value Parameters ========== name: the name of the value to unset ( remove key in dictionary ) quiet: disable verbose output if True ( default is False )
def unset_config_value(self, name, quiet=False): """unset a configuration value Parameters ========== name: the name of the value to unset (remove key in dictionary) quiet: disable verbose output if True (default is False) """ config_data = self._rea...
Get the download path for a file. If not defined return default from config.
def get_default_download_dir(self, *subdirs): """ Get the download path for a file. If not defined, return default from config. Parameters ========== subdirs: a single (or list of) subfolders under the basepath """ # Look up value for key "path" i...
print a single configuration value based on a prefix and separator
def print_config_value(self, name, prefix='- ', separator=': '): """print a single configuration value, based on a prefix and separator Parameters ========== name: the key of the config valur in self.config_values to print prefix: the prefix to print separ...
a wrapper to print_config_value to print all configuration values Parameters ========== prefix: the character prefix to put before the printed config value defaults to -
def print_config_values(self, prefix='- '): """a wrapper to print_config_value to print all configuration values Parameters ========== prefix: the character prefix to put before the printed config value defaults to "- " """ print('Configuratio...
make call to list competitions format the response and return a list of Competition instances
def competitions_list(self, group=None, category=None, sort_by=None, page=1, search=None): """ make call to list competitions, format the response, and return a list of C...
a wrapper for competitions_list for the client.
def competitions_list_cli(self, group=None, category=None, sort_by=None, page=1, search=None, csv_display=False): """ a wrapper for ...
submit a competition!
def competition_submit(self, file_name, message, competition, quiet=False): """ submit a competition! Parameters ========== file_name: the competition metadata file message: the submission description competition: the competition name quie...
submit a competition using the client. Arguments are same as for competition_submit except for extra arguments provided here. Parameters ========== competition_opt: an alternative competition option provided by cli
def competition_submit_cli(self, file_name, message, competition, competition_opt=None, quiet=False): """ submit a competition using the client. Arguments ar...
get the list of Submission for a particular competition
def competition_submissions(self, competition): """ get the list of Submission for a particular competition Parameters ========== competition: the name of the competition """ submissions_result = self.process_response( self.competitions_submission...
wrapper to competition_submission will return either json or csv to the user. Additional parameters are listed below see competition_submissions for rest.
def competition_submissions_cli(self, competition=None, competition_opt=None, csv_display=False, quiet=False): """ wrapper to competition_submission, will return either...
list files for competition Parameters ========== competition: the name of the competition
def competition_list_files(self, competition): """ list files for competition Parameters ========== competition: the name of the competition """ competition_list_files_result = self.process_response( self.competitions_data_list_files_with_http_inf...
List files for a competition if it exists
def competition_list_files_cli(self, competition, competition_opt=None, csv_display=False, quiet=False): """ List files for a competition, if it exists Paramet...
download a competition file to a designated location or use a default location
def competition_download_file(self, competition, file_name, path=None, force=False, quiet=False): """ download a competition file to a designa...
a wrapper to competition_download_file to download all competition files.
def competition_download_files(self, competition, path=None, force=False, quiet=True): """ a wrapper to competition_download_file to download all competition fi...
a wrapper to competition_download_files but first will parse input from API client. Additional parameters are listed here see competition_download for remaining.
def competition_download_cli(self, competition, competition_opt=None, file_name=None, path=None, force=False, quiet=False)...
Download competition leaderboards
def competition_leaderboard_download(self, competition, path, quiet=True): """ Download competition leaderboards Parameters ========= competition: the name of the competition path: a path to download the file to quiet: suppress verbose output (default...
view a leaderboard based on a competition name
def competition_leaderboard_view(self, competition): """ view a leaderboard based on a competition name Parameters ========== competition: the competition name to view leadboard for """ result = self.process_response( self.competition_view_leaderb...
a wrapper for competition_leaderbord_view that will print the results as a table or comma separated values
def competition_leaderboard_cli(self, competition, competition_opt=None, path=None, view=False, download=False, ...
return a list of datasets!
def dataset_list(self, sort_by=None, size=None, file_type=None, license_name=None, tag_ids=None, search=None, user=None, mine=False, ...
a wrapper to datasets_list for the client. Additional parameters are described here see dataset_list for others.
def dataset_list_cli(self, sort_by=None, size=None, file_type=None, license_name=None, tag_ids=None, search=None, user=None, ...
view metadata for a dataset.
def dataset_view(self, dataset): """ view metadata for a dataset. Parameters ========== dataset: the string identified of the dataset should be in format [owner]/[dataset-name] """ if '/' in dataset: self.validate_dataset_stri...
list files for a dataset Parameters ========== dataset: the string identified of the dataset should be in format [ owner ]/ [ dataset - name ]
def dataset_list_files(self, dataset): """ list files for a dataset Parameters ========== dataset: the string identified of the dataset should be in format [owner]/[dataset-name] """ if dataset is None: raise ValueError('A dat...
a wrapper to dataset_list_files for the client ( list files for a dataset ) Parameters ========== dataset: the string identified of the dataset should be in format [ owner ]/ [ dataset - name ] dataset_opt: an alternative option to providing a dataset csv_display: if True print comma separated values instead of table
def dataset_list_files_cli(self, dataset, dataset_opt=None, csv_display=False): """ a wrapper to dataset_list_files for the client (list files for a dataset) Parameters ========== ...
call to get the status of a dataset from the API Parameters ========== dataset: the string identified of the dataset should be in format [ owner ]/ [ dataset - name ]
def dataset_status(self, dataset): """ call to get the status of a dataset from the API Parameters ========== dataset: the string identified of the dataset should be in format [owner]/[dataset-name] """ if dataset is None: rai...
wrapper for client for dataset_status with additional dataset_opt to get the status of a dataset from the API Parameters ========== dataset_opt: an alternative to dataset
def dataset_status_cli(self, dataset, dataset_opt=None): """ wrapper for client for dataset_status, with additional dataset_opt to get the status of a dataset from the API Parameters ========== dataset_opt: an alternative to dataset """ dataset = ...
download a single file for a dataset
def dataset_download_file(self, dataset, file_name, path=None, force=False, quiet=True): """ download a single file for a dataset Parameters ...
download all files for a dataset
def dataset_download_files(self, dataset, path=None, force=False, quiet=True, unzip=False): """ download all files for a dataset Parameters ...
client wrapper for dataset_download_files and download dataset file either for a specific file ( when file_name is provided ) or all files for a dataset ( plural )
def dataset_download_cli(self, dataset, dataset_opt=None, file_name=None, path=None, unzip=False, force=False, quiet=...
upload a dataset file
def dataset_upload_file(self, path, quiet): """ upload a dataset file Parameters ========== path: the complete path to upload quiet: suppress verbose output (default is False) """ file_name = os.path.basename(path) content_length = os.path...
create a version of a dataset
def dataset_create_version(self, folder, version_notes, quiet=False, convert_to_csv=True, delete_old_versions=False, dir_mode='skip'):...
client wrapper for creating a version of a dataset Parameters ========== folder: the folder with the dataset configuration/ data files version_notes: notes to add for the version quiet: suppress verbose output ( default is False ) convert_to_csv: on upload if data should be converted to csv delete_old_versions: if True...
def dataset_create_version_cli(self, folder, version_notes, quiet=False, convert_to_csv=True, delete_old_versions=False, ...
initialize a folder with a a dataset configuration ( metadata ) file
def dataset_initialize(self, folder): """ initialize a folder with a a dataset configuration (metadata) file Parameters ========== folder: the folder to initialize the metadata file in """ if not os.path.isdir(folder): raise ValueError('Invalid fo...
create a new dataset meaning the same as creating a version but with extra metadata like license and user/ owner. Parameters ========== folder: the folder to initialize the metadata file in public: should the dataset be public? quiet: suppress verbose output ( default is False ) convert_to_csv: if True convert data to ...
def dataset_create_new(self, folder, public=False, quiet=False, convert_to_csv=True, dir_mode='skip'): """ create a new dataset, meaning the same as creating a version but ...
client wrapper for creating a new dataset Parameters ========== folder: the folder to initialize the metadata file in public: should the dataset be public? quiet: suppress verbose output ( default is False ) convert_to_csv: if True convert data to comma separated value dir_mode: What to do with directories: skip - igno...
def dataset_create_new_cli(self, folder=None, public=False, quiet=False, convert_to_csv=True, dir_mode='skip'): """ client wrapper for creating a new dataset...
download a file to an output file based on a chunk size
def download_file(self, response, outfile, quiet=True, chunk_size=1048576): """ download a file to an output file based on a chunk size Parameters ========== response: the response to download outfile: the output file to download to quiet: suppress ve...
list kernels based on a set of search criteria
def kernels_list(self, page=1, page_size=20, dataset=None, competition=None, parent_kernel=None, search=None, mine=False, user=None, ...
client wrapper for kernels_list see this function for arguments. Additional arguments are provided here. Parameters ========== csv_display: if True print comma separated values instead of table
def kernels_list_cli(self, mine=False, page=1, page_size=20, search=None, csv_display=False, parent=None, competition=None, ...
create a new kernel in a specified folder from template including json metadata that grabs values from the configuration. Parameters ========== folder: the path of the folder
def kernels_initialize(self, folder): """ create a new kernel in a specified folder from template, including json metadata that grabs values from the configuration. Parameters ========== folder: the path of the folder """ if not os.path.isdir(fold...
client wrapper for kernels_initialize takes same arguments but sets default folder to be None. If None defaults to present working directory. Parameters ========== folder: the path of the folder ( None defaults to $ { PWD } )
def kernels_initialize_cli(self, folder=None): """ client wrapper for kernels_initialize, takes same arguments but sets default folder to be None. If None, defaults to present working directory. Parameters ========== folder: the path of the folder (No...
read the metadata file and kernel files from a notebook validate both and use Kernel API to push to Kaggle if all is valid. Parameters ========== folder: the path of the folder
def kernels_push(self, folder): """ read the metadata file and kernel files from a notebook, validate both, and use Kernel API to push to Kaggle if all is valid. Parameters ========== folder: the path of the folder """ if not os.path.isdir(folder)...
client wrapper for kernels_push with same arguments.
def kernels_push_cli(self, folder): """ client wrapper for kernels_push, with same arguments. """ folder = folder or os.getcwd() result = self.kernels_push(folder) if result is None: print('Kernel push error: see previous output') elif not result.error: ...
pull a kernel including a metadata file ( if metadata is True ) and associated files to a specified path. Parameters ========== kernel: the kernel to pull path: the path to pull files to on the filesystem metadata: if True also pull metadata quiet: suppress verbosity ( default is True )
def kernels_pull(self, kernel, path, metadata=False, quiet=True): """ pull a kernel, including a metadata file (if metadata is True) and associated files to a specified path. Parameters ========== kernel: the kernel to pull path: the path to pull file...
client wrapper for kernels_pull
def kernels_pull_cli(self, kernel, kernel_opt=None, path=None, metadata=False): """ client wrapper for kernels_pull """ kernel = kernel or kernel_opt effective_path = self.kernels_pull( ...
retrieve output for a specified kernel Parameters ========== kernel: the kernel to output path: the path to pull files to on the filesystem force: if output already exists force overwrite ( default False ) quiet: suppress verbosity ( default is True )
def kernels_output(self, kernel, path, force=False, quiet=True): """ retrieve output for a specified kernel Parameters ========== kernel: the kernel to output path: the path to pull files to on the filesystem force: if output already exists, force ove...
client wrapper for kernels_output with same arguments. Extra arguments are described below and see kernels_output for others. Parameters ========== kernel_opt: option from client instead of kernel if not defined
def kernels_output_cli(self, kernel, kernel_opt=None, path=None, force=False, quiet=False): """ client wrapper for kernels_output, with same arguments. Extra argumen...
call to the api to get the status of a kernel. Parameters ========== kernel: the kernel to get the status for
def kernels_status(self, kernel): """ call to the api to get the status of a kernel. Parameters ========== kernel: the kernel to get the status for """ if kernel is None: raise ValueError('A kernel must be specified') if '/' in kernel: ...
client wrapper for kernel_status Parameters ========== kernel_opt: additional option from the client if kernel not defined
def kernels_status_cli(self, kernel, kernel_opt=None): """ client wrapper for kernel_status Parameters ========== kernel_opt: additional option from the client, if kernel not defined """ kernel = kernel or kernel_opt response = self.kernels_status(ker...
determine if a download is needed based on timestamp. Return True if needed ( remote is newer ) or False if local is newest. Parameters ========== response: the response from the API outfile: the output file to write to quiet: suppress verbose output ( default is True )
def download_needed(self, response, outfile, quiet=True): """ determine if a download is needed based on timestamp. Return True if needed (remote is newer) or False if local is newest. Parameters ========== response: the response from the API outfile:...
print a table of items for a set of fields defined
def print_table(self, items, fields): """ print a table of items, for a set of fields defined Parameters ========== items: a list of items to print fields: a list of fields to select from items """ formats = [] borders = [] for f i...
print a set of fields in a set of items using a csv. writer
def print_csv(self, items, fields): """ print a set of fields in a set of items using a csv.writer Parameters ========== items: a list of items to print fields: a list of fields to select from items """ writer = csv.writer(sys.stdout) writ...
process a response from the API. We check the API version against the client s to see if it s old and give them a warning ( once )
def process_response(self, result): """ process a response from the API. We check the API version against the client's to see if it's old, and give them a warning (once) Parameters ========== result: the result from the API """ if len(result) == 3...
determine if a client ( on the local user s machine ) is up to date with the version provided on the server. Return a boolean with True or False Parameters ========== server_version: the server version string to compare to the host
def is_up_to_date(self, server_version): """ determine if a client (on the local user's machine) is up to date with the version provided on the server. Return a boolean with True or False Parameters ========== server_version: the server version string...
upload files in a folder Parameters ========== request: the prepared request resources: the files to upload folder: the folder to upload from quiet: suppress verbose output ( default is False )
def upload_files(self, request, resources, folder, quiet=False, dir_mode='skip'): """ upload files in a folder Parameters ========== request: the prepared request ...
Helper function to upload a single file Parameters ========== file_name: name of the file to upload full_path: path to the file to upload request: the prepared request resources: optional file metadata quiet: suppress verbose output: return: True - upload unsuccessful ; False - upload successful
def _upload_file(self, file_name, full_path, quiet, request, resources): """ Helper function to upload a single file Parameters ========== file_name: name of the file to upload full_path: path to the file to upload request: the prepared request ...
process a column check for the type and return the processed column Parameters ========== column: a list of values in a column to be processed
def process_column(self, column): """ process a column, check for the type, and return the processed column Parameters ========== column: a list of values in a column to be processed """ processed_column = DatasetColumn( name=self.get_...
function to complete an upload to retrieve a path from a url Parameters ========== path: the path for the upload that is read in url: the url to send the POST to quiet: suppress verbose output ( default is False )
def upload_complete(self, path, url, quiet): """ function to complete an upload to retrieve a path from a url Parameters ========== path: the path for the upload that is read in url: the url to send the POST to quiet: suppress verbose output (default ...
determine if a dataset string is valid meaning it is in the format of { username }/ { dataset - slug }. Parameters ========== dataset: the dataset name to validate
def validate_dataset_string(self, dataset): """ determine if a dataset string is valid, meaning it is in the format of {username}/{dataset-slug}. Parameters ========== dataset: the dataset name to validate """ if dataset: if '/' not in...
determine if a kernel string is valid meaning it is in the format of { username }/ { kernel - slug }. Parameters ========== kernel: the kernel name to validate
def validate_kernel_string(self, kernel): """ determine if a kernel string is valid, meaning it is in the format of {username}/{kernel-slug}. Parameters ========== kernel: the kernel name to validate """ if kernel: if '/' not in kernel...
validate resources is a wrapper to validate the existence of files and that there are no duplicates for a folder and set of resources.
def validate_resources(self, folder, resources): """ validate resources is a wrapper to validate the existence of files and that there are no duplicates for a folder and set of resources. Parameters ========== folder: the folder to validate resources:...
ensure that one or more resource files exist in a folder
def validate_files_exist(self, folder, resources): """ ensure that one or more resource files exist in a folder Parameters ========== folder: the folder to validate resources: one or more resources to validate within the folder """ for item in res...
ensure that the user has not provided duplicate paths in a list of resources.
def validate_no_duplicate_paths(self, resources): """ ensure that the user has not provided duplicate paths in a list of resources. Parameters ========== resources: one or more resources to validate not duplicated """ paths = set() for ite...
convert a set of file_data to a metadata file at path
def convert_to_dataset_file_metadata(self, file_data, path): """ convert a set of file_data to a metadata file at path Parameters ========== file_data: a dictionary of file data to write to file path: the path to write the metadata to """ as_metad...
read the buffer passing named and non named arguments to the io. BufferedReader function.
def read(self, *args, **kwargs): """ read the buffer, passing named and non named arguments to the io.BufferedReader function. """ buf = io.BufferedReader.read(self, *args, **kwargs) self.increment(len(buf)) return buf
Get parameters as list of tuples formatting collections.
def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. :param params: Parameters as dict or list of two-tuples :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collection...
Builds form parameters.
def prepare_post_parameters(self, post_params=None, files=None): """Builds form parameters. :param post_params: Normal form parameters. :param files: File parameters. :return: Form parameters with files. """ params = [] if post_params: params = post_...
Deserializes body to file
def __deserialize_file(self, response): """Deserializes body to file Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. :param response: RESTResponse. :return: file path. """ fd, path = t...