id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
16,300
all-16301
[ "Do", "executes", "BackgroundService", ".", "setRecording", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetRecordingParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetRecording", ",", "p", ",", "nil", ")", "\n", "}" ]
16,301
all-16302
[ "encodePeers", "is", "used", "to", "serialize", "a", "Configuration", "into", "the", "old", "peers", "format", ".", "This", "is", "here", "for", "backwards", "compatibility", "when", "operating", "with", "a", "mix", "of", "old", "servers", "and", "should", "be", "removed", "once", "we", "deprecate", "support", "for", "protocol", "version", "1", "." ]
[ "func", "encodePeers", "(", "configuration", "Configuration", ",", "trans", "Transport", ")", "[", "]", "byte", "{", "// Gather up all the voters, other suffrage types are not supported by", "// this data format.", "var", "encPeers", "[", "]", "[", "]", "byte", "\n", "for", "_", ",", "server", ":=", "<mask>", "configuration", ".", "Servers", "{", "if", "server", ".", "Suffrage", "==", "Voter", "{", "encPeers", "=", "append", "(", "encPeers", ",", "trans", ".", "EncodePeer", "(", "server", ".", "ID", ",", "server", ".", "Address", ")", ")", "\n", "}", "\n", "}", "\n\n", "// Encode the entire array.", "buf", ",", "err", ":=", "encodeMsgPack", "(", "encPeers", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n\n", "return", "buf", ".", "Bytes", "(", ")", "\n", "}" ]
16,302
all-16303
[ "Success", "calls", "UI", ".", "Success", "to", "write", ".", "Useful", "when", "you", "want", "separate", "colors", "or", "prefixes", ".", "SuccessFGColor", "and", "SuccessBGColor", "are", "used", "for", "color", "." ]
[ "func", "(", "ui", "*", "ColorUI", ")", "Success", "(", "<mask>", "string", ")", "{", "ct", ".", "ChangeColor", "(", "ui", ".", "SuccessFGColor", ".", "Code", ",", "ui", ".", "SuccessFGColor", ".", "Bright", ",", "ui", ".", "SuccessBGColor", ".", "Code", ",", "ui", ".", "SuccessBGColor", ".", "Bright", ")", "\n", "ui", ".", "UI", ".", "Success", "(", "message", ")", "\n", "ct", ".", "ResetColor", "(", ")", "\n", "}" ]
16,303
all-16304
[ "FromJSON", "allows", "a", "fixture", "to", "be", "created", "from", "json", "input" ]
[ "func", "FromJSON", "(", "<mask>", "*", "sql", ".", "DB", ",", "jsonIn", "[", "]", "byte", ")", "(", "Fixture", ",", "error", ")", "{", "var", "tables", "Tables", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "jsonIn", ",", "&", "tables", ")", "\n", "return", "New", "(", "db", ",", "tables", ")", ",", "err", "\n", "}" ]
16,304
all-16305
[ "NewExecWatchCommand", "returns", "the", "CLI", "command", "for", "exec", "-", "watch", "." ]
[ "func", "NewExecWatchCommand", "(", ")", "cli", ".", "Command", "{", "return", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "ArgsUsage", ":", "\"", "\"", ",", "Flags", ":", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "0", ",", "Usage", ":", "\"", "\"", "}", ",", "cli", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", "}", ",", "}", ",", "Action", ":", "func", "(", "c", "*", "cli", ".", "<mask>", ")", "error", "{", "execWatchCommandFunc", "(", "c", ",", "mustNewKeyAPI", "(", "c", ")", ")", "\n", "return", "nil", "\n", "}", ",", "}", "\n", "}" ]
16,305
all-16306
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "OperationType" ]
[ "func", "(", "e", "OperationType", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "<mask>", ":=", "operationTypeMap", "[", "v", "]", "\n", "return", "ok", "\n", "}" ]
16,306
all-16307
[ "SelectObjects", "executes", "a", "statement", "which", "must", "yield", "rows", "with", "a", "specific", "columns", "schema", ".", "It", "invokes", "the", "given", "Dest", "hook", "for", "each", "yielded", "row", "." ]
[ "func", "SelectObjects", "(", "stmt", "*", "sql", ".", "Stmt", ",", "dest", "Dest", ",", "args", "...", "<mask>", "{", "}", ")", "error", "{", "rows", ",", "err", ":=", "stmt", ".", "Query", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "for", "i", ":=", "0", ";", "rows", ".", "Next", "(", ")", ";", "i", "++", "{", "err", ":=", "rows", ".", "Scan", "(", "dest", "(", "i", ")", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "err", "=", "rows", ".", "Err", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,307
all-16308
[ "validateIPRules", "validates", "IP", "rules", "created", "in", "the", "container", "network", "namespace", "." ]
[ "func", "validateIPRules", "(", ")", "error", "{", "var", "iptable", "*", "iptables", ".", "IPTables", "\n", "var", "err", "error", "\n\n", "if", "iptable", ",", "err", "=", "iptables", ".", "NewWithProtocol", "(", "iptables", ".", "ProtocolIPv4", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Print detailed info for debugging.", "str", ",", "_", ":=", "iptable", ".", "ListChains", "(", "\"", "\"", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\"", ",", "str", ")", "\n\n", "strs", ",", "_", ":=", "iptable", ".", "Stats", "(", "\"", "\"", ",", "ingressChain", ")", "\n", "for", "_", ",", "str", "=", "<mask>", "strs", "{", "fmt", ".", "Printf", "(", "\"", "\"", ",", "str", ")", "\n", "}", "\n", "strs", ",", "_", "=", "iptable", ".", "Stats", "(", "\"", "\"", ",", "egressChain", ")", "\n", "for", "_", ",", "str", "=", "range", "strs", "{", "fmt", ".", "Printf", "(", "\"", "\"", ",", "str", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "ingressChain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "appPorts", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "proxyIngressPort", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "ingressChain", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "egressChain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "gid", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "egressChain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "egressIgnoredPorts", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "egressChain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "egressIgnoredIPv4Addresses", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "egressChain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "proxyEgressPort", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "exist", ",", "err", ":=", "iptable", ".", "Exists", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "egressChain", ")", ";", "!", "exist", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,308
all-16309
[ "NewJWKClient", "creates", "a", "new", "JWKClient", "instance", "from", "the", "provided", "options", "." ]
[ "func", "NewJWKClient", "(", "options", "JWKClientOptions", ",", "extractor", "RequestTokenExtractor", ")", "*", "JWKClient", "{", "return", "NewJWKClientWithCache", "(", "<mask>", ",", "extractor", ",", "nil", ")", "\n", "}" ]
16,309
all-16310
[ "ReadSCSIBusSharing", "checks", "the", "SCSI", "bus", "sharing", "and", "returns", "a", "sharing", "type", "depending", "on", "if", "all", "controllers", "are", "one", "specific", "kind", "or", "not", ".", "Only", "the", "first", "number", "of", "controllers", "specified", "by", "count", "are", "checked", "." ]
[ "func", "ReadSCSIBusSharing", "(", "l", "<mask>", ".", "VirtualDeviceList", ",", "count", "int", ")", "string", "{", "ctlrs", ":=", "make", "(", "[", "]", "types", ".", "BaseVirtualSCSIController", ",", "count", ")", "\n", "for", "_", ",", "dev", ":=", "range", "l", "{", "if", "sc", ",", "ok", ":=", "dev", ".", "(", "types", ".", "BaseVirtualSCSIController", ")", ";", "ok", "&&", "sc", ".", "GetVirtualSCSIController", "(", ")", ".", "BusNumber", "<", "int32", "(", "count", ")", "{", "ctlrs", "[", "sc", ".", "GetVirtualSCSIController", "(", ")", ".", "BusNumber", "]", "=", "sc", "\n", "}", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "count", ",", "scsiControllerListString", "(", "ctlrs", ")", ")", "\n", "if", "ctlrs", "[", "0", "]", "==", "nil", "{", "return", "subresourceControllerSharingUnknown", "\n", "}", "\n", "last", ":=", "ctlrs", "[", "0", "]", ".", "(", "types", ".", "BaseVirtualSCSIController", ")", ".", "GetVirtualSCSIController", "(", ")", ".", "SharedBus", "\n", "for", "_", ",", "ctlr", ":=", "range", "ctlrs", "[", "1", ":", "]", "{", "if", "ctlr", "==", "nil", "||", "ctlr", ".", "(", "types", ".", "BaseVirtualSCSIController", ")", ".", "GetVirtualSCSIController", "(", ")", ".", "SharedBus", "!=", "last", "{", "return", "subresourceControllerSharingMixed", "\n", "}", "\n", "}", "\n", "return", "string", "(", "last", ")", "\n", "}" ]
16,310
all-16311
[ "doEnc", "encodes", "in", "as", "the", "payload", "in", "a", "JWT", "." ]
[ "func", "doEnc", "(", "signer", "jwt", ".", "Signer", ",", "in", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// make sure its valid json first", "m", ":=", "<mask>", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n\n", "// do the initial decode", "d", ":=", "json", ".", "NewDecoder", "(", "bytes", ".", "NewBuffer", "(", "in", ")", ")", "\n", "d", ".", "UseNumber", "(", ")", "\n", "err", "=", "d", ".", "Decode", "(", "&", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// encode claims", "out", ",", "err", ":=", "signer", ".", "Encode", "(", "&", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "out", ",", "nil", "\n", "}" ]
16,311
all-16312
[ "SendAmount", "returns", "the", "amount", "spent", "denominated", "in", "the", "source", "asset", "in", "the", "course", "of", "this", "path", "payment" ]
[ "func", "(", "pr", "*", "PathPaymentResult", ")", "SendAmount", "(", ")", "Int64", "{", "s", ",", "ok", ":=", "pr", ".", "GetSuccess", "(", ")", "\n", "if", "!", "ok", "{", "return", "0", "\n", "}", "\n\n", "if", "len", "(", "s", ".", "Offers", ")", "==", "0", "{", "return", "s", ".", "Last", ".", "Amount", "\n", "}", "\n\n", "sa", ":=", "s", ".", "Offers", "[", "0", "]", ".", "AssetBought", "\n", "var", "<mask>", "Int64", "\n\n", "for", "_", ",", "o", ":=", "range", "s", ".", "Offers", "{", "if", "o", ".", "AssetBought", ".", "String", "(", ")", "!=", "sa", ".", "String", "(", ")", "{", "break", "\n", "}", "\n", "ret", "+=", "o", ".", "AmountBought", "\n", "}", "\n\n", "return", "ret", "\n", "}" ]
16,312
all-16313
[ "legacyEndpointsFromMateService", "tries", "to", "retrieve", "Endpoints", "from", "Services", "annotated", "with", "Mate", "s", "annotation", "semantics", "." ]
[ "func", "legacyEndpointsFromMateService", "(", "svc", "*", "v1", ".", "Service", ")", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "var", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", "\n\n", "// Get the desired hostname of the service from the annotation.", "hostname", ",", "exists", ":=", "svc", ".", "Annotations", "[", "mateAnnotationKey", "]", "\n", "if", "!", "exists", "{", "return", "nil", "\n", "}", "\n\n", "// Create a corresponding endpoint for each configured external entrypoint.", "for", "_", ",", "lb", ":=", "range", "svc", ".", "Status", ".", "LoadBalancer", ".", "Ingress", "{", "if", "lb", ".", "IP", "!=", "\"", "\"", "{", "endpoints", "=", "append", "(", "endpoints", ",", "endpoint", ".", "NewEndpoint", "(", "hostname", ",", "endpoint", ".", "RecordTypeA", ",", "lb", ".", "IP", ")", ")", "\n", "}", "\n", "if", "lb", ".", "Hostname", "!=", "\"", "\"", "{", "endpoints", "=", "<mask>", "(", "endpoints", ",", "endpoint", ".", "NewEndpoint", "(", "hostname", ",", "endpoint", ".", "RecordTypeCNAME", ",", "lb", ".", "Hostname", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "endpoints", "\n", "}" ]
16,313
all-16314
[ "HasUrl", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ServiceHookSlackRequest", ")", "HasUrl", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Url", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
16,314
all-16315
[ "newDataReader", "creates", "a", "new", "DataReader", "reading", "from", "r", "." ]
[ "func", "newDataReader", "(", "r", "io", ".", "Reader", ")", "*", "internalDataReader", "{", "buffered", ":=", "bufio", ".", "NewReader", "(", "r", ")", "\n\n", "<mask>", ":=", "internalDataReader", "{", "wrapped", ":", "r", ",", "buffered", ":", "buffered", ",", "}", "\n\n", "return", "&", "reader", "\n", "}" ]
16,315
all-16316
[ "Loop", "starts", "the", "main", "-", "thread", "loop", ".", "Loop", "must", "be", "called", "on", "the", "main", "thread", "." ]
[ "func", "Loop", "(", "ch", "<-", "chan", "error", ")", "error", "{", "atomic", ".", "StoreInt32", "(", "&", "started", ",", "1", ")", "\n", "for", "{", "select", "{", "case", "f", ":=", "<-", "funcs", ":", "f", "(", ")", "\n", "<mask>", "err", ":=", "<-", "ch", ":", "// ch returns a value not only when an error occur but also it is closed.", "return", "err", "\n", "}", "\n", "}", "\n", "}" ]
16,316
all-16317
[ "specify", "the", "organization", "of", "vertex", "arrays" ]
[ "func", "VertexArrayAttribFormat", "(", "vaobj", "uint32", ",", "attribindex", "uint32", ",", "size", "int32", ",", "xtype", "uint32", ",", "normalized", "bool", ",", "relativeoffset", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpVertexArrayAttribFormat", ",", "6", ",", "uintptr", "(", "vaobj", ")", ",", "uintptr", "(", "attribindex", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "xtype", ")", ",", "boolToUintptr", "(", "normalized", ")", ",", "uintptr", "(", "relativeoffset", ")", ")", "\n", "}" ]
16,317
all-16318
[ "Seek", "follows", "the", "y", ".", "Iterator", "interface" ]
[ "func", "(", "itr", "*", "Iterator", ")", "Seek", "(", "key", "[", "]", "byte", ")", "{", "if", "!", "itr", ".", "reversed", "{", "itr", ".", "seek", "(", "key", ")", "\n", "}", "else", "{", "itr", ".", "seekForPrev", "(", "<mask>", ")", "\n", "}", "\n", "}" ]
16,318
all-16319
[ "AllImageStates", "indicates", "an", "expected", "call", "of", "AllImageStates" ]
[ "func", "(", "mr", "*", "MockTaskEngineStateMockRecorder", ")", "AllImageStates", "(", ")", "*", "gomock", ".", "Call", "{", "<mask>", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockTaskEngineState", ")", "(", "nil", ")", ".", "AllImageStates", ")", ")", "\n", "}" ]
16,319
all-16320
[ "setIntersect", "removes", "any", "elements", "from", "the", "first", "list", "that", "are", "not", "in", "the", "second", "returning", "the", "new", "set", "and", "the", "removed", "elements", "." ]
[ "func", "setIntersect", "(", "a", ",", "b", "[", "]", "string", ")", "(", "filtered", ",", "removed", "[", "]", "string", ")", "{", "for", "_", ",", "elemA", ":=", "range", "a", "{", "found", ":=", "false", "\n", "for", "_", ",", "elemB", ":=", "range", "b", "{", "if", "elemA", "==", "elemB", "{", "<mask>", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "found", "{", "filtered", "=", "append", "(", "filtered", ",", "elemA", ")", "\n", "}", "else", "{", "removed", "=", "append", "(", "removed", ",", "elemA", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
16,320
all-16321
[ "GetPadding", "is", "a", "wrapper", "around", "gtk_alignment_get_padding", "()", "." ]
[ "func", "(", "v", "*", "Alignment", ")", "GetPadding", "(", ")", "(", "top", ",", "<mask>", ",", "left", ",", "right", "uint", ")", "{", "var", "ctop", ",", "cbottom", ",", "cleft", ",", "cright", "C", ".", "guint", "\n", "C", ".", "gtk_alignment_get_padding", "(", "v", ".", "native", "(", ")", ",", "&", "ctop", ",", "&", "cbottom", ",", "&", "cleft", ",", "&", "cright", ")", "\n", "return", "uint", "(", "ctop", ")", ",", "uint", "(", "cbottom", ")", ",", "uint", "(", "cleft", ")", ",", "uint", "(", "cright", ")", "\n", "}" ]
16,321
all-16322
[ "Duration", "pretty", "prints", "a", "duration", "in", "a", "human", "readable", "way", "." ]
[ "func", "Duration", "(", "d", "*", "types", ".", "Duration", ")", "string", "{", "duration", ",", "_", ":=", "types", ".", "DurationFromProto", "(", "d", ")", "\n", "return", "units", ".", "HumanDuration", "(", "<mask>", ")", "\n", "}" ]
16,322
all-16323
[ "MustTr", "retrieves", "the", "Tr", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationResult", ")", "MustTr", "(", ")", "OperationResultTr", "{", "val", ",", "<mask>", ":=", "u", ".", "GetTr", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
16,323
all-16324
[ "ProcessEvent", "processes", "all", "events", "come", "from", "the", "control", "parent", ".", "If", "a", "control", "processes", "an", "event", "it", "should", "return", "true", ".", "If", "the", "method", "returns", "false", "it", "means", "that", "the", "control", "do", "not", "want", "or", "cannot", "process", "the", "event", "and", "the", "caller", "sends", "the", "event", "to", "the", "control", "parent" ]
[ "func", "(", "c", "*", "CheckBox", ")", "ProcessEvent", "(", "event", "Event", ")", "bool", "{", "if", "(", "!", "c", ".", "Active", "(", ")", "&&", "event", ".", "Type", "==", "EventKey", ")", "||", "!", "c", ".", "Enabled", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "if", "(", "event", ".", "Type", "==", "EventKey", "&&", "event", ".", "Key", "==", "term", ".", "KeySpace", ")", "||", "(", "event", ".", "Type", "==", "EventClick", ")", "{", "if", "c", ".", "<mask>", "==", "0", "{", "c", ".", "SetState", "(", "1", ")", "\n", "}", "else", "if", "c", ".", "state", "==", "2", "{", "c", ".", "SetState", "(", "0", ")", "\n", "}", "else", "{", "if", "c", ".", "allow3state", "{", "c", ".", "SetState", "(", "2", ")", "\n", "}", "else", "{", "c", ".", "SetState", "(", "0", ")", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
16,324
all-16325
[ "ApplyConfig", "updates", "the", "status", "state", "as", "the", "new", "config", "requires", "." ]
[ "func", "(", "n", "*", "Manager", ")", "ApplyConfig", "(", "conf", "*", "config", ".", "Config", ")", "error", "{", "n", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "n", ".", "opts", ".", "ExternalLabels", "=", "conf", ".", "GlobalConfig", ".", "ExternalLabels", "\n", "n", ".", "opts", ".", "RelabelConfigs", "=", "conf", ".", "AlertingConfig", ".", "AlertRelabelConfigs", "\n\n", "amSets", ":=", "make", "(", "map", "[", "string", "]", "*", "alertmanagerSet", ")", "\n\n", "for", "_", ",", "cfg", ":=", "<mask>", "conf", ".", "AlertingConfig", ".", "AlertmanagerConfigs", "{", "ams", ",", "err", ":=", "newAlertmanagerSet", "(", "cfg", ",", "n", ".", "logger", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "ams", ".", "metrics", "=", "n", ".", "metrics", "\n\n", "// The config hash is used for the map lookup identifier.", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "amSets", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "md5", ".", "Sum", "(", "b", ")", ")", "]", "=", "ams", "\n", "}", "\n\n", "n", ".", "alertmanagers", "=", "amSets", "\n\n", "return", "nil", "\n", "}" ]
16,325
all-16326
[ "GetMulti", "is", "a", "batch", "version", "of", "Get", ".", "dst", "must", "be", "a", "[]", "S", "[]", "*", "S", "[]", "I", "or", "[]", "P", "for", "some", "struct", "type", "S", "some", "interface", "type", "I", "or", "some", "non", "-", "interface", "non", "-", "pointer", "type", "P", "such", "that", "P", "or", "*", "P", "implements", "PropertyLoadSaver", ".", "If", "an", "[]", "I", "each", "element", "must", "be", "a", "valid", "dst", "for", "Get", ":", "it", "must", "be", "a", "struct", "pointer", "or", "implement", "PropertyLoadSaver", ".", "As", "a", "special", "case", "PropertyList", "is", "an", "invalid", "type", "for", "dst", "even", "though", "a", "PropertyList", "is", "a", "slice", "of", "structs", ".", "It", "is", "treated", "as", "invalid", "to", "avoid", "being", "mistakenly", "passed", "when", "[]", "PropertyList", "was", "intended", "." ]
[ "func", "GetMulti", "(", "c", "context", ".", "Context", ",", "key", "[", "]", "*", "Key", ",", "dst", "interface", "{", "}", ")", "error", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "dst", ")", "\n", "multiArgType", ",", "_", ":=", "checkMultiArg", "(", "v", ")", "\n", "if", "multiArgType", "==", "multiArgTypeInvalid", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "key", ")", "!=", "v", ".", "Len", "(", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "key", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "if", "err", ":=", "multiValid", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "GetRequest", "{", "Key", ":", "multiKeyToProto", "(", "internal", ".", "FullyQualifiedAppID", "(", "c", ")", ",", "key", ")", ",", "}", "\n", "res", ":=", "&", "pb", ".", "GetResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "key", ")", "!=", "len", "(", "res", ".", "Entity", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "multiErr", ",", "any", ":=", "make", "(", "appengine", ".", "MultiError", ",", "len", "(", "key", ")", ")", ",", "false", "\n", "for", "i", ",", "e", ":=", "range", "res", ".", "Entity", "{", "if", "e", ".", "Entity", "==", "nil", "{", "multiErr", "[", "i", "]", "=", "ErrNoSuchEntity", "\n", "}", "else", "{", "elem", ":=", "v", ".", "Index", "(", "i", ")", "\n", "if", "multiArgType", "==", "multiArgTypePropertyLoadSaver", "||", "multiArgType", "==", "multiArgTypeStruct", "{", "elem", "=", "elem", ".", "Addr", "(", ")", "\n", "}", "\n", "if", "multiArgType", "==", "multiArgTypeStructPtr", "&&", "elem", ".", "IsNil", "(", ")", "{", "elem", ".", "Set", "(", "reflect", ".", "New", "(", "elem", ".", "Type", "(", ")", ".", "Elem", "(", ")", ")", ")", "\n", "}", "\n", "multiErr", "[", "i", "]", "=", "loadEntity", "(", "elem", ".", "Interface", "(", ")", ",", "e", ".", "Entity", ")", "\n", "}", "\n", "if", "multiErr", "[", "i", "]", "!=", "nil", "{", "any", "=", "true", "\n", "}", "\n", "}", "\n", "if", "any", "{", "return", "multiErr", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,326
all-16327
[ "GetMaximalCursorSize", "()", "is", "a", "wrapper", "around", "gdk_display_get_maximal_cursor_size", "()", "." ]
[ "func", "(", "v", "*", "Display", ")", "GetMaximalCursorSize", "(", ")", "(", "<mask>", ",", "height", "uint", ")", "{", "var", "w", ",", "h", "C", ".", "guint", "\n", "C", ".", "gdk_display_get_maximal_cursor_size", "(", "v", ".", "native", "(", ")", ",", "&", "w", ",", "&", "h", ")", "\n", "return", "uint", "(", "w", ")", ",", "uint", "(", "h", ")", "\n", "}" ]
16,327
all-16328
[ "PutDir", "puts", "a", "directory", "in", "the", "hashtree", "." ]
[ "func", "(", "o", "*", "Ordered", ")", "PutDir", "(", "path", "string", ")", "{", "path", "=", "clean", "(", "path", ")", "\n", "if", "path", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "nodeProto", ":=", "&", "NodeProto", "{", "Name", ":", "base", "(", "path", ")", ",", "DirNode", ":", "&", "DirectoryNodeProto", "{", "}", ",", "}", "\n", "o", ".", "putDir", "(", "<mask>", ",", "nodeProto", ")", "\n", "}" ]
16,328
all-16329
[ "FetchCheck", "retrieves", "check", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchCheck", "(", "cid", "CIDType", ")", "(", "*", "Check", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "checkCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "CheckCIDRegex", ",", "checkCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "<mask>", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "checkCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "checkCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "result", ")", ")", "\n", "}", "\n\n", "check", ":=", "new", "(", "Check", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "check", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "check", ",", "nil", "\n", "}" ]
16,329
all-16330
[ "WriteTimeout", "sets", "the", "connection", "timeout", "for", "write", "operations", ".", "A", "value", "of", "0", "disables", "the", "timeout", "." ]
[ "func", "(", "c", "*", "Command", ")", "WriteTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "Command", "{", "c", ".", "writeTimeout", "=", "timeout", "\n", "return", "c", "\n", "}" ]
16,330
all-16331
[ "NewKVGetQuery", "parses", "a", "string", "into", "a", "dependency", "." ]
[ "func", "NewKVGetQuery", "(", "s", "string", ")", "(", "*", "KVGetQuery", ",", "error", ")", "{", "if", "s", "!=", "\"", "\"", "&&", "!", "KVGetQueryRe", ".", "MatchString", "(", "s", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n\n", "m", ":=", "regexpMatch", "(", "KVGetQueryRe", ",", "s", ")", "\n", "return", "&", "KVGetQuery", "{", "stopCh", ":", "<mask>", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "dc", ":", "m", "[", "\"", "\"", "]", ",", "key", ":", "m", "[", "\"", "\"", "]", ",", "}", ",", "nil", "\n", "}" ]
16,331
all-16332
[ "copyWithSnapshots", "creates", "a", "non", "-", "sparse", "copy", "of", "a", "container", "including", "its", "snapshots", "This", "does", "not", "introduce", "a", "dependency", "relation", "between", "the", "source", "RBD", "storage", "volume", "and", "the", "target", "RBD", "storage", "volume", "." ]
[ "func", "(", "s", "*", "storageCeph", ")", "cephRBDVolumeDumpToFile", "(", "sourceVolumeName", "string", ",", "file", "string", ")", "error", "{", "logger", ".", "Debugf", "(", "`Dumping RBD storage volume \"%s\" to \"%s\"`", ",", "sourceVolumeName", ",", "<mask>", ")", "\n\n", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "s", ".", "UserName", ",", "\"", "\"", ",", "s", ".", "ClusterName", ",", "sourceVolumeName", ",", "file", ",", "}", "\n\n", "rbdSendCmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "args", "...", ")", "\n", "err", ":=", "rbdSendCmd", ".", "Run", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", ".", "Debugf", "(", "`Dumped RBD storage volume \"%s\" to \"%s\"`", ",", "sourceVolumeName", ",", "file", ")", "\n", "return", "nil", "\n", "}" ]
16,332
all-16333
[ "GetBinWindow", "is", "a", "wrapper", "around", "gtk_tree_view_get_bin_window", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "GetBinWindow", "(", ")", "*", "gdk", ".", "Window", "{", "c", ":=", "C", ".", "gtk_tree_view_get_bin_window", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "w", ":=", "&", "gdk", ".", "Window", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "<mask>", "w", "\n", "}" ]
16,333
all-16334
[ "ExpandCustomizationSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationSpec", "." ]
[ "func", "ExpandCustomizationSpec", "(", "d", "*", "schema", ".", "ResourceData", ",", "family", "string", ")", "<mask>", ".", "CustomizationSpec", "{", "obj", ":=", "types", ".", "CustomizationSpec", "{", "Identity", ":", "expandBaseCustomizationIdentitySettings", "(", "d", ",", "family", ")", ",", "GlobalIPSettings", ":", "expandCustomizationGlobalIPSettings", "(", "d", ")", ",", "NicSettingMap", ":", "expandSliceOfCustomizationAdapterMapping", "(", "d", ")", ",", "}", "\n", "return", "obj", "\n", "}" ]
16,334
all-16335
[ "/", "*", "On", "your", "dashboard", "at", "http", ":", "//", "app", ".", "pusher", ".", "com", "you", "can", "set", "up", "webhooks", "to", "POST", "a", "payload", "to", "your", "server", "after", "certain", "events", ".", "Such", "events", "include", "channels", "being", "occupied", "or", "vacated", "members", "being", "added", "or", "removed", "in", "presence", "-", "channels", "or", "after", "client", "-", "originated", "events", ".", "For", "more", "information", "see", "https", ":", "//", "pusher", ".", "com", "/", "docs", "/", "webhooks", "." ]
[ "func", "(", "c", "*", "Client", ")", "Webhook", "(", "header", "http", ".", "Header", ",", "body", "[", "]", "byte", ")", "(", "*", "Webhook", ",", "error", ")", "{", "for", "_", ",", "token", ":=", "range", "header", "[", "\"", "\"", "]", "{", "if", "token", "==", "c", ".", "Key", "&&", "checkSignature", "(", "header", ".", "Get", "(", "\"", "\"", ")", ",", "c", ".", "Secret", ",", "body", ")", "{", "unmarshalledWebhooks", ",", "err", ":=", "unmarshalledWebhook", "(", "body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "unmarshalledWebhooks", ",", "err", "\n", "}", "\n", "decryptedWebhooks", ",", "err", ":=", "decryptEvents", "(", "*", "unmarshalledWebhooks", ",", "c", ".", "EncryptionMasterKey", ")", "\n", "return", "decryptedWebhooks", ",", "err", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
16,335
all-16336
[ "PathRedirect", "---------------------------------------------------------------", "NewPathRedirect", "returns", "a", "static", "URL", "path", "matcher", "that", "redirects", "if", "the", "trailing", "slash", "differs", "." ]
[ "func", "NewPathRedirect", "(", "path", "string", ")", "PathRedirect", "{", "if", "!", "strings", ".", "HasPrefix", "(", "path", ",", "\"", "\"", ")", "{", "path", "=", "\"", "\"", "+", "path", "\n", "}", "\n", "return", "PathRedirect", "(", "<mask>", ")", "\n", "}" ]
16,336
all-16337
[ "HasName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "p", "*", "Period", ")", "HasName", "(", ")", "bool", "{", "if", "p", "!=", "nil", "&&", "p", ".", "Name", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
16,337
all-16338
[ "taskContainerMetricsUnsafe", "gets", "all", "container", "metrics", "for", "a", "task", "arn", "." ]
[ "func", "(", "engine", "*", "DockerStatsEngine", ")", "taskContainerMetricsUnsafe", "(", "taskArn", "string", ")", "(", "[", "]", "*", "ecstcs", ".", "ContainerMetric", ",", "error", ")", "{", "containerMap", ",", "taskExists", ":=", "engine", ".", "tasksToContainers", "[", "taskArn", "]", "\n", "if", "!", "taskExists", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "containerMetrics", "[", "]", "*", "ecstcs", ".", "ContainerMetric", "\n", "for", "_", ",", "<mask>", ":=", "range", "containerMap", "{", "dockerID", ":=", "container", ".", "containerMetadata", ".", "DockerID", "\n", "// Check if the container is terminal. If it is, make sure that it is", "// cleaned up properly. We might sometimes miss events from docker task", "// engine and this helps in reconciling the state. The tcs client's", "// GetInstanceMetrics probe is used as the trigger for this.", "if", "engine", ".", "stopTrackingContainerUnsafe", "(", "container", ",", "taskArn", ")", "{", "continue", "\n", "}", "\n\n", "if", "!", "container", ".", "statsQueue", ".", "enoughDatapointsInBuffer", "(", ")", "&&", "!", "container", ".", "statsQueue", ".", "resetThresholdElapsed", "(", "queueResetThreshold", ")", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "dockerID", ")", "\n", "continue", "\n", "}", "\n\n", "// Container is not terminal. Get CPU stats set.", "cpuStatsSet", ",", "err", ":=", "container", ".", "statsQueue", ".", "GetCPUStatsSet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ",", "dockerID", ")", "\n", "continue", "\n", "}", "\n\n", "// Get memory stats set.", "memoryStatsSet", ",", "err", ":=", "container", ".", "statsQueue", ".", "GetMemoryStatsSet", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ",", "dockerID", ")", "\n", "continue", "\n", "}", "\n\n", "containerMetrics", "=", "append", "(", "containerMetrics", ",", "&", "ecstcs", ".", "ContainerMetric", "{", "CpuStatsSet", ":", "cpuStatsSet", ",", "MemoryStatsSet", ":", "memoryStatsSet", ",", "}", ")", "\n\n", "}", "\n\n", "return", "containerMetrics", ",", "nil", "\n", "}" ]
16,338
all-16339
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniformMatrix3fv", "(", "program", "uint32", ",", "location", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpProgramUniformMatrix3fv", ",", "5", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "count", ")", ",", "boolToUintptr", "(", "transpose", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ")", "\n", "}" ]
16,339
all-16340
[ "GetRef", "returns", "the", "hash", "of", "a", "ref", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "GetRef", "(", "<mask>", ",", "repo", ",", "ref", "string", ")", "(", "string", ",", "error", ")", "{", "return", "TestRef", ",", "nil", "\n", "}" ]
16,340
all-16341
[ "String", "returns", "the", "string", "representation", "of", "the", "identity", "." ]
[ "func", "(", "i", "Identity", ")", "<mask>", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", ".", "Name", ",", "i", ".", "Category", ")", "\n", "}" ]
16,341
all-16342
[ "WithPath", "if", "specified", "deletes", "only", "cookies", "with", "the", "exact", "path", "." ]
[ "func", "(", "p", "DeleteCookiesParams", ")", "WithPath", "(", "path", "string", ")", "*", "DeleteCookiesParams", "{", "p", ".", "Path", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
16,342
all-16343
[ "NetworkUpdate", "updates", "the", "network", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "NetworkUpdate", "(", "name", ",", "<mask>", "string", ",", "config", "map", "[", "string", "]", "string", ")", "error", "{", "id", ",", "_", ",", "err", ":=", "c", ".", "NetworkGet", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "err", "=", "NetworkUpdateDescription", "(", "tx", ".", "tx", ",", "id", ",", "description", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "NetworkConfigClear", "(", "tx", ".", "tx", ",", "id", ",", "c", ".", "nodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "networkConfigAdd", "(", "tx", ".", "tx", ",", "id", ",", "c", ".", "nodeID", ",", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n\n", "return", "err", "\n", "}" ]
16,343
all-16344
[ "NodeHeartbeat", "updates", "the", "heartbeat", "column", "of", "the", "node", "with", "the", "given", "address", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NodeHeartbeat", "(", "address", "string", ",", "heartbeat", "time", ".", "Time", ")", "error", "{", "stmt", ":=", "\"", "\"", "\n", "result", ",", "err", ":=", "c", ".", "<mask>", ".", "Exec", "(", "stmt", ",", "heartbeat", ",", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "n", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "n", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,344
all-16345
[ "render", "primitives", "using", "a", "count", "derived", "from", "a", "transform", "feedback", "object" ]
[ "func", "DrawTransformFeedback", "(", "mode", "uint32", ",", "id", "uint32", ")", "{", "C", ".", "glowDrawTransformFeedback", "(", "gpDrawTransformFeedback", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ")", "\n", "}" ]
16,345
all-16346
[ "Has", "returns", "true", "if", "the", "given", "key", "exists", "in", "Args", "." ]
[ "func", "(", "a", "*", "Args", ")", "Has", "(", "<mask>", "string", ")", "bool", "{", "return", "hasArg", "(", "a", ".", "args", ",", "key", ")", "\n", "}" ]
16,346
all-16347
[ "readFromHTTP", "reads", "file", "from", "a", "http", "url", "it", "s", "up", "the", "caller", "to", "make", "sure", "sourcePath", "has", "been", "tested", "against", "url", ".", "ParseRequestURI", "()" ]
[ "func", "readFromHTTP", "(", "targetURL", "*", "url", ".", "URL", ")", "(", "string", ",", "error", ")", "{", "var", "client", "http", ".", "<mask>", "\n", "resp", ",", "err", ":=", "client", ".", "Get", "(", "targetURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n\n", "if", "resp", ".", "StatusCode", "==", "http", ".", "StatusOK", "{", "bytes", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "string", "(", "bytes", ")", ",", "nil", "\n", "}", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "targetURL", ".", "String", "(", ")", ")", "\n", "}" ]
16,347
all-16348
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SearchInContentReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger20", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
16,348
all-16349
[ "PSCGetChannelInfo", "calls", "getChannelInfo", "method", "of", "Privatix", "service", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PSCGetChannelInfo", "(", "opts", "*", "bind", ".", "CallOpts", ",", "client", "common", ".", "<mask>", ",", "agent", "common", ".", "Address", ",", "blockNumber", "uint32", ",", "hash", "[", "common", ".", "HashLength", "]", "byte", ")", "(", "uint64", ",", "uint32", ",", "uint64", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n", "return", "b", ".", "psc", ".", "GetChannelInfo", "(", "opts", ",", "client", ",", "agent", ",", "blockNumber", ",", "hash", ")", "\n", "}" ]
16,349
all-16350
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoveBreakpointParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger27", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,350
all-16351
[ "Lookup", "search", "a", "specific", "PathName", "in", "the", "RouteList", "and", "return", "the", "*", "RouteInfo" ]
[ "func", "(", "a", "RouteList", ")", "Lookup", "(", "<mask>", "string", ")", "(", "*", "RouteInfo", ",", "error", ")", "{", "for", "_", ",", "ri", ":=", "range", "a", "{", "if", "ri", ".", "PathName", "==", "name", "{", "return", "ri", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
16,351
all-16352
[ "Create", "the", "label" ]
[ "func", "<mask>", "(", "repo", "string", ",", "label", "Label", ")", "Update", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "repo", ")", ".", "WithField", "(", "\"", "\"", ",", "label", ".", "Name", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "Update", "{", "Why", ":", "\"", "\"", ",", "Wanted", ":", "&", "label", ",", "repo", ":", "repo", "}", "\n", "}" ]
16,352
all-16353
[ "New", "returns", "a", "new", "API", "object", "." ]
[ "func", "New", "(", "db", "func", "(", ")", "*", "tsdb", ".", "DB", ",", "enableAdmin", "bool", ",", ")", "*", "API", "{", "return", "&", "API", "{", "db", ":", "<mask>", ",", "enableAdmin", ":", "enableAdmin", ",", "}", "\n", "}" ]
16,353
all-16354
[ "Commit", "marks", "the", "process", "of", "storing", "the", "image", "as", "successful", "and", "asks", "for", "the", "image", "to", "be", "persisted", ".", "WARNING", ":", "This", "does", "not", "have", "any", "transactional", "semantics", ":", "-", "Uploaded", "data", "MAY", "be", "visible", "to", "others", "before", "Commit", "()", "is", "called", "-", "Uploaded", "data", "MAY", "be", "removed", "or", "MAY", "remain", "around", "if", "Close", "()", "is", "called", "without", "Commit", "()", "(", "i", ".", "e", ".", "rollback", "is", "allowed", "but", "not", "guaranteed", ")" ]
[ "func", "(", "d", "*", "ociImageDestination", ")", "Commit", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "ioutil", ".", "WriteFile", "(", "d", ".", "ref", ".", "ociLayoutPath", "(", ")", ",", "[", "]", "byte", "(", "`{\"imageLayoutVersion\": \"1.0.0\"}`", ")", ",", "0644", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "indexJSON", ",", "err", ":=", "json", ".", "Marshal", "(", "d", ".", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "ioutil", ".", "WriteFile", "(", "d", ".", "ref", ".", "indexPath", "(", ")", ",", "indexJSON", ",", "0644", ")", "\n", "}" ]
16,354
all-16355
[ "getScope", "is", "a", "helper", "function", "for", "the", "GetScope", "GRPC", "API", "as", "well", "is", "Authorized", "()", "and", "other", "authorization", "checks", "(", "e", ".", "g", ".", "checking", "if", "a", "user", "is", "an", "OWNER", "to", "determine", "if", "they", "can", "modify", "an", "ACL", ")", "." ]
[ "func", "(", "a", "*", "apiServer", ")", "getScope", "(", "ctx", "context", ".", "Context", ",", "subject", "string", ",", "acl", "*", "authclient", ".", "ACL", ")", "(", "authclient", ".", "Scope", ",", "error", ")", "{", "// Get scope based on user's direct access", "scope", ":=", "acl", ".", "Entries", "[", "subject", "]", "\n\n", "// Expand scope based on group access", "groups", ",", "err", ":=", "a", ".", "getGroups", "(", "ctx", ",", "subject", ")", "\n", "if", "err", "!=", "nil", "{", "return", "authclient", ".", "Scope_NONE", ",", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "g", ":=", "range", "<mask>", "{", "groupScope", ":=", "acl", ".", "Entries", "[", "g", "]", "\n", "if", "scope", "<", "groupScope", "{", "scope", "=", "groupScope", "\n", "}", "\n", "}", "\n", "return", "scope", ",", "nil", "\n", "}" ]
16,355
all-16356
[ "ParseMessage", "parse", "a", "raw", "Twitch", "IRC", "message" ]
[ "func", "ParseMessage", "(", "line", "string", ")", "Message", "{", "// Uncomment this and recoverMessage if debugging a message that crashes the parser", "//defer recoverMessage(line)", "ircMessage", ",", "err", ":=", "parseIRCMessage", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "parseRawMessage", "(", "ircMessage", ")", "\n", "}", "\n\n", "if", "mt", ",", "ok", ":=", "messageTypeMap", "[", "ircMessage", ".", "Command", "]", ";", "ok", "{", "return", "mt", ".", "Parser", "(", "ircMessage", ")", "\n", "}", "\n\n", "return", "parseRawMessage", "(", "ircMessage", ")", "\n", "}" ]
16,356
all-16357
[ "trails", "[", "0", "]", ".", "Hash", "is", "the", "leaf", "hash", "for", "items", "[", "0", "]", ".", "trails", "[", "i", "]", ".", "Parent", ".", "Parent", "....", "Parent", "==", "root", "for", "all", "i", "." ]
[ "func", "trailsFromHashers", "(", "items", "[", "]", "Hasher", ")", "(", "trails", "[", "]", "*", "SimpleProofNode", ",", "root", "*", "SimpleProofNode", ")", "{", "// Recursive impl.", "switch", "len", "(", "items", ")", "{", "case", "0", ":", "return", "nil", ",", "nil", "\n", "case", "1", ":", "trail", ":=", "&", "SimpleProofNode", "{", "items", "[", "0", "]", ".", "Hash", "(", ")", ",", "nil", ",", "nil", ",", "nil", "}", "\n", "return", "[", "]", "*", "SimpleProofNode", "{", "trail", "}", ",", "trail", "\n", "default", ":", "lefts", ",", "leftRoot", ":=", "trailsFromHashers", "(", "items", "[", ":", "(", "len", "(", "items", ")", "+", "1", ")", "/", "2", "]", ")", "\n", "rights", ",", "rightRoot", ":=", "trailsFromHashers", "(", "items", "[", "(", "len", "(", "items", ")", "+", "1", ")", "/", "2", ":", "]", ")", "\n", "rootHash", ":=", "SimpleHashFromTwoHashes", "(", "leftRoot", ".", "Hash", ",", "rightRoot", ".", "Hash", ")", "\n", "root", ":=", "&", "SimpleProofNode", "{", "rootHash", ",", "nil", ",", "nil", ",", "nil", "}", "\n", "leftRoot", ".", "Parent", "=", "root", "\n", "leftRoot", ".", "Right", "=", "rightRoot", "\n", "rightRoot", ".", "Parent", "=", "root", "\n", "rightRoot", ".", "Left", "=", "leftRoot", "\n", "return", "<mask>", "(", "lefts", ",", "rights", "...", ")", ",", "root", "\n", "}", "\n", "}" ]
16,357
all-16358
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RemoveEventListenerBreakpointParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
16,358
all-16359
[ "ReadAll", "reads", "out", "records", "of", "the", "current", "WAL", ".", "If", "opened", "in", "write", "mode", "it", "must", "read", "out", "all", "records", "until", "EOF", ".", "Or", "an", "error", "will", "be", "returned", ".", "If", "opened", "in", "read", "mode", "it", "will", "try", "to", "read", "all", "records", "if", "possible", ".", "If", "it", "cannot", "read", "out", "the", "expected", "snap", "it", "will", "return", "ErrSnapshotNotFound", ".", "If", "loaded", "snap", "doesn", "t", "match", "with", "the", "expected", "one", "it", "will", "return", "all", "the", "records", "and", "error", "ErrSnapshotMismatch", ".", "TODO", ":", "detect", "not", "-", "last", "-", "snap", "error", ".", "TODO", ":", "maybe", "loose", "the", "checking", "of", "match", ".", "After", "ReadAll", "the", "WAL", "will", "be", "ready", "for", "appending", "new", "records", "." ]
[ "func", "(", "w", "*", "WAL", ")", "ReadAll", "(", ")", "(", "metadata", "[", "]", "<mask>", ",", "state", "raftpb", ".", "HardState", ",", "ents", "[", "]", "raftpb", ".", "Entry", ",", "err", "error", ")", "{", "w", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rec", ":=", "&", "walpb", ".", "Record", "{", "}", "\n", "decoder", ":=", "w", ".", "decoder", "\n\n", "var", "match", "bool", "\n", "for", "err", "=", "decoder", ".", "decode", "(", "rec", ")", ";", "err", "==", "nil", ";", "err", "=", "decoder", ".", "decode", "(", "rec", ")", "{", "switch", "rec", ".", "Type", "{", "case", "entryType", ":", "e", ":=", "mustUnmarshalEntry", "(", "rec", ".", "Data", ")", "\n", "if", "e", ".", "Index", ">", "w", ".", "start", ".", "Index", "{", "ents", "=", "append", "(", "ents", "[", ":", "e", ".", "Index", "-", "w", ".", "start", ".", "Index", "-", "1", "]", ",", "e", ")", "\n", "}", "\n", "w", ".", "enti", "=", "e", ".", "Index", "\n\n", "case", "stateType", ":", "state", "=", "mustUnmarshalState", "(", "rec", ".", "Data", ")", "\n\n", "case", "metadataType", ":", "if", "metadata", "!=", "nil", "&&", "!", "bytes", ".", "Equal", "(", "metadata", ",", "rec", ".", "Data", ")", "{", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "ErrMetadataConflict", "\n", "}", "\n", "metadata", "=", "rec", ".", "Data", "\n\n", "case", "crcType", ":", "crc", ":=", "decoder", ".", "crc", ".", "Sum32", "(", ")", "\n", "// current crc of decoder must match the crc of the record.", "// do no need to match 0 crc, since the decoder is a new one at this case.", "if", "crc", "!=", "0", "&&", "rec", ".", "Validate", "(", "crc", ")", "!=", "nil", "{", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "ErrCRCMismatch", "\n", "}", "\n", "decoder", ".", "updateCRC", "(", "rec", ".", "Crc", ")", "\n\n", "case", "snapshotType", ":", "var", "snap", "walpb", ".", "Snapshot", "\n", "pbutil", ".", "MustUnmarshal", "(", "&", "snap", ",", "rec", ".", "Data", ")", "\n", "if", "snap", ".", "Index", "==", "w", ".", "start", ".", "Index", "{", "if", "snap", ".", "Term", "!=", "w", ".", "start", ".", "Term", "{", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "ErrSnapshotMismatch", "\n", "}", "\n", "match", "=", "true", "\n", "}", "\n\n", "default", ":", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rec", ".", "Type", ")", "\n", "}", "\n", "}", "\n\n", "switch", "w", ".", "tail", "(", ")", "{", "case", "nil", ":", "// We do not have to read out all entries in read mode.", "// The last record maybe a partial written one, so", "// ErrunexpectedEOF might be returned.", "if", "err", "!=", "io", ".", "EOF", "&&", "err", "!=", "io", ".", "ErrUnexpectedEOF", "{", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "err", "\n", "}", "\n", "default", ":", "// We must read all of the entries if WAL is opened in write mode.", "if", "err", "!=", "io", ".", "EOF", "{", "state", ".", "Reset", "(", ")", "\n", "return", "nil", ",", "state", ",", "nil", ",", "err", "\n", "}", "\n", "// decodeRecord() will return io.EOF if it detects a zero record,", "// but this zero record may be followed by non-zero records from", "// a torn write. Overwriting some of these non-zero records, but", "// not all, will cause CRC errors on WAL open. Since the records", "// were never fully synced to disk in the first place, it's safe", "// to zero them out to avoid any CRC errors from new writes.", "if", "_", ",", "err", "=", "w", ".", "tail", "(", ")", ".", "Seek", "(", "w", ".", "decoder", ".", "lastOffset", "(", ")", ",", "io", ".", "SeekStart", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "state", ",", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "fileutil", ".", "ZeroToEnd", "(", "w", ".", "tail", "(", ")", ".", "File", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "state", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "err", "=", "nil", "\n", "if", "!", "match", "{", "err", "=", "ErrSnapshotNotFound", "\n", "}", "\n\n", "// close decoder, disable reading", "if", "w", ".", "readClose", "!=", "nil", "{", "w", ".", "readClose", "(", ")", "\n", "w", ".", "readClose", "=", "nil", "\n", "}", "\n", "w", ".", "start", "=", "walpb", ".", "Snapshot", "{", "}", "\n\n", "w", ".", "metadata", "=", "metadata", "\n\n", "if", "w", ".", "tail", "(", ")", "!=", "nil", "{", "// create encoder (chain crc with the decoder), enable appending", "w", ".", "encoder", ",", "err", "=", "newFileEncoder", "(", "w", ".", "tail", "(", ")", ".", "File", ",", "w", ".", "decoder", ".", "lastCRC", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "w", ".", "decoder", "=", "nil", "\n\n", "return", "metadata", ",", "state", ",", "ents", ",", "err", "\n", "}" ]
16,359
all-16360
[ "Do", "executes", "Runtime", ".", "addBinding", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "AddBindingParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandAddBinding", ",", "p", ",", "nil", ")", "\n", "}" ]
16,360
all-16361
[ "AddAll", "binds", "a", "path", "to", "GET", "POST", "PUT", "and", "DELETE", "methods", "." ]
[ "func", "(", "r", "*", "DelayedRouter", ")", "AddAll", "(", "version", ",", "path", "string", ",", "h", "http", ".", "Handler", ")", "*", "mux", ".", "Route", "{", "return", "r", ".", "addRoute", "(", "<mask>", ",", "path", ",", "h", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
16,361
all-16362
[ "ListStoreNew", "is", "a", "wrapper", "around", "gtk_list_store_newv", "()", "." ]
[ "func", "ListStoreNew", "(", "types", "...", "glib", ".", "<mask>", ")", "(", "*", "ListStore", ",", "error", ")", "{", "gtypes", ":=", "C", ".", "alloc_types", "(", "C", ".", "int", "(", "len", "(", "types", ")", ")", ")", "\n", "for", "n", ",", "val", ":=", "range", "types", "{", "C", ".", "set_type", "(", "gtypes", ",", "C", ".", "int", "(", "n", ")", ",", "C", ".", "GType", "(", "val", ")", ")", "\n", "}", "\n", "defer", "C", ".", "g_free", "(", "C", ".", "gpointer", "(", "gtypes", ")", ")", "\n", "c", ":=", "C", ".", "gtk_list_store_newv", "(", "C", ".", "gint", "(", "len", "(", "types", ")", ")", ",", "gtypes", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "ls", ":=", "wrapListStore", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "return", "ls", ",", "nil", "\n", "}" ]
16,362
all-16363
[ "GetInt", "returns", "the", "int64", "value", "of", "the", "variant", "if", "it", "is", "an", "integer", "type", "and", "an", "error", "otherwise", ".", "It", "wraps", "variouns", "g_variant_get_", "*", "functions", "dealing", "with", "integers", "of", "different", "sizes", "." ]
[ "func", "(", "v", "*", "Variant", ")", "GetInt", "(", ")", "(", "int64", ",", "error", ")", "{", "t", ":=", "v", ".", "Type", "(", ")", ".", "String", "(", ")", "\n", "var", "i", "int64", "\n", "switch", "t", "{", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_byte", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_int16", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_uint16", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_int32", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_uint32", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "<mask>", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_int64", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "case", "\"", "\"", ":", "i", "=", "int64", "(", "C", ".", "g_variant_get_uint64", "(", "v", ".", "native", "(", ")", ")", ")", "\n", "default", ":", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "return", "i", ",", "nil", "\n", "}" ]
16,363
all-16364
[ "void", "pango_cairo_show_error_underline", "(", "cairo_t", "*", "cr", "double", "x", "double", "y", "double", "width", "double", "height", ")", ";", "/", "*", "Rendering", "to", "a", "path", "void", "pango_cairo_glyph_string_path", "(", "cairo_t", "*", "cr", "PangoFont", "*", "font", "PangoGlyphString", "*", "glyphs", ")", ";" ]
[ "func", "CairoGlyphStringPath", "(", "cr", "*", "cairo", ".", "Context", ",", "font", "*", "Font", ",", "glyphs", "*", "GlyphString", ")", "{", "C", ".", "pango_cairo_glyph_string_path", "(", "cairo_context", "(", "cr", ")", ",", "<mask>", ".", "native", "(", ")", ",", "glyphs", ".", "native", "(", ")", ")", "\n", "}" ]
16,364
all-16365
[ "KeySplits", "can", "be", "used", "to", "get", "rough", "key", "ranges", "to", "divide", "up", "iteration", "over", "the", "DB", "." ]
[ "func", "(", "db", "*", "DB", ")", "KeySplits", "(", "prefix", "[", "]", "byte", ")", "[", "]", "string", "{", "var", "splits", "[", "]", "string", "\n", "for", "_", ",", "ti", ":=", "range", "db", ".", "Tables", "(", ")", "{", "// We don't use ti.Left, because that has a tendency to store !badger", "// keys.", "if", "bytes", ".", "HasPrefix", "(", "ti", ".", "Right", ",", "prefix", ")", "{", "splits", "=", "append", "(", "splits", ",", "string", "(", "ti", ".", "Right", ")", ")", "\n", "}", "\n", "}", "\n", "<mask>", ".", "Strings", "(", "splits", ")", "\n", "return", "splits", "\n", "}" ]
16,365
all-16366
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetPressureNotificationsSuppressedParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,366
all-16367
[ "Leader", "returns", "the", "current", "leader", "." ]
[ "func", "(", "f", "*", "Follower", ")", "Leader", "(", ")", "string", "{", "f", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "leader", "\n", "}" ]
16,367
all-16368
[ "FileUploadWithMetadata", "returns", "an", "UploadFunc", "which", "copies", "all", "data", "from", "the", "file", "on", "disk", "into", "GCS", "object", "and", "also", "sets", "the", "provided", "metadata", "fields", "on", "the", "object", "." ]
[ "func", "FileUploadWithMetadata", "(", "file", "string", ",", "metadata", "<mask>", "[", "string", "]", "string", ")", "UploadFunc", "{", "return", "func", "(", "obj", "*", "storage", ".", "ObjectHandle", ")", "error", "{", "reader", ",", "err", ":=", "os", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "uploadErr", ":=", "DataUploadWithMetadata", "(", "reader", ",", "metadata", ")", "(", "obj", ")", "\n", "closeErr", ":=", "reader", ".", "Close", "(", ")", "\n\n", "return", "errorutil", ".", "NewAggregate", "(", "uploadErr", ",", "closeErr", ")", "\n", "}", "\n", "}" ]
16,368
all-16369
[ "Subscribe", "attaches", "a", "reporter", "to", "the", "Registry", "." ]
[ "func", "(", "r", "*", "Registry", ")", "Subscribe", "(", "rep", "Reporter", ")", "{", "r", ".", "mutex", ".", "Lock", "(", ")", "\n", "r", ".", "reporters", "=", "<mask>", "(", "r", ".", "reporters", ",", "rep", ")", "\n", "r", ".", "mutex", ".", "Unlock", "(", ")", "\n", "}" ]
16,369
all-16370
[ "GetDefaultBottomMargin", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_default_bottom_margin", "()", "." ]
[ "func", "(", "ps", "*", "PaperSize", ")", "GetDefaultBottomMargin", "(", "<mask>", "Unit", ")", "float64", "{", "c", ":=", "C", ".", "gtk_paper_size_get_default_bottom_margin", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
16,370
all-16371
[ "Enabled", "is", "a", "convenience", "that", "returns", "true", "if", "clustering", "is", "enabled", "on", "this", "node", "." ]
[ "func", "Enabled", "(", "node", "*", "db", ".", "Node", ")", "(", "bool", ",", "error", ")", "{", "enabled", ":=", "false", "\n", "err", ":=", "node", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "NodeTx", ")", "error", "{", "addresses", ",", "err", ":=", "<mask>", ".", "RaftNodeAddresses", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "enabled", "=", "len", "(", "addresses", ")", ">", "0", "\n", "return", "nil", "\n", "}", ")", "\n", "return", "enabled", ",", "err", "\n", "}" ]
16,371
all-16372
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetShowPaintRectsParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,372
all-16373
[ "set", "the", "blend", "color" ]
[ "func", "BlendColor", "(", "<mask>", "float32", ",", "green", "float32", ",", "blue", "float32", ",", "alpha", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpBlendColor", ",", "4", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "red", ")", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "green", ")", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "blue", ")", ")", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "alpha", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
16,373
all-16374
[ "DecodeItem", "decodes", "encoded", "[", "2", "byte", "len", "]", "[", "item_bytes", "]", "format", "." ]
[ "func", "(", "m", "*", "Nitro", ")", "DecodeItem", "(", "buf", "[", "]", "byte", ",", "r", "io", ".", "Reader", ")", "(", "*", "Item", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "buf", "[", "0", ":", "2", "]", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "l", ":=", "binary", ".", "BigEndian", ".", "Uint16", "(", "buf", "[", "0", ":", "2", "]", ")", "\n", "if", "l", ">", "0", "{", "itm", ":=", "m", ".", "allocItem", "(", "int", "(", "l", ")", ",", "m", ".", "useMemoryMgmt", ")", "\n", "<mask>", ":=", "itm", ".", "Bytes", "(", ")", "\n", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "data", ")", "\n", "return", "itm", ",", "err", "\n", "}", "\n\n", "return", "nil", ",", "nil", "\n", "}" ]
16,374
all-16375
[ "DeleteCmd", "represents", "the", "delete", "command" ]
[ "func", "DeleteCmd", "(", ")", "*", "cobra", ".", "Command", "{", "var", "do", "=", "&", "cli", ".", "DeleteOptions", "{", "}", "\n", "var", "deleteCmd", "=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Use this command to delete cloud resources.\n\t\n\tThis command will attempt to build the resource graph based on an API model.\n\tOnce the graph is built, the delete will attempt to delete the resources from the cloud.\n\tAfter the delete is complete, the state store will be left in tact and could potentially be applied later.\n\t\n\tTo delete the resource AND the API model in the state store, use --purge.`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "switch", "len", "(", "args", ")", "{", "case", "0", ":", "do", ".", "Name", "=", "viper", ".", "GetString", "(", "keyKubicornName", ")", "\n", "case", "1", ":", "do", ".", "Name", "=", "args", "[", "0", "]", "\n", "default", ":", "logger", ".", "Critical", "(", "\"", "\"", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "if", "err", ":=", "runDelete", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "err", ".", "Error", "(", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "}", ",", "}", "\n\n", "fs", ":=", "deleteCmd", ".", "Flags", "(", ")", "\n\n", "bindCommonStateStoreFlags", "(", "&", "do", ".", "StateStoreOptions", ",", "fs", ")", "\n", "bindCommonAwsFlags", "(", "&", "do", ".", "AwsOptions", ",", "fs", ")", "\n\n", "fs", ".", "StringVar", "(", "&", "do", ".", "AwsProfile", ",", "keyAwsProfile", ",", "viper", ".", "GetString", "(", "keyAwsProfile", ")", ",", "descAwsProfile", ")", "\n", "fs", ".", "StringVar", "(", "&", "do", ".", "GitRemote", ",", "keyGitConfig", ",", "viper", ".", "GetString", "(", "keyGitConfig", ")", ",", "descGitConfig", ")", "\n", "fs", ".", "BoolVarP", "(", "&", "do", ".", "Purge", ",", "keyPurge", ",", "\"", "\"", ",", "viper", ".", "GetBool", "(", "keyPurge", ")", ",", "descPurge", ")", "\n\n", "return", "deleteCmd", "\n", "}" ]
16,375
all-16376
[ "getNameAndItsPpid", "returns", "the", "exe", "file", "name", "its", "parent", "process", "id", "." ]
[ "func", "getNameAndItsPpid", "(", "pid", "int", ")", "(", "exefile", "string", ",", "parentid", "int", ",", "err", "error", ")", "{", "pe", ",", "err", ":=", "getProcessEntry", "(", "pid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "0", ",", "err", "\n", "}", "\n\n", "name", ":=", "syscall", ".", "UTF16ToString", "(", "<mask>", ".", "ExeFile", "[", ":", "]", ")", "\n", "return", "name", ",", "int", "(", "pe", ".", "ParentProcessID", ")", ",", "nil", "\n", "}" ]
16,376
all-16377
[ "GetSSHKeyPath", "returns", "the", "ssh", "key", "path" ]
[ "func", "(", "d", "*", "BaseDriver", ")", "GetSSHKeyPath", "(", ")", "<mask>", "{", "if", "d", ".", "SSHKeyPath", "==", "\"", "\"", "{", "d", ".", "SSHKeyPath", "=", "d", ".", "ResolveStorePath", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "d", ".", "SSHKeyPath", "\n", "}" ]
16,377
all-16378
[ "NewUpdateCommand", "returns", "the", "CLI", "command", "for", "update", "." ]
[ "func", "NewUpdateCommand", "(", ")", "<mask>", ".", "Command", "{", "return", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "ArgsUsage", ":", "\"", "\"", ",", "Flags", ":", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "0", ",", "Usage", ":", "\"", "\"", "}", ",", "}", ",", "Action", ":", "func", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "updateCommandFunc", "(", "c", ",", "mustNewKeyAPI", "(", "c", ")", ")", "\n", "return", "nil", "\n", "}", ",", "}", "\n", "}" ]
16,378
all-16379
[ "Return", "a", "new", "instance", "of", "Hosts", "." ]
[ "func", "NewHosts", "(", ")", "(", "Hosts", ",", "error", ")", "{", "osHostsFilePath", ":=", "\"", "\"", "\n\n", "if", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "osHostsFilePath", "=", "os", ".", "ExpandEnv", "(", "filepath", ".", "FromSlash", "(", "hostsFilePath", ")", ")", "\n", "}", "else", "{", "osHostsFilePath", "=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "}", "\n\n", "hosts", ":=", "Hosts", "{", "Path", ":", "osHostsFilePath", "}", "\n\n", "err", ":=", "hosts", ".", "Load", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "hosts", ",", "err", "\n", "}", "\n\n", "return", "hosts", ",", "nil", "\n", "}" ]
16,379
all-16380
[ "DockerHostConfig", "construct", "the", "configuration", "recognized", "by", "docker" ]
[ "func", "(", "task", "*", "Task", ")", "DockerHostConfig", "(", "container", "*", "apicontainer", ".", "<mask>", ",", "dockerContainerMap", "map", "[", "string", "]", "*", "apicontainer", ".", "DockerContainer", ",", "apiVersion", "dockerclient", ".", "DockerVersion", ")", "(", "*", "dockercontainer", ".", "HostConfig", ",", "*", "apierrors", ".", "HostConfigError", ")", "{", "return", "task", ".", "dockerHostConfig", "(", "container", ",", "dockerContainerMap", ",", "apiVersion", ")", "\n", "}" ]
16,380
all-16381
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetCookieReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,381
all-16382
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardListItem", ")", "GetType", "(", ")", "string", "{", "if", "d", "==", "nil", "||", "d", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "Type", "\n", "}" ]
16,382
all-16383
[ "Parameters", ":", "-", "Key" ]
[ "func", "(", "p", "*", "KeyValueClient", ")", "Get", "(", "key", "string", ")", "(", "r", "string", ",", "err", "error", ")", "{", "if", "err", "=", "p", ".", "sendGet", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "return", "p", ".", "recvGet", "(", ")", "\n", "}" ]
16,383
all-16384
[ "ReadFloat64", "reads", "and", "returns", "a", "float64", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadFloat64", "(", ")", "float64", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "var", "n", "int", "\n", "n", ",", "r", ".", "err", "=", "io", ".", "ReadFull", "(", "r", ".", "rd", ",", "r", ".", "b", "[", ":", "8", "]", ")", "\n", "r", ".", "cnt", "+=", "n", "\n", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "bits", ":=", "<mask>", ".", "LittleEndian", ".", "Uint64", "(", "r", ".", "b", "[", ":", "8", "]", ")", "\n", "return", "math", ".", "Float64frombits", "(", "bits", ")", "\n", "}" ]
16,384
all-16385
[ "ackPublishHealthMetricHandler", "consumes", "the", "ack", "message", "from", "backend", ".", "The", "backend", "sends", "the", "ack", "each", "time", "it", "processes", "a", "health", "message" ]
[ "func", "ackPublishHealthMetricHandler", "(", "timer", "*", "time", ".", "Timer", ")", "func", "(", "*", "ecstcs", ".", "AckPublishHealth", ")", "{", "return", "func", "(", "*", "ecstcs", ".", "AckPublishHealth", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "<mask>", ".", "Reset", "(", "retry", ".", "AddJitter", "(", "defaultHeartbeatTimeout", ",", "defaultHeartbeatJitter", ")", ")", "\n", "}", "\n", "}" ]
16,385
all-16386
[ "Update", "changes", "informations", "of", "the", "service", "instance", "." ]
[ "func", "(", "si", "*", "ServiceInstance", ")", "Update", "(", "service", "Service", ",", "updateData", "ServiceInstance", ",", "evt", "*", "event", ".", "Event", ",", "requestID", "string", ")", "error", "{", "err", ":=", "validateServiceInstanceTeamOwner", "(", "updateData", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "conn", ",", "err", ":=", "<mask>", ".", "Conn", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "conn", ".", "Close", "(", ")", "\n", "tags", ":=", "processTags", "(", "updateData", ".", "Tags", ")", "\n", "if", "tags", "==", "nil", "{", "updateData", ".", "Tags", "=", "si", ".", "Tags", "\n", "}", "else", "{", "updateData", ".", "Tags", "=", "tags", "\n", "}", "\n", "actions", ":=", "[", "]", "*", "action", ".", "Action", "{", "&", "updateServiceInstance", ",", "&", "notifyUpdateServiceInstance", "}", "\n", "pipeline", ":=", "action", ".", "NewPipeline", "(", "actions", "...", ")", "\n", "return", "pipeline", ".", "Execute", "(", "service", ",", "*", "si", ",", "updateData", ",", "evt", ",", "requestID", ")", "\n", "}" ]
16,386
all-16387
[ "RegexpHost", "-----------------------------------------------------------------", "NewRegexpHost", "returns", "a", "regexp", "matcher", "for", "the", "given", "URL", "host", "pattern", "." ]
[ "func", "NewRegexpHost", "(", "pattern", "string", ")", "(", "*", "RegexpHost", ",", "error", ")", "{", "r", ",", "err", ":=", "CompileRegexp", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "RegexpHost", "{", "*", "r", "}", ",", "nil", "\n", "}" ]
16,387
all-16388
[ "Next", "returns", "the", "next", "element", ".", "If", "it", "is", "the", "same", "as", "the", "current", "key", "ignore", "it", "." ]
[ "func", "(", "s", "*", "MergeIterator", ")", "Next", "(", ")", "{", "if", "len", "(", "s", ".", "h", ")", "==", "0", "{", "return", "\n", "}", "\n\n", "smallest", ":=", "s", ".", "h", "[", "0", "]", ".", "itr", "\n", "smallest", ".", "Next", "(", ")", "\n\n", "for", "len", "(", "s", ".", "h", ")", ">", "0", "{", "smallest", "=", "s", ".", "h", "[", "0", "]", ".", "itr", "\n", "if", "!", "smallest", ".", "Valid", "(", ")", "{", "heap", ".", "Pop", "(", "&", "s", ".", "h", ")", "\n", "<mask>", "\n", "}", "\n\n", "heap", ".", "Fix", "(", "&", "s", ".", "h", ",", "0", ")", "\n", "smallest", "=", "s", ".", "h", "[", "0", "]", ".", "itr", "\n", "if", "smallest", ".", "Valid", "(", ")", "{", "if", "!", "bytes", ".", "Equal", "(", "smallest", ".", "Key", "(", ")", ",", "s", ".", "curKey", ")", "{", "break", "\n", "}", "\n", "smallest", ".", "Next", "(", ")", "\n", "}", "\n", "}", "\n", "if", "!", "smallest", ".", "Valid", "(", ")", "{", "return", "\n", "}", "\n", "s", ".", "storeKey", "(", "smallest", ")", "\n", "}" ]
16,388
all-16389
[ "MarshalJSON", "marshals", "itself", "." ]
[ "func", "(", "n", "Base64BigInt", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "buf", ",", "err", ":=", "ToBytes", "(", "Base64String", "(", "n", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "v", ":=", "big", ".", "NewInt", "(", "0", ")", "\n", "v", ".", "SetBytes", "(", "buf", ")", "\n", "return", "[", "]", "byte", "(", "v", ".", "String", "(", ")", ")", ",", "nil", "\n", "}" ]
16,389
all-16390
[ "AddFlags", "adds", "a", "list", "of", "flags", "to", "be", "used", "by", "nmap", ".", "Seperate", "flags", "by", "new", "arguments", ".", "The", "order", "of", "the", "flag", "is", "kept", "so", "when", "using", "flags", "that", "require", "file", "names", "seperate", "it", "by", "using", "multiple", "arguments", ".", "Use", "the", "DisallowedFlags", "variable", "to", "guide", "you", "on", "which", "flags", "are", "not", "allowed", "to", "be", "used", "." ]
[ "func", "(", "s", "Scan", ")", "AddFlags", "(", "<mask>", "...", "string", ")", "Scan", "{", "for", "_", ",", "flag", ":=", "range", "flags", "{", "if", "strings", ".", "Contains", "(", "flag", ",", "\"", "\"", ")", "{", "s", ".", "configErr", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "s", "\n", "}", "\n", "for", "_", ",", "df", ":=", "range", "DisallowedFlags", "{", "if", "flag", "==", "df", "{", "s", ".", "configErr", "=", "&", "DisallowedFlagError", "{", "df", "}", "\n", "return", "s", "\n", "}", "\n", "}", "\n", "}", "\n\n", "s", ".", "configOpts", "=", "append", "(", "s", ".", "configOpts", ",", "flags", "...", ")", "\n", "return", "s", "\n", "}" ]
16,390
all-16391
[ "NewSecret", "creates", "a", "new", "secret", "." ]
[ "func", "NewSecret", "(", "object", "*", "Object", ",", "rule", "*", "Rule", ",", "nLine", "int", ",", "line", "string", ")", "*", "Secret", "{", "s", ":=", "&", "Secret", "{", "Object", ":", "object", ",", "Rule", ":", "rule", ",", "Nline", ":", "nLine", ",", "Line", ":", "<mask>", ",", "}", "\n", "return", "s", "\n", "}" ]
16,391
all-16392
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventNavigatedWithinDocument", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage53", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,392
all-16393
[ "MoveObjectTo", "moves", "a", "object", "by", "reference", "into", "a", "folder", "." ]
[ "func", "MoveObjectTo", "(", "ref", "types", ".", "ManagedObjectReference", ",", "folder", "*", "object", ".", "Folder", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "task", ",", "err", ":=", "folder", ".", "MoveInto", "(", "ctx", ",", "[", "]", "<mask>", ".", "ManagedObjectReference", "{", "ref", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "tctx", ",", "tcancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "tcancel", "(", ")", "\n", "return", "task", ".", "Wait", "(", "tctx", ")", "\n", "}" ]
16,393
all-16394
[ "Child", "returns", "a", "populated", "pointer", "for", "a", "given", "path", ".", "If", "the", "path", "cannot", "be", "found", "a", "null", "pointer", "is", "returned", "." ]
[ "func", "(", "c", "*", "Client", ")", "Child", "(", "path", "string", ",", "params", "map", "[", "string", "]", "string", ",", "v", "interface", "{", "}", ")", "*", "Client", "{", "u", ":=", "c", ".", "Url", "+", "\"", "\"", "+", "path", "\n\n", "res", ",", "err", ":=", "c", ".", "api", ".", "Call", "(", "\"", "\"", ",", "u", ",", "c", ".", "Auth", ",", "nil", ",", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n\n", "err", "=", "json", ".", "Unmarshal", "(", "res", ",", "&", "v", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "return", "nil", "\n", "}", "\n\n", "ret", ":=", "&", "Client", "{", "api", ":", "c", ".", "api", ",", "Auth", ":", "c", ".", "Auth", ",", "Url", ":", "u", ",", "value", ":", "v", "}", "\n\n", "return", "<mask>", "\n", "}" ]
16,394
all-16395
[ "Open", "opens", "a", "file", "for", "reading", "." ]
[ "func", "Open", "(", "file", "string", ")", "(", "*", "Reader", ",", "error", ")", "{", "// TODO: Deal with closing file.", "f", ",", "err", ":=", "os", ".", "Open", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "fi", ",", "err", ":=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "Close", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "NewReader", "(", "f", ",", "fi", ".", "Size", "(", ")", ")", "\n", "}" ]
16,395
all-16396
[ "check", "returns", "true", "if", "at", "least", "one", "of", "the", "tag", "groups", "is", "satisfied", "." ]
[ "func", "(", "l", "tagLine", ")", "check", "(", "c", "*", "config", ".", "Config", ",", "os", ",", "arch", "string", ")", "bool", "{", "if", "len", "(", "l", ")", "==", "0", "{", "return", "<mask>", "\n", "}", "\n", "for", "_", ",", "g", ":=", "range", "l", "{", "if", "g", ".", "check", "(", "c", ",", "os", ",", "arch", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
16,396
all-16397
[ "start", "starts", "the", "sync", "process", "on", "a", "different", "goroutine" ]
[ "func", "(", "b", "*", "bindSyncer", ")", "start", "(", ")", "error", "{", "if", "b", ".", "started", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "b", ".", "appLister", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "b", ".", "interval", "==", "0", "{", "b", ".", "interval", "=", "5", "*", "<mask>", ".", "Minute", "\n", "}", "\n", "b", ".", "shutdown", "=", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n", "b", ".", "done", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "b", ".", "started", "=", "true", "\n", "log", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "b", ".", "interval", ")", "\n", "go", "func", "(", "d", "time", ".", "Duration", ")", "{", "for", "{", "select", "{", "case", "<-", "time", ".", "After", "(", "d", ")", ":", "start", ":=", "time", ".", "Now", "(", ")", "\n", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "apps", ",", "err", ":=", "b", ".", "appLister", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "syncDuration", ".", "Set", "(", "time", ".", "Since", "(", "start", ")", ".", "Seconds", "(", ")", ")", "\n", "break", "\n", "}", "\n", "for", "_", ",", "a", ":=", "range", "apps", "{", "err", "=", "b", ".", "sync", "(", "a", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "a", ".", "GetName", "(", ")", ",", "err", ")", "\n", "}", "\n", "if", "len", "(", "b", ".", "shutdown", ")", ">", "0", "{", "break", "\n", "}", "\n", "}", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "len", "(", "apps", ")", ")", "\n", "d", "=", "b", ".", "interval", "\n", "syncDuration", ".", "Set", "(", "time", ".", "Since", "(", "start", ")", ".", "Seconds", "(", ")", ")", "\n", "case", "<-", "b", ".", "shutdown", ":", "b", ".", "done", "<-", "struct", "{", "}", "{", "}", "\n", "return", "\n", "}", "\n", "}", "\n", "}", "(", "time", ".", "Millisecond", "*", "100", ")", "\n", "return", "nil", "\n", "}" ]
16,397
all-16398
[ "ShouldReport", "tells", "if", "a", "prowjob", "should", "be", "reported", "by", "this", "reporter" ]
[ "func", "(", "c", "*", "<mask>", ")", "ShouldReport", "(", "pj", "*", "prowapi", ".", "ProwJob", ")", "bool", "{", "pubSubMap", ":=", "findLabels", "(", "pj", ",", "PubSubProjectLabel", ",", "PubSubTopicLabel", ")", "\n", "return", "pubSubMap", "[", "PubSubProjectLabel", "]", "!=", "\"", "\"", "&&", "pubSubMap", "[", "PubSubTopicLabel", "]", "!=", "\"", "\"", "\n", "}" ]
16,398
all-16399
[ "NewManager", "returns", "an", "implementation", "of", "Manager", "ready", "to", "be", "started", "by", "calling", "the", "Run", "method", "." ]
[ "func", "NewManager", "(", "o", "*", "ManagerOptions", ")", "*", "Manager", "{", "if", "o", ".", "Metrics", "==", "nil", "{", "o", ".", "Metrics", "=", "NewGroupMetrics", "(", "o", ".", "Registerer", ")", "\n", "}", "\n\n", "m", ":=", "&", "Manager", "{", "groups", ":", "map", "[", "string", "]", "*", "<mask>", "{", "}", ",", "opts", ":", "o", ",", "block", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "logger", ":", "o", ".", "Logger", ",", "}", "\n\n", "if", "o", ".", "Registerer", "!=", "nil", "{", "o", ".", "Registerer", ".", "MustRegister", "(", "m", ")", "\n", "}", "\n\n", "o", ".", "Metrics", ".", "iterationsMissed", ".", "Inc", "(", ")", "\n", "return", "m", "\n", "}" ]
16,399
all-16400
[ "Next", "invoke", "next", "route", "with", "the", "given", "ResponseWriter", "and", "Request" ]
[ "func", "(", "c", "*", "Context", ")", "Next", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ")", "{", "if", "c", ".", "route", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "next", ":=", "c", ".", "route", ".", "next", ";", "next", "!=", "nil", "{", "c", ".", "route", "=", "next", "\n", "next", ".", "ServeHTTPContext", "(", "w", ",", "r", ",", "c", ")", "\n", "}", "else", "{", "c", ".", "holdUp", "=", "true", "\n", "}", "\n", "}" ]