How to use the kaggle.models.dataset_upload_file.DatasetUploadFile function in kaggle

To help you get started, we’ve selected a few kaggle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kaggle / kaggle-api / kaggle / api / kaggle_api_extended.py View on Github external
:return: True - upload unsuccessful; False - upload successful
        """

        if not quiet:
            print('Starting upload for file ' + file_name)

        content_length = os.path.getsize(full_path)
        token = self.dataset_upload_file(full_path, quiet)
        if token is None:
            if not quiet:
                print('Upload unsuccessful: ' + file_name)
            return True
        if not quiet:
            print('Upload successful: ' + file_name + ' (' +
                  File.get_size(content_length) + ')')
        upload_file = DatasetUploadFile()
        upload_file.token = token
        if resources:
            for item in resources:
                if file_name == item.get('path'):
                    upload_file.description = item.get('description')
                    if 'schema' in item:
                        fields = self.get_or_default(item['schema'], 'fields',
                                                     [])
                        processed = []
                        count = 0
                        for field in fields:
                            processed.append(self.process_column(field))
                            processed[count].order = count
                            count += 1
                        upload_file.columns = processed
        request.files.append(upload_file)
github Kaggle / kaggle-api / kaggle / models / dataset_upload_file.py View on Github external
def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, DatasetUploadFile):
            return False

        return self.__dict__ == other.__dict__