def transitive_reload(objects, visited): for obj in objects: if type(obj) == types.ModuleType and obj not in visited: status(obj) tryreload(obj) # 이것을 리로드, 속성으로 되돌아감 visited.add(obj) transitive_reload(obj.__dict__.values(), visited)
def transitive_reload(objects, visited): for obj in objects: if type(obj) == types.ModuleType and obj not in visited: status(obj) tryreload(obj) # Reload this, recur to attrs visited.add(obj) transitive_reload(obj.__dict__.values(), visited)
def transitive_reload(modules, visited): while modules: next_ = modules.pop() status(next_) tryreload(next_) visited.add(next_) modules.extend(x for x in next_.__dict__.values() if type(x) == types.ModuleType and x not in visited)
def transitive_reload(modules, visited): while modules: next = modules.pop() # Delete next item at end status(next) # Reload this, push attrs tryreload(next) visited.add(next) modules.extend(x for x in next.__dict__.values() if type(x) == types.ModuleType and x not in visited)
def transitive_reload(modules, visited): while modules: next = modules.pop() # 끝에서 next 항목 삭제 status(next) # 이것을 리로드, 속성 밀어 넣기 tryreload(next) visited.add(next) modules.extend(x for x in next.__dict__.values() if type(x) == types.ModuleType and x not in visited)
def transitive_reload2(modules, visited): # 2: Avoid 'in' during 'extend' while modules: next = modules.pop() # Delete next item at end if next in visited: continue # Already reloaded anywhere? status(next) # Reload this, push attrs tryreload(next) visited.add(next) modules.extend(x for x in next.__dict__.values() if type(x) == types.ModuleType)
def transitive_reload3(modules, visited): # 3: Symmetry, catch non-mods while modules: next = modules.pop() # Delete next item at end if (type(next) == types.ModuleType # Valid module object? and next not in visited): # Not already reloaded? status(next) # Reload this, push attrs tryreload(next) visited.add(next) modules.extend(next.__dict__.values())
def transitive_reload(modules, visited): while modules: nextmod = modules.pop() status(nextmod) tryreload(nextmod) visited.add(nextmod) #print('VISITED:', visited) modules.extend(x for x in nextmod.__dict__.values() if type(x) == types.ModuleType and x not in visited and x not in modules)