def mark_async(obj): for child in obj.args + obj.exes: if S.isvar(child) or not isinstance(child, _Executable): continue if obj.async_: child.async_ = True mark_async(child)
def _get_name(obj, depth=3): if isinstance(obj, list): if len(obj) == 1: return _get_name(obj[0], depth) return "[{}]".format(_map_join(lambda x: _get_name(x, depth - 1), obj)) elif isinstance(obj, _Executable): name = obj.__class__.__name__ if depth > 1: items = filter( lambda x: not S.isvar(x) and isinstance(x, _Executable), obj.args + obj.exes, ) else: items = [] items = _map_join(lambda x: _get_name(x, depth - 1), items) return "{}({})".format(name, items)