From 09c0c255a67e6b045b7582aa7e413f435d601489 Mon Sep 17 00:00:00 2001 From: jsitarova Date: Thu, 10 Oct 2024 10:26:07 +0200 Subject: [PATCH] fix5: use if any --- src/python/dxpy/bindings/dxapplet.py | 3 +-- src/python/dxpy/bindings/dxjob.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/python/dxpy/bindings/dxapplet.py b/src/python/dxpy/bindings/dxapplet.py index c235ab0d9..3be1ab9cc 100644 --- a/src/python/dxpy/bindings/dxapplet.py +++ b/src/python/dxpy/bindings/dxapplet.py @@ -58,8 +58,7 @@ def _get_run_input_common_fields(executable_input, **kwargs): if kwargs.get(arg) is not None: run_input[arg] = kwargs[arg] - if any(kwargs.get(key) is not None for key in - ['instance_type', 'cluster_spec', 'fpga_driver', 'nvidia_driver']): + if any(kwargs.get(key) is not None for key in ['instance_type', 'cluster_spec', 'fpga_driver', 'nvidia_driver']): instance_type_srd = SystemRequirementsDict.from_instance_type(kwargs.get('instance_type')) cluster_spec_srd = SystemRequirementsDict(kwargs.get('cluster_spec')) fpga_driver_srd = SystemRequirementsDict(kwargs.get('fpga_driver')) diff --git a/src/python/dxpy/bindings/dxjob.py b/src/python/dxpy/bindings/dxjob.py index 947ca57c5..bcb09b63c 100644 --- a/src/python/dxpy/bindings/dxjob.py +++ b/src/python/dxpy/bindings/dxjob.py @@ -184,7 +184,7 @@ def new(self, fn_input, fn_name, name=None, tags=None, properties=None, details= req_input["tags"] = tags if properties is not None: req_input["properties"] = properties - if instance_type is not None or cluster_spec is not None or fpga_driver is not None or nvidia_driver is not None: + if any(requirement is not None for requirement in [instance_type, cluster_spec, fpga_driver, nvidia_driver]): instance_type_srd = SystemRequirementsDict.from_instance_type(instance_type, fn_name) cluster_spec_srd = SystemRequirementsDict(cluster_spec) fpga_driver_srd = SystemRequirementsDict(fpga_driver)