cannot call 'as.list' on a synapser generator inside of another function

Description

I can do:

1 2 foo <- synapser::synGetTeamMembers(teamid) foo <- as.list(foo)

I cannot do:

1 2 3 4 otherFxn <- function(teamid) { foo <- synapser::synGetTeamMembers(teamid) foo <- as.list(foo) return(foo)

I get back:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 $.__enclos_env__ <environment: 0xbb32810> $py.variableName [1] "__R__.namespace[4]" $clone function (deep = FALSE) { assign_func_envs <- function(objs, target_env) { if (is.null(target_env)) return(objs) lapply(objs, function(x) { if (is.function(x)) environment(x) <- target_env x }) } list2env2 <- function(x, envir = NULL, parent = emptyenv(), hash = (length(x) > 100), size = max(29L, length(x)), empty_to_null = TRUE) { if (is.null(envir)) { envir <- new.env(hash = hash, parent = parent, size = size) } if (length(x) == 0) { if (empty_to_null) return(NULL) else return(envir) } list2env(x, envir) } clone_super <- function(old_enclos_env, new_enclos_env, public_bind_env, has_private, private_bind_env) { old_super_bind_env <- old_enclos_env$super if (is.null(old_super_bind_env)) return() super_copies <- as.list.environment(old_super_bind_env, all.names = TRUE) super_copies <- super_copies[setdiff(names(super_copies), ".__enclos_env__")] if (length(super_copies) == 0) { new_enclos_env$super <- new.env(parent = emptyenv(), hash = FALSE) return() } old_super_enclos_env <- old_super_bind_env$.__enclos_env__ new_super_enclos_env <- new.env(parent = parent.env(old_super_enclos_env), hash = FALSE) new_super_enclos_env$self <- public_bind_env if (has_private) new_super_enclos_env$private <- private_bind_env new_super_bind_env <- new.env(parent = emptyenv(), hash = FALSE) new_super_bind_env$.__enclos_env__ <- new_super_enclos_env super_copies <- assign_func_envs(super_copies, new_super_enclos_env) active_idx <- vapply(names(super_copies), bindingIsActive, env = old_super_bind_env, TRUE) active_copies <- super_copies[active_idx] non_active_copies <- super_copies[!active_idx] list2env2(non_active_copies, new_super_bind_env) if (length(active_copies) > 0) { for (name in names(active_copies)) { makeActiveBinding(name, active_copies[[name]], new_super_bind_env) } } new_enclos_env$super <- new_super_bind_env clone_super(old_super_enclos_env, new_super_enclos_env, public_bind_env, has_private, private_bind_env) } old_enclos_env <- .subset2(self, ".__enclos_env__") if (!is.environment(old_enclos_env)) { stop("clone() must be called from an R6 object.") } old_public_bind_env <- self old_private_bind_env <- old_enclos_env$private has_private <- !is.null(old_private_bind_env) portable <- !identical(old_public_bind_env, old_enclos_env) if (deep) { if (has_private && is.function(old_private_bind_env$deep_clone)) { deep_clone <- old_private_bind_env$deep_clone } else { deep_clone <- function(name, value) { if (is.environment(value) && !is.null(value$.__enclos_env__)) { return(value$clone(deep = TRUE)) } value } } } if (portable) { if (has_private) { private_bind_env <- new.env(emptyenv(), hash = FALSE) } public_bind_env <- new.env(emptyenv(), hash = FALSE) new_enclos_env <- new.env(parent.env(old_enclos_env), hash = FALSE) } else { if (has_private) { private_bind_env <- new.env(parent.env(old_private_bind_env), hash = FALSE) public_bind_env <- new.env(private_bind_env, hash = FALSE) } else { public_bind_env <- new.env(parent.env(old_public_bind_env), hash = FALSE) } new_enclos_env <- public_bind_env } public_copies <- as.list.environment(old_public_bind_env, all.names = TRUE) if (!portable) { public_copies$self <- NULL } public_copies <- public_copies[setdiff(names(public_copies), ".__enclos_env__")] public_copies <- assign_func_envs(public_copies, new_enclos_env) active_idx <- vapply(names(public_copies), bindingIsActive, env = old_public_bind_env, logical(1)) active_copies <- public_copies[active_idx] public_copies <- public_copies[!active_idx] if (deep) { public_copies <- mapply(deep_clone, names(public_copies), public_copies, SIMPLIFY = FALSE) } list2env2(public_copies, public_bind_env) if (length(active_copies) > 0) { for (name in names(active_copies)) { makeActiveBinding(name, active_copies[[name]], public_bind_env) } } if (has_private) { private_copies <- as.list.environment(old_private_bind_env, all.names = TRUE) if (deep) { private_copies <- mapply(deep_clone, names(private_copies), private_copies, SIMPLIFY = FALSE) } private_copies <- assign_func_envs(private_copies, new_enclos_env) list2env2(private_copies, private_bind_env) } clone_super(old_enclos_env, new_enclos_env, public_bind_env, has_private, private_bind_env) public_bind_env$.__enclos_env__ <- new_enclos_env new_enclos_env$self <- public_bind_env if (has_private) new_enclos_env$private <- private_bind_env class(public_bind_env) <- class(old_public_bind_env) if (environmentIsLocked(old_public_bind_env)) { lockEnvironment(public_bind_env) } if (has_private && environmentIsLocked(old_private_bind_env)) { lockEnvironment(private_bind_env) } for (name in names(public_copies)) { if (is.function(.subset2(public_bind_env, name))) lockBinding(name, public_bind_env) } if (has_private) { for (name in names(private_copies)) { if (is.function(private_bind_env[[name]])) lockBinding(name, private_bind_env) } } public_bind_env } <environment: 0xbb32810> $nextElem function (...) { x <- list(...) i <- if (!is.null(names(x))) (nchar(names(x)) > 0) else rep(FALSE, length(x)) xargs <- if (sum(!i) > 0) x[!i] else NULL xkwargs <- if (sum(i) > 0) x[i] else NULL pyCall("__R__.namespace[4].nextElem", args = xargs, kwargs = xkwargs) } <environment: 0xbb32810> $asList function (...) { x <- list(...) i <- if (!is.null(names(x))) (nchar(names(x)) > 0) else rep(FALSE, length(x)) xargs <- if (sum(!i) > 0) x[!i] else NULL xkwargs <- if (sum(i) > 0) x[i] else NULL pyCall("__R__.namespace[4].asList", args = xargs, kwargs = xkwargs) } <environment: 0xbb32810> $print function () pyPrint(self$py.variableName) <environment: 0xbb467b0> $initialize function (variableName, objectName, type) { if (!missing(variableName)) self$py.variableName <- variableName if (!missing(objectName)) private$py.objectName <- objectName if (!missing(type)) private$py.type <- type reg.finalizer(self, pyObjectFinalize, onexit = TRUE) } <environment: 0xbb467b0>

Environment

None

Status

Assignee

Unassigned

Reporter

Kenneth Daily

Labels

None

Validator

Kenneth Daily

Release Version History

None

Priority

Major
Configure