Skip to content

Commit

Permalink
Transformation: Fixing metadata for recursion with mutliple items
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Dec 1, 2023
1 parent 0faa31d commit 8a180bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions loki/bulk/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,7 @@ def process(self, transformation):
continue

_item = items[0]
transformation.apply(
items[0].source, role=_item.role, mode=_item.mode,
item=_item, items=items, targets=_item.targets,
)
transformation.apply(items[0].source, items=items)
else:
for item in traversal:
if item_filter and not isinstance(item, item_filter):
Expand Down
5 changes: 2 additions & 3 deletions loki/transform/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,14 @@ def apply_file(self, sourcefile, **kwargs):
role = kwargs.pop('role', None)
targets = kwargs.pop('targets', None)

if 'items' in kwargs:
if 'items':

Check failure on line 194 in loki/transform/transformation.py

View workflow job for this annotation

GitHub Actions / code checks (3.11)

W0125: Using a conditional statement with a constant value (using-constant-test)
# TODO: This special logic is required for the
# DependencyTransformation to capture certain corner
# cases. Once the module wrapping is split into its
# own transformation, we can probably simplify this.

# We consider the sourcefile to be a "kernel" file if all items are kernels
if all(item.role == 'kernel' for item in items):
role = 'kernel'
role = 'kernel' if all(item.role == 'kernel' for item in items) else 'driver'

if targets is None:
# We collect the targets for file/module-level imports from all items
Expand Down

0 comments on commit 8a180bc

Please sign in to comment.