How to use decorate method of is Package

Best Is code snippet using is.decorate

starlark_mapping.go

Source:starlark_mapping.go Github

copy

Full Screen

...9func (env *Env) starlarkPredeclare() starlark.StringDict {10 r := starlark.StringDict{}11 r["amend_breakpoint"] = starlark.NewBuiltin("amend_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {12 if err := isCancelled(thread); err != nil {13 return starlark.None, decorateError(thread, err)14 }15 var rpcArgs rpc2.AmendBreakpointIn16 var rpcRet rpc2.AmendBreakpointOut17 if len(args) > 0 && args[0] != starlark.None {18 err := unmarshalStarlarkValue(args[0], &rpcArgs.Breakpoint, "Breakpoint")19 if err != nil {20 return starlark.None, decorateError(thread, err)21 }22 }23 for _, kv := range kwargs {24 var err error25 switch kv[0].(starlark.String) {26 case "Breakpoint":27 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Breakpoint, "Breakpoint")28 default:29 err = fmt.Errorf("unknown argument %q", kv[0])30 }31 if err != nil {32 return starlark.None, decorateError(thread, err)33 }34 }35 err := env.ctx.Client().CallAPI("AmendBreakpoint", &rpcArgs, &rpcRet)36 if err != nil {37 return starlark.None, err38 }39 return env.interfaceToStarlarkValue(rpcRet), nil40 })41 r["ancestors"] = starlark.NewBuiltin("ancestors", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {42 if err := isCancelled(thread); err != nil {43 return starlark.None, decorateError(thread, err)44 }45 var rpcArgs rpc2.AncestorsIn46 var rpcRet rpc2.AncestorsOut47 if len(args) > 0 && args[0] != starlark.None {48 err := unmarshalStarlarkValue(args[0], &rpcArgs.GoroutineID, "GoroutineID")49 if err != nil {50 return starlark.None, decorateError(thread, err)51 }52 }53 if len(args) > 1 && args[1] != starlark.None {54 err := unmarshalStarlarkValue(args[1], &rpcArgs.NumAncestors, "NumAncestors")55 if err != nil {56 return starlark.None, decorateError(thread, err)57 }58 }59 if len(args) > 2 && args[2] != starlark.None {60 err := unmarshalStarlarkValue(args[2], &rpcArgs.Depth, "Depth")61 if err != nil {62 return starlark.None, decorateError(thread, err)63 }64 }65 for _, kv := range kwargs {66 var err error67 switch kv[0].(starlark.String) {68 case "GoroutineID":69 err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineID, "GoroutineID")70 case "NumAncestors":71 err = unmarshalStarlarkValue(kv[1], &rpcArgs.NumAncestors, "NumAncestors")72 case "Depth":73 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Depth, "Depth")74 default:75 err = fmt.Errorf("unknown argument %q", kv[0])76 }77 if err != nil {78 return starlark.None, decorateError(thread, err)79 }80 }81 err := env.ctx.Client().CallAPI("Ancestors", &rpcArgs, &rpcRet)82 if err != nil {83 return starlark.None, err84 }85 return env.interfaceToStarlarkValue(rpcRet), nil86 })87 r["attached_to_existing_process"] = starlark.NewBuiltin("attached_to_existing_process", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {88 if err := isCancelled(thread); err != nil {89 return starlark.None, decorateError(thread, err)90 }91 var rpcArgs rpc2.AttachedToExistingProcessIn92 var rpcRet rpc2.AttachedToExistingProcessOut93 err := env.ctx.Client().CallAPI("AttachedToExistingProcess", &rpcArgs, &rpcRet)94 if err != nil {95 return starlark.None, err96 }97 return env.interfaceToStarlarkValue(rpcRet), nil98 })99 r["cancel_next"] = starlark.NewBuiltin("cancel_next", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {100 if err := isCancelled(thread); err != nil {101 return starlark.None, decorateError(thread, err)102 }103 var rpcArgs rpc2.CancelNextIn104 var rpcRet rpc2.CancelNextOut105 err := env.ctx.Client().CallAPI("CancelNext", &rpcArgs, &rpcRet)106 if err != nil {107 return starlark.None, err108 }109 return env.interfaceToStarlarkValue(rpcRet), nil110 })111 r["checkpoint"] = starlark.NewBuiltin("checkpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {112 if err := isCancelled(thread); err != nil {113 return starlark.None, decorateError(thread, err)114 }115 var rpcArgs rpc2.CheckpointIn116 var rpcRet rpc2.CheckpointOut117 if len(args) > 0 && args[0] != starlark.None {118 err := unmarshalStarlarkValue(args[0], &rpcArgs.Where, "Where")119 if err != nil {120 return starlark.None, decorateError(thread, err)121 }122 }123 for _, kv := range kwargs {124 var err error125 switch kv[0].(starlark.String) {126 case "Where":127 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Where, "Where")128 default:129 err = fmt.Errorf("unknown argument %q", kv[0])130 }131 if err != nil {132 return starlark.None, decorateError(thread, err)133 }134 }135 err := env.ctx.Client().CallAPI("Checkpoint", &rpcArgs, &rpcRet)136 if err != nil {137 return starlark.None, err138 }139 return env.interfaceToStarlarkValue(rpcRet), nil140 })141 r["clear_breakpoint"] = starlark.NewBuiltin("clear_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {142 if err := isCancelled(thread); err != nil {143 return starlark.None, decorateError(thread, err)144 }145 var rpcArgs rpc2.ClearBreakpointIn146 var rpcRet rpc2.ClearBreakpointOut147 if len(args) > 0 && args[0] != starlark.None {148 err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")149 if err != nil {150 return starlark.None, decorateError(thread, err)151 }152 }153 if len(args) > 1 && args[1] != starlark.None {154 err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")155 if err != nil {156 return starlark.None, decorateError(thread, err)157 }158 }159 for _, kv := range kwargs {160 var err error161 switch kv[0].(starlark.String) {162 case "Id":163 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")164 case "Name":165 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")166 default:167 err = fmt.Errorf("unknown argument %q", kv[0])168 }169 if err != nil {170 return starlark.None, decorateError(thread, err)171 }172 }173 err := env.ctx.Client().CallAPI("ClearBreakpoint", &rpcArgs, &rpcRet)174 if err != nil {175 return starlark.None, err176 }177 return env.interfaceToStarlarkValue(rpcRet), nil178 })179 r["clear_checkpoint"] = starlark.NewBuiltin("clear_checkpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {180 if err := isCancelled(thread); err != nil {181 return starlark.None, decorateError(thread, err)182 }183 var rpcArgs rpc2.ClearCheckpointIn184 var rpcRet rpc2.ClearCheckpointOut185 if len(args) > 0 && args[0] != starlark.None {186 err := unmarshalStarlarkValue(args[0], &rpcArgs.ID, "ID")187 if err != nil {188 return starlark.None, decorateError(thread, err)189 }190 }191 for _, kv := range kwargs {192 var err error193 switch kv[0].(starlark.String) {194 case "ID":195 err = unmarshalStarlarkValue(kv[1], &rpcArgs.ID, "ID")196 default:197 err = fmt.Errorf("unknown argument %q", kv[0])198 }199 if err != nil {200 return starlark.None, decorateError(thread, err)201 }202 }203 err := env.ctx.Client().CallAPI("ClearCheckpoint", &rpcArgs, &rpcRet)204 if err != nil {205 return starlark.None, err206 }207 return env.interfaceToStarlarkValue(rpcRet), nil208 })209 r["raw_command"] = starlark.NewBuiltin("raw_command", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {210 if err := isCancelled(thread); err != nil {211 return starlark.None, decorateError(thread, err)212 }213 var rpcArgs api.DebuggerCommand214 var rpcRet rpc2.CommandOut215 if len(args) > 0 && args[0] != starlark.None {216 err := unmarshalStarlarkValue(args[0], &rpcArgs.Name, "Name")217 if err != nil {218 return starlark.None, decorateError(thread, err)219 }220 }221 if len(args) > 1 && args[1] != starlark.None {222 err := unmarshalStarlarkValue(args[1], &rpcArgs.ThreadID, "ThreadID")223 if err != nil {224 return starlark.None, decorateError(thread, err)225 }226 }227 if len(args) > 2 && args[2] != starlark.None {228 err := unmarshalStarlarkValue(args[2], &rpcArgs.GoroutineID, "GoroutineID")229 if err != nil {230 return starlark.None, decorateError(thread, err)231 }232 }233 if len(args) > 3 && args[3] != starlark.None {234 err := unmarshalStarlarkValue(args[3], &rpcArgs.ReturnInfoLoadConfig, "ReturnInfoLoadConfig")235 if err != nil {236 return starlark.None, decorateError(thread, err)237 }238 } else {239 cfg := env.ctx.LoadConfig()240 rpcArgs.ReturnInfoLoadConfig = &cfg241 }242 if len(args) > 4 && args[4] != starlark.None {243 err := unmarshalStarlarkValue(args[4], &rpcArgs.Expr, "Expr")244 if err != nil {245 return starlark.None, decorateError(thread, err)246 }247 }248 if len(args) > 5 && args[5] != starlark.None {249 err := unmarshalStarlarkValue(args[5], &rpcArgs.UnsafeCall, "UnsafeCall")250 if err != nil {251 return starlark.None, decorateError(thread, err)252 }253 }254 for _, kv := range kwargs {255 var err error256 switch kv[0].(starlark.String) {257 case "Name":258 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")259 case "ThreadID":260 err = unmarshalStarlarkValue(kv[1], &rpcArgs.ThreadID, "ThreadID")261 case "GoroutineID":262 err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineID, "GoroutineID")263 case "ReturnInfoLoadConfig":264 err = unmarshalStarlarkValue(kv[1], &rpcArgs.ReturnInfoLoadConfig, "ReturnInfoLoadConfig")265 case "Expr":266 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")267 case "UnsafeCall":268 err = unmarshalStarlarkValue(kv[1], &rpcArgs.UnsafeCall, "UnsafeCall")269 default:270 err = fmt.Errorf("unknown argument %q", kv[0])271 }272 if err != nil {273 return starlark.None, decorateError(thread, err)274 }275 }276 err := env.ctx.Client().CallAPI("Command", &rpcArgs, &rpcRet)277 if err != nil {278 return starlark.None, err279 }280 return env.interfaceToStarlarkValue(rpcRet), nil281 })282 r["create_breakpoint"] = starlark.NewBuiltin("create_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {283 if err := isCancelled(thread); err != nil {284 return starlark.None, decorateError(thread, err)285 }286 var rpcArgs rpc2.CreateBreakpointIn287 var rpcRet rpc2.CreateBreakpointOut288 if len(args) > 0 && args[0] != starlark.None {289 err := unmarshalStarlarkValue(args[0], &rpcArgs.Breakpoint, "Breakpoint")290 if err != nil {291 return starlark.None, decorateError(thread, err)292 }293 }294 for _, kv := range kwargs {295 var err error296 switch kv[0].(starlark.String) {297 case "Breakpoint":298 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Breakpoint, "Breakpoint")299 default:300 err = fmt.Errorf("unknown argument %q", kv[0])301 }302 if err != nil {303 return starlark.None, decorateError(thread, err)304 }305 }306 err := env.ctx.Client().CallAPI("CreateBreakpoint", &rpcArgs, &rpcRet)307 if err != nil {308 return starlark.None, err309 }310 return env.interfaceToStarlarkValue(rpcRet), nil311 })312 r["create_watchpoint"] = starlark.NewBuiltin("create_watchpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {313 if err := isCancelled(thread); err != nil {314 return starlark.None, decorateError(thread, err)315 }316 var rpcArgs rpc2.CreateWatchpointIn317 var rpcRet rpc2.CreateWatchpointOut318 if len(args) > 0 && args[0] != starlark.None {319 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")320 if err != nil {321 return starlark.None, decorateError(thread, err)322 }323 } else {324 rpcArgs.Scope = env.ctx.Scope()325 }326 if len(args) > 1 && args[1] != starlark.None {327 err := unmarshalStarlarkValue(args[1], &rpcArgs.Expr, "Expr")328 if err != nil {329 return starlark.None, decorateError(thread, err)330 }331 }332 if len(args) > 2 && args[2] != starlark.None {333 err := unmarshalStarlarkValue(args[2], &rpcArgs.Type, "Type")334 if err != nil {335 return starlark.None, decorateError(thread, err)336 }337 }338 for _, kv := range kwargs {339 var err error340 switch kv[0].(starlark.String) {341 case "Scope":342 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")343 case "Expr":344 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")345 case "Type":346 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Type, "Type")347 default:348 err = fmt.Errorf("unknown argument %q", kv[0])349 }350 if err != nil {351 return starlark.None, decorateError(thread, err)352 }353 }354 err := env.ctx.Client().CallAPI("CreateWatchpoint", &rpcArgs, &rpcRet)355 if err != nil {356 return starlark.None, err357 }358 return env.interfaceToStarlarkValue(rpcRet), nil359 })360 r["detach"] = starlark.NewBuiltin("detach", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {361 if err := isCancelled(thread); err != nil {362 return starlark.None, decorateError(thread, err)363 }364 var rpcArgs rpc2.DetachIn365 var rpcRet rpc2.DetachOut366 if len(args) > 0 && args[0] != starlark.None {367 err := unmarshalStarlarkValue(args[0], &rpcArgs.Kill, "Kill")368 if err != nil {369 return starlark.None, decorateError(thread, err)370 }371 }372 for _, kv := range kwargs {373 var err error374 switch kv[0].(starlark.String) {375 case "Kill":376 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Kill, "Kill")377 default:378 err = fmt.Errorf("unknown argument %q", kv[0])379 }380 if err != nil {381 return starlark.None, decorateError(thread, err)382 }383 }384 err := env.ctx.Client().CallAPI("Detach", &rpcArgs, &rpcRet)385 if err != nil {386 return starlark.None, err387 }388 return env.interfaceToStarlarkValue(rpcRet), nil389 })390 r["disassemble"] = starlark.NewBuiltin("disassemble", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {391 if err := isCancelled(thread); err != nil {392 return starlark.None, decorateError(thread, err)393 }394 var rpcArgs rpc2.DisassembleIn395 var rpcRet rpc2.DisassembleOut396 if len(args) > 0 && args[0] != starlark.None {397 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")398 if err != nil {399 return starlark.None, decorateError(thread, err)400 }401 } else {402 rpcArgs.Scope = env.ctx.Scope()403 }404 if len(args) > 1 && args[1] != starlark.None {405 err := unmarshalStarlarkValue(args[1], &rpcArgs.StartPC, "StartPC")406 if err != nil {407 return starlark.None, decorateError(thread, err)408 }409 }410 if len(args) > 2 && args[2] != starlark.None {411 err := unmarshalStarlarkValue(args[2], &rpcArgs.EndPC, "EndPC")412 if err != nil {413 return starlark.None, decorateError(thread, err)414 }415 }416 if len(args) > 3 && args[3] != starlark.None {417 err := unmarshalStarlarkValue(args[3], &rpcArgs.Flavour, "Flavour")418 if err != nil {419 return starlark.None, decorateError(thread, err)420 }421 }422 for _, kv := range kwargs {423 var err error424 switch kv[0].(starlark.String) {425 case "Scope":426 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")427 case "StartPC":428 err = unmarshalStarlarkValue(kv[1], &rpcArgs.StartPC, "StartPC")429 case "EndPC":430 err = unmarshalStarlarkValue(kv[1], &rpcArgs.EndPC, "EndPC")431 case "Flavour":432 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Flavour, "Flavour")433 default:434 err = fmt.Errorf("unknown argument %q", kv[0])435 }436 if err != nil {437 return starlark.None, decorateError(thread, err)438 }439 }440 err := env.ctx.Client().CallAPI("Disassemble", &rpcArgs, &rpcRet)441 if err != nil {442 return starlark.None, err443 }444 return env.interfaceToStarlarkValue(rpcRet), nil445 })446 r["dump_cancel"] = starlark.NewBuiltin("dump_cancel", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {447 if err := isCancelled(thread); err != nil {448 return starlark.None, decorateError(thread, err)449 }450 var rpcArgs rpc2.DumpCancelIn451 var rpcRet rpc2.DumpCancelOut452 err := env.ctx.Client().CallAPI("DumpCancel", &rpcArgs, &rpcRet)453 if err != nil {454 return starlark.None, err455 }456 return env.interfaceToStarlarkValue(rpcRet), nil457 })458 r["dump_start"] = starlark.NewBuiltin("dump_start", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {459 if err := isCancelled(thread); err != nil {460 return starlark.None, decorateError(thread, err)461 }462 var rpcArgs rpc2.DumpStartIn463 var rpcRet rpc2.DumpStartOut464 if len(args) > 0 && args[0] != starlark.None {465 err := unmarshalStarlarkValue(args[0], &rpcArgs.Destination, "Destination")466 if err != nil {467 return starlark.None, decorateError(thread, err)468 }469 }470 for _, kv := range kwargs {471 var err error472 switch kv[0].(starlark.String) {473 case "Destination":474 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Destination, "Destination")475 default:476 err = fmt.Errorf("unknown argument %q", kv[0])477 }478 if err != nil {479 return starlark.None, decorateError(thread, err)480 }481 }482 err := env.ctx.Client().CallAPI("DumpStart", &rpcArgs, &rpcRet)483 if err != nil {484 return starlark.None, err485 }486 return env.interfaceToStarlarkValue(rpcRet), nil487 })488 r["dump_wait"] = starlark.NewBuiltin("dump_wait", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {489 if err := isCancelled(thread); err != nil {490 return starlark.None, decorateError(thread, err)491 }492 var rpcArgs rpc2.DumpWaitIn493 var rpcRet rpc2.DumpWaitOut494 if len(args) > 0 && args[0] != starlark.None {495 err := unmarshalStarlarkValue(args[0], &rpcArgs.Wait, "Wait")496 if err != nil {497 return starlark.None, decorateError(thread, err)498 }499 }500 for _, kv := range kwargs {501 var err error502 switch kv[0].(starlark.String) {503 case "Wait":504 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Wait, "Wait")505 default:506 err = fmt.Errorf("unknown argument %q", kv[0])507 }508 if err != nil {509 return starlark.None, decorateError(thread, err)510 }511 }512 err := env.ctx.Client().CallAPI("DumpWait", &rpcArgs, &rpcRet)513 if err != nil {514 return starlark.None, err515 }516 return env.interfaceToStarlarkValue(rpcRet), nil517 })518 r["eval"] = starlark.NewBuiltin("eval", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {519 if err := isCancelled(thread); err != nil {520 return starlark.None, decorateError(thread, err)521 }522 var rpcArgs rpc2.EvalIn523 var rpcRet rpc2.EvalOut524 if len(args) > 0 && args[0] != starlark.None {525 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")526 if err != nil {527 return starlark.None, decorateError(thread, err)528 }529 } else {530 rpcArgs.Scope = env.ctx.Scope()531 }532 if len(args) > 1 && args[1] != starlark.None {533 err := unmarshalStarlarkValue(args[1], &rpcArgs.Expr, "Expr")534 if err != nil {535 return starlark.None, decorateError(thread, err)536 }537 }538 if len(args) > 2 && args[2] != starlark.None {539 err := unmarshalStarlarkValue(args[2], &rpcArgs.Cfg, "Cfg")540 if err != nil {541 return starlark.None, decorateError(thread, err)542 }543 } else {544 cfg := env.ctx.LoadConfig()545 rpcArgs.Cfg = &cfg546 }547 for _, kv := range kwargs {548 var err error549 switch kv[0].(starlark.String) {550 case "Scope":551 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")552 case "Expr":553 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")554 case "Cfg":555 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")556 default:557 err = fmt.Errorf("unknown argument %q", kv[0])558 }559 if err != nil {560 return starlark.None, decorateError(thread, err)561 }562 }563 err := env.ctx.Client().CallAPI("Eval", &rpcArgs, &rpcRet)564 if err != nil {565 return starlark.None, err566 }567 return env.interfaceToStarlarkValue(rpcRet), nil568 })569 r["examine_memory"] = starlark.NewBuiltin("examine_memory", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {570 if err := isCancelled(thread); err != nil {571 return starlark.None, decorateError(thread, err)572 }573 var rpcArgs rpc2.ExamineMemoryIn574 var rpcRet rpc2.ExaminedMemoryOut575 if len(args) > 0 && args[0] != starlark.None {576 err := unmarshalStarlarkValue(args[0], &rpcArgs.Address, "Address")577 if err != nil {578 return starlark.None, decorateError(thread, err)579 }580 }581 if len(args) > 1 && args[1] != starlark.None {582 err := unmarshalStarlarkValue(args[1], &rpcArgs.Length, "Length")583 if err != nil {584 return starlark.None, decorateError(thread, err)585 }586 }587 for _, kv := range kwargs {588 var err error589 switch kv[0].(starlark.String) {590 case "Address":591 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Address, "Address")592 case "Length":593 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Length, "Length")594 default:595 err = fmt.Errorf("unknown argument %q", kv[0])596 }597 if err != nil {598 return starlark.None, decorateError(thread, err)599 }600 }601 err := env.ctx.Client().CallAPI("ExamineMemory", &rpcArgs, &rpcRet)602 if err != nil {603 return starlark.None, err604 }605 return env.interfaceToStarlarkValue(rpcRet), nil606 })607 r["find_location"] = starlark.NewBuiltin("find_location", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {608 if err := isCancelled(thread); err != nil {609 return starlark.None, decorateError(thread, err)610 }611 var rpcArgs rpc2.FindLocationIn612 var rpcRet rpc2.FindLocationOut613 if len(args) > 0 && args[0] != starlark.None {614 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")615 if err != nil {616 return starlark.None, decorateError(thread, err)617 }618 } else {619 rpcArgs.Scope = env.ctx.Scope()620 }621 if len(args) > 1 && args[1] != starlark.None {622 err := unmarshalStarlarkValue(args[1], &rpcArgs.Loc, "Loc")623 if err != nil {624 return starlark.None, decorateError(thread, err)625 }626 }627 if len(args) > 2 && args[2] != starlark.None {628 err := unmarshalStarlarkValue(args[2], &rpcArgs.IncludeNonExecutableLines, "IncludeNonExecutableLines")629 if err != nil {630 return starlark.None, decorateError(thread, err)631 }632 }633 if len(args) > 3 && args[3] != starlark.None {634 err := unmarshalStarlarkValue(args[3], &rpcArgs.SubstitutePathRules, "SubstitutePathRules")635 if err != nil {636 return starlark.None, decorateError(thread, err)637 }638 }639 for _, kv := range kwargs {640 var err error641 switch kv[0].(starlark.String) {642 case "Scope":643 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")644 case "Loc":645 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Loc, "Loc")646 case "IncludeNonExecutableLines":647 err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeNonExecutableLines, "IncludeNonExecutableLines")648 case "SubstitutePathRules":649 err = unmarshalStarlarkValue(kv[1], &rpcArgs.SubstitutePathRules, "SubstitutePathRules")650 default:651 err = fmt.Errorf("unknown argument %q", kv[0])652 }653 if err != nil {654 return starlark.None, decorateError(thread, err)655 }656 }657 err := env.ctx.Client().CallAPI("FindLocation", &rpcArgs, &rpcRet)658 if err != nil {659 return starlark.None, err660 }661 return env.interfaceToStarlarkValue(rpcRet), nil662 })663 r["function_return_locations"] = starlark.NewBuiltin("function_return_locations", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {664 if err := isCancelled(thread); err != nil {665 return starlark.None, decorateError(thread, err)666 }667 var rpcArgs rpc2.FunctionReturnLocationsIn668 var rpcRet rpc2.FunctionReturnLocationsOut669 if len(args) > 0 && args[0] != starlark.None {670 err := unmarshalStarlarkValue(args[0], &rpcArgs.FnName, "FnName")671 if err != nil {672 return starlark.None, decorateError(thread, err)673 }674 }675 for _, kv := range kwargs {676 var err error677 switch kv[0].(starlark.String) {678 case "FnName":679 err = unmarshalStarlarkValue(kv[1], &rpcArgs.FnName, "FnName")680 default:681 err = fmt.Errorf("unknown argument %q", kv[0])682 }683 if err != nil {684 return starlark.None, decorateError(thread, err)685 }686 }687 err := env.ctx.Client().CallAPI("FunctionReturnLocations", &rpcArgs, &rpcRet)688 if err != nil {689 return starlark.None, err690 }691 return env.interfaceToStarlarkValue(rpcRet), nil692 })693 r["get_breakpoint"] = starlark.NewBuiltin("get_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {694 if err := isCancelled(thread); err != nil {695 return starlark.None, decorateError(thread, err)696 }697 var rpcArgs rpc2.GetBreakpointIn698 var rpcRet rpc2.GetBreakpointOut699 if len(args) > 0 && args[0] != starlark.None {700 err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")701 if err != nil {702 return starlark.None, decorateError(thread, err)703 }704 }705 if len(args) > 1 && args[1] != starlark.None {706 err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")707 if err != nil {708 return starlark.None, decorateError(thread, err)709 }710 }711 for _, kv := range kwargs {712 var err error713 switch kv[0].(starlark.String) {714 case "Id":715 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")716 case "Name":717 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")718 default:719 err = fmt.Errorf("unknown argument %q", kv[0])720 }721 if err != nil {722 return starlark.None, decorateError(thread, err)723 }724 }725 err := env.ctx.Client().CallAPI("GetBreakpoint", &rpcArgs, &rpcRet)726 if err != nil {727 return starlark.None, err728 }729 return env.interfaceToStarlarkValue(rpcRet), nil730 })731 r["get_thread"] = starlark.NewBuiltin("get_thread", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {732 if err := isCancelled(thread); err != nil {733 return starlark.None, decorateError(thread, err)734 }735 var rpcArgs rpc2.GetThreadIn736 var rpcRet rpc2.GetThreadOut737 if len(args) > 0 && args[0] != starlark.None {738 err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")739 if err != nil {740 return starlark.None, decorateError(thread, err)741 }742 }743 for _, kv := range kwargs {744 var err error745 switch kv[0].(starlark.String) {746 case "Id":747 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")748 default:749 err = fmt.Errorf("unknown argument %q", kv[0])750 }751 if err != nil {752 return starlark.None, decorateError(thread, err)753 }754 }755 err := env.ctx.Client().CallAPI("GetThread", &rpcArgs, &rpcRet)756 if err != nil {757 return starlark.None, err758 }759 return env.interfaceToStarlarkValue(rpcRet), nil760 })761 r["is_multiclient"] = starlark.NewBuiltin("is_multiclient", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {762 if err := isCancelled(thread); err != nil {763 return starlark.None, decorateError(thread, err)764 }765 var rpcArgs rpc2.IsMulticlientIn766 var rpcRet rpc2.IsMulticlientOut767 err := env.ctx.Client().CallAPI("IsMulticlient", &rpcArgs, &rpcRet)768 if err != nil {769 return starlark.None, err770 }771 return env.interfaceToStarlarkValue(rpcRet), nil772 })773 r["last_modified"] = starlark.NewBuiltin("last_modified", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {774 if err := isCancelled(thread); err != nil {775 return starlark.None, decorateError(thread, err)776 }777 var rpcArgs rpc2.LastModifiedIn778 var rpcRet rpc2.LastModifiedOut779 err := env.ctx.Client().CallAPI("LastModified", &rpcArgs, &rpcRet)780 if err != nil {781 return starlark.None, err782 }783 return env.interfaceToStarlarkValue(rpcRet), nil784 })785 r["breakpoints"] = starlark.NewBuiltin("breakpoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {786 if err := isCancelled(thread); err != nil {787 return starlark.None, decorateError(thread, err)788 }789 var rpcArgs rpc2.ListBreakpointsIn790 var rpcRet rpc2.ListBreakpointsOut791 err := env.ctx.Client().CallAPI("ListBreakpoints", &rpcArgs, &rpcRet)792 if err != nil {793 return starlark.None, err794 }795 return env.interfaceToStarlarkValue(rpcRet), nil796 })797 r["checkpoints"] = starlark.NewBuiltin("checkpoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {798 if err := isCancelled(thread); err != nil {799 return starlark.None, decorateError(thread, err)800 }801 var rpcArgs rpc2.ListCheckpointsIn802 var rpcRet rpc2.ListCheckpointsOut803 err := env.ctx.Client().CallAPI("ListCheckpoints", &rpcArgs, &rpcRet)804 if err != nil {805 return starlark.None, err806 }807 return env.interfaceToStarlarkValue(rpcRet), nil808 })809 r["dynamic_libraries"] = starlark.NewBuiltin("dynamic_libraries", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {810 if err := isCancelled(thread); err != nil {811 return starlark.None, decorateError(thread, err)812 }813 var rpcArgs rpc2.ListDynamicLibrariesIn814 var rpcRet rpc2.ListDynamicLibrariesOut815 err := env.ctx.Client().CallAPI("ListDynamicLibraries", &rpcArgs, &rpcRet)816 if err != nil {817 return starlark.None, err818 }819 return env.interfaceToStarlarkValue(rpcRet), nil820 })821 r["function_args"] = starlark.NewBuiltin("function_args", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {822 if err := isCancelled(thread); err != nil {823 return starlark.None, decorateError(thread, err)824 }825 var rpcArgs rpc2.ListFunctionArgsIn826 var rpcRet rpc2.ListFunctionArgsOut827 if len(args) > 0 && args[0] != starlark.None {828 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")829 if err != nil {830 return starlark.None, decorateError(thread, err)831 }832 } else {833 rpcArgs.Scope = env.ctx.Scope()834 }835 if len(args) > 1 && args[1] != starlark.None {836 err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")837 if err != nil {838 return starlark.None, decorateError(thread, err)839 }840 } else {841 rpcArgs.Cfg = env.ctx.LoadConfig()842 }843 for _, kv := range kwargs {844 var err error845 switch kv[0].(starlark.String) {846 case "Scope":847 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")848 case "Cfg":849 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")850 default:851 err = fmt.Errorf("unknown argument %q", kv[0])852 }853 if err != nil {854 return starlark.None, decorateError(thread, err)855 }856 }857 err := env.ctx.Client().CallAPI("ListFunctionArgs", &rpcArgs, &rpcRet)858 if err != nil {859 return starlark.None, err860 }861 return env.interfaceToStarlarkValue(rpcRet), nil862 })863 r["functions"] = starlark.NewBuiltin("functions", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {864 if err := isCancelled(thread); err != nil {865 return starlark.None, decorateError(thread, err)866 }867 var rpcArgs rpc2.ListFunctionsIn868 var rpcRet rpc2.ListFunctionsOut869 if len(args) > 0 && args[0] != starlark.None {870 err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")871 if err != nil {872 return starlark.None, decorateError(thread, err)873 }874 }875 for _, kv := range kwargs {876 var err error877 switch kv[0].(starlark.String) {878 case "Filter":879 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")880 default:881 err = fmt.Errorf("unknown argument %q", kv[0])882 }883 if err != nil {884 return starlark.None, decorateError(thread, err)885 }886 }887 err := env.ctx.Client().CallAPI("ListFunctions", &rpcArgs, &rpcRet)888 if err != nil {889 return starlark.None, err890 }891 return env.interfaceToStarlarkValue(rpcRet), nil892 })893 r["goroutines"] = starlark.NewBuiltin("goroutines", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {894 if err := isCancelled(thread); err != nil {895 return starlark.None, decorateError(thread, err)896 }897 var rpcArgs rpc2.ListGoroutinesIn898 var rpcRet rpc2.ListGoroutinesOut899 if len(args) > 0 && args[0] != starlark.None {900 err := unmarshalStarlarkValue(args[0], &rpcArgs.Start, "Start")901 if err != nil {902 return starlark.None, decorateError(thread, err)903 }904 }905 if len(args) > 1 && args[1] != starlark.None {906 err := unmarshalStarlarkValue(args[1], &rpcArgs.Count, "Count")907 if err != nil {908 return starlark.None, decorateError(thread, err)909 }910 }911 if len(args) > 2 && args[2] != starlark.None {912 err := unmarshalStarlarkValue(args[2], &rpcArgs.Filters, "Filters")913 if err != nil {914 return starlark.None, decorateError(thread, err)915 }916 }917 if len(args) > 3 && args[3] != starlark.None {918 err := unmarshalStarlarkValue(args[3], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions")919 if err != nil {920 return starlark.None, decorateError(thread, err)921 }922 }923 for _, kv := range kwargs {924 var err error925 switch kv[0].(starlark.String) {926 case "Start":927 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Start, "Start")928 case "Count":929 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Count, "Count")930 case "Filters":931 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filters, "Filters")932 case "GoroutineGroupingOptions":933 err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions")934 default:935 err = fmt.Errorf("unknown argument %q", kv[0])936 }937 if err != nil {938 return starlark.None, decorateError(thread, err)939 }940 }941 err := env.ctx.Client().CallAPI("ListGoroutines", &rpcArgs, &rpcRet)942 if err != nil {943 return starlark.None, err944 }945 return env.interfaceToStarlarkValue(rpcRet), nil946 })947 r["local_vars"] = starlark.NewBuiltin("local_vars", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {948 if err := isCancelled(thread); err != nil {949 return starlark.None, decorateError(thread, err)950 }951 var rpcArgs rpc2.ListLocalVarsIn952 var rpcRet rpc2.ListLocalVarsOut953 if len(args) > 0 && args[0] != starlark.None {954 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")955 if err != nil {956 return starlark.None, decorateError(thread, err)957 }958 } else {959 rpcArgs.Scope = env.ctx.Scope()960 }961 if len(args) > 1 && args[1] != starlark.None {962 err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")963 if err != nil {964 return starlark.None, decorateError(thread, err)965 }966 } else {967 rpcArgs.Cfg = env.ctx.LoadConfig()968 }969 for _, kv := range kwargs {970 var err error971 switch kv[0].(starlark.String) {972 case "Scope":973 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")974 case "Cfg":975 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")976 default:977 err = fmt.Errorf("unknown argument %q", kv[0])978 }979 if err != nil {980 return starlark.None, decorateError(thread, err)981 }982 }983 err := env.ctx.Client().CallAPI("ListLocalVars", &rpcArgs, &rpcRet)984 if err != nil {985 return starlark.None, err986 }987 return env.interfaceToStarlarkValue(rpcRet), nil988 })989 r["package_vars"] = starlark.NewBuiltin("package_vars", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {990 if err := isCancelled(thread); err != nil {991 return starlark.None, decorateError(thread, err)992 }993 var rpcArgs rpc2.ListPackageVarsIn994 var rpcRet rpc2.ListPackageVarsOut995 if len(args) > 0 && args[0] != starlark.None {996 err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")997 if err != nil {998 return starlark.None, decorateError(thread, err)999 }1000 }1001 if len(args) > 1 && args[1] != starlark.None {1002 err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")1003 if err != nil {1004 return starlark.None, decorateError(thread, err)1005 }1006 } else {1007 rpcArgs.Cfg = env.ctx.LoadConfig()1008 }1009 for _, kv := range kwargs {1010 var err error1011 switch kv[0].(starlark.String) {1012 case "Filter":1013 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")1014 case "Cfg":1015 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")1016 default:1017 err = fmt.Errorf("unknown argument %q", kv[0])1018 }1019 if err != nil {1020 return starlark.None, decorateError(thread, err)1021 }1022 }1023 err := env.ctx.Client().CallAPI("ListPackageVars", &rpcArgs, &rpcRet)1024 if err != nil {1025 return starlark.None, err1026 }1027 return env.interfaceToStarlarkValue(rpcRet), nil1028 })1029 r["packages_build_info"] = starlark.NewBuiltin("packages_build_info", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1030 if err := isCancelled(thread); err != nil {1031 return starlark.None, decorateError(thread, err)1032 }1033 var rpcArgs rpc2.ListPackagesBuildInfoIn1034 var rpcRet rpc2.ListPackagesBuildInfoOut1035 if len(args) > 0 && args[0] != starlark.None {1036 err := unmarshalStarlarkValue(args[0], &rpcArgs.IncludeFiles, "IncludeFiles")1037 if err != nil {1038 return starlark.None, decorateError(thread, err)1039 }1040 }1041 for _, kv := range kwargs {1042 var err error1043 switch kv[0].(starlark.String) {1044 case "IncludeFiles":1045 err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeFiles, "IncludeFiles")1046 default:1047 err = fmt.Errorf("unknown argument %q", kv[0])1048 }1049 if err != nil {1050 return starlark.None, decorateError(thread, err)1051 }1052 }1053 err := env.ctx.Client().CallAPI("ListPackagesBuildInfo", &rpcArgs, &rpcRet)1054 if err != nil {1055 return starlark.None, err1056 }1057 return env.interfaceToStarlarkValue(rpcRet), nil1058 })1059 r["registers"] = starlark.NewBuiltin("registers", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1060 if err := isCancelled(thread); err != nil {1061 return starlark.None, decorateError(thread, err)1062 }1063 var rpcArgs rpc2.ListRegistersIn1064 var rpcRet rpc2.ListRegistersOut1065 if len(args) > 0 && args[0] != starlark.None {1066 err := unmarshalStarlarkValue(args[0], &rpcArgs.ThreadID, "ThreadID")1067 if err != nil {1068 return starlark.None, decorateError(thread, err)1069 }1070 }1071 if len(args) > 1 && args[1] != starlark.None {1072 err := unmarshalStarlarkValue(args[1], &rpcArgs.IncludeFp, "IncludeFp")1073 if err != nil {1074 return starlark.None, decorateError(thread, err)1075 }1076 }1077 if len(args) > 2 && args[2] != starlark.None {1078 err := unmarshalStarlarkValue(args[2], &rpcArgs.Scope, "Scope")1079 if err != nil {1080 return starlark.None, decorateError(thread, err)1081 }1082 } else {1083 scope := env.ctx.Scope()1084 rpcArgs.Scope = &scope1085 }1086 for _, kv := range kwargs {1087 var err error1088 switch kv[0].(starlark.String) {1089 case "ThreadID":1090 err = unmarshalStarlarkValue(kv[1], &rpcArgs.ThreadID, "ThreadID")1091 case "IncludeFp":1092 err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeFp, "IncludeFp")1093 case "Scope":1094 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")1095 default:1096 err = fmt.Errorf("unknown argument %q", kv[0])1097 }1098 if err != nil {1099 return starlark.None, decorateError(thread, err)1100 }1101 }1102 err := env.ctx.Client().CallAPI("ListRegisters", &rpcArgs, &rpcRet)1103 if err != nil {1104 return starlark.None, err1105 }1106 return env.interfaceToStarlarkValue(rpcRet), nil1107 })1108 r["sources"] = starlark.NewBuiltin("sources", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1109 if err := isCancelled(thread); err != nil {1110 return starlark.None, decorateError(thread, err)1111 }1112 var rpcArgs rpc2.ListSourcesIn1113 var rpcRet rpc2.ListSourcesOut1114 if len(args) > 0 && args[0] != starlark.None {1115 err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")1116 if err != nil {1117 return starlark.None, decorateError(thread, err)1118 }1119 }1120 for _, kv := range kwargs {1121 var err error1122 switch kv[0].(starlark.String) {1123 case "Filter":1124 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")1125 default:1126 err = fmt.Errorf("unknown argument %q", kv[0])1127 }1128 if err != nil {1129 return starlark.None, decorateError(thread, err)1130 }1131 }1132 err := env.ctx.Client().CallAPI("ListSources", &rpcArgs, &rpcRet)1133 if err != nil {1134 return starlark.None, err1135 }1136 return env.interfaceToStarlarkValue(rpcRet), nil1137 })1138 r["threads"] = starlark.NewBuiltin("threads", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1139 if err := isCancelled(thread); err != nil {1140 return starlark.None, decorateError(thread, err)1141 }1142 var rpcArgs rpc2.ListThreadsIn1143 var rpcRet rpc2.ListThreadsOut1144 err := env.ctx.Client().CallAPI("ListThreads", &rpcArgs, &rpcRet)1145 if err != nil {1146 return starlark.None, err1147 }1148 return env.interfaceToStarlarkValue(rpcRet), nil1149 })1150 r["types"] = starlark.NewBuiltin("types", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1151 if err := isCancelled(thread); err != nil {1152 return starlark.None, decorateError(thread, err)1153 }1154 var rpcArgs rpc2.ListTypesIn1155 var rpcRet rpc2.ListTypesOut1156 if len(args) > 0 && args[0] != starlark.None {1157 err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")1158 if err != nil {1159 return starlark.None, decorateError(thread, err)1160 }1161 }1162 for _, kv := range kwargs {1163 var err error1164 switch kv[0].(starlark.String) {1165 case "Filter":1166 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")1167 default:1168 err = fmt.Errorf("unknown argument %q", kv[0])1169 }1170 if err != nil {1171 return starlark.None, decorateError(thread, err)1172 }1173 }1174 err := env.ctx.Client().CallAPI("ListTypes", &rpcArgs, &rpcRet)1175 if err != nil {1176 return starlark.None, err1177 }1178 return env.interfaceToStarlarkValue(rpcRet), nil1179 })1180 r["process_pid"] = starlark.NewBuiltin("process_pid", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1181 if err := isCancelled(thread); err != nil {1182 return starlark.None, decorateError(thread, err)1183 }1184 var rpcArgs rpc2.ProcessPidIn1185 var rpcRet rpc2.ProcessPidOut1186 err := env.ctx.Client().CallAPI("ProcessPid", &rpcArgs, &rpcRet)1187 if err != nil {1188 return starlark.None, err1189 }1190 return env.interfaceToStarlarkValue(rpcRet), nil1191 })1192 r["recorded"] = starlark.NewBuiltin("recorded", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1193 if err := isCancelled(thread); err != nil {1194 return starlark.None, decorateError(thread, err)1195 }1196 var rpcArgs rpc2.RecordedIn1197 var rpcRet rpc2.RecordedOut1198 err := env.ctx.Client().CallAPI("Recorded", &rpcArgs, &rpcRet)1199 if err != nil {1200 return starlark.None, err1201 }1202 return env.interfaceToStarlarkValue(rpcRet), nil1203 })1204 r["restart"] = starlark.NewBuiltin("restart", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1205 if err := isCancelled(thread); err != nil {1206 return starlark.None, decorateError(thread, err)1207 }1208 var rpcArgs rpc2.RestartIn1209 var rpcRet rpc2.RestartOut1210 if len(args) > 0 && args[0] != starlark.None {1211 err := unmarshalStarlarkValue(args[0], &rpcArgs.Position, "Position")1212 if err != nil {1213 return starlark.None, decorateError(thread, err)1214 }1215 }1216 if len(args) > 1 && args[1] != starlark.None {1217 err := unmarshalStarlarkValue(args[1], &rpcArgs.ResetArgs, "ResetArgs")1218 if err != nil {1219 return starlark.None, decorateError(thread, err)1220 }1221 }1222 if len(args) > 2 && args[2] != starlark.None {1223 err := unmarshalStarlarkValue(args[2], &rpcArgs.NewArgs, "NewArgs")1224 if err != nil {1225 return starlark.None, decorateError(thread, err)1226 }1227 }1228 if len(args) > 3 && args[3] != starlark.None {1229 err := unmarshalStarlarkValue(args[3], &rpcArgs.Rerecord, "Rerecord")1230 if err != nil {1231 return starlark.None, decorateError(thread, err)1232 }1233 }1234 if len(args) > 4 && args[4] != starlark.None {1235 err := unmarshalStarlarkValue(args[4], &rpcArgs.Rebuild, "Rebuild")1236 if err != nil {1237 return starlark.None, decorateError(thread, err)1238 }1239 }1240 if len(args) > 5 && args[5] != starlark.None {1241 err := unmarshalStarlarkValue(args[5], &rpcArgs.NewRedirects, "NewRedirects")1242 if err != nil {1243 return starlark.None, decorateError(thread, err)1244 }1245 }1246 for _, kv := range kwargs {1247 var err error1248 switch kv[0].(starlark.String) {1249 case "Position":1250 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Position, "Position")1251 case "ResetArgs":1252 err = unmarshalStarlarkValue(kv[1], &rpcArgs.ResetArgs, "ResetArgs")1253 case "NewArgs":1254 err = unmarshalStarlarkValue(kv[1], &rpcArgs.NewArgs, "NewArgs")1255 case "Rerecord":1256 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Rerecord, "Rerecord")1257 case "Rebuild":1258 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Rebuild, "Rebuild")1259 case "NewRedirects":1260 err = unmarshalStarlarkValue(kv[1], &rpcArgs.NewRedirects, "NewRedirects")1261 default:1262 err = fmt.Errorf("unknown argument %q", kv[0])1263 }1264 if err != nil {1265 return starlark.None, decorateError(thread, err)1266 }1267 }1268 err := env.ctx.Client().CallAPI("Restart", &rpcArgs, &rpcRet)1269 if err != nil {1270 return starlark.None, err1271 }1272 return env.interfaceToStarlarkValue(rpcRet), nil1273 })1274 r["set_expr"] = starlark.NewBuiltin("set_expr", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1275 if err := isCancelled(thread); err != nil {1276 return starlark.None, decorateError(thread, err)1277 }1278 var rpcArgs rpc2.SetIn1279 var rpcRet rpc2.SetOut1280 if len(args) > 0 && args[0] != starlark.None {1281 err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")1282 if err != nil {1283 return starlark.None, decorateError(thread, err)1284 }1285 } else {1286 rpcArgs.Scope = env.ctx.Scope()1287 }1288 if len(args) > 1 && args[1] != starlark.None {1289 err := unmarshalStarlarkValue(args[1], &rpcArgs.Symbol, "Symbol")1290 if err != nil {1291 return starlark.None, decorateError(thread, err)1292 }1293 }1294 if len(args) > 2 && args[2] != starlark.None {1295 err := unmarshalStarlarkValue(args[2], &rpcArgs.Value, "Value")1296 if err != nil {1297 return starlark.None, decorateError(thread, err)1298 }1299 }1300 for _, kv := range kwargs {1301 var err error1302 switch kv[0].(starlark.String) {1303 case "Scope":1304 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")1305 case "Symbol":1306 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Symbol, "Symbol")1307 case "Value":1308 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Value, "Value")1309 default:1310 err = fmt.Errorf("unknown argument %q", kv[0])1311 }1312 if err != nil {1313 return starlark.None, decorateError(thread, err)1314 }1315 }1316 err := env.ctx.Client().CallAPI("Set", &rpcArgs, &rpcRet)1317 if err != nil {1318 return starlark.None, err1319 }1320 return env.interfaceToStarlarkValue(rpcRet), nil1321 })1322 r["stacktrace"] = starlark.NewBuiltin("stacktrace", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1323 if err := isCancelled(thread); err != nil {1324 return starlark.None, decorateError(thread, err)1325 }1326 var rpcArgs rpc2.StacktraceIn1327 var rpcRet rpc2.StacktraceOut1328 if len(args) > 0 && args[0] != starlark.None {1329 err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")1330 if err != nil {1331 return starlark.None, decorateError(thread, err)1332 }1333 }1334 if len(args) > 1 && args[1] != starlark.None {1335 err := unmarshalStarlarkValue(args[1], &rpcArgs.Depth, "Depth")1336 if err != nil {1337 return starlark.None, decorateError(thread, err)1338 }1339 }1340 if len(args) > 2 && args[2] != starlark.None {1341 err := unmarshalStarlarkValue(args[2], &rpcArgs.Full, "Full")1342 if err != nil {1343 return starlark.None, decorateError(thread, err)1344 }1345 }1346 if len(args) > 3 && args[3] != starlark.None {1347 err := unmarshalStarlarkValue(args[3], &rpcArgs.Defers, "Defers")1348 if err != nil {1349 return starlark.None, decorateError(thread, err)1350 }1351 }1352 if len(args) > 4 && args[4] != starlark.None {1353 err := unmarshalStarlarkValue(args[4], &rpcArgs.Opts, "Opts")1354 if err != nil {1355 return starlark.None, decorateError(thread, err)1356 }1357 }1358 if len(args) > 5 && args[5] != starlark.None {1359 err := unmarshalStarlarkValue(args[5], &rpcArgs.Cfg, "Cfg")1360 if err != nil {1361 return starlark.None, decorateError(thread, err)1362 }1363 }1364 for _, kv := range kwargs {1365 var err error1366 switch kv[0].(starlark.String) {1367 case "Id":1368 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")1369 case "Depth":1370 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Depth, "Depth")1371 case "Full":1372 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Full, "Full")1373 case "Defers":1374 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Defers, "Defers")1375 case "Opts":1376 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Opts, "Opts")1377 case "Cfg":1378 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")1379 default:1380 err = fmt.Errorf("unknown argument %q", kv[0])1381 }1382 if err != nil {1383 return starlark.None, decorateError(thread, err)1384 }1385 }1386 err := env.ctx.Client().CallAPI("Stacktrace", &rpcArgs, &rpcRet)1387 if err != nil {1388 return starlark.None, err1389 }1390 return env.interfaceToStarlarkValue(rpcRet), nil1391 })1392 r["state"] = starlark.NewBuiltin("state", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1393 if err := isCancelled(thread); err != nil {1394 return starlark.None, decorateError(thread, err)1395 }1396 var rpcArgs rpc2.StateIn1397 var rpcRet rpc2.StateOut1398 if len(args) > 0 && args[0] != starlark.None {1399 err := unmarshalStarlarkValue(args[0], &rpcArgs.NonBlocking, "NonBlocking")1400 if err != nil {1401 return starlark.None, decorateError(thread, err)1402 }1403 }1404 for _, kv := range kwargs {1405 var err error1406 switch kv[0].(starlark.String) {1407 case "NonBlocking":1408 err = unmarshalStarlarkValue(kv[1], &rpcArgs.NonBlocking, "NonBlocking")1409 default:1410 err = fmt.Errorf("unknown argument %q", kv[0])1411 }1412 if err != nil {1413 return starlark.None, decorateError(thread, err)1414 }1415 }1416 err := env.ctx.Client().CallAPI("State", &rpcArgs, &rpcRet)1417 if err != nil {1418 return starlark.None, err1419 }1420 return env.interfaceToStarlarkValue(rpcRet), nil1421 })1422 r["toggle_breakpoint"] = starlark.NewBuiltin("toggle_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {1423 if err := isCancelled(thread); err != nil {1424 return starlark.None, decorateError(thread, err)1425 }1426 var rpcArgs rpc2.ToggleBreakpointIn1427 var rpcRet rpc2.ToggleBreakpointOut1428 if len(args) > 0 && args[0] != starlark.None {1429 err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")1430 if err != nil {1431 return starlark.None, decorateError(thread, err)1432 }1433 }1434 if len(args) > 1 && args[1] != starlark.None {1435 err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")1436 if err != nil {1437 return starlark.None, decorateError(thread, err)1438 }1439 }1440 for _, kv := range kwargs {1441 var err error1442 switch kv[0].(starlark.String) {1443 case "Id":1444 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")1445 case "Name":1446 err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")1447 default:1448 err = fmt.Errorf("unknown argument %q", kv[0])1449 }1450 if err != nil {1451 return starlark.None, decorateError(thread, err)1452 }1453 }1454 err := env.ctx.Client().CallAPI("ToggleBreakpoint", &rpcArgs, &rpcRet)1455 if err != nil {1456 return starlark.None, err1457 }1458 return env.interfaceToStarlarkValue(rpcRet), nil1459 })1460 return r1461}...

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import "fmt"2type I interface {3 M()4}5type T struct {6}7func (t *T) M() {8 fmt.Println(t.S)9}10type Decorator func(I) I11func Decorate(decorator Decorator, i I) I {12 return decorator(i)13}14func main() {15 t := &T{"Hello"}16 Decorate(func(i I) I {17 return &struct {18 }{i}19 }, t).M()20}21import "fmt"22type Shape interface {23 Draw()24}25type Rectangle struct {26}27func (r *Rectangle) Draw() {28 fmt.Println("Shape: Rectangle")29}30type Circle struct {31}32func (c *Circle) Draw() {33 fmt.Println("Shape: Circle")34}35type ShapeDecorator struct {36}37func (s *ShapeDecorator) Draw() {38 s.decoratedShape.Draw()39}40type RedShapeDecorator struct {41}42func (r *RedShapeDecorator) Draw() {43 r.ShapeDecorator.Draw()44 r.setRedBorder(r)45}46func (r *RedShapeDecorator) setRedBorder(s Shape) {47 fmt.Println("Border Color: Red")48}49func main() {50 circle := &Circle{}51 redCircle := &RedShapeDecorator{ShapeDecorator{circle}}52 redCircle.Draw()53 rectangle := &Rectangle{}54 redRectangle := &RedShapeDecorator{ShapeDecorator{rectangle}}55 redRectangle.Draw()56}

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 i := is{10}4 fmt.Println(i.decorate())5}6import "fmt"7func main() {8 i := is{10}9 fmt.Println(i.decorate())10}11import "fmt"12func main() {13 i := is{10}14 fmt.Println(i.decorate())15}16import "fmt"17func main() {18 i := is{10}19 fmt.Println(i.decorate())20}21import "fmt"22func main() {23 i := is{10}24 fmt.Println(i.decorate())25}26import "fmt"27func main() {28 i := is{10}29 fmt.Println(i.decorate())30}31import "fmt"32func main() {33 i := is{10}34 fmt.Println(i.decorate())35}36import "fmt"37func main() {38 i := is{10}39 fmt.Println(i.decorate())40}41import "fmt"42func main() {43 i := is{10}44 fmt.Println(i.decorate())45}46import "fmt"47func main() {48 i := is{10}49 fmt.Println(i.decorate())50}51import "fmt"52func main() {53 i := is{10}54 fmt.Println(i.decorate())55}56import "fmt"57func main() {58 i := is{10}59 fmt.Println(i.decorate())60}

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("value of i before calling function", i)4 decorate(reflect.ValueOf(&i))5 fmt.Println("value of i after calling function", i)6}7func decorate(v reflect.Value) {8 v.Elem().SetInt(55)9}10import (11func main() {12 fmt.Println("value of i before calling function", i)13 decorate(reflect.TypeOf(&i))14 fmt.Println("value of i after calling function", i)15}16func decorate(v reflect.Type) {17 fmt.Println("type of variable", v)18}19import (20type User struct {21}22func main() {23 u := User{Name: "John"}24 fmt.Println("value of u before calling function", u)25 decorate(reflect.TypeOf(u))26 fmt.Println("value of u after calling function", u)27}28func decorate(v reflect.Type) {29 fmt.Println("type of variable", v)30}31value of u before calling function {John}32value of u after calling function {John

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import "fmt"2type I interface {3 do()4}5type Decorator struct {6}7func (d *Decorator) do() {8 fmt.Println("Before")9 d.i.do()10 fmt.Println("After")11}12type is struct {13}14func (i *is) do() {15 fmt.Println("Hello, " + i.name)16}17func main() {18 d := Decorator{&is{"World"}}19 d.do()20}

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1func main() {2 var a = is{1}3 a.decorate()4 fmt.Println(a.x)5}6func main() {7 var a = is{1}8 a.decorate()9 fmt.Println(a.x)10}11func main() {12 var a = is{1}13 a.decorate()14 fmt.Println(a.x)15}16func main() {17 var a = is{1}18 a.decorate()19 fmt.Println(a.x)20}21func main() {22 var a = is{1}23 a.decorate()24 fmt.Println(a.x)25}26func main() {27 var a = is{1}28 a.decorate()29 fmt.Println(a.x)30}31func main() {32 var a = is{1}33 a.decorate()34 fmt.Println(a.x)35}36func main() {37 var a = is{1}38 a.decorate()39 fmt.Println(a.x)40}41func main() {42 var a = is{1}43 a.decorate()44 fmt.Println(a.x)45}46func main() {47 var a = is{1}48 a.decorate()49 fmt.Println(a.x)50}51func main() {52 var a = is{1}53 a.decorate()54 fmt.Println(a.x)55}56func main() {57 var a = is{1}58 a.decorate()59 fmt.Println(a.x)60}61func main() {62 var a = is{1}63 a.decorate()

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 is := is{}4 is.decorate()5}6type is struct {7}8func (i is) decorate() {9 my := my{}10 myType := reflect.TypeOf(my)11 myValue := reflect.ValueOf(my)12 for i := 0; i < myType.NumMethod(); i++ {13 method := myType.Method(i)14 inputs := methodType.NumIn()15 outputs := methodType.NumOut()16 fmt.Println("Method Name is:", methodName)17 fmt.Println("Number of inputs are:", inputs)18 fmt.Println("Number of outputs are:", outputs)19 for j := 0; j < inputs; j++ {20 inputType := methodType.In(j)21 inputName := inputType.Name()22 fmt.Println("Input Name is:", inputName, "Input Type is:", inputType)23 }24 for k := 0; k < outputs; k++ {25 outputType := methodType.Out(k)26 outputName := outputType.Name()27 fmt.Println("Output Name is:", outputName, "Output Type is:", outputType)28 }29 myValue.Method(i).Call(nil)30 }31}

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 var c1 = is{1}4 c1.decorate()5 fmt.Println(c1)6}7type is struct {8}9func (i *is) decorate() {10}11./1.go:10: cannot use c1 (type is) as type *is in argument to c1.decorate12type is struct {13}14func (i *is) decorate() {15}16func main() {17 var c1 = is{1}18 c1.decorate()19 fmt.Println(c1)20}21{2}22type is struct {23}24func (i is) decorate() {25}26func main() {27 var c1 = is{1}28 c1.decorate()29 fmt.Println(c1)30}31{1}32type is struct {33}34func (i is) decorate() {35}36func main() {37 var c1 = is{1}38 c1.decorate()39 fmt.Println(c1)40}41{2}

Full Screen

Full Screen

decorate

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 i := &is{}4 i.decorate()5}6import "fmt"7type is struct {8}9func (i *is) decorate() {10 fmt.Println("Decorating the object of is")11}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful