File tree 1 file changed +31
-16
lines changed 1 file changed +31
-16
lines changed Original file line number Diff line number Diff line change 7
7
Any ,
8
8
Callable ,
9
9
Dict ,
10
+ Iterable ,
10
11
List ,
11
12
MutableMapping ,
12
13
MutableSequence ,
@@ -425,21 +426,35 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
425
426
if isinstance (sfname , str ):
426
427
d_location = cast (str , datum ["location" ])
427
428
sf_location = None
428
- for existing_processed_secondaryfile in datum .get (
429
- "secondaryFiles" , []
430
- ):
431
- if (
432
- os .path .basename (
433
- existing_processed_secondaryfile .get (
434
- "location" , ""
435
- )
436
- )
437
- == sfname
438
- ):
439
- # the secondary file has already been processed; use established location
440
- sf_location = existing_processed_secondaryfile [
441
- "location"
442
- ]
429
+ if isinstance (datum , MutableMapping ) and datum .get ("secondaryFiles" ):
430
+ if isinstance (datum ["secondaryFiles" ], Iterable ):
431
+ for existing_processed_secondaryfile in datum [
432
+ "secondaryFiles"
433
+ ]:
434
+ if isinstance (
435
+ existing_processed_secondaryfile ,
436
+ MutableMapping ,
437
+ ):
438
+ existing_processed_location = existing_processed_secondaryfile .get (
439
+ "location"
440
+ )
441
+ if (
442
+ existing_processed_location
443
+ and isinstance (
444
+ existing_processed_location , str
445
+ )
446
+ ):
447
+ if (
448
+ os .path .basename (
449
+ existing_processed_location
450
+ )
451
+ == sfname
452
+ ):
453
+ # the secondary file has already been processed;
454
+ # use established location
455
+ sf_location = existing_processed_secondaryfile [
456
+ "location"
457
+ ]
443
458
if not sf_location :
444
459
if "/" in d_location :
445
460
sf_location = (
@@ -490,7 +505,7 @@ def addsf(
490
505
sfname ,
491
506
)
492
507
elif discover_secondaryFiles and self .fs_access .exists (
493
- sf_location
508
+ cast ( str , sf_location )
494
509
):
495
510
addsf (
496
511
cast (
You can’t perform that action at this time.
0 commit comments