Skip to content

Commit

Permalink
extract_paths more efficient, small fixup (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz authored Jun 20, 2022
1 parent 9620433 commit 978390f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sisyphus/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ def extract_paths(args: Any) -> Set:
:rtype: set
"""
out = set()
visited_obj_ids = set()
visited_obj_ids = {} # id -> obj # keep ref to obj alive, to avoid having same id for different objs
queue = [args]
while queue:
obj = queue.pop()
if id(obj) in visited_obj_ids:
continue
visited_obj_ids.add(id(obj))
visited_obj_ids[id(obj)] = obj
if isinstance(obj, Block) or isinstance(obj, enum.Enum):
continue
if hasattr(obj, '_sis_path') and obj._sis_path is True:
Expand Down

0 comments on commit 978390f

Please sign in to comment.