From 09f51f59af9290cd4c93345c6e0f682d32af052e Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 13 Dec 2017 08:39:00 -0500 Subject: [PATCH] Upload optimization - eliminate second call to check_binary in upload.py. --- tools/data_source/upload.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 7e9d06a1ebf..2c229ba2890 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -123,7 +123,8 @@ def add_file(dataset, registry, json_file, output_path): file_err('The uploaded file is empty', dataset, json_file) return # Is dataset content supported sniffable binary? - if check_binary(dataset.path): + is_binary = check_binary(dataset.path) + if is_binary: # Sniff the data type guessed_ext = sniff.guess_ext(dataset.path, registry.sniff_order) # Set data_type only if guessed_ext is a binary datatype @@ -259,7 +260,7 @@ def add_file(dataset, registry, json_file, output_path): dataset.name = uncompressed_name data_type = 'zip' if not data_type: - if check_binary(dataset.path) or registry.is_extension_unsniffable_binary(dataset.file_type): + if is_binary or registry.is_extension_unsniffable_binary(dataset.file_type): # We have a binary dataset, but it is not Bam, Sff or Pdf data_type = 'binary' parts = dataset.name.split(".")