Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
quiet: suppress verbose output
: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
def __init__(self, init_dict):
parsed_dict = {k: parse(v) for k, v in init_dict.items()}
self.__dict__.update(parsed_dict)
self.tags = [Tag(t) for t in self.tags]
self.files = [File(f) for f in self.files]
self.versions = [DatasetVersion(v) for v in self.versions]
self.size = File.get_size(self.totalBytes)