Skip to content

Commit f1efc96

Browse files
committed
turns who-can into a generator for more live feedback
1 parent f48e74b commit f1efc96

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

iamspy/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def who_can(
7979
if Path(model).is_file():
8080
m.load_model(model)
8181

82-
print("\n".join(m.who_can(action, resource, conditions, condition_file, strict_conditions)))
82+
for x in m.who_can(action, resource, conditions, condition_file, strict_conditions):
83+
print(x)
8384

8485

8586
@app.command()

iamspy/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def who_can(
243243
sources.append(str(source)[1:-1])
244244
solver.add(s != source)
245245
sat = solver.check() == z3.sat
246-
return sources
246+
yield str(source)[1:-1]
247247

248248
def who_can_batch_resource(
249249
self,

0 commit comments

Comments
 (0)