id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequence
pl_tokens
sequence
400
all-401
[ "expandClusterVMToolsMonitoringSettings", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterVmToolsMonitoringSettings", "." ]
[ "func", "expandClusterVMToolsMonitoringSettings", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "ClusterVmToolsMonitoringSettings", "{", "obj", ":=", "&", "<mask>", ".", "ClusterVmToolsMonitoringSettings", "{", "FailureInterval", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "MaxFailures", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "MaxFailureWindow", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "MinUpTime", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "VmMonitoring", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n\n", "return", "obj", "\n", "}" ]
401
all-402
[ "GetMessage", "returns", "the", "Message", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetMessage", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "Message", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Message", "\n", "}" ]
402
all-403
[ "Return", "a", "generic", "vertex", "attribute", "parameter" ]
[ "func", "GetVertexAttribLdv", "(", "<mask>", "uint32", ",", "pname", "uint32", ",", "params", "*", "float64", ")", "{", "syscall", ".", "Syscall", "(", "gpGetVertexAttribLdv", ",", "3", ",", "uintptr", "(", "index", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
403
all-404
[ "Sign", "creates", "a", "(", "non", "-", "detached", ")", "signature", "of", "input", "using", "keyIdentity", ".", "Fails", "with", "a", "SigningNotSupportedError", "if", "the", "mechanism", "does", "not", "support", "signing", "." ]
[ "func", "(", "m", "*", "gpgmeSigningMechanism", ")", "Sign", "(", "input", "[", "]", "byte", ",", "keyIdentity", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "key", ",", "err", ":=", "m", ".", "ctx", ".", "GetKey", "(", "keyIdentity", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "inputData", ",", "err", ":=", "gpgme", ".", "NewDataBytes", "(", "input", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "<mask>", "sigBuffer", "bytes", ".", "Buffer", "\n", "sigData", ",", "err", ":=", "gpgme", ".", "NewDataWriter", "(", "&", "sigBuffer", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "m", ".", "ctx", ".", "Sign", "(", "[", "]", "*", "gpgme", ".", "Key", "{", "key", "}", ",", "inputData", ",", "sigData", ",", "gpgme", ".", "SigModeNormal", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "sigBuffer", ".", "Bytes", "(", ")", ",", "nil", "\n", "}" ]
404
all-405
[ "SampleWithSeed", "picks", "n", "pseudo", "-", "randomly", "chosen", "input", "items", ".", "It", "uses", "seed", "as", "the", "argument", "for", "its", "random", "number", "generation", "and", "therefore", "different", "executions", "of", "SampleWithSeed", "with", "the", "same", "arguments", "will", "chose", "the", "same", "items", "." ]
[ "func", "SampleWithSeed", "(", "n", "int", ",", "seed", "int64", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "arg", "Arg", ")", "error", "{", "// Could speed this up by using Algorithm Z from Vitter.", "r", ":=", "rand", ".", "New", "(", "rand", ".", "NewSource", "(", "seed", ")", ")", "\n", "reservoir", ":=", "<mask>", "(", "[", "]", "string", ",", "0", ",", "n", ")", "\n", "i", ":=", "0", "\n", "for", "s", ":=", "range", "arg", ".", "In", "{", "if", "i", "<", "n", "{", "reservoir", "=", "append", "(", "reservoir", ",", "s", ")", "\n", "}", "else", "{", "j", ":=", "r", ".", "Intn", "(", "i", "+", "1", ")", "\n", "if", "j", "<", "n", "{", "reservoir", "[", "j", "]", "=", "s", "\n", "}", "\n", "}", "\n", "i", "++", "\n", "}", "\n", "for", "_", ",", "s", ":=", "range", "reservoir", "{", "arg", ".", "Out", "<-", "s", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
405
all-406
[ "GetItems", "implements", "the", "Collection", "interface" ]
[ "func", "(", "<mask>", "*", "ResourcesConfigCollection", ")", "GetItems", "(", ")", "[", "]", "Object", "{", "var", "items", "[", "]", "Object", "\n", "for", "_", ",", "i", ":=", "range", "in", ".", "Items", "{", "items", "=", "append", "(", "items", ",", "i", ")", "\n", "}", "\n", "return", "items", "\n", "}" ]
406
all-407
[ "NewDriver", "creates", "a", "new", "Hyper", "-", "v", "driver", "with", "default", "settings", "." ]
[ "func", "NewDriver", "(", "hostName", ",", "storePath", "string", ")", "*", "Driver", "{", "<mask>", "&", "Driver", "{", "DiskSize", ":", "defaultDiskSize", ",", "MemSize", ":", "defaultMemory", ",", "CPU", ":", "defaultCPU", ",", "DisableDynamicMemory", ":", "defaultDisableDynamicMemory", ",", "BaseDriver", ":", "&", "drivers", ".", "BaseDriver", "{", "MachineName", ":", "hostName", ",", "StorePath", ":", "storePath", ",", "}", ",", "}", "\n", "}" ]
407
all-408
[ "All", "the", "Read", "*", "functions", "below", "will", "panic", "if", "something", "goes", "wrong", ".", "ReadAt", "reads", "len", "(", "b", ")", "bytes", "at", "address", "a", "in", "the", "inferior", "and", "stores", "them", "in", "b", "." ]
[ "func", "(", "p", "*", "Process", ")", "ReadAt", "(", "b", "[", "]", "byte", ",", "a", "<mask>", ")", "{", "for", "{", "m", ":=", "p", ".", "findMapping", "(", "a", ")", "\n", "if", "m", "==", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", ")", ")", "\n", "}", "\n", "n", ":=", "copy", "(", "b", ",", "m", ".", "contents", "[", "a", ".", "Sub", "(", "m", ".", "min", ")", ":", "]", ")", "\n", "if", "n", "==", "len", "(", "b", ")", "{", "return", "\n", "}", "\n", "// Modify request to get data from the next mapping.", "b", "=", "b", "[", "n", ":", "]", "\n", "a", "=", "a", ".", "Add", "(", "int64", "(", "n", ")", ")", "\n", "}", "\n", "}" ]
408
all-409
[ "String", "returns", "the", "textual", "representation", "of", "this", "ByteCode" ]
[ "func", "(", "b", "*", "ByteCode", ")", "String", "(", ")", "string", "{", "buf", ":=", "rbpool", ".", "Get", "(", ")", "\n", "defer", "rbpool", ".", "Release", "(", "buf", ")", "\n\n", "fmt", ".", "Fprintf", "(", "buf", ",", "\"", "\\n", "\\n", "\"", ",", "b", ".", "Name", ",", "b", ".", "GeneratedOn", ",", ")", "\n", "for", "k", ",", "v", ":=", "<mask>", "b", ".", "OpList", "{", "fmt", ".", "Fprintf", "(", "buf", ",", "\"", "\\n", "\"", ",", "k", "+", "1", ",", "v", ")", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
409
all-410
[ "returns", "true", "if", "i", "before", "j" ]
[ "func", "before", "(", "i", ",", "j", "ScheduleItem", ")", "bool", "{", "iEnd", ":=", "i", ".", "Time", "(", ")", ".", "UnixNano", "(", ")", "+", "i", ".", "Duration", "(", ")", ".", "Nanoseconds", "(", ")", "\n", "jStart", ":=", "j", ".", "Time", "(", ")", ".", "UnixNano", "(", ")", "\n", "if", "i", ",", "ok", ":=", "i", ".", "(", "ScheduleItemWithTimestamp", ")", ";", "ok", "{", "if", "j", ",", "<mask>", ":=", "j", ".", "(", "ScheduleItemWithTimestamp", ")", ";", "ok", "{", "iEnd", "=", "i", ".", "Timestamp", "(", ")", "+", "i", ".", "Duration", "(", ")", ".", "Nanoseconds", "(", ")", "\n", "jStart", "=", "j", ".", "Timestamp", "(", ")", "\n", "}", "\n", "}", "\n", "return", "iEnd", "<", "jStart", "\n", "}" ]
410
all-411
[ "FetchEntity", "fetchs", "the", "given", "Identifiable", "from", "the", "server", "." ]
[ "func", "(", "s", "*", "Session", ")", "FetchEntity", "(", "object", "Identifiable", ")", "*", "Error", "{", "url", ",", "berr", ":=", "s", ".", "getPersonalURL", "(", "object", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "<mask>", ",", "berr", ":=", "s", ".", "send", "(", "request", ",", "nil", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n\n", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "response", ".", "Body", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "string", "(", "body", ")", ")", "\n\n", "arr", ":=", "IdentifiablesList", "{", "object", "}", "// trick for weird api..", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "&", "arr", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
411
all-412
[ "HasAggregation", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "Event", ")", "HasAggregation", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "Aggregation", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
412
all-413
[ "ObjectChange", "subscribes", "to", "changes", "for", "objects", "of", "a", "given", "type", "." ]
[ "func", "(", "h", "*", "Handler", ")", "ObjectChange", "(", "ctx", "context", ".", "Context", ",", "tkn", ",", "objectType", "string", ",", "objectIDs", "[", "]", "string", ")", "(", "*", "rpc", ".", "Subscription", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "objectType", ",", "\"", "\"", ",", "objectIDs", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "table", ",", "ok", ":=", "objectChangeTables", "[", "objectType", "]", "\n", "if", "!", "ok", "{", "logger", ".", "Warn", "(", "ErrBadObjectType", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrBadObjectType", "\n", "}", "\n\n", "ntf", ",", "ok", ":=", "rpc", ".", "NotifierFromContext", "(", "ctx", ")", "\n", "if", "!", "ok", "{", "logger", ".", "<mask>", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "sub", ":=", "ntf", ".", "CreateSubscription", "(", ")", "\n", "cb", ":=", "func", "(", "job", "*", "data", ".", "Job", ",", "result", "error", ")", "{", "obj", ",", "err", ":=", "h", ".", "db", ".", "FindByPrimaryKeyFrom", "(", "table", ",", "job", ".", "RelatedID", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "var", "odata", "json", ".", "RawMessage", "\n", "if", "obj", "!=", "nil", "{", "odata", ",", "err", "=", "json", ".", "Marshal", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "err", "=", "ntf", ".", "Notify", "(", "sub", ".", "ID", ",", "&", "ObjectChangeResult", "{", "odata", ",", "job", ",", "rpcsrv", ".", "ToError", "(", "result", ")", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "sid", ":=", "string", "(", "sub", ".", "ID", ")", "\n", "err", ":=", "h", ".", "queue", ".", "Subscribe", "(", "objectIDs", ",", "sid", ",", "cb", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "ErrInternal", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "for", "err", ",", "ok", ":=", "<-", "sub", ".", "Err", "(", ")", ";", "ok", ";", "{", "if", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "err", ":=", "h", ".", "queue", ".", "Unsubscribe", "(", "objectIDs", ",", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "sub", ",", "nil", "\n", "}" ]
413
all-414
[ "NewDisplayer", "creates", "a", "new", "displayer", "using", "the", "response", "body", "." ]
[ "func", "NewDisplayer", "(", "resp", "*", "http", ".", "Response", ")", "(", "*", "Displayer", ",", "error", ")", "{", "defer", "resp", ".", "<mask>", ".", "Close", "(", ")", "\n", "js", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "disp", ":=", "Displayer", "{", "response", ":", "resp", ",", "body", ":", "string", "(", "js", ")", "}", "\n", "if", "len", "(", "js", ")", ">", "2", "{", "err", "=", "json", ".", "Unmarshal", "(", "js", ",", "&", "disp", ".", "RawOutput", ")", "\n", "if", "err", "!=", "nil", "{", "disp", ".", "RawOutput", "=", "string", "(", "js", ")", "\n", "}", "\n", "}", "\n", "return", "&", "disp", ",", "nil", "\n", "}" ]
414
all-415
[ "SearchHosts", "searches", "through", "the", "hosts", "facet", "returning", "matching", "hostnames", "." ]
[ "func", "(", "client", "*", "Client", ")", "SearchHosts", "(", "search", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "out", "reqSearch", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "search", ",", "nil", ",", "&", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Results", ".", "Hosts", ",", "nil", "\n", "}" ]
415
all-416
[ "Element", "returns", "a", "value", "of", "a", "matrix", "at", "(", "i", "j", ")", "." ]
[ "func", "(", "g", "*", "GeoM", ")", "Element", "(", "i", ",", "j", "int", ")", "float64", "{", "switch", "{", "case", "i", "==", "0", "&&", "j", "==", "0", ":", "return", "float64", "(", "g", ".", "a_1", ")", "+", "1", "\n", "<mask>", "i", "==", "0", "&&", "j", "==", "1", ":", "return", "float64", "(", "g", ".", "b", ")", "\n", "case", "i", "==", "0", "&&", "j", "==", "2", ":", "return", "float64", "(", "g", ".", "tx", ")", "\n", "case", "i", "==", "1", "&&", "j", "==", "0", ":", "return", "float64", "(", "g", ".", "c", ")", "\n", "case", "i", "==", "1", "&&", "j", "==", "1", ":", "return", "float64", "(", "g", ".", "d_1", ")", "+", "1", "\n", "case", "i", "==", "1", "&&", "j", "==", "2", ":", "return", "float64", "(", "g", ".", "ty", ")", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
416
all-417
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListFloat32Option", ")", "Set", "(", "<mask>", "string", ")", "error", "{", "val", ":=", "Float32Option", "{", "}", "\n", "val", ".", "Set", "(", "value", ")", "\n", "*", "o", "=", "append", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
417
all-418
[ "Load", "loads", "JSON", "files", "from", "configPaths", ".", "and", "assigns", "decoded", "values", "into", "the", "conf", "value", "." ]
[ "func", "LoadJSON", "(", "conf", "<mask>", "{", "}", ",", "configPaths", "...", "string", ")", "error", "{", "return", "loadWithFunc", "(", "conf", ",", "configPaths", ",", "nil", ",", "json", ".", "Unmarshal", ")", "\n", "}" ]
418
all-419
[ "Timeout", "adds", "a", "timeout", "to", "a", "Check", ".", "If", "the", "underlying", "check", "takes", "longer", "than", "the", "timeout", "it", "returns", "an", "error", "." ]
[ "func", "Timeout", "(", "check", "Check", ",", "timeout", "<mask>", ".", "Duration", ")", "Check", "{", "return", "func", "(", ")", "error", "{", "c", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "c", "<-", "check", "(", ")", "}", "(", ")", "\n", "select", "{", "case", "err", ":=", "<-", "c", ":", "return", "err", "\n", "case", "<-", "time", ".", "After", "(", "timeout", ")", ":", "return", "timeoutError", "(", "timeout", ")", "\n", "}", "\n", "}", "\n", "}" ]
419
all-420
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "InspectMode", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
420
all-421
[ "GetSourceTypeOk", "returns", "a", "tuple", "with", "the", "SourceType", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "GetSourceTypeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "SourceType", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "SourceType", ",", "true", "\n", "}" ]
421
all-422
[ "FindSpace", "-" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "FindSpace", "(", "orgName", ",", "spaceName", "string", ")", "(", "cfclient", ".", "Space", ",", "error", ")", "{", "orgGUID", ",", "err", ":=", "m", ".", "OrgMgr", ".", "GetOrgGUID", "(", "orgName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "cfclient", ".", "Space", "{", "}", ",", "err", "\n", "}", "\n", "spaces", ",", "err", ":=", "m", ".", "ListSpaces", "(", "orgGUID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "cfclient", ".", "Space", "{", "}", ",", "err", "\n", "}", "\n", "for", "_", ",", "theSpace", ":=", "range", "spaces", "{", "if", "theSpace", ".", "Name", "==", "spaceName", "{", "return", "theSpace", ",", "nil", "\n", "}", "\n", "}", "\n", "if", "m", ".", "Peek", "{", "return", "cfclient", ".", "Space", "{", "<mask>", ":", "spaceName", ",", "Guid", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "spaceName", ")", ",", "OrganizationGuid", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "orgName", ")", ",", "}", ",", "nil", "\n", "}", "\n", "return", "cfclient", ".", "Space", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "spaceName", ",", "orgName", ")", "\n", "}" ]
422
all-423
[ "encodeContent", "writes", "out", "the", "content", "in", "the", "selected", "encoding", "." ]
[ "func", "(", "p", "*", "Part", ")", "encodeContent", "(", "b", "*", "bufio", ".", "Writer", ",", "cte", "transferEncoding", ")", "(", "err", "error", ")", "{", "switch", "cte", "{", "case", "teBase64", ":", "enc", ":=", "base64", ".", "StdEncoding", "\n", "text", ":=", "make", "(", "[", "]", "byte", ",", "enc", ".", "EncodedLen", "(", "len", "(", "p", ".", "Content", ")", ")", ")", "\n", "base64", ".", "StdEncoding", ".", "Encode", "(", "text", ",", "p", ".", "Content", ")", "\n", "// Wrap lines.", "lineLen", ":=", "76", "\n", "for", "len", "(", "text", ")", ">", "0", "{", "if", "lineLen", ">", "len", "(", "text", ")", "{", "lineLen", "=", "len", "(", "<mask>", ")", "\n", "}", "\n", "if", "_", ",", "err", "=", "b", ".", "Write", "(", "text", "[", ":", "lineLen", "]", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ".", "Write", "(", "crnl", ")", "\n", "text", "=", "text", "[", "lineLen", ":", "]", "\n", "}", "\n", "case", "teQuoted", ":", "qp", ":=", "quotedprintable", ".", "NewWriter", "(", "b", ")", "\n", "if", "_", ",", "err", "=", "qp", ".", "Write", "(", "p", ".", "Content", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "qp", ".", "Close", "(", ")", "\n", "default", ":", "_", ",", "err", "=", "b", ".", "Write", "(", "p", ".", "Content", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
423
all-424
[ "Finalize", "ensures", "the", "configuration", "has", "no", "nil", "pointers", "and", "sets", "default", "values", "." ]
[ "func", "(", "c", "*", "TemplateConfig", ")", "Finalize", "(", ")", "{", "if", "c", ".", "Backup", "==", "nil", "{", "c", ".", "Backup", "=", "Bool", "(", "false", ")", "\n", "}", "\n\n", "if", "c", ".", "Command", "==", "nil", "{", "c", ".", "Command", "=", "String", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "CommandTimeout", "==", "nil", "{", "c", ".", "CommandTimeout", "=", "TimeDuration", "(", "DefaultTemplateCommandTimeout", ")", "\n", "}", "\n\n", "if", "c", ".", "Contents", "==", "nil", "{", "c", ".", "Contents", "=", "String", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "CreateDestDirs", "==", "nil", "{", "c", ".", "CreateDestDirs", "=", "Bool", "(", "true", ")", "\n", "}", "\n\n", "if", "c", ".", "Destination", "==", "nil", "{", "c", ".", "Destination", "=", "<mask>", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "ErrMissingKey", "==", "nil", "{", "c", ".", "ErrMissingKey", "=", "Bool", "(", "false", ")", "\n", "}", "\n\n", "if", "c", ".", "Exec", "==", "nil", "{", "c", ".", "Exec", "=", "DefaultExecConfig", "(", ")", "\n", "}", "\n\n", "// Backwards compat for specifying command directly", "if", "c", ".", "Exec", ".", "Command", "==", "nil", "&&", "c", ".", "Command", "!=", "nil", "{", "c", ".", "Exec", ".", "Command", "=", "c", ".", "Command", "\n", "}", "\n", "if", "c", ".", "Exec", ".", "Timeout", "==", "nil", "&&", "c", ".", "CommandTimeout", "!=", "nil", "{", "c", ".", "Exec", ".", "Timeout", "=", "c", ".", "CommandTimeout", "\n", "}", "\n", "c", ".", "Exec", ".", "Finalize", "(", ")", "\n\n", "if", "c", ".", "Perms", "==", "nil", "{", "c", ".", "Perms", "=", "FileMode", "(", "0", ")", "\n", "}", "\n\n", "if", "c", ".", "Source", "==", "nil", "{", "c", ".", "Source", "=", "String", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "Wait", "==", "nil", "{", "c", ".", "Wait", "=", "DefaultWaitConfig", "(", ")", "\n", "}", "\n", "c", ".", "Wait", ".", "Finalize", "(", ")", "\n\n", "if", "c", ".", "LeftDelim", "==", "nil", "{", "c", ".", "LeftDelim", "=", "String", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "c", ".", "RightDelim", "==", "nil", "{", "c", ".", "RightDelim", "=", "String", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
424
all-425
[ "Inhibited", "is", "a", "wrapper", "around", "gtk_application_inhibit", "()", "." ]
[ "func", "(", "v", "*", "Application", ")", "Inhibited", "(", "w", "*", "Window", ",", "flags", "ApplicationInhibitFlags", ",", "reason", "string", ")", "uint", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "<mask>", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "return", "uint", "(", "C", ".", "gtk_application_inhibit", "(", "v", ".", "native", "(", ")", ",", "w", ".", "native", "(", ")", ",", "C", ".", "GtkApplicationInhibitFlags", "(", "flags", ")", ",", "cstr1", ")", ")", "\n", "}" ]
425
all-426
[ "paranoidUnmarshalJSONObject", "unmarshals", "data", "as", "a", "JSON", "object", "but", "failing", "on", "the", "slightest", "unexpected", "aspect", "(", "including", "duplicated", "keys", "unrecognized", "keys", "and", "non", "-", "matching", "types", ")", ".", "Each", "of", "the", "fields", "in", "exactFields", "must", "be", "present", "exactly", "once", "and", "none", "other", "fields", "are", "accepted", "." ]
[ "func", "paranoidUnmarshalJSONObjectExactFields", "(", "data", "[", "]", "byte", ",", "exactFields", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "seenKeys", ":=", "map", "[", "string", "]", "struct", "{", "}", "{", "}", "\n", "if", "err", ":=", "paranoidUnmarshalJSONObject", "(", "data", ",", "func", "(", "key", "string", ")", "interface", "{", "}", "{", "if", "valuePtr", ",", "ok", ":=", "exactFields", "[", "key", "]", ";", "ok", "{", "seenKeys", "[", "key", "]", "=", "struct", "{", "}", "{", "}", "\n", "return", "valuePtr", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "key", ":=", "<mask>", "exactFields", "{", "if", "_", ",", "ok", ":=", "seenKeys", "[", "key", "]", ";", "!", "ok", "{", "return", "jsonFormatError", "(", "fmt", ".", "Sprintf", "(", "`Key \"%s\" missing in a JSON object`", ",", "key", ")", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
426
all-427
[ "GetEditable", "is", "a", "wrapper", "around", "gtk_text_view_get_editable", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "GetEditable", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_text_view_get_editable", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
427
all-428
[ "ToQueryResult", "builds", "a", "QueryResult", "proto", "." ]
[ "func", "ToQueryResult", "(", "ss", "storage", ".", "SeriesSet", ",", "sampleLimit", "int", ")", "(", "*", "prompb", ".", "QueryResult", ",", "error", ")", "{", "numSamples", ":=", "0", "\n", "resp", ":=", "&", "prompb", ".", "QueryResult", "{", "}", "\n", "for", "ss", ".", "Next", "(", ")", "{", "series", ":=", "ss", ".", "At", "(", ")", "\n", "iter", ":=", "<mask>", ".", "Iterator", "(", ")", "\n", "samples", ":=", "[", "]", "prompb", ".", "Sample", "{", "}", "\n\n", "for", "iter", ".", "Next", "(", ")", "{", "numSamples", "++", "\n", "if", "sampleLimit", ">", "0", "&&", "numSamples", ">", "sampleLimit", "{", "return", "nil", ",", "HTTPError", "{", "msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sampleLimit", ")", ",", "status", ":", "http", ".", "StatusBadRequest", ",", "}", "\n", "}", "\n", "ts", ",", "val", ":=", "iter", ".", "At", "(", ")", "\n", "samples", "=", "append", "(", "samples", ",", "prompb", ".", "Sample", "{", "Timestamp", ":", "ts", ",", "Value", ":", "val", ",", "}", ")", "\n", "}", "\n", "if", "err", ":=", "iter", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "resp", ".", "Timeseries", "=", "append", "(", "resp", ".", "Timeseries", ",", "&", "prompb", ".", "TimeSeries", "{", "Labels", ":", "labelsToLabelsProto", "(", "series", ".", "Labels", "(", ")", ")", ",", "Samples", ":", "samples", ",", "}", ")", "\n", "}", "\n", "if", "err", ":=", "ss", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "resp", ",", "nil", "\n", "}" ]
428
all-429
[ "MultiPartBody", "-" ]
[ "func", "MultiPartBody", "(", "paramName", ",", "filename", "string", ",", "fileRef", "io", ".", "Reader", ",", "params", "map", "[", "string", "]", "string", ")", "(", "body", "io", ".", "ReadWriter", ",", "contentType", "string", ",", "err", "error", ")", "{", "var", "part", "io", ".", "Writer", "\n\n", "body", "=", "&", "<mask>", ".", "Buffer", "{", "}", "\n", "writer", ":=", "multipart", ".", "NewWriter", "(", "body", ")", "\n\n", "if", "part", ",", "err", "=", "writer", ".", "CreateFormFile", "(", "paramName", ",", "filename", ")", ";", "err", "==", "nil", "{", "if", "_", ",", "err", "=", "io", ".", "Copy", "(", "part", ",", "fileRef", ")", ";", "err", "==", "nil", "{", "for", "key", ",", "val", ":=", "range", "params", "{", "_", "=", "writer", ".", "WriteField", "(", "key", ",", "val", ")", "\n", "}", "\n", "contentType", "=", "writer", ".", "FormDataContentType", "(", ")", "\n", "writer", ".", "Close", "(", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
429
all-430
[ "attach", "multiple", "buffer", "objects", "to", "a", "vertex", "array", "object" ]
[ "func", "BindVertexBuffers", "(", "first", "uint32", ",", "count", "int32", ",", "buffers", "*", "uint32", ",", "offsets", "*", "int", ",", "strides", "*", "int32", ")", "{", "C", ".", "glowBindVertexBuffers", "(", "gpBindVertexBuffers", ",", "(", "C", ".", "GLuint", ")", "(", "first", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "buffers", ")", ")", ",", "(", "*", "C", ".", "GLintptr", ")", "(", "unsafe", ".", "Pointer", "(", "offsets", ")", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "strides", ")", ")", ")", "\n", "}" ]
430
all-431
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ValueSourceType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
431
all-432
[ "PSCRemoveServiceOffering", "calls", "removeServiceOffering", "method", "of", "Privatix", "service", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PSCRemoveServiceOffering", "(", "opts", "*", "bind", ".", "TransactOpts", ",", "offeringHash", "[", "32", "]", "<mask>", ")", "(", "*", "types", ".", "Transaction", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "tx", ",", "err", ":=", "b", ".", "psc", ".", "RemoveServiceOffering", "(", "opts", ",", "offeringHash", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "tx", ",", "err", "\n", "}" ]
432
all-433
[ "TimeoutWriter", "returns", "an", "io", ".", "Writer", "that", "wraps", "the", "passed", "-", "in", "io", ".", "Writer", ".", "If", "the", "underlying", "Writer", "fails", "to", "write", "within", "the", "alloted", "timeout", "ErrTimeout", "is", "returned", "." ]
[ "func", "TimeoutWriter", "(", "w", "io", ".", "Writer", ",", "timeout", "time", ".", "Duration", ")", "io", ".", "<mask>", "{", "return", "timeoutReaderWriterCloser", "{", "w", ":", "w", ",", "d", ":", "timeout", "}", "\n", "}" ]
433
all-434
[ "StatusString", "returns", "the", "string", "of", "the", "cgroup", "resource", "status" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "StatusString", "(", "status", "resourcestatus", ".", "ResourceStatus", ")", "string", "{", "return", "CgroupStatus", "(", "status", ")", ".", "<mask>", "(", ")", "\n", "}" ]
434
all-435
[ "Enumerate", "creates", "a", "new", "instance", "of", "Enumerable", "which", "can", "be", "executed", "on", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "Enumerate", "(", "cancel", "<-", "chan", "struct", "{", "}", ")", "Enumerator", "{", "retval", ":=", "make", "(", "chan", "interface", "{", "}", ")", "\n\n", "go", "func", "(", ")", "{", "list", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "list", ".", "key", ".", "RUnlock", "(", ")", "\n", "defer", "close", "(", "retval", ")", "\n\n", "current", ":=", "list", ".", "first", "\n", "for", "current", "!=", "nil", "{", "select", "{", "case", "retval", "<-", "<mask>", ".", "payload", ":", "break", "\n", "case", "<-", "cancel", ":", "return", "\n", "}", "\n", "current", "=", "current", ".", "next", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "retval", "\n", "}" ]
435
all-436
[ "NewEnvironmentBrowser", "initializes", "a", "new", "EnvironmentBrowser", "based", "off", "the", "supplied", "managed", "object", "reference", "." ]
[ "func", "NewEnvironmentBrowser", "(", "c", "*", "vim25", ".", "Client", ",", "<mask>", "types", ".", "ManagedObjectReference", ")", "*", "EnvironmentBrowser", "{", "return", "&", "EnvironmentBrowser", "{", "Common", ":", "object", ".", "NewCommon", "(", "c", ",", "ref", ")", ",", "}", "\n", "}" ]
436
all-437
[ "String", "returns", "key", "=", "val", "format", "of", "the", "environment", "variables", ".", "Each", "on", "a", "line", "." ]
[ "func", "(", "e", "EnvVar", ")", "String", "(", ")", "string", "{", "b", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "for", "_", ",", "env", ":=", "<mask>", "e", "{", "// don't include invalid strings", "if", "len", "(", "strings", ".", "SplitN", "(", "env", ",", "\"", "\"", ",", "2", ")", ")", "<", "2", "{", "continue", "\n", "}", "\n", "fmt", ".", "Fprintln", "(", "b", ",", "env", ")", "\n", "}", "\n", "return", "b", ".", "String", "(", ")", "\n", "}" ]
437
all-438
[ "HasNewId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Dashboard", ")", "HasNewId", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "NewId", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
438
all-439
[ "Create", "takes", "the", "representation", "of", "a", "prowJob", "and", "creates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "prowJob", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Create", "(", "prowJob", "*", "prowjobsv1", ".", "ProwJob", ")", "(", "<mask>", "*", "prowjobsv1", ".", "ProwJob", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewCreateAction", "(", "prowjobsResource", ",", "c", ".", "ns", ",", "prowJob", ")", ",", "&", "prowjobsv1", ".", "ProwJob", "{", "}", ")", "\n\n", "if", "obj", "==", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "obj", ".", "(", "*", "prowjobsv1", ".", "ProwJob", ")", ",", "err", "\n", "}" ]
439
all-440
[ "SetLeftMargin", "is", "a", "wrapper", "around", "gtk_text_view_set_left_margin", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "SetLeftMargin", "(", "margin", "int", ")", "{", "C", ".", "gtk_text_view_set_left_margin", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
440
all-441
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "Docker", "ImageReference", "." ]
[ "func", "ParseReference", "(", "refString", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "if", "refString", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "refString", ")", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "SplitN", "(", "refString", ",", "\"", "\"", ",", "2", ")", "\n", "path", ":=", "parts", "[", "0", "]", "\n", "var", "destinationRef", "reference", ".", "NamedTagged", "\n\n", "// A :tag was specified, which is only necessary for destinations.", "if", "len", "(", "parts", ")", "==", "2", "{", "ref", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "parts", "[", "1", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "ref", "=", "reference", ".", "TagNameOnly", "(", "ref", ")", "\n\n", "if", "_", ",", "isDigest", ":=", "ref", ".", "(", "reference", ".", "Canonical", ")", ";", "isDigest", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "refString", ")", "\n", "}", "\n\n", "refTagged", ",", "isTagged", ":=", "ref", ".", "(", "reference", ".", "NamedTagged", ")", "\n", "if", "!", "isTagged", "{", "// Really shouldn't be hit...", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "refString", ")", "\n", "}", "\n", "destinationRef", "=", "refTagged", "\n", "}", "\n\n", "return", "archiveReference", "{", "destinationRef", ":", "destinationRef", ",", "path", ":", "<mask>", ",", "}", ",", "nil", "\n", "}" ]
441
all-442
[ "ExecNode", "is", "like", "Exec", "except", "it", "will", "attempt", "to", "return", "the", "result", "as", "a", "node", "-", "set", "." ]
[ "func", "(", "xp", "XPathExec", ")", "ExecNode", "(", "t", "tree", ".", "Node", ",", "opts", "...", "FuncOpts", ")", "(", "tree", ".", "NodeSet", ",", "error", ")", "{", "res", ",", "err", ":=", "xp", ".", "Exec", "(", "t", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "n", ",", "ok", ":=", "<mask>", ".", "(", "tree", ".", "NodeSet", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "n", ",", "nil", "\n", "}" ]
442
all-443
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "InstanceType", ")", "Locator", "(", "api", "*", "API", ")", "*", "InstanceTypeLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "InstanceTypeLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
443
all-444
[ "Reset", "unstucks", "a", "type", "of", "stale", "resource", "to", "a", "new", "state", ".", "In", ":", "rtype", "-", "type", "of", "the", "resource", "state", "-", "current", "state", "of", "the", "resource", "expire", "-", "duration", "before", "resource", "s", "last", "update", "dest", "-", "destination", "state", "of", "expired", "resources", "Out", ":", "map", "of", "resource", "name", "-", "resource", "owner", "." ]
[ "func", "(", "r", "*", "Ranch", ")", "Reset", "(", "rtype", ",", "state", "string", ",", "expire", "time", ".", "Duration", ",", "dest", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "r", ".", "resourcesLock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "resourcesLock", ".", "Unlock", "(", ")", "\n\n", "ret", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n\n", "resources", ",", "err", ":=", "r", ".", "Storage", ".", "GetResources", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "idx", ":=", "range", "resources", "{", "res", ":=", "resources", "[", "idx", "]", "\n", "if", "rtype", "==", "res", ".", "Type", "&&", "state", "==", "res", ".", "State", "&&", "res", ".", "Owner", "!=", "\"", "\"", "{", "if", "time", ".", "Since", "(", "res", ".", "LastUpdate", ")", ">", "expire", "{", "res", ".", "LastUpdate", "=", "r", ".", "UpdateTime", "(", ")", "\n", "ret", "[", "res", ".", "Name", "]", "=", "res", ".", "Owner", "\n", "res", ".", "Owner", "=", "\"", "\"", "\n", "res", ".", "State", "=", "dest", "\n", "if", "err", ":=", "r", ".", "Storage", ".", "UpdateResource", "(", "res", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Name", ")", "\n", "return", "<mask>", ",", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "ret", ",", "nil", "\n", "}" ]
444
all-445
[ "GetPipelineInfo", "retrieves", "and", "returns", "a", "valid", "PipelineInfo", "from", "PFS", ".", "It", "does", "the", "PFS", "read", "/", "unmarshalling", "of", "bytes", "as", "well", "as", "filling", "in", "missing", "fields" ]
[ "func", "GetPipelineInfo", "(", "pachClient", "*", "client", ".", "APIClient", ",", "ptr", "*", "pps", ".", "EtcdPipelineInfo", ",", "full", "bool", ")", "(", "*", "pps", ".", "PipelineInfo", ",", "error", ")", "{", "result", ":=", "&", "pps", ".", "PipelineInfo", "{", "}", "\n", "if", "full", "{", "buf", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "if", "err", ":=", "pachClient", ".", "GetFile", "(", "ppsconsts", ".", "SpecRepo", ",", "ptr", ".", "SpecCommit", ".", "<mask>", ",", "ppsconsts", ".", "SpecFile", ",", "0", ",", "0", ",", "&", "buf", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "result", ".", "Unmarshal", "(", "buf", ".", "Bytes", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "result", ".", "State", "=", "ptr", ".", "State", "\n", "result", ".", "Reason", "=", "ptr", ".", "Reason", "\n", "result", ".", "JobCounts", "=", "ptr", ".", "JobCounts", "\n", "result", ".", "LastJobState", "=", "ptr", ".", "LastJobState", "\n", "result", ".", "SpecCommit", "=", "ptr", ".", "SpecCommit", "\n", "return", "result", ",", "nil", "\n", "}" ]
445
all-446
[ "Snapshot", "creates", "a", "new", "ZFS", "snapshot", "of", "the", "receiving", "dataset", "using", "the", "specified", "name", ".", "Optionally", "the", "snapshot", "can", "be", "taken", "recursively", "creating", "snapshots", "of", "all", "descendent", "filesystems", "in", "a", "single", "atomic", "operation", "." ]
[ "func", "(", "d", "*", "Dataset", ")", "Snapshot", "(", "<mask>", "string", ",", "recursive", "bool", ")", "(", "*", "Dataset", ",", "error", ")", "{", "args", ":=", "make", "(", "[", "]", "string", ",", "1", ",", "4", ")", "\n", "args", "[", "0", "]", "=", "\"", "\"", "\n", "if", "recursive", "{", "args", "=", "append", "(", "args", ",", "\"", "\"", ")", "\n", "}", "\n", "snapName", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "Name", ",", "name", ")", "\n", "args", "=", "append", "(", "args", ",", "snapName", ")", "\n", "_", ",", "err", ":=", "zfs", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "GetDataset", "(", "snapName", ")", "\n", "}" ]
446
all-447
[ "assignStmt", "emits", "code", "to", "fn", "for", "a", "parallel", "assignment", "of", "rhss", "to", "lhss", ".", "isDef", "is", "true", "if", "this", "is", "a", "short", "variable", "declaration", "(", ":", "=", ")", ".", "Note", "the", "similarity", "with", "localValueSpec", "." ]
[ "func", "(", "b", "*", "builder", ")", "assignStmt", "(", "fn", "*", "Function", ",", "lhss", ",", "rhss", "[", "]", "ast", ".", "Expr", ",", "isDef", "bool", ")", "{", "// Side effects of all LHSs and RHSs must occur in left-to-right order.", "lvals", ":=", "make", "(", "[", "]", "lvalue", ",", "len", "(", "lhss", ")", ")", "\n", "isZero", ":=", "make", "(", "[", "]", "bool", ",", "len", "(", "lhss", ")", ")", "\n", "for", "i", ",", "lhs", ":=", "range", "lhss", "{", "<mask>", "lval", "lvalue", "=", "blank", "{", "}", "\n", "if", "!", "isBlankIdent", "(", "lhs", ")", "{", "if", "isDef", "{", "if", "obj", ":=", "fn", ".", "Pkg", ".", "info", ".", "Defs", "[", "lhs", ".", "(", "*", "ast", ".", "Ident", ")", "]", ";", "obj", "!=", "nil", "{", "fn", ".", "addNamedLocal", "(", "obj", ")", "\n", "isZero", "[", "i", "]", "=", "true", "\n", "}", "\n", "}", "\n", "lval", "=", "b", ".", "addr", "(", "fn", ",", "lhs", ",", "false", ")", "// non-escaping", "\n", "}", "\n", "lvals", "[", "i", "]", "=", "lval", "\n", "}", "\n", "if", "len", "(", "lhss", ")", "==", "len", "(", "rhss", ")", "{", "// Simple assignment: x = f() (!isDef)", "// Parallel assignment: x, y = f(), g() (!isDef)", "// or short var decl: x, y := f(), g() (isDef)", "//", "// In all cases, the RHSs may refer to the LHSs,", "// so we need a storebuf.", "var", "sb", "storebuf", "\n", "for", "i", ":=", "range", "rhss", "{", "b", ".", "assign", "(", "fn", ",", "lvals", "[", "i", "]", ",", "rhss", "[", "i", "]", ",", "isZero", "[", "i", "]", ",", "&", "sb", ")", "\n", "}", "\n", "sb", ".", "emit", "(", "fn", ")", "\n", "}", "else", "{", "// e.g. x, y = pos()", "tuple", ":=", "b", ".", "exprN", "(", "fn", ",", "rhss", "[", "0", "]", ")", "\n", "emitDebugRef", "(", "fn", ",", "rhss", "[", "0", "]", ",", "tuple", ",", "false", ")", "\n", "for", "i", ",", "lval", ":=", "range", "lvals", "{", "lval", ".", "store", "(", "fn", ",", "emitExtract", "(", "fn", ",", "tuple", ",", "i", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
447
all-448
[ "Infof", "logs", "provided", "message", "with", "formatting", "in", "INFO", "level", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "Infof", "(", "format", "string", ",", "a", "...", "<mask>", "{", "}", ")", "{", "logger", ".", "log", "(", "INFO", ",", "format", ",", "a", "...", ")", "\n", "}" ]
448
all-449
[ "/", "*", "Interrupt", "sends", "the", "SIGINT", "signal", "to", "all", "the", "processes", "started", "by", "Run", ".", "It", "does", "not", "wait", "for", "the", "processes", "to", "exit", "." ]
[ "func", "Interrupt", "(", ")", "{", "trackedSessionsMutex", ".", "Lock", "(", ")", "\n", "defer", "trackedSessionsMutex", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "session", ":=", "<mask>", "trackedSessions", "{", "session", ".", "Interrupt", "(", ")", "\n", "}", "\n", "}" ]
449
all-450
[ "ipAddrsForVirtualMachines", "takes", "a", "set", "of", "virtual", "machines", "and", "returns", "a", "consolidated", "list", "of", "IP", "addresses", "for", "all", "of", "the", "VMs", "." ]
[ "func", "ipAddrsForVirtualMachines", "(", "ctx", "context", ".", "Context", ",", "client", "*", "vSphereClient", ",", "vms", "[", "]", "*", "object", ".", "VirtualMachine", ")", "(", "[", "]", "string", ",", "error", ")", "{", "<mask>", "addrs", "[", "]", "string", "\n", "for", "_", ",", "vm", ":=", "range", "vms", "{", "as", ",", "err", ":=", "buildAndSelectGuestIPs", "(", "ctx", ",", "vm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "addrs", "=", "append", "(", "addrs", ",", "as", "...", ")", "\n", "}", "\n", "return", "addrs", ",", "nil", "\n", "}" ]
450
all-451
[ "Like", "UnmarshalBinaryBare", "but", "will", "first", "decode", "the", "byte", "-", "length", "prefix", ".", "UnmarshalBinaryLengthPrefixed", "will", "panic", "if", "ptr", "is", "a", "nil", "-", "pointer", ".", "Returns", "an", "error", "if", "not", "all", "of", "bz", "is", "consumed", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "UnmarshalBinaryLengthPrefixed", "(", "bz", "[", "]", "byte", ",", "ptr", "<mask>", "{", "}", ")", "error", "{", "if", "len", "(", "bz", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Read byte-length prefix.", "u64", ",", "n", ":=", "binary", ".", "Uvarint", "(", "bz", ")", "\n", "if", "n", "<", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "if", "u64", ">", "uint64", "(", "len", "(", "bz", ")", "-", "n", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "u64", ",", "len", "(", "bz", ")", "-", "n", ")", "\n", "}", "else", "if", "u64", "<", "uint64", "(", "len", "(", "bz", ")", "-", "n", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "u64", ",", "len", "(", "bz", ")", "-", "n", ")", "\n", "}", "\n", "bz", "=", "bz", "[", "n", ":", "]", "\n\n", "// Decode.", "return", "cdc", ".", "UnmarshalBinaryBare", "(", "bz", ",", "ptr", ")", "\n", "}" ]
451
all-452
[ "CreateNamedTemporaryCredentials", "generates", "temporary", "credentials", "from", "permanent", "credentials", "valid", "for", "the", "given", "duration", "starting", "immediately", ".", "The", "temporary", "credentials", "scopes", "must", "be", "a", "subset", "of", "the", "permanent", "credentials", "scopes", ".", "The", "duration", "may", "not", "be", "more", "than", "31", "days", ".", "Any", "authorized", "scopes", "of", "the", "permanent", "credentials", "will", "be", "passed", "through", "as", "authorized", "scopes", "to", "the", "temporary", "credentials", "but", "will", "not", "be", "restricted", "via", "the", "certificate", ".", "Note", "that", "the", "auth", "service", "already", "applies", "a", "5", "minute", "clock", "skew", "to", "the", "start", "and", "expiry", "times", "in", "https", ":", "//", "github", ".", "com", "/", "taskcluster", "/", "taskcluster", "-", "auth", "/", "pull", "/", "117", "so", "no", "clock", "skew", "is", "applied", "in", "this", "method", "nor", "should", "be", "applied", "by", "the", "caller", ".", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "docs", "/", "manual", "/", "design", "/", "apis", "/", "hawk", "/", "temporary", "-", "credentials" ]
[ "func", "(", "permaCreds", "*", "Credentials", ")", "CreateNamedTemporaryCredentials", "(", "tempClientID", "string", ",", "duration", "time", ".", "Duration", ",", "scopes", "...", "string", ")", "(", "tempCreds", "*", "Credentials", ",", "err", "error", ")", "{", "if", "duration", ">", "31", "*", "24", "*", "time", ".", "Hour", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "duration", ".", "<mask>", "(", ")", "+", "\"", "\"", ")", "\n", "}", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "start", ":=", "now", "\n", "expiry", ":=", "now", ".", "Add", "(", "duration", ")", "\n\n", "if", "permaCreds", ".", "ClientID", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "permaCreds", ".", "AccessToken", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "permaCreds", ".", "Certificate", "!=", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cert", ":=", "&", "Certificate", "{", "Version", ":", "1", ",", "Scopes", ":", "scopes", ",", "Start", ":", "start", ".", "UnixNano", "(", ")", "/", "1e6", ",", "Expiry", ":", "expiry", ".", "UnixNano", "(", ")", "/", "1e6", ",", "Seed", ":", "slugid", ".", "V4", "(", ")", "+", "slugid", ".", "V4", "(", ")", ",", "Signature", ":", "\"", "\"", ",", "// gets set in Sign() method below", "}", "\n", "// include the issuer iff this is a named credential", "if", "tempClientID", "!=", "\"", "\"", "{", "cert", ".", "Issuer", "=", "permaCreds", ".", "ClientID", "\n", "}", "\n\n", "cert", ".", "Sign", "(", "permaCreds", ".", "AccessToken", ",", "tempClientID", ")", "\n\n", "certBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "tempAccessToken", ",", "err", ":=", "generateTemporaryAccessToken", "(", "permaCreds", ".", "AccessToken", ",", "cert", ".", "Seed", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "tempCreds", "=", "&", "Credentials", "{", "ClientID", ":", "permaCreds", ".", "ClientID", ",", "AccessToken", ":", "tempAccessToken", ",", "Certificate", ":", "string", "(", "certBytes", ")", ",", "AuthorizedScopes", ":", "permaCreds", ".", "AuthorizedScopes", ",", "}", "\n", "if", "tempClientID", "!=", "\"", "\"", "{", "tempCreds", ".", "ClientID", "=", "tempClientID", "\n", "}", "\n\n", "return", "\n", "}" ]
452
all-453
[ "AppendBodyString", "appends", "s", "to", "response", "body", "." ]
[ "func", "(", "resp", "*", "<mask>", ")", "AppendBodyString", "(", "s", "string", ")", "{", "resp", ".", "closeBodyStream", "(", ")", "\n", "resp", ".", "bodyBuffer", "(", ")", ".", "WriteString", "(", "s", ")", "\n", "}" ]
453
all-454
[ "WithFromKey", "specifies", "the", "range", "of", "Get", "Delete", "Watch", "requests", "to", "be", "equal", "or", "greater", "than", "the", "key", "in", "the", "argument", "." ]
[ "func", "WithFromKey", "(", ")", "OpOption", "{", "return", "func", "(", "op", "*", "Op", ")", "{", "if", "len", "(", "op", ".", "key", ")", "==", "0", "{", "op", ".", "key", "=", "[", "]", "byte", "{", "0", "}", "\n", "}", "\n", "op", ".", "<mask>", "=", "[", "]", "byte", "(", "\"", "\\x00", "\"", ")", "\n", "}", "\n", "}" ]
454
all-455
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Task", ")", "Locator", "(", "api", "*", "API", ")", "*", "TaskLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "TaskLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
455
all-456
[ "Start", "starts", "the", "specified", "command", "but", "does", "not", "wait", "for", "it", "to", "complete", ".", "The", "Wait", "method", "will", "return", "the", "exit", "code", "and", "release", "associated", "resources", "once", "the", "command", "exits", "." ]
[ "func", "(", "c", "*", "Cmd", ")", "Start", "(", ")", "error", "{", "if", "c", ".", "lookPathErr", "!=", "nil", "{", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "c", ".", "lookPathErr", "\n", "}", "\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "lp", ",", "err", ":=", "lookExtensions", "(", "c", ".", "Path", ",", "c", ".", "Dir", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "err", "\n", "}", "\n", "c", ".", "Path", "=", "lp", "\n", "}", "\n", "if", "c", ".", "Process", "!=", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "ctx", "!=", "nil", "{", "select", "{", "case", "<-", "c", ".", "ctx", ".", "Done", "(", ")", ":", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "c", ".", "ctx", ".", "Err", "(", ")", "\n", "default", ":", "}", "\n", "}", "\n\n", "type", "F", "func", "(", "*", "Cmd", ")", "(", "*", "os", ".", "<mask>", ",", "error", ")", "\n", "for", "_", ",", "setupFd", ":=", "range", "[", "]", "F", "{", "(", "*", "Cmd", ")", ".", "stdin", ",", "(", "*", "Cmd", ")", ".", "stdout", ",", "(", "*", "Cmd", ")", ".", "stderr", "}", "{", "fd", ",", "err", ":=", "setupFd", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "err", "\n", "}", "\n", "c", ".", "childFiles", "=", "append", "(", "c", ".", "childFiles", ",", "fd", ")", "\n", "}", "\n", "c", ".", "childFiles", "=", "append", "(", "c", ".", "childFiles", ",", "c", ".", "ExtraFiles", "...", ")", "\n\n", "var", "err", "error", "\n", "c", ".", "Process", ",", "err", "=", "os", ".", "StartProcess", "(", "c", ".", "Path", ",", "c", ".", "argv", "(", ")", ",", "&", "os", ".", "ProcAttr", "{", "Dir", ":", "c", ".", "Dir", ",", "Files", ":", "c", ".", "childFiles", ",", "Env", ":", "dedupEnv", "(", "c", ".", "envv", "(", ")", ")", ",", "Sys", ":", "c", ".", "SysProcAttr", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterWait", ")", "\n", "return", "err", "\n", "}", "\n\n", "c", ".", "closeDescriptors", "(", "c", ".", "closeAfterStart", ")", "\n\n", "c", ".", "errch", "=", "make", "(", "chan", "error", ",", "len", "(", "c", ".", "goroutine", ")", ")", "\n", "for", "_", ",", "fn", ":=", "range", "c", ".", "goroutine", "{", "go", "func", "(", "fn", "func", "(", ")", "error", ")", "{", "c", ".", "errch", "<-", "fn", "(", ")", "\n", "}", "(", "fn", ")", "\n", "}", "\n\n", "if", "c", ".", "ctx", "!=", "nil", "{", "c", ".", "waitDone", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "go", "func", "(", ")", "{", "select", "{", "case", "<-", "c", ".", "ctx", ".", "Done", "(", ")", ":", "c", ".", "Process", ".", "Kill", "(", ")", "\n", "case", "<-", "c", ".", "waitDone", ":", "}", "\n", "}", "(", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
456
all-457
[ "RegisterHandlerForIdentity", "registers", "the", "given", "EventHandler", "for", "the", "given", "Entity", "Identity", ".", "You", "can", "pass", "the", "bambou", ".", "AllIdentity", "as", "identity", "to", "register", "the", "handler", "for", "all", "events", ".", "If", "you", "pass", "a", "handler", "for", "an", "Identity", "that", "is", "already", "registered", "the", "previous", "handler", "will", "be", "silently", "overwriten", "." ]
[ "func", "(", "p", "*", "PushCenter", ")", "RegisterHandlerForIdentity", "(", "handler", "EventHandler", ",", "identity", "Identity", ")", "{", "if", "identity", ".", "<mask>", "==", "AllIdentity", ".", "Name", "{", "p", ".", "defaultHander", "=", "handler", "\n", "return", "\n", "}", "\n\n", "p", ".", "handlers", "[", "identity", ".", "Name", "]", "=", "handler", "\n", "}" ]
457
all-458
[ "UpdateJobState", "performs", "the", "operations", "involved", "with", "a", "job", "state", "transition", "." ]
[ "func", "UpdateJobState", "(", "pipelines", "col", ".", "ReadWriteCollection", ",", "jobs", "col", ".", "ReadWriteCollection", ",", "jobPtr", "*", "pps", ".", "EtcdJobInfo", ",", "state", "pps", ".", "JobState", ",", "reason", "string", ")", "error", "{", "// Update pipeline", "pipelinePtr", ":=", "&", "pps", ".", "EtcdPipelineInfo", "{", "}", "\n", "if", "err", ":=", "pipelines", ".", "Get", "(", "jobPtr", ".", "Pipeline", ".", "Name", ",", "pipelinePtr", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "pipelinePtr", ".", "JobCounts", "==", "nil", "{", "pipelinePtr", ".", "JobCounts", "=", "<mask>", "(", "map", "[", "int32", "]", "int32", ")", "\n", "}", "\n", "if", "pipelinePtr", ".", "JobCounts", "[", "int32", "(", "jobPtr", ".", "State", ")", "]", "!=", "0", "{", "pipelinePtr", ".", "JobCounts", "[", "int32", "(", "jobPtr", ".", "State", ")", "]", "--", "\n", "}", "\n", "pipelinePtr", ".", "JobCounts", "[", "int32", "(", "state", ")", "]", "++", "\n", "pipelinePtr", ".", "LastJobState", "=", "state", "\n", "if", "err", ":=", "pipelines", ".", "Put", "(", "jobPtr", ".", "Pipeline", ".", "Name", ",", "pipelinePtr", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Update job info", "var", "err", "error", "\n", "if", "state", "==", "pps", ".", "JobState_JOB_STARTING", "{", "jobPtr", ".", "Started", ",", "err", "=", "types", ".", "TimestampProto", "(", "time", ".", "Now", "(", ")", ")", "\n", "}", "else", "if", "IsTerminal", "(", "state", ")", "{", "jobPtr", ".", "Finished", ",", "err", "=", "types", ".", "TimestampProto", "(", "time", ".", "Now", "(", ")", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "jobPtr", ".", "State", "=", "state", "\n", "jobPtr", ".", "Reason", "=", "reason", "\n", "return", "jobs", ".", "Put", "(", "jobPtr", ".", "Job", ".", "ID", ",", "jobPtr", ")", "\n", "}" ]
458
all-459
[ "isNextSuffixPattern", "see", "next", "2", "patterns", "can", "be", "suffix", "matcher", ".", "If", "following", "two", "cases", "are", "both", "true", "it", "could", "possibly", "become", "a", "suffix", "matcher", ".", "1", ".", "the", "first", "pattern", "is", "a", "Matcher", ".", "2", ".", "the", "next", "pattern", "is", "a", "static", "pattern", ".", "If", "the", "first", "matcher", "can", "t", "match", "the", "first", "rune", "of", "the", "second", "static", "pattern", "next", "pattern", "should", "be", "a", "suffix", "matcher", "combined", "the", "two", "patterns", "." ]
[ "func", "isNextSuffixPattern", "(", "p", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "p", ")", ">=", "2", "&&", "isMatchPattern", "(", "p", "[", "0", "]", ")", "&&", "!", "isMatchPattern", "(", "p", "[", "1", "]", ")", "{", "matcher", ",", "_", ":=", "parseMatcher", "(", "p", "[", "0", "]", ")", "\n", "if", "_", ",", "ok", ":=", "matcher", ".", "(", "*", "FixedLengthMatcher", ")", ";", "ok", "{", "return", "<mask>", "\n", "}", "\n", "r", ",", "_", ":=", "utf8", ".", "DecodeRuneInString", "(", "p", "[", "1", "]", ")", "\n", "return", "matcher", ".", "MatchRune", "(", "r", ")", "\n", "}", "\n", "return", "false", "\n", "}" ]
459
all-460
[ "SetHeadersClickable", "is", "a", "wrapper", "around", "gtk_tree_view_set_headers_clickable", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "SetHeadersClickable", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_tree_view_set_headers_clickable", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "show", ")", ")", "\n", "}" ]
460
all-461
[ "Item", "returns", "item", "text", "by", "its", "index", ".", "If", "index", "is", "out", "of", "range", "an", "empty", "string", "and", "false", "are", "returned" ]
[ "func", "(", "l", "*", "ListBox", ")", "Item", "(", "id", "int", ")", "(", "string", ",", "bool", ")", "{", "if", "len", "(", "l", ".", "items", ")", "<=", "id", "||", "id", "<", "0", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n\n", "return", "l", ".", "items", "[", "id", "]", ",", "true", "\n", "}" ]
461
all-462
[ "GetDynamicData", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockEC2MetadataClient", ")", "GetDynamicData", "(", "arg0", "string", ")", "(", "string", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "string", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
462
all-463
[ "Merge", "takes", "the", "results", "of", "this", "Enumerator", "and", "others", "and", "funnels", "them", "into", "a", "single", "Enumerator", ".", "The", "order", "of", "in", "which", "they", "will", "be", "combined", "is", "non", "-", "deterministic", "." ]
[ "func", "(", "iter", "Enumerator", ")", "Merge", "(", "others", "...", "Enumerator", ")", "Enumerator", "{", "retval", ":=", "make", "(", "chan", "<mask>", "{", "}", ")", "\n\n", "var", "wg", "sync", ".", "WaitGroup", "\n", "wg", ".", "Add", "(", "len", "(", "others", ")", "+", "1", ")", "\n\n", "funnel", ":=", "func", "(", "prevResult", "Enumerator", ")", "{", "for", "entry", ":=", "range", "prevResult", "{", "retval", "<-", "entry", "\n", "}", "\n", "wg", ".", "Done", "(", ")", "\n", "}", "\n\n", "go", "funnel", "(", "iter", ")", "\n", "for", "_", ",", "item", ":=", "range", "others", "{", "go", "funnel", "(", "item", ")", "\n", "}", "\n\n", "go", "func", "(", ")", "{", "wg", ".", "Wait", "(", ")", "\n", "close", "(", "retval", ")", "\n", "}", "(", ")", "\n", "return", "retval", "\n", "}" ]
463
all-464
[ "insertStr", "inserts", "s", "into", "ss", "preserving", "sorting", "(", "it", "assumes", "that", "ss", "is", "sorted", ")", ".", "If", "a", "copy", "is", "necessary", "(", "because", "cap", "(", "ss", ")", "is", "too", "small", ")", "only", "does", "one", "copy", "(", "unlike", "append", "(", "append", "(", "ss", "[", ":", "idx", "]", "newS", ")", "ss", "[", "idx", ":", "]", "...", ")", ")", ".", "This", "is", "because", "directory", "nodes", "may", "include", "a", "large", "number", "of", "children", ".", "This", "is", "used", "to", "preserve", "the", "order", "in", "DirectoryNode", ".", "Children", "which", "must", "be", "maintained", "so", "that", "equivalent", "directories", "have", "the", "same", "hash", ".", "Returns", "true", "if", "newS", "was", "added", "to", "ss", "and", "false", "otherwise", "(", "if", "newS", "is", "already", "in", "ss", ")", "." ]
[ "func", "insertStr", "(", "ss", "*", "[", "]", "string", ",", "newS", "string", ")", "bool", "{", "sz", ":=", "cap", "(", "*", "ss", ")", "\n", "idx", ":=", "sort", ".", "SearchStrings", "(", "*", "ss", ",", "newS", ")", "\n", "if", "idx", ">=", "len", "(", "*", "ss", ")", "||", "(", "*", "<mask>", ")", "[", "idx", "]", "!=", "newS", "{", "// Need to insert new element", "if", "sz", ">=", "(", "len", "(", "*", "ss", ")", "+", "1", ")", "{", "*", "ss", "=", "(", "*", "ss", ")", "[", ":", "len", "(", "*", "ss", ")", "+", "1", "]", "\n", "copy", "(", "(", "*", "ss", ")", "[", "idx", "+", "1", ":", "]", ",", "(", "*", "ss", ")", "[", "idx", ":", "]", ")", "\n", "(", "*", "ss", ")", "[", "idx", "]", "=", "newS", "\n", "}", "else", "{", "// Need to grow ss (i.e. make a copy)", "// - Using a factor (instead of always adding a constant number of", "// elements) ensures amortized constant time for insertions, and keeping", "// it reasonably low avoids wasting too much space. Current value of", "// 1.33 is arbitrary.", "// - If sz is small, grow sz by at least a constant amount (must be >=1,", "// currently 10)", "cap1", ",", "cap2", ":=", "int", "(", "float64", "(", "sz", ")", "*", "1.33", ")", ",", "sz", "+", "10", "\n", "newSs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "*", "ss", ")", "+", "1", ",", "max", "(", "cap1", ",", "cap2", ")", ")", "\n", "copy", "(", "newSs", ",", "(", "*", "ss", ")", "[", ":", "idx", "]", ")", "\n", "copy", "(", "newSs", "[", "idx", "+", "1", ":", "]", ",", "(", "*", "ss", ")", "[", "idx", ":", "]", ")", "\n", "newSs", "[", "idx", "]", "=", "newS", "\n", "*", "ss", "=", "newSs", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
464
all-465
[ "GetSSHUsername", "returns", "the", "username", "to", "use", "with", "SSH" ]
[ "func", "(", "d", "*", "Driver", ")", "GetSSHUsername", "(", ")", "string", "{", "if", "d", ".", "SSHUser", "==", "\"", "\"", "{", "name", ":=", "strings", ".", "ToLower", "(", "d", ".", "Image", ")", "\n\n", "if", "strings", ".", "Contains", "(", "name", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "name", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "<mask>", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "name", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "name", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "name", ",", "\"", "\"", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "defaultSSHUser", "\n", "}", "\n\n", "return", "d", ".", "SSHUser", "\n", "}" ]
465
all-466
[ "HasPermission", "returns", "whether", "or", "not", "the", "user", "has", "the", "permission", "to", "perform", "a", "certain", "task", "." ]
[ "func", "(", "r", "*", "Server", ")", "HasPermission", "(", "username", ",", "project", ",", "permission", "string", ")", "bool", "{", "r", ".", "permissionsLock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "permissionsLock", ".", "Unlock", "(", ")", "\n\n", "// Check whether the permissions are cached", "_", ",", "cached", ":=", "r", ".", "permissions", "[", "username", "]", "\n\n", "if", "!", "cached", "{", "r", ".", "syncPermissions", "(", "username", ")", "\n", "}", "\n\n", "r", ".", "resourcesLock", ".", "Lock", "(", ")", "\n", "permissions", ":=", "r", ".", "permissions", "[", "username", "]", "[", "r", ".", "<mask>", "[", "project", "]", "]", "\n", "r", ".", "resourcesLock", ".", "Unlock", "(", ")", "\n\n", "return", "shared", ".", "StringInSlice", "(", "permission", ",", "permissions", ")", "\n", "}" ]
466
all-467
[ "NewLedgerEntryExt", "creates", "a", "new", "LedgerEntryExt", "." ]
[ "func", "NewLedgerEntryExt", "(", "v", "int32", ",", "value", "<mask>", "{", "}", ")", "(", "result", "LedgerEntryExt", ",", "err", "error", ")", "{", "result", ".", "V", "=", "v", "\n", "switch", "int32", "(", "v", ")", "{", "case", "0", ":", "// void", "}", "\n", "return", "\n", "}" ]
467
all-468
[ "header", "computes", "the", "header", "for", "the", "given", "tag" ]
[ "func", "(", "id", "*", "streamID", ")", "header", "(", "tag", "uint64", ")", "uint64", "{", "<mask>", ":=", "id", ".", "id", "<<", "3", "|", "tag", "\n", "if", "!", "id", ".", "initiator", "{", "header", "--", "\n", "}", "\n", "return", "header", "\n", "}" ]
468
all-469
[ "execSetns", "runs", "the", "process", "that", "executes", "C", "code", "to", "perform", "the", "setns", "calls", "because", "setns", "support", "requires", "the", "C", "process", "to", "fork", "off", "a", "child", "and", "perform", "the", "setns", "before", "the", "go", "runtime", "boots", "we", "wait", "on", "the", "process", "to", "die", "and", "receive", "the", "child", "s", "pid", "over", "the", "provided", "pipe", "." ]
[ "func", "(", "p", "*", "setnsProcess", ")", "execSetns", "(", ")", "error", "{", "err", ":=", "p", ".", "cmd", ".", "Start", "(", ")", "\n", "p", ".", "childPipe", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "newSystemError", "(", "err", ")", "\n", "}", "\n", "status", ",", "err", ":=", "p", ".", "cmd", ".", "Process", ".", "Wait", "(", ")", "\n", "if", "err", "!=", "nil", "{", "p", ".", "cmd", ".", "Wait", "(", ")", "\n", "return", "newSystemError", "(", "err", ")", "\n", "}", "\n", "if", "!", "status", ".", "Success", "(", ")", "{", "p", ".", "cmd", ".", "Wait", "(", ")", "\n", "return", "newSystemError", "(", "&", "exec", ".", "ExitError", "{", "ProcessState", ":", "status", "}", ")", "\n", "}", "\n", "<mask>", "pid", "*", "pid", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "p", ".", "parentPipe", ")", ".", "Decode", "(", "&", "pid", ")", ";", "err", "!=", "nil", "{", "p", ".", "cmd", ".", "Wait", "(", ")", "\n", "return", "newSystemError", "(", "err", ")", "\n", "}", "\n\n", "process", ",", "err", ":=", "os", ".", "FindProcess", "(", "pid", ".", "Pid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "p", ".", "cmd", ".", "Process", "=", "process", "\n", "return", "nil", "\n", "}" ]
469
all-470
[ "SendMsg", "sends", "a", "message", "(", "possibly", "dropping", "a", "message", "on", "full", "buffers", ")" ]
[ "func", "(", "s", "*", "Stream", ")", "SendMsg", "(", "msg", "interface", "{", "}", ")", "{", "select", "{", "case", "s", ".", "sendBuffer", "<-", "msg", ":", "// normal flow if the channel is not blocked", "default", ":", "s", ".", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "atomic", ".", "AddUint64", "(", "&", "s", ".", "dropped", ",", "1", ")", "\n", "<-", "s", ".", "sendBuffer", "// drop oldest and try again (if conn temporarily unavailable)", "\n", "select", "{", "<mask>", "s", ".", "sendBuffer", "<-", "msg", ":", "default", ":", "// drop newest (too many cuncurrent SendMsg)", "s", ".", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "atomic", ".", "AddUint64", "(", "&", "s", ".", "dropped", ",", "1", ")", "\n", "}", "\n", "}", "\n", "}" ]
470
all-471
[ "NewClientWithServerInfo", "creates", "a", "new", "Client", "connection", "from", "the", "user", "name", "password", "resource", "host", "URL", "and", "conf", "URL", "passed", "to", "it", "." ]
[ "func", "NewClientWithServerInfo", "(", "user", ",", "pass", ",", "<mask>", ",", "authType", ",", "host", ",", "domain", ",", "conf", "string", ")", "(", "*", "Client", ",", "error", ")", "{", "connection", ",", "err", ":=", "xmpp", ".", "Dial", "(", "host", ")", "\n\n", "var", "b", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "xml", ".", "EscapeText", "(", "&", "b", ",", "[", "]", "byte", "(", "pass", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "c", ":=", "&", "Client", "{", "AuthType", ":", "authType", ",", "Username", ":", "user", ",", "Password", ":", "b", ".", "String", "(", ")", ",", "Resource", ":", "resource", ",", "Id", ":", "user", "+", "\"", "\"", "+", "domain", ",", "// private", "connection", ":", "connection", ",", "mentionNames", ":", "make", "(", "map", "[", "string", "]", "string", ")", ",", "receivedUsers", ":", "make", "(", "chan", "[", "]", "*", "User", ")", ",", "receivedRooms", ":", "make", "(", "chan", "[", "]", "*", "Room", ")", ",", "receivedMessage", ":", "make", "(", "chan", "*", "Message", ")", ",", "host", ":", "host", ",", "domain", ":", "domain", ",", "conf", ":", "conf", ",", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "c", ",", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "authenticate", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "c", ",", "err", "\n", "}", "\n\n", "go", "c", ".", "listen", "(", ")", "\n", "return", "c", ",", "nil", "\n", "}" ]
471
all-472
[ "title", ":", "profile", "symbol", "handler", "path", ":", "/", "debug", "/", "pprof", "/", "symbol", "method", ":", "GET", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized" ]
[ "func", "symbolHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermDebug", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "pprof", ".", "Symbol", "(", "w", ",", "r", ")", "\n", "return", "nil", "\n", "}" ]
472
all-473
[ "/", "*", "Detect", "takes", "a", "regular", "expression", "and", "returns", "a", "channel", "." ]
[ "func", "(", "b", "*", "Buffer", ")", "Detect", "(", "desired", "string", ",", "args", "...", "interface", "{", "}", ")", "chan", "bool", "{", "formattedRegexp", ":=", "desired", "\n", "if", "len", "(", "args", ")", ">", "0", "{", "formattedRegexp", "=", "fmt", ".", "Sprintf", "(", "desired", ",", "args", "...", ")", "\n", "}", "\n", "re", ":=", "regexp", ".", "MustCompile", "(", "formattedRegexp", ")", "\n\n", "b", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "b", ".", "detectCloser", "==", "nil", "{", "b", ".", "detectCloser", "=", "make", "(", "chan", "interface", "{", "}", ")", "\n", "}", "\n\n", "closer", ":=", "b", ".", "detectCloser", "\n", "<mask>", ":=", "make", "(", "chan", "bool", ")", "\n", "go", "func", "(", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "10", "*", "time", ".", "Millisecond", ")", "\n", "defer", "ticker", ".", "Stop", "(", ")", "\n", "defer", "close", "(", "response", ")", "\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ":", "b", ".", "lock", ".", "Lock", "(", ")", "\n", "data", ",", "cursor", ":=", "b", ".", "contents", "[", "b", ".", "readCursor", ":", "]", ",", "b", ".", "readCursor", "\n", "loc", ":=", "re", ".", "FindIndex", "(", "data", ")", "\n", "b", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "loc", "!=", "nil", "{", "response", "<-", "true", "\n", "b", ".", "lock", ".", "Lock", "(", ")", "\n", "newCursorPosition", ":=", "cursor", "+", "uint64", "(", "loc", "[", "1", "]", ")", "\n", "if", "newCursorPosition", ">=", "b", ".", "readCursor", "{", "b", ".", "readCursor", "=", "newCursorPosition", "\n", "}", "\n", "b", ".", "lock", ".", "Unlock", "(", ")", "\n", "return", "\n", "}", "\n", "case", "<-", "closer", ":", "return", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "response", "\n", "}" ]
473
all-474
[ "Version", "returns", "the", "version", "of", "the", "database", "schema", "." ]
[ "func", "Version", "(", "connStr", "string", ")", "(", "int64", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "sql", ".", "Open", "(", "\"", "\"", ",", "connStr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "defer", "db", ".", "Close", "(", ")", "\n", "return", "goose", ".", "GetDBVersion", "(", "db", ")", "\n", "}" ]
474
all-475
[ "MutateTransaction", "for", "AutoSequence", "loads", "the", "sequence", "and", "sets", "it", "on", "the", "tx", ".", "NOTE", ":", "this", "mutator", "assumes", "that", "the", "source", "account", "has", "already", "been", "set", "on", "the", "transaction", "and", "will", "error", "if", "that", "has", "not", "occurred", "." ]
[ "func", "(", "m", "AutoSequence", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "error", "{", "source", ":=", "o", ".", "TX", ".", "SourceAccount", "\n\n", "if", "source", "==", "(", "xdr", ".", "AccountId", "{", "}", ")", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "seq", ",", "err", ":=", "m", ".", "SequenceForAccount", "(", "source", ".", "Address", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "o", ".", "TX", ".", "SeqNum", "=", "seq", "+", "1", "\n", "return", "nil", "\n", "}" ]
475
all-476
[ "ContainersByNodeName", "returns", "a", "map", "associating", "each", "container", "to", "the", "name", "of", "its", "node", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainersByNodeName", "(", "project", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "stmt", ":=", "`\nSELECT containers.name, nodes.name\n FROM containers\n JOIN nodes ON nodes.id = containers.node_id\n JOIN projects ON projects.id = containers.project_id\n WHERE containers.type=?\n AND projects.name = ?\n`", "\n", "rows", ",", "err", ":=", "c", ".", "tx", ".", "Query", "(", "stmt", ",", "CTypeRegular", ",", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "result", ":=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "for", "i", ":=", "0", ";", "rows", ".", "Next", "(", ")", ";", "i", "++", "{", "var", "name", "string", "\n", "var", "nodeName", "string", "\n", "err", ":=", "<mask>", ".", "Scan", "(", "&", "name", ",", "&", "nodeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "result", "[", "name", "]", "=", "nodeName", "\n", "}", "\n\n", "err", "=", "rows", ".", "Err", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
476
all-477
[ "expandDVSNameArrayUplinkPortPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "DVSNameArrayUplinkPortPolicy", "." ]
[ "func", "expandDVSNameArrayUplinkPortPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "DVSNameArrayUplinkPortPolicy", "{", "obj", ":=", "&", "types", ".", "DVSNameArrayUplinkPortPolicy", "{", "UplinkPortName", ":", "structure", ".", "SliceInterfacesToStrings", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "[", "]", "<mask>", "{", "}", ")", ")", ",", "}", "\n", "if", "structure", ".", "AllFieldsEmpty", "(", "obj", ")", "{", "return", "nil", "\n", "}", "\n", "return", "obj", "\n", "}" ]
477
all-478
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ScreencastFrameMetadata", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
478
all-479
[ "GlobFileF", "returns", "files", "that", "match", "a", "given", "glob", "pattern", "in", "a", "given", "commit", "calling", "f", "with", "each", "FileInfo", ".", "The", "pattern", "is", "documented", "here", ":", "https", ":", "//", "golang", ".", "org", "/", "pkg", "/", "path", "/", "filepath", "/", "#Match" ]
[ "func", "(", "c", "APIClient", ")", "GlobFileF", "(", "repoName", "string", ",", "commitID", "string", ",", "pattern", "string", ",", "f", "func", "(", "fi", "*", "pfs", ".", "FileInfo", ")", "error", ")", "error", "{", "fs", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "GlobFileStream", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "GlobFileRequest", "{", "Commit", ":", "NewCommit", "(", "repoName", ",", "commitID", ")", ",", "<mask>", ":", "pattern", ",", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "for", "{", "fi", ",", "err", ":=", "fs", ".", "Recv", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "return", "nil", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "err", ":=", "f", "(", "fi", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "errutil", ".", "ErrBreak", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "}", "\n", "}" ]
479
all-480
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform2i", "(", "<mask>", "int32", ",", "v0", "int32", ",", "v1", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpUniform2i", ",", "3", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "v0", ")", ",", "uintptr", "(", "v1", ")", ")", "\n", "}" ]
480
all-481
[ "writeScriptFile", "writes", "content", "to", "a", "temporary", "file", ".", "It", "changes", "the", "temporary", "file", "mode", "to", "executable", "and", "closes", "it", "to", "prepare", "it", "for", "execution", "." ]
[ "func", "writeScriptFile", "(", "content", "[", "]", "byte", ")", "(", "file", "gitos", ".", "File", ",", "err", "error", ")", "{", "if", "file", ",", "err", "=", "gos", ".", "TempFile", "(", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "_", ",", "err", "=", "file", ".", "Write", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "file", ".", "Chmod", "(", "os", ".", "FileMode", "(", "0755", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "file", ",", "file", ".", "Close", "(", ")", "\n", "}" ]
481
all-482
[ "----------------------------------------", "consume", "*", "for", "skipping", "struct", "fields", "Read", "everything", "without", "doing", "anything", "with", "it", ".", "Report", "errors", "if", "they", "occur", "." ]
[ "func", "consumeAny", "(", "typ3", "Typ3", ",", "bz", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "var", "_n", "int", "\n", "switch", "typ3", "{", "case", "Typ3_Varint", ":", "_", ",", "_n", ",", "err", "=", "DecodeVarint", "(", "bz", ")", "\n", "case", "Typ3_8Byte", ":", "_", ",", "_n", ",", "err", "=", "DecodeInt64", "(", "bz", ")", "\n", "<mask>", "Typ3_ByteLength", ":", "_", ",", "_n", ",", "err", "=", "DecodeByteSlice", "(", "bz", ")", "\n", "case", "Typ3_4Byte", ":", "_", ",", "_n", ",", "err", "=", "DecodeInt32", "(", "bz", ")", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "typ3", ")", "\n", "return", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "// do not slide", "return", "\n", "}", "\n", "slide", "(", "&", "bz", ",", "&", "n", ",", "_n", ")", "\n", "return", "\n", "}" ]
482
all-483
[ "processCredentialsRequest", "returns", "the", "response", "json", "containing", "credentials", "for", "the", "credentials", "id", "in", "the", "request" ]
[ "func", "processCredentialsRequest", "(", "credentialsManager", "credentials", ".", "<mask>", ",", "r", "*", "http", ".", "Request", ",", "credentialsID", "string", ",", "errPrefix", "string", ")", "(", "[", "]", "byte", ",", "string", ",", "string", ",", "*", "handlersutils", ".", "ErrorMessage", ",", "error", ")", "{", "if", "credentialsID", "==", "\"", "\"", "{", "errText", ":=", "errPrefix", "+", "\"", "\"", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "errText", ",", "r", ".", "RemoteAddr", ")", "\n", "msg", ":=", "&", "handlersutils", ".", "ErrorMessage", "{", "Code", ":", "ErrNoIDInRequest", ",", "Message", ":", "errText", ",", "HTTPErrorCode", ":", "http", ".", "StatusBadRequest", ",", "}", "\n", "return", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "msg", ",", "errors", ".", "New", "(", "errText", ")", "\n", "}", "\n\n", "credentials", ",", "ok", ":=", "credentialsManager", ".", "GetTaskCredentials", "(", "credentialsID", ")", "\n", "if", "!", "ok", "{", "errText", ":=", "errPrefix", "+", "\"", "\"", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "errText", ",", "r", ".", "RemoteAddr", ")", "\n", "msg", ":=", "&", "handlersutils", ".", "ErrorMessage", "{", "Code", ":", "ErrInvalidIDInRequest", ",", "Message", ":", "errText", ",", "HTTPErrorCode", ":", "http", ".", "StatusBadRequest", ",", "}", "\n", "return", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "msg", ",", "errors", ".", "New", "(", "errText", ")", "\n", "}", "\n\n", "if", "utils", ".", "ZeroOrNil", "(", "credentials", ".", "ARN", ")", "&&", "utils", ".", "ZeroOrNil", "(", "credentials", ".", "IAMRoleCredentials", ")", "{", "// This can happen when the agent is restarted and is reconciling its state.", "errText", ":=", "errPrefix", "+", "\"", "\"", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "errText", ",", "r", ".", "RemoteAddr", ")", "\n", "msg", ":=", "&", "handlersutils", ".", "ErrorMessage", "{", "Code", ":", "ErrCredentialsUninitialized", ",", "Message", ":", "errText", ",", "HTTPErrorCode", ":", "http", ".", "StatusServiceUnavailable", ",", "}", "\n", "return", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "msg", ",", "errors", ".", "New", "(", "errText", ")", "\n", "}", "\n\n", "credentialsJSON", ",", "err", ":=", "json", ".", "Marshal", "(", "credentials", ".", "IAMRoleCredentials", ")", "\n", "if", "err", "!=", "nil", "{", "errText", ":=", "errPrefix", "+", "\"", "\"", "\n", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "errText", ",", "r", ".", "RemoteAddr", ")", "\n", "msg", ":=", "&", "handlersutils", ".", "ErrorMessage", "{", "Code", ":", "ErrInternalServer", ",", "Message", ":", "\"", "\"", ",", "HTTPErrorCode", ":", "http", ".", "StatusInternalServerError", ",", "}", "\n", "return", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "msg", ",", "errors", ".", "New", "(", "errText", ")", "\n", "}", "\n\n", "// Success", "return", "credentialsJSON", ",", "credentials", ".", "ARN", ",", "credentials", ".", "IAMRoleCredentials", ".", "RoleType", ",", "nil", ",", "nil", "\n", "}" ]
483
all-484
[ "checkCommitMessages", "will", "perform", "the", "actual", "DCO", "check", "by", "retrieving", "all", "commits", "contained", "within", "the", "PR", "with", "the", "given", "number", ".", "*", "All", "*", "commits", "in", "the", "pull", "request", "*", "must", "*", "match", "the", "testRe", "in", "order", "to", "pass", "." ]
[ "func", "checkCommitMessages", "(", "gc", "gitHubClient", ",", "l", "*", "logrus", ".", "Entry", ",", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "[", "]", "github", ".", "GitCommit", ",", "error", ")", "{", "allCommits", ",", "err", ":=", "gc", ".", "ListPRCommits", "(", "org", ",", "repo", ",", "number", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "l", ".", "Debugf", "(", "\"", "\"", ",", "len", "(", "allCommits", ")", ")", "\n\n", "var", "commitsMissingDCO", "[", "]", "github", ".", "GitCommit", "\n", "for", "_", ",", "commit", ":=", "range", "allCommits", "{", "if", "!", "testRe", ".", "MatchString", "(", "commit", ".", "Commit", ".", "Message", ")", "{", "c", ":=", "commit", ".", "Commit", "\n", "c", ".", "SHA", "=", "commit", ".", "SHA", "\n", "commitsMissingDCO", "=", "<mask>", "(", "commitsMissingDCO", ",", "c", ")", "\n", "}", "\n", "}", "\n\n", "l", ".", "Debugf", "(", "\"", "\"", ",", "len", "(", "commitsMissingDCO", ")", "==", "0", ")", "\n", "return", "commitsMissingDCO", ",", "nil", "\n", "}" ]
484
all-485
[ "deleteRecord", "deletes", "all", "existing", "records", "(", "CNAME", "TXT", "A", ")", "for", "the", "given", "Endpoint", ".", "DNSName", "with", "1", "API", "call" ]
[ "func", "(", "d", "*", "dynProviderState", ")", "deleteRecord", "(", "client", "*", "dynect", ".", "Client", ",", "ep", "*", "endpoint", ".", "Endpoint", ")", "error", "{", "link", ":=", "d", ".", "buildLinkToRecord", "(", "ep", ")", "\n", "if", "link", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "response", ":=", "dynect", ".", "RecordResponse", "{", "}", "\n\n", "err", ":=", "apiRetryLoop", "(", "func", "(", ")", "error", "{", "return", "client", ".", "Do", "(", "\"", "\"", ",", "link", ",", "nil", ",", "&", "<mask>", ")", "\n", "}", ")", "\n\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "link", ",", "errorOrValue", "(", "err", ",", "&", "response", ")", ")", "\n", "return", "err", "\n", "}" ]
485
all-486
[ "sanityCheckPackage", "checks", "invariants", "of", "packages", "upon", "creation", ".", "It", "does", "not", "require", "that", "the", "package", "is", "built", ".", "Unlike", "sanityCheck", "(", "for", "functions", ")", "it", "just", "panics", "at", "the", "first", "error", "." ]
[ "func", "sanityCheckPackage", "(", "pkg", "*", "Package", ")", "{", "if", "pkg", ".", "Pkg", "==", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pkg", ")", ")", "\n", "}", "\n", "pkg", ".", "String", "(", ")", "// must not crash", "\n\n", "for", "name", ",", "mem", ":=", "range", "pkg", ".", "Members", "{", "if", "name", "!=", "mem", ".", "Name", "(", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pkg", ".", "Pkg", ".", "Path", "(", ")", ",", "mem", ",", "mem", ".", "Name", "(", ")", ",", "name", ")", ")", "\n", "}", "\n", "obj", ":=", "mem", ".", "Object", "(", ")", "\n", "if", "obj", "==", "nil", "{", "// This check is sound because fields", "// {Global,Function}.object have type", "// types.Object. (If they were declared as", "// *types.{Var,Func}, we'd have a non-empty", "// interface containing a nil pointer.)", "<mask>", "// not all members have typechecker objects", "\n", "}", "\n", "if", "obj", ".", "Name", "(", ")", "!=", "name", "{", "if", "obj", ".", "Name", "(", ")", "==", "\"", "\"", "&&", "strings", ".", "HasPrefix", "(", "mem", ".", "Name", "(", ")", ",", "\"", "\"", ")", "{", "// Ok. The name of a declared init function varies between", "// its types.Func (\"init\") and its ssa.Function (\"init#%d\").", "}", "else", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pkg", ".", "Pkg", ".", "Path", "(", ")", ",", "mem", ",", "obj", ".", "Name", "(", ")", ",", "name", ")", ")", "\n", "}", "\n", "}", "\n", "if", "obj", ".", "Pos", "(", ")", "!=", "mem", ".", "Pos", "(", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "mem", ",", "mem", ".", "Pos", "(", ")", ",", "obj", ".", "Pos", "(", ")", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
486
all-487
[ "/", "1", ".", "0", "/", "storage", "-", "pools", "Create", "a", "storage", "pool", "." ]
[ "func", "storagePoolsPost", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "Response", "{", "storagePoolCreateLock", ".", "Lock", "(", ")", "\n", "defer", "storagePoolCreateLock", ".", "Unlock", "(", ")", "\n\n", "req", ":=", "api", ".", "StoragePoolsPost", "{", "}", "\n\n", "// Parse the request.", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", "Body", ")", ".", "Decode", "(", "&", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n\n", "// Sanity checks.", "if", "req", ".", "Name", "==", "\"", "\"", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "if", "strings", ".", "Contains", "(", "req", ".", "Name", ",", "\"", "\"", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "if", "req", ".", "Driver", "==", "\"", "\"", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "version", ".", "APIVersion", ",", "req", ".", "Name", ")", "\n", "response", ":=", "SyncResponseLocation", "(", "true", ",", "nil", ",", "url", ")", "\n\n", "if", "isClusterNotification", "(", "r", ")", "{", "// This is an internal request which triggers the actual", "// creation of the pool across all nodes, after they have been", "// previously defined.", "err", "=", "storagePoolValidate", "(", "req", ".", "Name", ",", "req", ".", "Driver", ",", "req", ".", "Config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n", "err", "=", "doStoragePoolCreateInternal", "(", "d", ".", "State", "(", ")", ",", "req", ".", "Name", ",", "req", ".", "Description", ",", "req", ".", "Driver", ",", "req", ".", "Config", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "return", "response", "\n", "}", "\n\n", "targetNode", ":=", "queryParam", "(", "r", ",", "\"", "\"", ")", "\n", "if", "targetNode", "==", "\"", "\"", "{", "count", ",", "err", ":=", "cluster", ".", "Count", "(", "d", ".", "State", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "if", "count", "==", "1", "{", "// No targetNode was specified and we're either a single-node", "// cluster or not clustered at all, so create the storage", "// pool immediately.", "err", "=", "storagePoolCreateInternal", "(", "d", ".", "State", "(", ")", ",", "req", ".", "Name", ",", "req", ".", "Description", ",", "req", ".", "Driver", ",", "req", ".", "Config", ")", "\n", "}", "else", "{", "// No targetNode was specified and we're clustered, so finalize the", "// config in the db and actually create the pool on all nodes.", "err", "=", "storagePoolsPostCluster", "(", "d", ",", "req", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n", "return", "response", "\n\n", "}", "\n\n", "// A targetNode was specified, let's just define the node's storage", "// without actually creating it. The only legal key values for the", "// storage config are the ones in StoragePoolNodeConfigKeys.", "for", "key", ":=", "range", "req", ".", "Config", "{", "if", "!", "shared", ".", "StringInSlice", "(", "key", ",", "db", ".", "StoragePoolNodeConfigKeys", ")", "{", "return", "SmartError", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ")", ")", "\n", "}", "\n", "}", "\n\n", "err", "=", "storagePoolValidate", "(", "req", ".", "Name", ",", "req", ".", "Driver", ",", "req", ".", "Config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n\n", "err", "=", "d", ".", "cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "return", "tx", ".", "StoragePoolCreatePending", "(", "targetNode", ",", "req", ".", "Name", ",", "req", ".", "Driver", ",", "req", ".", "Config", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "db", ".", "ErrAlreadyDefined", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "targetNode", ")", ")", "\n", "}", "\n", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "return", "response", "\n", "}" ]
487
all-488
[ "SetVisibleFunc", "is", "a", "wrapper", "around", "gtk_tree_model_filter_set_visible_func", "()", "." ]
[ "func", "(", "v", "*", "TreeModelFilter", ")", "SetVisibleFunc", "(", "f", "TreeModelFilterVisibleFunc", ",", "userData", "...", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "userData", ")", ">", "1", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "t", ":=", "treeModelFilterVisibleFuncData", "{", "fn", ":", "f", "}", "\n", "if", "len", "(", "userData", ")", ">", "0", "{", "t", ".", "userData", "=", "userData", "[", "0", "]", "\n", "}", "\n", "treeModelVisibleFilterFuncRegistry", ".", "Lock", "(", ")", "\n", "id", ":=", "treeModelVisibleFilterFuncRegistry", ".", "next", "\n", "treeModelVisibleFilterFuncRegistry", ".", "next", "++", "\n", "treeModelVisibleFilterFuncRegistry", ".", "m", "[", "id", "]", "=", "t", "\n", "treeModelVisibleFilterFuncRegistry", ".", "Unlock", "(", ")", "\n\n", "C", ".", "_gtk_tree_model_filter_set_visible_func", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gpointer", "(", "uintptr", "(", "<mask>", ")", ")", ")", "\n", "return", "nil", "\n", "}" ]
488
all-489
[ "newLogWithSize", "returns", "a", "log", "using", "the", "given", "storage", "and", "max", "message", "size", "." ]
[ "func", "newLogWithSize", "(", "storage", "Storage", ",", "logger", "Logger", ",", "maxNextEntsSize", "uint64", ")", "*", "raftLog", "{", "if", "storage", "==", "nil", "{", "log", ".", "Panic", "(", "\"", "\"", ")", "\n", "}", "\n", "<mask>", ":=", "&", "raftLog", "{", "storage", ":", "storage", ",", "logger", ":", "logger", ",", "maxNextEntsSize", ":", "maxNextEntsSize", ",", "}", "\n", "firstIndex", ",", "err", ":=", "storage", ".", "FirstIndex", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "// TODO(bdarnell)", "\n", "}", "\n", "lastIndex", ",", "err", ":=", "storage", ".", "LastIndex", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "// TODO(bdarnell)", "\n", "}", "\n", "log", ".", "unstable", ".", "offset", "=", "lastIndex", "+", "1", "\n", "log", ".", "unstable", ".", "logger", "=", "logger", "\n", "// Initialize our committed and applied pointers to the time of the last compaction.", "log", ".", "committed", "=", "firstIndex", "-", "1", "\n", "log", ".", "applied", "=", "firstIndex", "-", "1", "\n\n", "return", "log", "\n", "}" ]
489
all-490
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Preference", ")", "Locator", "(", "api", "*", "API", ")", "*", "PreferenceLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "PreferenceLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
490
all-491
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Type", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
491
all-492
[ "EnterMaintenanceMode", "puts", "a", "host", "into", "maintenance", "mode", ".", "If", "evacuate", "is", "set", "to", "true", "all", "powered", "off", "VMs", "will", "be", "removed", "from", "the", "host", "or", "the", "task", "will", "block", "until", "this", "is", "the", "case", "depending", "on", "whether", "or", "not", "DRS", "is", "on", "or", "off", "for", "the", "host", "s", "cluster", ".", "This", "parameter", "is", "ignored", "on", "direct", "ESXi", "." ]
[ "func", "EnterMaintenanceMode", "(", "host", "*", "object", ".", "HostSystem", ",", "timeout", "int", ",", "evacuate", "bool", ")", "error", "{", "if", "err", ":=", "viapi", ".", "VimValidateVirtualCenter", "(", "host", ".", "Client", "(", ")", ")", ";", "err", "!=", "nil", "{", "evacuate", "=", "<mask>", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "host", ".", "Name", "(", ")", ",", "evacuate", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "time", ".", "Second", "*", "time", ".", "Duration", "(", "timeout", ")", ")", "\n", "defer", "cancel", "(", ")", "\n", "task", ",", "err", ":=", "host", ".", "EnterMaintenanceMode", "(", "ctx", ",", "int32", "(", "timeout", ")", ",", "evacuate", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "task", ".", "Wait", "(", "ctx", ")", "\n", "}" ]
492
all-493
[ "/", "*", "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", ".", "The", "control", "processes", "only", "space", "button", "and", "mouse", "clicks", "to", "make", "control", "selected", ".", "Deselecting", "control", "is", "not", "possible", ":", "one", "has", "to", "click", "another", "radio", "of", "the", "radio", "group", "to", "deselect", "this", "button" ]
[ "func", "(", "c", "*", "Radio", ")", "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", ".", "group", "==", "nil", "{", "c", ".", "SetSelected", "(", "true", ")", "\n", "}", "else", "{", "c", ".", "<mask>", ".", "SelectItem", "(", "c", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
493
all-494
[ "NewDeploymentManifest", "-", "deployment", "manifest", "constructor" ]
[ "func", "NewDeploymentManifest", "(", "b", "[", "]", "byte", ")", "*", "DeploymentManifest", "{", "dm", ":=", "<mask>", "(", "DeploymentManifest", ")", "\n", "yaml", ".", "Unmarshal", "(", "b", ",", "dm", ")", "\n", "return", "dm", "\n", "}" ]
494
all-495
[ "Add", "the", "<project", ">", "_", "prefix", "when", "the", "given", "project", "name", "is", "not", "default", "." ]
[ "func", "projectPrefix", "(", "project", "string", ",", "s", "string", ")", "string", "{", "if", "project", "!=", "\"", "\"", "{", "s", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "s", ")", "\n", "}", "\n", "return", "s", "\n", "}" ]
495
all-496
[ "Equals", "compares", "to", "public", "keys" ]
[ "func", "(", "ePub", "*", "ECDSAPublicKey", ")", "Equals", "(", "o", "Key", ")", "bool", "{", "oPub", ",", "ok", ":=", "o", ".", "(", "*", "ECDSAPublicKey", ")", "\n", "if", "!", "<mask>", "{", "return", "false", "\n", "}", "\n\n", "return", "ePub", ".", "pub", ".", "X", "!=", "nil", "&&", "ePub", ".", "pub", ".", "Y", "!=", "nil", "&&", "oPub", ".", "pub", ".", "X", "!=", "nil", "&&", "oPub", ".", "pub", ".", "Y", "!=", "nil", "&&", "0", "==", "ePub", ".", "pub", ".", "X", ".", "Cmp", "(", "oPub", ".", "pub", ".", "X", ")", "&&", "0", "==", "ePub", ".", "pub", ".", "Y", ".", "Cmp", "(", "oPub", ".", "pub", ".", "Y", ")", "\n", "}" ]
496
all-497
[ "WaitForImage", "is", "a", "wrapper", "around", "gtk_clipboard_wait_for_image" ]
[ "func", "(", "v", "*", "Clipboard", ")", "WaitForImage", "(", ")", "(", "*", "gdk", ".", "Pixbuf", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_clipboard_wait_for_image", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "p", ":=", "&", "gdk", ".", "Pixbuf", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "return", "p", ",", "nil", "\n", "}" ]
497
all-498
[ "ACTOR", "server" ]
[ "func", "(", "peer", "*", "localPeer", ")", "actorLoop", "(", "actionChan", "<-", "chan", "localPeerAction", ")", "{", "gossipTimer", ":=", "time", ".", "Tick", "(", "gossipInterval", ")", "\n", "for", "{", "select", "{", "case", "action", ":=", "<-", "actionChan", ":", "action", "(", ")", "\n", "<mask>", "<-", "gossipTimer", ":", "peer", ".", "router", ".", "sendAllGossip", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
498
all-499
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventWebSocketClosed", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork46", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
499
all-500
[ "query", "information", "about", "an", "active", "uniform", "block" ]
[ "func", "GetActiveUniformBlockiv", "(", "program", "uint32", ",", "uniformBlockIndex", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetActiveUniformBlockiv", ",", "4", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "uniformBlockIndex", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]