[enh] tox recommendation

This commit is contained in:
ljf 2021-05-08 18:01:54 +02:00
parent a84ccb44cc
commit 36cac914d6

View file

@ -170,15 +170,17 @@ class _HTTPArgumentParser(object):
# Append the option string only # Append the option string only
if option_string is not None and value != 0: if option_string is not None and value != 0:
arg_strings.append(option_string) arg_strings.append(option_string)
elif isinstance(value, FileUpload) and (isinstance(action.type, argparse.FileType) or action.type == open): elif isinstance(value, FileUpload) and (
isinstance(action.type, argparse.FileType) or action.type == open
):
# Upload the file in a temp directory # Upload the file in a temp directory
global UPLOAD_DIR global UPLOAD_DIR
if UPLOAD_DIR is None: if UPLOAD_DIR is None:
UPLOAD_DIR = mkdtemp(prefix='moulinette_upload_') UPLOAD_DIR = mkdtemp(prefix="moulinette_upload_")
value.save(UPLOAD_DIR) value.save(UPLOAD_DIR)
if option_string is not None: if option_string is not None:
arg_strings.append(option_string) arg_strings.append(option_string)
arg_strings.append(UPLOAD_DIR + '/' + value.filename) arg_strings.append(UPLOAD_DIR + "/" + value.filename)
elif isinstance(value, str): elif isinstance(value, str):
if option_string is not None: if option_string is not None:
arg_strings.append(option_string) arg_strings.append(option_string)