@@ -260,14 +260,14 @@ def stageFiles(pm, stageFunc=None, ignoreWritable=False, symLink=True, secret_st
260
260
ensure_writable (p .target )
261
261
elif p .type == "CreateFile" :
262
262
with open (p .target , "wb" ) as n :
263
- if secret_store :
263
+ if secret_store is not None :
264
264
n .write (secret_store .retrieve (p .resolved ).encode ("utf-8" ))
265
265
else :
266
266
n .write (p .resolved .encode ("utf-8" ))
267
267
os .chmod (p .target , stat .S_IRUSR )
268
268
elif p .type == "CreateWritableFile" :
269
269
with open (p .target , "wb" ) as n :
270
- if secret_store :
270
+ if secret_store is not None :
271
271
n .write (secret_store .retrieve (p .resolved ).encode ("utf-8" ))
272
272
else :
273
273
n .write (p .resolved .encode ("utf-8" ))
@@ -519,7 +519,7 @@ def __init__(self,
519
519
self .doc_schema = loadingContext .avsc_names
520
520
521
521
self .formatgraph = None # type: Optional[Graph]
522
- if self .doc_loader :
522
+ if self .doc_loader is not None :
523
523
self .formatgraph = self .doc_loader .graph
524
524
525
525
checkRequirements (self .tool , supportedProcessRequirements )
@@ -530,7 +530,7 @@ def __init__(self,
530
530
531
531
sd , _ = self .get_requirement ("SchemaDefRequirement" )
532
532
533
- if sd :
533
+ if sd is not None :
534
534
sdtypes = sd ["types" ]
535
535
av = schema .make_valid_avro (sdtypes , {t ["name" ]: t for t in avroize_type (sdtypes )}, set ())
536
536
for i in av :
@@ -596,13 +596,15 @@ def __init__(self,
596
596
597
597
dockerReq , is_req = self .get_requirement ("DockerRequirement" )
598
598
599
- if dockerReq and dockerReq .get ("dockerOutputDirectory" ) and not is_req :
599
+ if dockerReq is not None and "dockerOutputDirectory" in dockerReq \
600
+ and is_req is not None and not is_req :
600
601
_logger .warning (SourceLine (
601
602
item = dockerReq , raise_type = Text ).makeError (
602
603
"When 'dockerOutputDirectory' is declared, DockerRequirement "
603
604
"should go in the 'requirements' section, not 'hints'." "" ))
604
605
605
- if dockerReq and dockerReq .get ("dockerOutputDirectory" ) == "/var/spool/cwl" :
606
+ if dockerReq is not None and is_req is not None \
607
+ and dockerReq .get ("dockerOutputDirectory" ) == "/var/spool/cwl" :
606
608
if is_req :
607
609
# In this specific case, it is legal to have /var/spool/cwl, so skip the check.
608
610
pass
@@ -636,7 +638,7 @@ def _init_job(self, joborder, runtimeContext):
636
638
stagedir = u""
637
639
638
640
loadListingReq , _ = self .get_requirement ("http://commonwl.org/cwltool#LoadListingRequirement" )
639
- if loadListingReq :
641
+ if loadListingReq is not None :
640
642
loadListing = loadListingReq .get ("loadListing" )
641
643
else :
642
644
loadListing = "deep_listing" # will default to "no_listing" in CWL v1.1
@@ -648,15 +650,15 @@ def _init_job(self, joborder, runtimeContext):
648
650
defaultDocker = runtimeContext .default_container
649
651
650
652
if (dockerReq or defaultDocker ) and runtimeContext .use_container :
651
- if dockerReq :
653
+ if dockerReq is not None :
652
654
# Check if docker output directory is absolute
653
655
if dockerReq .get ("dockerOutputDirectory" ) and \
654
656
dockerReq .get ("dockerOutputDirectory" ).startswith ('/' ):
655
657
outdir = dockerReq .get ("dockerOutputDirectory" )
656
658
else :
657
659
outdir = dockerReq .get ("dockerOutputDirectory" ) or \
658
660
runtimeContext .docker_outdir or random_outdir ()
659
- elif defaultDocker :
661
+ elif defaultDocker is not None :
660
662
outdir = runtimeContext .docker_outdir or random_outdir ()
661
663
tmpdir = runtimeContext .docker_tmpdir or "/tmp"
662
664
stagedir = runtimeContext .docker_stagedir or "/var/lib/cwl"
@@ -778,11 +780,11 @@ def evalResources(self, builder, runtimeContext):
778
780
elif mx is None :
779
781
mx = mn
780
782
781
- if mn :
783
+ if mn is not None :
782
784
request [a + "Min" ] = cast (int , mn )
783
785
request [a + "Max" ] = cast (int , mx )
784
786
785
- if runtimeContext .select_resources :
787
+ if runtimeContext .select_resources is not None :
786
788
return runtimeContext .select_resources (request , runtimeContext )
787
789
return {
788
790
"cores" : request ["coresMin" ],
0 commit comments