id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
20,700
all-20701
[ "cvDrawContours", "(", "CvArr", "*", "img", "CvSeq", "*", "contour", "CvScalar", "externalColor", "CvScalar", "holeColor", "int", "maxLevel", "int", "thickness", "=", "1", "int", "lineType", "=", "8" ]
[ "func", "DrawContours", "(", "image", "*", "IplImage", ",", "contours", "*", "Seq", ",", "externalColor", ",", "holeColor", "Scalar", ",", "maxLevel", ",", "thickness", ",", "lineType", "int", ",", "offset", "<mask>", ")", "{", "C", ".", "cvDrawContours", "(", "unsafe", ".", "Pointer", "(", "image", ")", ",", "(", "*", "C", ".", "CvSeq", ")", "(", "contours", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "externalColor", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "holeColor", ")", ",", "C", ".", "int", "(", "maxLevel", ")", ",", "C", ".", "int", "(", "thickness", ")", ",", "C", ".", "int", "(", "lineType", ")", ",", "C", ".", "cvPoint", "(", "C", ".", "int", "(", "offset", ".", "X", ")", ",", "C", ".", "int", "(", "offset", ".", "Y", ")", ")", ")", "\n", "}" ]
20,701
all-20702
[ "String", "implements", "the", "Stringer", "interface", "." ]
[ "func", "(", "f", "*", "ParameterFieldSet", ")", "String", "(", ")", "string", "{", "a", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "f", ".", "fields", ")", ")", "\n", "for", "i", ",", "f", ":=", "range", "f", ".", "fields", "{", "a", "[", "i", "]", "=", "f", ".", "<mask>", "(", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "a", ")", "\n", "}" ]
20,702
all-20703
[ "NewKVListQuery", "parses", "a", "string", "into", "a", "dependency", "." ]
[ "func", "NewKVListQuery", "(", "s", "string", ")", "(", "*", "KVListQuery", ",", "error", ")", "{", "if", "s", "!=", "\"", "\"", "&&", "!", "KVListQueryRe", ".", "MatchString", "(", "s", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n\n", "m", ":=", "regexpMatch", "(", "KVListQueryRe", ",", "s", ")", "\n", "return", "&", "KVListQuery", "{", "stopCh", ":", "<mask>", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "dc", ":", "m", "[", "\"", "\"", "]", ",", "prefix", ":", "m", "[", "\"", "\"", "]", ",", "}", ",", "nil", "\n", "}" ]
20,703
all-20704
[ "Perform", "a", "single", "heartbeat", "request", "against", "the", "node", "with", "the", "given", "address", "." ]
[ "func", "heartbeatNode", "(", "taskCtx", "context", ".", "Context", ",", "address", "string", ",", "cert", "*", "shared", ".", "CertInfo", ",", "raftNodes", "[", "]", "db", ".", "RaftNode", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\"", ",", "address", ")", "\n\n", "config", ",", "err", ":=", "tlsClientConfig", "(", "cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "address", ",", "databaseEndpoint", ")", "\n", "client", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "config", "}", "}", "\n\n", "buffer", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "err", "=", "json", ".", "NewEncoder", "(", "&", "buffer", ")", ".", "Encode", "(", "raftNodes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "bytes", ".", "NewReader", "(", "buffer", ".", "Bytes", "(", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "2", "*", "time", ".", "Second", ")", "\n", "defer", "cancel", "(", ")", "\n", "<mask>", "=", "request", ".", "WithContext", "(", "ctx", ")", "\n", "request", ".", "Close", "=", "true", "// Immediately close the connection after the request is done", "\n\n", "// Perform the request asynchronously, so we can abort it if the task context is done.", "errCh", ":=", "make", "(", "chan", "error", ")", "\n", "go", "func", "(", ")", "{", "response", ",", "err", ":=", "client", ".", "Do", "(", "request", ")", "\n", "if", "err", "!=", "nil", "{", "errCh", "<-", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n", "if", "response", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "errCh", "<-", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "response", ".", "Status", ")", "\n", "return", "\n", "}", "\n", "errCh", "<-", "nil", "\n", "}", "(", ")", "\n\n", "select", "{", "case", "err", ":=", "<-", "errCh", ":", "return", "err", "\n", "case", "<-", "taskCtx", ".", "Done", "(", ")", ":", "return", "taskCtx", ".", "Err", "(", ")", "\n", "}", "\n", "}" ]
20,704
all-20705
[ "AddDialer", "adds", "a", "sub", "-", "dialer", "usable", "by", "this", "dialer", ".", "Dialers", "added", "first", "will", "be", "selected", "first", "based", "on", "the", "address", "." ]
[ "func", "(", "d", "*", "Dialer", ")", "AddDialer", "(", "pd", "transport", ".", "Dialer", ")", "{", "d", ".", "Dialers", "=", "<mask>", "(", "d", ".", "Dialers", ",", "pd", ")", "\n", "}" ]
20,705
all-20706
[ "UnmarshalJSON", "overrides", "the", "logic", "for", "parsing", "the", "JSON", "-", "encoded", "ResourceStatus", "data" ]
[ "func", "(", "vs", "*", "VolumeStatus", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "if", "strings", ".", "ToLower", "(", "string", "(", "b", ")", ")", "==", "\"", "\"", "{", "*", "vs", "=", "VolumeStatusNone", "\n", "return", "nil", "\n", "}", "\n\n", "if", "b", "[", "0", "]", "!=", "'\"'", "||", "b", "[", "len", "(", "b", ")", "-", "1", "]", "!=", "'\"'", "{", "*", "<mask>", "=", "VolumeStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "string", "(", "b", ")", ")", "\n", "}", "\n\n", "strStatus", ":=", "string", "(", "b", "[", "1", ":", "len", "(", "b", ")", "-", "1", "]", ")", "\n", "stat", ",", "ok", ":=", "resourceStatusMap", "[", "strStatus", "]", "\n", "if", "!", "ok", "{", "*", "vs", "=", "VolumeStatusNone", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "*", "vs", "=", "stat", "\n", "return", "nil", "\n", "}" ]
20,706
all-20707
[ "List", "returns", "the", "insertion", "-", "ordered", "list", "of", "dependencies", "." ]
[ "func", "(", "s", "*", "Set", ")", "List", "(", ")", "[", "]", "Dependency", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "r", ":=", "make", "(", "[", "]", "Dependency", ",", "len", "(", "s", ".", "list", ")", ")", "\n", "for", "i", ",", "k", ":=", "range", "s", ".", "<mask>", "{", "r", "[", "i", "]", "=", "s", ".", "set", "[", "k", "]", "\n", "}", "\n", "return", "r", "\n", "}" ]
20,707
all-20708
[ "duplicate", "of", "dockerCPUShares", "in", "task_linux", ".", "go" ]
[ "func", "(", "task", "*", "<mask>", ")", "dockerCPUShares", "(", "containerCPU", "uint", ")", "int64", "{", "if", "containerCPU", "<=", "1", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "containerCPU", ")", "\n", "return", "2", "\n", "}", "\n", "return", "int64", "(", "containerCPU", ")", "\n", "}" ]
20,708
all-20709
[ "GetTitle", "returns", "the", "Title", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardLite", ")", "GetTitle", "(", ")", "<mask>", "{", "if", "d", "==", "nil", "||", "d", ".", "Title", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "Title", "\n", "}" ]
20,709
all-20710
[ "SetInferenceAccelerators", "sets", "the", "InferenceAccelerators", "field", "s", "value", "." ]
[ "func", "(", "s", "*", "RegisterTaskDefinitionInput", ")", "SetInferenceAccelerators", "(", "v", "[", "]", "*", "InferenceAccelerator", ")", "*", "RegisterTaskDefinitionInput", "{", "s", ".", "InferenceAccelerators", "=", "v", "\n", "<mask>", "s", "\n", "}" ]
20,710
all-20711
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetPlatformFontsForNodeParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss38", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,711
all-20712
[ "ErrorReportingService", "is", "an", "option", "that", "defines", "the", "name", "of", "the", "service", "being", "tracked", "for", "Stackdriver", "error", "reporting", ".", "See", ":", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "error", "-", "reporting", "/", "docs", "/", "formatting", "-", "error", "-", "messages" ]
[ "func", "ErrorReportingService", "(", "service", "string", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "sh", ".", "errorReportingServiceName", "=", "<mask>", "\n", "return", "nil", "\n", "}", "\n", "}" ]
20,712
all-20713
[ "AppendBytes", "appends", "response", "header", "representation", "to", "dst", "and", "returns", "the", "extended", "dst", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "AppendBytes", "(", "dst", "[", "]", "byte", ")", "[", "]", "byte", "{", "statusCode", ":=", "h", ".", "StatusCode", "(", ")", "\n", "if", "statusCode", "<", "0", "{", "statusCode", "=", "StatusOK", "\n", "}", "\n", "dst", "=", "<mask>", "(", "dst", ",", "statusLine", "(", "statusCode", ")", "...", ")", "\n\n", "server", ":=", "h", ".", "Server", "(", ")", "\n", "if", "len", "(", "server", ")", "!=", "0", "{", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strServer", ",", "server", ")", "\n", "}", "\n", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strDate", ",", "serverDate", ".", "Load", "(", ")", ".", "(", "[", "]", "byte", ")", ")", "\n\n", "// Append Content-Type only for non-zero responses", "// or if it is explicitly set.", "// See https://github.com/valyala/fasthttp/issues/28 .", "if", "h", ".", "ContentLength", "(", ")", "!=", "0", "||", "len", "(", "h", ".", "contentType", ")", ">", "0", "{", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strContentType", ",", "h", ".", "ContentType", "(", ")", ")", "\n", "}", "\n\n", "if", "len", "(", "h", ".", "contentLengthBytes", ")", ">", "0", "{", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strContentLength", ",", "h", ".", "contentLengthBytes", ")", "\n", "}", "\n\n", "for", "i", ",", "n", ":=", "0", ",", "len", "(", "h", ".", "h", ")", ";", "i", "<", "n", ";", "i", "++", "{", "kv", ":=", "&", "h", ".", "h", "[", "i", "]", "\n", "if", "!", "bytes", ".", "Equal", "(", "kv", ".", "key", ",", "strDate", ")", "{", "dst", "=", "appendHeaderLine", "(", "dst", ",", "kv", ".", "key", ",", "kv", ".", "value", ")", "\n", "}", "\n", "}", "\n\n", "n", ":=", "len", "(", "h", ".", "cookies", ")", "\n", "if", "n", ">", "0", "{", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "kv", ":=", "&", "h", ".", "cookies", "[", "i", "]", "\n", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strSetCookie", ",", "kv", ".", "value", ")", "\n", "}", "\n", "}", "\n\n", "if", "h", ".", "ConnectionClose", "(", ")", "{", "dst", "=", "appendHeaderLine", "(", "dst", ",", "strConnection", ",", "strClose", ")", "\n", "}", "\n\n", "return", "append", "(", "dst", ",", "strCRLF", "...", ")", "\n", "}" ]
20,713
all-20714
[ "TypeURIs", "-", "Builds", "up", "the", "type", "URI", "based", "on", "type", "e", ".", "g", "http", ":", "//", "www", ".", "ft", ".", "com", "/", "ontology", "/", "Person" ]
[ "func", "TypeURIs", "(", "labels", "[", "]", "string", ")", "[", "]", "string", "{", "var", "<mask>", "[", "]", "string", "\n", "sorted", ",", "err", ":=", "SortTypes", "(", "labels", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "[", "]", "string", "{", "}", "\n", "}", "\n", "for", "_", ",", "label", ":=", "range", "sorted", "{", "uri", ":=", "typeURIs", "[", "label", "]", "\n", "if", "uri", "!=", "\"", "\"", "{", "results", "=", "append", "(", "results", ",", "uri", ")", "\n", "}", "\n", "}", "\n", "return", "results", "\n", "}" ]
20,714
all-20715
[ "ImageLoad", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "ImageLoad", "(", "arg0", "context", ".", "Context", ",", "arg1", "io", ".", "Reader", ",", "arg2", "bool", ")", "(", "types", ".", "ImageLoadResponse", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "<mask>", ".", "ImageLoadResponse", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,715
all-20716
[ "RemoteURL", "returns", "the", "URL", "of", "a", "remote", "by", "its", "name", ".", "Or", "an", "error", "if", "the", "remote", "is", "not", "declared", "." ]
[ "func", "(", "r", "*", "Repository", ")", "RemoteURL", "(", "name", "string", ")", "(", "string", ",", "error", ")", "{", "config", ",", "err", ":=", "os", ".", "Open", "(", "filepath", ".", "Join", "(", "r", ".", "path", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "config", ".", "Close", "(", ")", "\n", "line", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "config", ")", "\n", "scanner", ".", "Split", "(", "bufio", ".", "ScanLines", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "if", "scanner", ".", "<mask>", "(", ")", "==", "line", "{", "scanner", ".", "Scan", "(", ")", "\n", "return", "strings", ".", "Split", "(", "scanner", ".", "Text", "(", ")", ",", "\"", "\"", ")", "[", "1", "]", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", ",", "errRemoteNotFound", "{", "name", "}", "\n", "}" ]
20,716
all-20717
[ "RemoveImageState", "removes", "an", "image", ".", "ImageState" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "RemoveImageState", "(", "imageState", "*", "<mask>", ".", "ImageState", ")", "{", "if", "imageState", "==", "nil", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "state", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "imageState", ",", "ok", ":=", "state", ".", "imageStates", "[", "imageState", ".", "Image", ".", "ImageID", "]", "\n", "if", "!", "ok", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "delete", "(", "state", ".", "imageStates", ",", "imageState", ".", "Image", ".", "ImageID", ")", "\n", "}" ]
20,717
all-20718
[ "LoadRulesFromFile", "loads", "rules", "from", "all", "YAML", "files", "inside", "different", "directories", "separated", "by", ":", "." ]
[ "func", "(", "s", "*", "Seekret", ")", "LoadRulesFromPath", "(", "path", "string", ",", "defaulEnabled", "bool", ")", "error", "{", "if", "path", "==", "\"", "\"", "{", "<mask>", "=", "DefaultRulesPath", "(", ")", "\n", "}", "\n", "dirList", ":=", "strings", ".", "Split", "(", "path", ",", "\"", "\"", ")", "\n", "for", "_", ",", "dir", ":=", "range", "dirList", "{", "err", ":=", "s", ".", "LoadRulesFromDir", "(", "dir", ",", "defaulEnabled", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,718
all-20719
[ "map", "all", "or", "part", "of", "a", "buffer", "object", "s", "data", "store", "into", "the", "client", "s", "address", "space" ]
[ "func", "MapBufferRange", "(", "target", "uint32", ",", "offset", "int", ",", "<mask>", "int", ",", "access", "uint32", ")", "unsafe", ".", "Pointer", "{", "ret", ":=", "C", ".", "glowMapBufferRange", "(", "gpMapBufferRange", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "offset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "length", ")", ",", "(", "C", ".", "GLbitfield", ")", "(", "access", ")", ")", "\n", "return", "(", "unsafe", ".", "Pointer", ")", "(", "ret", ")", "\n", "}" ]
20,719
all-20720
[ "NewReadWriter", "returns", "a", "new", "ReadWriter", "with", "rw", "as", "both", "its", "source", "and", "its", "sink", "." ]
[ "func", "NewReadWriter", "(", "rw", "<mask>", ".", "ReadWriter", ")", "ReadWriter", "{", "return", "&", "readWriter", "{", "r", ":", "rw", ",", "w", ":", "rw", "}", "\n", "}" ]
20,720
all-20721
[ "DeleteUser", "deletes", "the", "specified", "user" ]
[ "func", "(", "c", "*", "Client", ")", "DeleteUser", "(", "userid", "string", ")", "(", "*", "http", ".", "Header", ",", "error", ")", "{", "url", ":=", "umUsersPath", "(", "userid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "<mask>", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Delete", "(", "url", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
20,721
all-20722
[ "resourceVSphereComputeClusterApplyCustomAttributes", "processes", "the", "custom", "attributes", "step", "for", "both", "create", "and", "update", "for", "vsphere_compute_cluster", "." ]
[ "func", "resourceVSphereComputeClusterApplyCustomAttributes", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "cluster", "*", "object", ".", "ClusterComputeResource", ",", ")", "error", "{", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "// Verify a proper vCenter before proceeding if custom attributes are defined", "attrsProcessor", ",", "err", ":=", "customattribute", ".", "GetDiffProcessorIfAttributesDefined", "(", "client", ",", "d", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "attrsProcessor", "==", "nil", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ")", "\n", "return", "attrsProcessor", ".", "ProcessDiff", "(", "cluster", ")", "\n", "}" ]
20,722
all-20723
[ "return", "parameters", "of", "a", "query", "object", "target" ]
[ "func", "GetQueryiv", "(", "target", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpGetQueryiv", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
20,723
all-20724
[ "ServerInfo", "returns", "details", "for", "the", "server", "at", "the", "time", "the", "socket", "was", "initially", "acquired", "." ]
[ "func", "(", "socket", "*", "mongoSocket", ")", "ServerInfo", "(", ")", "*", "mongoServerInfo", "{", "<mask>", ".", "Lock", "(", ")", "\n", "serverInfo", ":=", "socket", ".", "serverInfo", "\n", "socket", ".", "Unlock", "(", ")", "\n", "return", "serverInfo", "\n", "}" ]
20,724
all-20725
[ "updatePeer", "updates", "the", "score", "of", "the", "peer", "and", "update", "it", "s", "position", "in", "heap", "as", "well", "." ]
[ "func", "(", "ch", "*", "<mask>", ")", "updatePeer", "(", "p", "*", "Peer", ")", "{", "ch", ".", "peers", ".", "onPeerChange", "(", "p", ")", "\n", "ch", ".", "subChannels", ".", "updatePeer", "(", "p", ")", "\n", "p", ".", "callOnUpdateComplete", "(", ")", "\n", "}" ]
20,725
all-20726
[ "AppendPage", "is", "a", "wrapper", "around", "gtk_assistant_append_page", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "AppendPage", "(", "page", "IWidget", ")", "int", "{", "c", ":=", "C", ".", "gtk_assistant_append_page", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
20,726
all-20727
[ "connect", "appends", "any", "necessary", "Identity", "Modified", "UniqueX", "or", "UniqueY", "types", "to", "the", "edit", "-", "script", "to", "connect", "p", ".", "point", "to", "dst", "." ]
[ "func", "(", "p", "*", "path", ")", "connect", "(", "dst", "point", ",", "f", "EqualFunc", ")", "{", "if", "p", ".", "dir", ">", "0", "{", "// Connect in forward direction.", "for", "dst", ".", "X", ">", "p", ".", "X", "&&", "dst", ".", "Y", ">", "p", ".", "Y", "{", "switch", "r", ":=", "f", "(", "p", ".", "X", ",", "p", ".", "Y", ")", ";", "{", "case", "r", ".", "Equal", "(", ")", ":", "p", ".", "append", "(", "Identity", ")", "\n", "case", "r", ".", "Similar", "(", ")", ":", "p", ".", "append", "(", "Modified", ")", "\n", "case", "dst", ".", "X", "-", "p", ".", "X", ">=", "dst", ".", "Y", "-", "p", ".", "Y", ":", "p", ".", "append", "(", "UniqueX", ")", "\n", "default", ":", "p", ".", "append", "(", "UniqueY", ")", "\n", "}", "\n", "}", "\n", "for", "dst", ".", "X", ">", "p", ".", "X", "{", "p", ".", "<mask>", "(", "UniqueX", ")", "\n", "}", "\n", "for", "dst", ".", "Y", ">", "p", ".", "Y", "{", "p", ".", "append", "(", "UniqueY", ")", "\n", "}", "\n", "}", "else", "{", "// Connect in reverse direction.", "for", "p", ".", "X", ">", "dst", ".", "X", "&&", "p", ".", "Y", ">", "dst", ".", "Y", "{", "switch", "r", ":=", "f", "(", "p", ".", "X", "-", "1", ",", "p", ".", "Y", "-", "1", ")", ";", "{", "case", "r", ".", "Equal", "(", ")", ":", "p", ".", "append", "(", "Identity", ")", "\n", "case", "r", ".", "Similar", "(", ")", ":", "p", ".", "append", "(", "Modified", ")", "\n", "case", "p", ".", "Y", "-", "dst", ".", "Y", ">=", "p", ".", "X", "-", "dst", ".", "X", ":", "p", ".", "append", "(", "UniqueY", ")", "\n", "default", ":", "p", ".", "append", "(", "UniqueX", ")", "\n", "}", "\n", "}", "\n", "for", "p", ".", "X", ">", "dst", ".", "X", "{", "p", ".", "append", "(", "UniqueX", ")", "\n", "}", "\n", "for", "p", ".", "Y", ">", "dst", ".", "Y", "{", "p", ".", "append", "(", "UniqueY", ")", "\n", "}", "\n", "}", "\n", "}" ]
20,727
all-20728
[ "attach", "a", "range", "of", "a", "buffer", "object", "s", "data", "store", "to", "a", "buffer", "texture", "object" ]
[ "func", "TextureBufferRange", "(", "texture", "uint32", ",", "internalformat", "uint32", ",", "buffer", "uint32", ",", "offset", "int", ",", "size", "int", ")", "{", "C", ".", "glowTextureBufferRange", "(", "gpTextureBufferRange", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "offset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "<mask>", ")", ")", "\n", "}" ]
20,728
all-20729
[ "NewStreamingBytesReader", "returns", "an", "io", ".", "Reader", "for", "a", "StreamingBytesClient", "." ]
[ "func", "NewStreamingBytesReader", "(", "streamingBytesClient", "StreamingBytesClient", ",", "cancel", "<mask>", ".", "CancelFunc", ")", "io", ".", "ReadCloser", "{", "return", "&", "streamingBytesReader", "{", "streamingBytesClient", ":", "streamingBytesClient", ",", "cancel", ":", "cancel", "}", "\n", "}" ]
20,729
all-20730
[ "HasLogQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesRequest", ")", "HasLogQuery", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "LogQuery", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,730
all-20731
[ "Prepend", "is", "a", "wrapper", "around", "gtk_menu_shell_prepend", "()", "." ]
[ "func", "(", "v", "*", "MenuShell", ")", "Prepend", "(", "<mask>", "IMenuItem", ")", "{", "C", ".", "gtk_menu_shell_prepend", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
20,731
all-20732
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventReceivedMessageFromTarget", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,732
all-20733
[ "ToMorseCode", "will", "format", "the", "provided", "string", "in", "Morse", "Code", "." ]
[ "func", "ToMorseCode", "(", "theString", "string", ")", "(", "string", ",", "error", ")", "{", "f", ":=", "New", "(", "theString", ")", "\n\n", "if", "f", ".", "length", "<", "1", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "lengthError", ")", "\n", "}", "\n\n", "f", ".", "makeLower", "(", ")", "\n\n", "var", "buffer", "bytes", ".", "Buffer", "\n\n", "for", "_", ",", "i", ":=", "range", "f", ".", "theString", "{", "key", ":=", "string", "(", "i", ")", "\n", "if", "_", ",", "ok", ":=", "morse", "[", "key", "]", ";", "ok", "{", "<mask>", ".", "WriteString", "(", "morse", "[", "key", "]", ")", "\n", "}", "else", "if", "key", "==", "\"", "\"", "{", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "buffer", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
20,733
all-20734
[ "flattenHostNicOrderPolicy", "reads", "various", "fields", "from", "a", "HostNicOrderPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenHostNicOrderPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "HostNicOrderPolicy", ")", "error", "{", "if", "obj", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "err", ":=", "d", ".", "<mask>", "(", "\"", "\"", ",", "structure", ".", "SliceStringsToInterfaces", "(", "obj", ".", "ActiveNic", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "structure", ".", "SliceStringsToInterfaces", "(", "obj", ".", "StandbyNic", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,734
all-20735
[ "GetDashboardLists", "returns", "a", "list", "of", "all", "dashboard", "lists", "created", "on", "this", "account", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetDashboardLists", "(", ")", "(", "[", "]", "DashboardList", ",", "error", ")", "{", "var", "out", "reqGetDashboardLists", "\n", "if", "err", ":=", "<mask>", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "DashboardLists", ",", "nil", "\n", "}" ]
20,735
all-20736
[ "UncompressedDigest", "returns", "an", "uncompressed", "digest", "corresponding", "to", "anyDigest", ".", "May", "return", "anyDigest", "if", "it", "is", "known", "to", "be", "uncompressed", ".", "Returns", "if", "nothing", "is", "known", "about", "the", "digest", "(", "it", "may", "be", "compressed", "or", "uncompressed", ")", "." ]
[ "func", "(", "mem", "*", "<mask>", ")", "UncompressedDigest", "(", "anyDigest", "digest", ".", "Digest", ")", "digest", ".", "Digest", "{", "mem", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "mem", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", "mem", ".", "uncompressedDigestLocked", "(", "anyDigest", ")", "\n", "}" ]
20,736
all-20737
[ "ErrorToStatus", "translates", "error", "into", "http", "code" ]
[ "func", "ErrorToStatus", "(", "err", "error", ")", "int", "{", "switch", "err", ".", "(", "type", ")", "{", "default", ":", "return", "http", ".", "StatusInternalServerError", "\n", "<mask>", "*", "ranch", ".", "OwnerNotMatch", ":", "return", "http", ".", "StatusUnauthorized", "\n", "case", "*", "ranch", ".", "ResourceNotFound", ":", "return", "http", ".", "StatusNotFound", "\n", "case", "*", "ranch", ".", "ResourceTypeNotFound", ":", "return", "http", ".", "StatusNotFound", "\n", "case", "*", "ranch", ".", "StateNotMatch", ":", "return", "http", ".", "StatusConflict", "\n", "}", "\n", "}" ]
20,737
all-20738
[ "square", "fills", "out", "with", "square", "wave", "values", "with", "the", "specified", "volume", "frequency", "and", "sequence", "." ]
[ "func", "square", "(", "out", "[", "]", "int16", ",", "volume", "float64", ",", "freq", "float64", ",", "sequence", "float64", ")", "{", "if", "freq", "==", "0", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "out", ")", ";", "i", "++", "{", "out", "[", "i", "]", "=", "0", "\n", "}", "\n", "return", "\n", "}", "\n", "length", ":=", "int", "(", "float64", "(", "sampleRate", ")", "/", "freq", ")", "\n", "if", "length", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "out", ")", ";", "i", "++", "{", "a", ":=", "int16", "(", "volume", "*", "math", ".", "MaxInt16", ")", "\n", "if", "i", "%", "<mask>", "<", "int", "(", "float64", "(", "length", ")", "*", "sequence", ")", "{", "a", "=", "-", "a", "\n", "}", "\n", "out", "[", "i", "]", "=", "a", "\n", "}", "\n", "}" ]
20,738
all-20739
[ "BlobKeyForFile", "returns", "a", "BlobKey", "for", "a", "Google", "Storage", "file", ".", "The", "filename", "should", "be", "of", "the", "form", "/", "gs", "/", "bucket_name", "/", "object_name", "." ]
[ "func", "BlobKeyForFile", "(", "c", "context", ".", "Context", ",", "filename", "string", ")", "(", "appengine", ".", "BlobKey", ",", "error", ")", "{", "req", ":=", "&", "blobpb", ".", "CreateEncodedGoogleStorageKeyRequest", "{", "Filename", ":", "&", "<mask>", ",", "}", "\n", "res", ":=", "&", "blobpb", ".", "CreateEncodedGoogleStorageKeyResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "appengine", ".", "BlobKey", "(", "*", "res", ".", "BlobKey", ")", ",", "nil", "\n", "}" ]
20,739
all-20740
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetResourceTreeParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage31", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,740
all-20741
[ "Publish", "executes", "callback", "defined", "for", "a", "topic", ".", "Any", "additional", "argument", "will", "be", "transferred", "to", "the", "callback", "." ]
[ "func", "(", "bus", "*", "EventBus", ")", "Publish", "(", "topic", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "bus", ".", "lock", ".", "Lock", "(", ")", "// will unlock if handler is not found or always after setUpPublish", "\n", "defer", "bus", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "handlers", ",", "ok", ":=", "bus", ".", "handlers", "[", "topic", "]", ";", "ok", "&&", "0", "<", "len", "(", "handlers", ")", "{", "// Handlers slice may be changed by removeHandler and Unsubscribe during iteration,", "// so make a copy and iterate the copied slice.", "copyHandlers", ":=", "make", "(", "[", "]", "*", "eventHandler", ",", "0", ",", "len", "(", "handlers", ")", ")", "\n", "copyHandlers", "=", "append", "(", "copyHandlers", ",", "handlers", "...", ")", "\n", "for", "i", ",", "handler", ":=", "range", "copyHandlers", "{", "if", "handler", ".", "flagOnce", "{", "bus", ".", "removeHandler", "(", "topic", ",", "i", ")", "\n", "}", "\n", "if", "!", "handler", ".", "async", "{", "bus", ".", "doPublish", "(", "handler", ",", "topic", ",", "args", "...", ")", "\n", "}", "else", "{", "bus", ".", "wg", ".", "Add", "(", "1", ")", "\n", "if", "<mask>", ".", "transactional", "{", "handler", ".", "Lock", "(", ")", "\n", "}", "\n", "go", "bus", ".", "doPublishAsync", "(", "handler", ",", "topic", ",", "args", "...", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
20,741
all-20742
[ "Pid", "returns", "the", "pid", "of", "the", "child", "process", ".", "If", "no", "child", "process", "exists", "0", "is", "returned", "." ]
[ "func", "(", "c", "*", "Child", ")", "Pid", "(", ")", "int", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "<mask>", "(", ")", "\n", "}" ]
20,742
all-20743
[ "SetEvaluationDuration", "updates", "evaluationDuration", "to", "the", "time", "in", "seconds", "it", "took", "to", "evaluate", "the", "rule", "on", "its", "last", "evaluation", "." ]
[ "func", "(", "rule", "*", "RecordingRule", ")", "SetEvaluationDuration", "(", "dur", "<mask>", ".", "Duration", ")", "{", "rule", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "rule", ".", "mtx", ".", "Unlock", "(", ")", "\n", "rule", ".", "evaluationDuration", "=", "dur", "\n", "}" ]
20,743
all-20744
[ "/", "*", "get", "a", "uid", "or", "gid", "mapping", "from", "/", "etc", "/", "subxid" ]
[ "func", "getFromShadow", "(", "fname", "string", ",", "username", "string", ")", "(", "[", "]", "[", "]", "int64", ",", "error", ")", "{", "entries", ":=", "[", "]", "[", "]", "int64", "{", "}", "\n\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "fname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "f", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "// Skip comments", "s", ":=", "strings", ".", "Split", "(", "scanner", ".", "Text", "(", ")", ",", "\"", "\"", ")", "\n", "if", "len", "(", "s", "[", "0", "]", ")", "==", "0", "{", "continue", "\n", "}", "\n\n", "// Validate format", "s", "=", "strings", ".", "Split", "(", "s", "[", "0", "]", ",", "\"", "\"", ")", "\n", "if", "len", "(", "s", ")", "<", "3", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "fname", ",", "s", ")", "\n", "}", "\n\n", "if", "strings", ".", "EqualFold", "(", "s", "[", "0", "]", ",", "username", ")", "{", "// Get range start", "entryStart", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "s", "[", "1", "]", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "// Get range size", "entrySize", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "s", "[", "2", "]", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "entries", "=", "<mask>", "(", "entries", ",", "[", "]", "int64", "{", "int64", "(", "entryStart", ")", ",", "int64", "(", "entrySize", ")", "}", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "entries", ")", "==", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "username", ",", "path", ".", "Base", "(", "fname", ")", ")", "\n", "}", "\n\n", "return", "entries", ",", "nil", "\n", "}" ]
20,744
all-20745
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StartScreencastParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,745
all-20746
[ "Scan", "implements", "the", "Scanner", "interface", "." ]
[ "func", "(", "t", "*", "Time", ")", "Scan", "(", "<mask>", "interface", "{", "}", ")", "error", "{", "var", "err", "error", "\n", "switch", "x", ":=", "value", ".", "(", "type", ")", "{", "case", "time", ".", "Time", ":", "t", ".", "Time", "=", "x", "\n", "case", "nil", ":", "t", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ",", "value", ")", "\n", "}", "\n", "t", ".", "Valid", "=", "err", "==", "nil", "\n", "return", "err", "\n", "}" ]
20,746
all-20747
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Value", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
20,747
all-20748
[ "ImageGet", "gets", "an", "Image", "object", "from", "the", "database", ".", "If", "strictMatching", "is", "false", "The", "fingerprint", "argument", "will", "be", "queried", "with", "a", "LIKE", "query", "means", "you", "can", "pass", "a", "shortform", "and", "will", "get", "the", "full", "fingerprint", ".", "There", "can", "never", "be", "more", "than", "one", "image", "with", "a", "given", "fingerprint", "as", "it", "is", "enforced", "by", "a", "UNIQUE", "constraint", "in", "the", "schema", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageGet", "(", "project", ",", "fingerprint", "string", ",", "public", "bool", ",", "strictMatching", "bool", ")", "(", "int", ",", "*", "api", ".", "Image", ",", "error", ")", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasImages", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "enabled", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "create", ",", "expire", ",", "used", ",", "upload", "*", "time", ".", "Time", "// These hold the db-returned times", "\n\n", "// The object we'll actually return", "image", ":=", "api", ".", "Image", "{", "}", "\n", "id", ":=", "-", "1", "\n", "arch", ":=", "-", "1", "\n\n", "// These two humongous things will be filled by the call to DbQueryRowScan", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "&", "id", ",", "&", "image", ".", "Fingerprint", ",", "&", "<mask>", ".", "Filename", ",", "&", "image", ".", "Size", ",", "&", "image", ".", "Cached", ",", "&", "image", ".", "Public", ",", "&", "image", ".", "AutoUpdate", ",", "&", "arch", ",", "&", "create", ",", "&", "expire", ",", "&", "used", ",", "&", "upload", "}", "\n\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", "}", "\n", "query", ":=", "`\n SELECT\n images.id, fingerprint, filename, size, cached, public, auto_update, architecture,\n creation_date, expiry_date, last_use_date, upload_date\n FROM images\n JOIN projects ON projects.id = images.project_id\n WHERE projects.name = ?`", "\n", "if", "strictMatching", "{", "inargs", "=", "append", "(", "inargs", ",", "fingerprint", ")", "\n", "query", "+=", "\"", "\"", "\n", "}", "else", "{", "inargs", "=", "append", "(", "inargs", ",", "fingerprint", "+", "\"", "\"", ")", "\n", "query", "+=", "\"", "\"", "\n", "}", "\n\n", "if", "public", "{", "query", "+=", "\"", "\"", "\n", "}", "\n\n", "err", "=", "dbQueryRowScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "-", "1", ",", "nil", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "-", "1", ",", "nil", ",", "err", "// Likely: there are no rows for this fingerprint", "\n", "}", "\n\n", "// Validate we only have a single match", "if", "!", "strictMatching", "{", "query", "=", "`\nSELECT COUNT(images.id)\n FROM images\n JOIN projects ON projects.id = images.project_id\n WHERE projects.name = ?\n AND fingerprint LIKE ?\n`", "\n", "count", ":=", "0", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "&", "count", "}", "\n\n", "err", "=", "dbQueryRowScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", ",", "err", "\n", "}", "\n\n", "if", "count", ">", "1", "{", "return", "-", "1", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "err", "=", "c", ".", "imageFill", "(", "id", ",", "&", "image", ",", "create", ",", "expire", ",", "used", ",", "upload", ",", "arch", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "id", ",", "&", "image", ",", "nil", "\n", "}" ]
20,748
all-20749
[ "vectorSelectorSingle", "evaluates", "a", "instant", "vector", "for", "the", "iterator", "of", "one", "time", "series", "." ]
[ "func", "(", "ev", "*", "evaluator", ")", "vectorSelectorSingle", "(", "it", "*", "storage", ".", "BufferedSeriesIterator", ",", "node", "*", "VectorSelector", ",", "ts", "int64", ")", "(", "int64", ",", "float64", ",", "bool", ")", "{", "refTime", ":=", "ts", "-", "durationMilliseconds", "(", "node", ".", "Offset", ")", "\n", "var", "t", "int64", "\n", "var", "v", "float64", "\n\n", "ok", ":=", "it", ".", "Seek", "(", "refTime", ")", "\n", "if", "!", "ok", "{", "if", "it", ".", "Err", "(", ")", "!=", "nil", "{", "ev", ".", "error", "(", "it", ".", "Err", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "if", "ok", "{", "t", ",", "v", "=", "it", ".", "Values", "(", ")", "\n", "}", "\n\n", "if", "!", "ok", "||", "t", ">", "refTime", "{", "t", ",", "v", ",", "ok", "=", "it", ".", "PeekBack", "(", "1", ")", "\n", "if", "!", "<mask>", "||", "t", "<", "refTime", "-", "durationMilliseconds", "(", "LookbackDelta", ")", "{", "return", "0", ",", "0", ",", "false", "\n", "}", "\n", "}", "\n", "if", "value", ".", "IsStaleNaN", "(", "v", ")", "{", "return", "0", ",", "0", ",", "false", "\n", "}", "\n", "return", "t", ",", "v", ",", "true", "\n", "}" ]
20,749
all-20750
[ "canonicalizeSubjects", "applies", "canonicalizeSubject", "to", "a", "list" ]
[ "func", "(", "a", "*", "apiServer", ")", "canonicalizeSubjects", "(", "ctx", "context", ".", "Context", ",", "subjects", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "subjects", "==", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}", "\n\n", "eg", ":=", "&", "errgroup", ".", "Group", "{", "}", "\n", "canonicalizedSubjects", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "subjects", ")", ")", "\n", "for", "i", ",", "subject", ":=", "range", "subjects", "{", "i", ",", "subject", ":=", "i", ",", "subject", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "<mask>", ",", "err", ":=", "a", ".", "canonicalizeSubject", "(", "ctx", ",", "subject", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "canonicalizedSubjects", "[", "i", "]", "=", "subject", "\n", "return", "nil", "\n", "}", ")", "\n", "}", "\n", "if", "err", ":=", "eg", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "canonicalizedSubjects", ",", "nil", "\n", "}" ]
20,750
all-20751
[ "indent", "returns", "the", "line", "s", "indent", "." ]
[ "func", "indent", "(", "str", "string", ")", "int", "{", "var", "i", "int", "\n\n", "for", "_", ",", "b", ":=", "<mask>", "str", "{", "if", "b", "!=", "unicodeSpace", "{", "break", "\n", "}", "\n", "i", "++", "\n", "}", "\n\n", "return", "i", "/", "2", "\n", "}" ]
20,751
all-20752
[ "GetEnableLogsSample", "returns", "the", "EnableLogsSample", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "o", "*", "<mask>", ")", "GetEnableLogsSample", "(", ")", "bool", "{", "if", "o", "==", "nil", "||", "o", ".", "EnableLogsSample", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "*", "o", ".", "EnableLogsSample", "\n", "}" ]
20,752
all-20753
[ "Validate", "validates", "this", "error" ]
[ "func", "(", "m", "*", "Error", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "<mask>", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateType", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,753
all-20754
[ "EnsureRowVisible", "scrolls", "the", "table", "vertically", "to", "make", "the", "currently", "selected", "row", "visible" ]
[ "func", "(", "l", "*", "TableView", ")", "EnsureRowVisible", "(", ")", "{", "length", ":=", "l", ".", "rowCount", "\n\n", "hgt", ":=", "l", ".", "height", "-", "3", "\n\n", "if", "length", "<=", "hgt", "||", "l", ".", "selectedRow", "==", "-", "1", "{", "return", "\n", "}", "\n\n", "diff", ":=", "l", ".", "selectedRow", "-", "l", ".", "topRow", "\n", "if", "diff", ">=", "0", "&&", "diff", "<", "hgt", "{", "return", "\n", "}", "\n\n", "if", "diff", "<", "0", "{", "l", ".", "topRow", "=", "l", ".", "selectedRow", "\n", "}", "else", "{", "top", ":=", "l", ".", "selectedRow", "-", "hgt", "+", "1", "\n", "if", "length", "-", "top", ">", "hgt", "{", "l", ".", "topRow", "=", "<mask>", "\n", "}", "else", "{", "l", ".", "topRow", "=", "length", "-", "hgt", "\n", "}", "\n", "}", "\n", "}" ]
20,754
all-20755
[ "Returns", "raw", "paste", "text" ]
[ "func", "(", "api", "*", "API", ")", "GetPasteTextById", "(", "paste_id", "string", ")", "(", "string", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "http", ".", "Get", "(", "\"", "\"", "+", "paste_id", ")", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "response", ".", "StatusCode", "!=", "200", "{", "return", "\"", "\"", ",", "PasteGetError", "\n", "}", "\n", "buf", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "_", ",", "err", "=", "buf", ".", "ReadFrom", "(", "response", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
20,755
all-20756
[ "stringFormat", "given", "a", "set", "of", "column", "widths", "and", "the", "number", "of", "columns", "in", "the", "current", "line", "returns", "a", "sprintf", "-", "style", "format", "string", "which", "can", "be", "used", "to", "print", "output", "aligned", "properly", "with", "other", "lines", "using", "the", "same", "widths", "set", "." ]
[ "func", "stringFormat", "(", "c", "*", "Config", ",", "widths", "[", "]", "int", ",", "columns", "int", ")", "string", "{", "// Create the buffer with an estimate of the length", "buf", ":=", "bytes", ".", "NewBuffer", "(", "<mask>", "(", "[", "]", "byte", ",", "0", ",", "(", "6", "+", "len", "(", "c", ".", "Glue", ")", ")", "*", "columns", ")", ")", "\n\n", "// Start with the prefix, if any was given. The buffer will not return an", "// error so it does not need to be handled", "buf", ".", "WriteString", "(", "c", ".", "Prefix", ")", "\n\n", "// Create the format string from the discovered widths", "for", "i", ":=", "0", ";", "i", "<", "columns", "&&", "i", "<", "len", "(", "widths", ")", ";", "i", "++", "{", "if", "i", "==", "columns", "-", "1", "{", "buf", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "}", "else", "{", "fmt", ".", "Fprintf", "(", "buf", ",", "\"", "\"", ",", "widths", "[", "i", "]", ",", "c", ".", "Glue", ")", "\n", "}", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
20,756
all-20757
[ "GetUpdated", "retrieves", "the", "Updated", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerEntryChange", ")", "GetUpdated", "(", ")", "(", "result", "LedgerEntry", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "<mask>", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Updated", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
20,757
all-20758
[ "KubeClient", "generates", "a", "kube", "client", "if", "it", "was", "not", "created", "before" ]
[ "func", "(", "p", "*", "SingletonClientGenerator", ")", "KubeClient", "(", ")", "(", "kubernetes", ".", "Interface", ",", "error", ")", "{", "<mask>", "err", "error", "\n", "p", ".", "kubeOnce", ".", "Do", "(", "func", "(", ")", "{", "p", ".", "kubeClient", ",", "err", "=", "NewKubeClient", "(", "p", ".", "KubeConfig", ",", "p", ".", "KubeMaster", ",", "p", ".", "RequestTimeout", ")", "\n", "}", ")", "\n", "return", "p", ".", "kubeClient", ",", "err", "\n", "}" ]
20,758
all-20759
[ "GetShowCloseButton", "is", "a", "wrapper", "arounb", "gtk_search_bar_get_show_close_button", "()", "." ]
[ "func", "(", "v", "*", "SearchBar", ")", "GetShowCloseButton", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_search_bar_get_show_close_button", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
20,759
all-20760
[ "containsNode", "returns", "true", "if", "the", "slice", "nodes", "contains", "n" ]
[ "func", "containsNode", "(", "nodes", "[", "]", "*", "raftNode", ",", "n", "*", "raftNode", ")", "bool", "{", "for", "_", ",", "rn", ":=", "range", "nodes", "{", "if", "rn", "==", "n", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
20,760
all-20761
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "TODO", "See", "#getCredentials" ]
[ "func", "(", "gceProvider", "*", "GceProvider", ")", "GetCredentials", "(", ")", "error", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "gceProvider", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "<mask>", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
20,761
all-20762
[ "Term", "implements", "the", "Storage", "interface", "." ]
[ "func", "(", "ms", "*", "MemoryStorage", ")", "Term", "(", "i", "uint64", ")", "(", "uint64", ",", "error", ")", "{", "ms", ".", "Lock", "(", ")", "\n", "defer", "ms", ".", "Unlock", "(", ")", "\n", "offset", ":=", "ms", ".", "ents", "[", "0", "]", ".", "Index", "\n", "if", "i", "<", "offset", "{", "return", "0", ",", "ErrCompacted", "\n", "}", "\n", "if", "int", "(", "i", "-", "<mask>", ")", ">=", "len", "(", "ms", ".", "ents", ")", "{", "return", "0", ",", "ErrUnavailable", "\n", "}", "\n", "return", "ms", ".", "ents", "[", "i", "-", "offset", "]", ".", "Term", ",", "nil", "\n", "}" ]
20,762
all-20763
[ "Debugm", "executes", "the", "same", "function", "on", "the", "default", "Base", "instance" ]
[ "func", "Debugm", "(", "m", "*", "Attrs", ",", "<mask>", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "curDefault", ".", "Debugm", "(", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
20,763
all-20764
[ "ACTOR", "methods", "NB", ":", "The", "conn", ".", "*", "fields", "are", "only", "written", "by", "the", "connection", "actor", "process", "which", "is", "the", "caller", "of", "the", "ConnectionAction", "funs", ".", "Hence", "we", "do", "not", "need", "locks", "for", "reading", "and", "only", "need", "write", "locks", "for", "fields", "read", "by", "other", "processes", ".", "Non", "-", "blocking", "." ]
[ "func", "(", "conn", "*", "LocalConnection", ")", "shutdown", "(", "err", "error", ")", "{", "// err should always be a real error, even if only io.EOF", "if", "err", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "select", "{", "<mask>", "conn", ".", "errorChan", "<-", "err", ":", "default", ":", "}", "\n", "}" ]
20,764
all-20765
[ "PutManifest", "writes", "manifest", "to", "the", "destination", ".", "FIXME?", "This", "should", "also", "receive", "a", "MIME", "type", "if", "known", "to", "differentiate", "between", "schema", "versions", ".", "If", "the", "destination", "is", "in", "principle", "available", "refuses", "this", "manifest", "type", "(", "e", ".", "g", ".", "it", "does", "not", "recognize", "the", "schema", ")", "but", "may", "accept", "a", "different", "manifest", "type", "the", "returned", "error", "must", "be", "an", "ManifestTypeRejectedError", "." ]
[ "func", "(", "d", "*", "dockerImageDestination", ")", "PutManifest", "(", "ctx", "context", ".", "Context", ",", "m", "[", "]", "byte", ")", "error", "{", "digest", ",", "err", ":=", "manifest", ".", "Digest", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d", ".", "manifestDigest", "=", "digest", "\n\n", "refTail", ",", "err", ":=", "d", ".", "ref", ".", "tagOrDigest", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "manifestPath", ",", "reference", ".", "Path", "(", "d", ".", "ref", ".", "ref", ")", ",", "refTail", ")", "\n\n", "<mask>", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "mimeType", ":=", "manifest", ".", "GuessMIMEType", "(", "m", ")", "\n", "if", "mimeType", "!=", "\"", "\"", "{", "headers", "[", "\"", "\"", "]", "=", "[", "]", "string", "{", "mimeType", "}", "\n", "}", "\n", "res", ",", "err", ":=", "d", ".", "c", ".", "makeRequest", "(", "ctx", ",", "\"", "\"", ",", "path", ",", "headers", ",", "bytes", ".", "NewReader", "(", "m", ")", ",", "v2Auth", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "res", ".", "Body", ".", "Close", "(", ")", "\n", "if", "!", "successStatus", "(", "res", ".", "StatusCode", ")", "{", "err", "=", "errors", ".", "Wrapf", "(", "client", ".", "HandleErrorResponse", "(", "res", ")", ",", "\"", "\"", ",", "refTail", ",", "d", ".", "ref", ".", "ref", ".", "Name", "(", ")", ")", "\n", "if", "isManifestInvalidError", "(", "errors", ".", "Cause", "(", "err", ")", ")", "{", "err", "=", "types", ".", "ManifestTypeRejectedError", "{", "Err", ":", "err", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,765
all-20766
[ "SetBatch", "takes", "a", "map", "of", "values", "and", "sets", "the", "appropriate", "top", "-", "level", "attributes", "for", "each", "item", ".", "attrs", "is", "a", "map", "[", "string", "]", "interface", "{}", "that", "follows", "a", "pattern", "in", "the", "example", "below", ":", "err", ":", "=", "SetBatch", "(", "d", "map", "[", "string", "]", "interface", "{}", "{", "foo", ":", "obj", ".", "Foo", "bar", ":", "obj", ".", "Bar", "}", ")", "if", "err", "!", "=", "nil", "{", "return", "err", "}", "For", "best", "results", "supplied", "values", "should", "be", "or", "have", "concrete", "values", "that", "map", "to", "the", "correct", "values", "for", "the", "respective", "type", "in", "helper", "/", "schema", ".", "This", "is", "enforced", "by", "way", "of", "checking", "each", "Set", "call", "for", "errors", ".", "If", "there", "is", "an", "error", "setting", "a", "particular", "key", "processing", "stops", "immediately", "." ]
[ "func", "SetBatch", "(", "d", "*", "schema", ".", "ResourceData", ",", "attrs", "<mask>", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "for", "k", ",", "v", ":=", "range", "attrs", "{", "if", "err", ":=", "d", ".", "Set", "(", "k", ",", "v", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "k", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,766
all-20767
[ "coalesceBuckets", "merges", "buckets", "with", "the", "same", "upper", "bound", ".", "The", "input", "buckets", "must", "be", "sorted", "." ]
[ "func", "coalesceBuckets", "(", "buckets", "buckets", ")", "buckets", "{", "last", ":=", "buckets", "[", "0", "]", "\n", "i", ":=", "0", "\n", "for", "_", ",", "b", ":=", "range", "buckets", "[", "1", ":", "]", "{", "if", "b", ".", "upperBound", "==", "last", ".", "upperBound", "{", "last", ".", "count", "+=", "b", ".", "count", "\n", "}", "else", "{", "buckets", "[", "i", "]", "=", "last", "\n", "<mask>", "=", "b", "\n", "i", "++", "\n", "}", "\n", "}", "\n", "buckets", "[", "i", "]", "=", "last", "\n", "return", "buckets", "[", ":", "i", "+", "1", "]", "\n", "}" ]
20,767
all-20768
[ "Shutdown", "will", "close", "all", "connections", "to", "backend", "stores", "and", "shutdown", "any", "running", "ring", "service", "connector", ".", "Note", "that", "the", "ReplValueStore", "can", "still", "be", "used", "after", "Shutdown", "it", "will", "just", "start", "reconnecting", "to", "backends", "again", ".", "To", "relaunch", "the", "ring", "service", "connector", "you", "will", "need", "to", "call", "Startup", "." ]
[ "func", "(", "<mask>", "*", "ReplValueStore", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ")", "error", "{", "rs", ".", "ringLock", ".", "Lock", "(", ")", "\n", "if", "rs", ".", "ringServerExitChan", "!=", "nil", "{", "close", "(", "rs", ".", "ringServerExitChan", ")", "\n", "rs", ".", "ringServerExitChan", "=", "nil", "\n", "}", "\n", "rs", ".", "storesLock", ".", "Lock", "(", ")", "\n", "for", "addr", ",", "stc", ":=", "range", "rs", ".", "stores", "{", "if", "err", ":=", "stc", ".", "store", ".", "Shutdown", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "rs", ".", "logDebug", "(", "\"", "\"", ",", "addr", ",", "err", ")", "\n", "}", "\n", "delete", "(", "rs", ".", "stores", ",", "addr", ")", "\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "rs", ".", "storesLock", ".", "Unlock", "(", ")", "\n", "return", "ctx", ".", "Err", "(", ")", "\n", "default", ":", "}", "\n", "}", "\n", "rs", ".", "storesLock", ".", "Unlock", "(", ")", "\n", "rs", ".", "ringLock", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}" ]
20,768
all-20769
[ "PageDown", "moves", "the", "visible", "list", "forward", "by", "x", "items", ".", "Where", "x", "is", "the", "size", "of", "the", "visible", "items", "on", "the", "list", ".", "The", "selected", "item", "becomes", "the", "first", "visible", "item", "." ]
[ "func", "(", "l", "*", "List", ")", "PageDown", "(", ")", "{", "start", ":=", "l", ".", "start", "+", "l", ".", "size", "\n", "<mask>", ":=", "len", "(", "l", ".", "scope", ")", "-", "l", ".", "size", "\n\n", "switch", "{", "case", "len", "(", "l", ".", "scope", ")", "<", "l", ".", "size", ":", "l", ".", "start", "=", "0", "\n", "case", "start", ">", "max", ":", "l", ".", "start", "=", "max", "\n", "default", ":", "l", ".", "start", "=", "start", "\n", "}", "\n\n", "cursor", ":=", "l", ".", "start", "\n\n", "if", "cursor", "==", "l", ".", "cursor", "{", "l", ".", "cursor", "=", "len", "(", "l", ".", "scope", ")", "-", "1", "\n", "}", "else", "if", "cursor", ">", "l", ".", "cursor", "{", "l", ".", "cursor", "=", "cursor", "\n", "}", "\n", "}" ]
20,769
all-20770
[ "AcceleratorValid", "is", "a", "wrapper", "around", "gtk_accelerator_valid", "()", "." ]
[ "func", "AcceleratorValid", "(", "key", "uint", ",", "mods", "gdk", ".", "ModifierType", ")", "bool", "{", "return", "gobool", "(", "C", ".", "gtk_accelerator_valid", "(", "C", ".", "guint", "(", "<mask>", ")", ",", "C", ".", "GdkModifierType", "(", "mods", ")", ")", ")", "\n", "}" ]
20,770
all-20771
[ "BoxNew", "()", "is", "a", "wrapper", "around", "gtk_box_new", "()", "." ]
[ "func", "BoxNew", "(", "orientation", "Orientation", ",", "spacing", "int", ")", "(", "*", "Box", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_box_new", "(", "C", ".", "GtkOrientation", "(", "orientation", ")", ",", "C", ".", "gint", "(", "spacing", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapBox", "(", "obj", ")", ",", "nil", "\n", "}" ]
20,771
all-20772
[ "Returns", "an", "slice", "of", "strings", "or", "the", "specified", "slice", "if", "the", "key", "doesn", "t", "exist", "or", "isn", "t", "a", "valid", "[]", "string" ]
[ "func", "(", "t", "Typed", ")", "StringsOr", "(", "key", "string", ",", "d", "[", "]", "string", ")", "[", "]", "string", "{", "n", ",", "ok", ":=", "t", ".", "StringsIf", "(", "key", ")", "\n", "if", "<mask>", "{", "return", "n", "\n", "}", "\n", "return", "d", "\n", "}" ]
20,772
all-20773
[ "Bool", "defines", "a", "bool", "flag", "with", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "return", "value", "is", "the", "address", "of", "a", "bool", "variable", "that", "stores", "the", "value", "of", "the", "flag", "." ]
[ "func", "Bool", "(", "name", "string", ",", "value", "bool", ",", "usage", "string", ")", "*", "bool", "{", "return", "EnvironmentFlags", ".", "Bool", "(", "name", ",", "<mask>", ",", "usage", ")", "\n", "}" ]
20,773
all-20774
[ "Exists", "check", "whether", "current", "Docker", "image", "is", "available", "." ]
[ "func", "(", "s", "*", "Image", ")", "Exists", "(", ")", "bool", "{", "out", ",", "err", ":=", "s", ".", "docker", ".", "Run", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n\n", "return", "strings", ".", "Contains", "(", "out", ",", "s", ".", "<mask>", ")", "\n", "}" ]
20,774
all-20775
[ "ForModule", "returns", "an", "OldLogger", "instance", ".", "OldLogger", "is", "deprecated", "and", "kept", "for", "compatibility", "reasons", ".", "Prefer", "using", "Seelog", "directly", "." ]
[ "func", "ForModule", "(", "module", "string", ")", "OldLogger", "{", "<mask>", ".", "Do", "(", "initLogger", ")", "\n", "return", "logger", ".", "New", "(", "\"", "\"", ",", "module", ")", "\n", "}" ]
20,775
all-20776
[ "LoadFile", "loads", "a", "build", "file", "from", "disk", "parses", "it", "and", "scans", "for", "rules", "and", "load", "statements", ".", "The", "syntax", "tree", "within", "the", "returned", "File", "will", "be", "modified", "by", "editing", "methods", ".", "This", "function", "returns", "I", "/", "O", "and", "parse", "errors", "without", "modification", ".", "It", "s", "safe", "to", "use", "os", ".", "IsNotExist", "and", "similar", "predicates", "." ]
[ "func", "LoadFile", "(", "path", ",", "pkg", "string", ")", "(", "*", "File", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "LoadData", "(", "path", ",", "pkg", ",", "data", ")", "\n", "}" ]
20,776
all-20777
[ "NewRouteMap", "initializes", "and", "returns", "a", "new", "routeMap", "." ]
[ "func", "NewRouteMap", "(", ")", "*", "routeMap", "{", "rm", ":=", "&", "routeMap", "{", "routes", ":", "make", "(", "map", "[", "string", "]", "<mask>", "[", "string", "]", "*", "Leaf", ")", ",", "}", "\n", "for", "m", ":=", "range", "_HTTP_METHODS", "{", "rm", ".", "routes", "[", "m", "]", "=", "make", "(", "map", "[", "string", "]", "*", "Leaf", ")", "\n", "}", "\n", "return", "rm", "\n", "}" ]
20,777
all-20778
[ "NewDomainFilter", "returns", "a", "new", "DomainFilter", "given", "a", "comma", "separated", "list", "of", "domains" ]
[ "func", "NewDomainFilter", "(", "domainFilters", "[", "]", "string", ")", "DomainFilter", "{", "filters", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "domainFilters", ")", ")", "\n\n", "// user can define filter domains either with trailing dot or without, we remove all trailing periods from", "// the internal representation", "for", "i", ",", "<mask>", ":=", "range", "domainFilters", "{", "filters", "[", "i", "]", "=", "strings", ".", "TrimSuffix", "(", "strings", ".", "TrimSpace", "(", "domain", ")", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "DomainFilter", "{", "filters", "}", "\n", "}" ]
20,778
all-20779
[ "NewECSClient", "creates", "a", "new", "ECSClient", "interface", "object" ]
[ "func", "NewECSClient", "(", "credentialProvider", "*", "credentials", ".", "Credentials", ",", "config", "*", "config", ".", "Config", ",", "ec2MetadataClient", "ec2", ".", "EC2MetadataClient", ")", "api", ".", "ECSClient", "{", "var", "ecsConfig", "aws", ".", "Config", "\n", "ecsConfig", ".", "Credentials", "=", "credentialProvider", "\n", "ecsConfig", ".", "Region", "=", "&", "config", ".", "AWSRegion", "\n", "ecsConfig", ".", "HTTPClient", "=", "httpclient", ".", "New", "(", "roundtripTimeout", ",", "config", ".", "AcceptInsecureCert", ")", "\n", "if", "config", ".", "APIEndpoint", "!=", "\"", "\"", "{", "ecsConfig", ".", "Endpoint", "=", "&", "config", ".", "APIEndpoint", "\n", "}", "\n", "standardClient", ":=", "ecs", ".", "New", "(", "<mask>", ".", "New", "(", "&", "ecsConfig", ")", ")", "\n", "submitStateChangeClient", ":=", "newSubmitStateChangeClient", "(", "&", "ecsConfig", ")", "\n", "pollEndpoinCache", ":=", "async", ".", "NewLRUCache", "(", "pollEndpointCacheSize", ",", "pollEndpointCacheTTL", ")", "\n", "return", "&", "APIECSClient", "{", "credentialProvider", ":", "credentialProvider", ",", "config", ":", "config", ",", "standardClient", ":", "standardClient", ",", "submitStateChangeClient", ":", "submitStateChangeClient", ",", "ec2metadata", ":", "ec2MetadataClient", ",", "pollEndpoinCache", ":", "pollEndpoinCache", ",", "}", "\n", "}" ]
20,779
all-20780
[ "MakeRaw", "put", "the", "terminal", "connected", "to", "the", "given", "file", "descriptor", "into", "raw", "mode", "and", "returns", "the", "previous", "state", "of", "the", "terminal", "so", "that", "it", "can", "be", "restored", "." ]
[ "func", "MakeRaw", "(", "fd", "int", ")", "(", "*", "State", ",", "error", ")", "{", "<mask>", "err", "error", "\n", "var", "oldState", ",", "newState", "*", "State", "\n\n", "oldState", ",", "err", "=", "GetState", "(", "fd", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "shared", ".", "DeepCopy", "(", "&", "oldState", ",", "&", "newState", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "C", ".", "cfmakeraw", "(", "(", "*", "C", ".", "struct_termios", ")", "(", "unsafe", ".", "Pointer", "(", "&", "newState", ".", "Termios", ")", ")", ")", "\n\n", "err", "=", "Restore", "(", "fd", ",", "newState", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "oldState", ",", "nil", "\n", "}" ]
20,780
all-20781
[ "SignHTTPRequest", "signs", "an", "http", ".", "Request", "struct", "with", "authv4", "using", "the", "given", "region", "service", "and", "credentials", "." ]
[ "func", "SignHTTPRequest", "(", "req", "*", "http", ".", "Request", ",", "region", ",", "service", "string", ",", "creds", "*", "credentials", ".", "Credentials", ",", "body", "io", ".", "ReadSeeker", ")", "error", "{", "signer", ":=", "v4", ".", "NewSigner", "(", "creds", ")", "\n", "_", ",", "err", ":=", "signer", ".", "Sign", "(", "req", ",", "<mask>", ",", "service", ",", "region", ",", "time", ".", "Now", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,781
all-20782
[ "Parse", "processes", "the", "given", "command", "line", "option", "storing", "the", "results", "in", "the", "field", "of", "the", "structs", "from", "which", "NewParser", "was", "constructed" ]
[ "func", "(", "p", "*", "<mask>", ")", "Parse", "(", "args", "[", "]", "string", ")", "error", "{", "// If -h or --help were specified then print usage", "for", "_", ",", "arg", ":=", "range", "args", "{", "if", "arg", "==", "\"", "\"", "||", "arg", "==", "\"", "\"", "{", "return", "ErrHelp", "\n", "}", "\n", "if", "arg", "==", "\"", "\"", "{", "return", "ErrVersion", "\n", "}", "\n", "if", "arg", "==", "\"", "\"", "{", "break", "\n", "}", "\n", "}", "\n\n", "// Process all command line arguments", "return", "process", "(", "p", ".", "specs", ",", "args", ")", "\n", "}" ]
20,782
all-20783
[ "ContainsFunc", "iterates", "all", "the", "items", "in", "the", "set", "and", "passes", "each", "to", "f", ".", "It", "returns", "true", "the", "first", "time", "a", "call", "to", "f", "returns", "true", "and", "false", "if", "no", "call", "to", "f", "returns", "true", "." ]
[ "func", "(", "s", "*", "Set", ")", "ContainsFunc", "(", "f", "func", "(", "<mask>", "{", "}", ")", "bool", ")", "bool", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "for", "k", ":=", "range", "s", ".", "m", "{", "if", "f", "(", "k", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
20,783
all-20784
[ "FindChild", "returns", "control", "if", "it", "is", "a", "child", "of", "the", "parent", "and", "nil", "otherwise" ]
[ "func", "FindChild", "(", "parent", ",", "control", "Control", ")", "Control", "{", "var", "res", "Control", "\n\n", "if", "parent", "==", "control", "{", "return", "parent", "\n", "}", "\n\n", "for", "_", ",", "ctrl", ":=", "range", "parent", ".", "Children", "(", ")", "{", "if", "ctrl", "==", "control", "{", "res", "=", "ctrl", "\n", "break", "\n", "}", "\n\n", "res", "=", "FindChild", "(", "ctrl", ",", "<mask>", ")", "\n", "if", "res", "!=", "nil", "{", "break", "\n", "}", "\n", "}", "\n\n", "return", "res", "\n", "}" ]
20,784
all-20785
[ "GetMetricQuery", "returns", "the", "MetricQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "q", "*", "QueryValueRequest", ")", "GetMetricQuery", "(", ")", "<mask>", "{", "if", "q", "==", "nil", "||", "q", ".", "MetricQuery", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "q", ".", "MetricQuery", "\n", "}" ]
20,785
all-20786
[ "ParseDuration", "parses", "a", "duration", "from", "a", "string", "compatible", "with", "scala", "duration", "syntax" ]
[ "func", "ParseDuration", "(", "cand", "string", ")", "(", "time", ".", "Duration", ",", "error", ")", "{", "if", "dur", ",", "err", ":=", "time", ".", "ParseDuration", "(", "cand", ")", ";", "err", "==", "nil", "{", "return", "dur", ",", "nil", "\n", "}", "\n\n", "var", "dur", "time", ".", "Duration", "\n", "ok", ":=", "false", "\n", "for", "_", ",", "match", ":=", "range", "durationMatcher", ".", "FindAllStringSubmatch", "(", "cand", ",", "-", "1", ")", "{", "factor", ",", "err", ":=", "strconv", ".", "Atoi", "(", "<mask>", "[", "2", "]", ")", "// converts string to int", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "unit", ":=", "strings", ".", "ToLower", "(", "strings", ".", "TrimSpace", "(", "match", "[", "3", "]", ")", ")", "\n\n", "for", "_", ",", "variants", ":=", "range", "timeUnits", "{", "last", ":=", "len", "(", "variants", ")", "-", "1", "\n", "multiplier", ":=", "timeMultiplier", "[", "variants", "[", "0", "]", "]", "\n\n", "for", "i", ",", "variant", ":=", "range", "variants", "{", "if", "(", "last", "==", "i", "&&", "strings", ".", "HasPrefix", "(", "unit", ",", "variant", ")", ")", "||", "strings", ".", "EqualFold", "(", "variant", ",", "unit", ")", "{", "ok", "=", "true", "\n", "dur", "+=", "(", "time", ".", "Duration", "(", "factor", ")", "*", "multiplier", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "ok", "{", "return", "dur", ",", "nil", "\n", "}", "\n", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cand", ")", "\n", "}" ]
20,786
all-20787
[ "GetAttr", "gets", "the", "value", "of", "the", "attribute", "with", "the", "provided", "name", ".", "If", "the", "attribute", "does", "not", "exist", "nil", "will", "be", "returned" ]
[ "func", "(", "a", "*", "Attrs", ")", "GetAttr", "(", "<mask>", "string", ")", "interface", "{", "}", "{", "a", ".", "attrsLock", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "attrsLock", ".", "RUnlock", "(", ")", "\n\n", "return", "a", ".", "attrs", "[", "getAttrHash", "(", "key", ")", "]", "\n", "}" ]
20,787
all-20788
[ "ForwardedResponseIfVolumeIsRemote", "redirects", "a", "request", "to", "the", "node", "hosting", "the", "volume", "with", "the", "given", "pool", "ID", "name", "and", "type", ".", "If", "the", "container", "is", "local", "nothing", "gets", "done", "and", "nil", "is", "returned", ".", "If", "more", "than", "one", "node", "has", "a", "matching", "volume", "an", "error", "is", "returned", ".", "This", "is", "used", "when", "no", "targetNode", "is", "specified", "and", "saves", "users", "some", "typing", "when", "the", "volume", "name", "/", "type", "is", "unique", "to", "a", "node", "." ]
[ "func", "ForwardedResponseIfVolumeIsRemote", "(", "d", "*", "Daemon", ",", "r", "*", "<mask>", ".", "Request", ",", "poolID", "int64", ",", "volumeName", "string", ",", "volumeType", "int", ")", "Response", "{", "if", "queryParam", "(", "r", ",", "\"", "\"", ")", "!=", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "cert", ":=", "d", ".", "endpoints", ".", "NetworkCert", "(", ")", "\n", "client", ",", "err", ":=", "cluster", ".", "ConnectIfVolumeIsRemote", "(", "d", ".", "cluster", ",", "poolID", ",", "volumeName", ",", "volumeType", ",", "cert", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "db", ".", "ErrNoSuchObject", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "if", "client", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "ForwardedResponse", "(", "client", ",", "r", ")", "\n", "}" ]
20,788
all-20789
[ "SetTransitionDuration", "is", "a", "wrapper", "around", "gtk_revealer_set_transition_duration", "()", "." ]
[ "func", "(", "v", "*", "Revealer", ")", "SetTransitionDuration", "(", "duration", "uint", ")", "{", "C", ".", "gtk_revealer_set_transition_duration", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "<mask>", ")", ")", "\n", "}" ]
20,789
all-20790
[ "title", ":", "token", "info", "path", ":", "/", "tokens", "/", "{", "token_id", "}", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Get", "token", "401", ":", "Unauthorized" ]
[ "func", "tokenInfo", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "tokenID", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "tokenID", "==", "\"", "\"", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusBadRequest", ")", "\n", "return", "nil", "\n", "}", "\n\n", "teamToken", ",", "err", ":=", "servicemanager", ".", "TeamToken", ".", "Info", "(", "tokenID", ",", "t", ")", "\n", "if", "err", "==", "authTypes", ".", "ErrTeamTokenNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "<mask>", "(", ")", ",", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermTeamTokenRead", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxTeam", ",", "teamToken", ".", "Team", ")", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "teamToken", ")", "\n", "}" ]
20,790
all-20791
[ "MatchHref", "returns", "true", "if", "the", "given", "href", "matches", "one", "of", "the", "action", "s", "href", "patterns", "exactly" ]
[ "func", "(", "a", "*", "Action", ")", "MatchHref", "(", "href", "string", ")", "bool", "{", "hrefs", ":=", "[", "]", "string", "{", "href", ",", "href", "+", "\"", "\"", "}", "\n", "for", "_", ",", "pattern", ":=", "range", "a", ".", "PathPatterns", "{", "for", "_", ",", "href", ":=", "range", "hrefs", "{", "indices", ":=", "<mask>", ".", "Regexp", ".", "FindStringIndex", "(", "href", ")", "\n", "// it is only an exact match if the pattern matches from the beginning to the length of the string", "if", "indices", "!=", "nil", "&&", "indices", "[", "0", "]", "==", "0", "&&", "indices", "[", "1", "]", "==", "len", "(", "href", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
20,791
all-20792
[ "Set", "is", "required", "for", "kingpin", "interfaces", "to", "allow", "command", "line", "params", "to", "be", "set", "to", "our", "map", "datatype" ]
[ "func", "(", "o", "*", "ListInt8Option", ")", "Set", "(", "value", "string", ")", "error", "{", "val", ":=", "Int8Option", "{", "}", "\n", "val", ".", "<mask>", "(", "value", ")", "\n", "*", "o", "=", "append", "(", "*", "o", ",", "val", ")", "\n", "return", "nil", "\n", "}" ]
20,792
all-20793
[ "ValidateJSON", "validates", "a", "given", "JSON", "against", "a", "given", "schema", "." ]
[ "func", "ValidateJSON", "(", "schema", ",", "data", "[", "]", "byte", ")", "bool", "{", "sloader", ":=", "gojsonschema", ".", "NewBytesLoader", "(", "schema", ")", "\n", "dloader", ":=", "gojsonschema", ".", "NewBytesLoader", "(", "data", ")", "\n", "<mask>", ",", "err", ":=", "gojsonschema", ".", "Validate", "(", "sloader", ",", "dloader", ")", "\n", "return", "err", "==", "nil", "&&", "result", ".", "Valid", "(", ")", "&&", "len", "(", "result", ".", "Errors", "(", ")", ")", "==", "0", "\n", "}" ]
20,793
all-20794
[ "saveDB", "copies", "the", "v3", "backend", "and", "strips", "cluster", "information", "." ]
[ "func", "saveDB", "(", "destDB", ",", "srcDB", "string", ",", "idx", "uint64", ",", "v3", "bool", ")", "{", "// open src db to safely copy db state", "if", "v3", "{", "var", "src", "*", "bolt", ".", "DB", "\n", "ch", ":=", "make", "(", "chan", "*", "bolt", ".", "DB", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "db", ",", "err", ":=", "bolt", ".", "Open", "(", "srcDB", ",", "0444", ",", "&", "bolt", ".", "Options", "{", "ReadOnly", ":", "true", "}", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "ch", "<-", "db", "\n", "}", "(", ")", "\n", "select", "{", "case", "src", "=", "<-", "ch", ":", "<mask>", "<-", "time", ".", "After", "(", "time", ".", "Second", ")", ":", "log", ".", "Println", "(", "\"", "\"", ",", "srcDB", ")", "\n", "src", "=", "<-", "ch", "\n", "}", "\n", "defer", "src", ".", "Close", "(", ")", "\n\n", "tx", ",", "err", ":=", "src", ".", "Begin", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n\n", "// copy srcDB to destDB", "dest", ",", "err", ":=", "os", ".", "Create", "(", "destDB", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "tx", ".", "WriteTo", "(", "dest", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "dest", ".", "Close", "(", ")", "\n", "if", "err", ":=", "tx", ".", "Rollback", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "}", "\n\n", "db", ",", "err", ":=", "bolt", ".", "Open", "(", "destDB", ",", "0644", ",", "&", "bolt", ".", "Options", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "tx", ",", "err", ":=", "db", ".", "Begin", "(", "true", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n\n", "// remove membership information; should be clobbered by --force-new-cluster", "for", "_", ",", "bucket", ":=", "range", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", "{", "tx", ".", "DeleteBucket", "(", "[", "]", "byte", "(", "bucket", ")", ")", "\n", "}", "\n\n", "// update consistent index to match hard state", "if", "!", "v3", "{", "idxBytes", ":=", "make", "(", "[", "]", "byte", ",", "8", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint64", "(", "idxBytes", ",", "idx", ")", "\n", "b", ",", "err", ":=", "tx", ".", "CreateBucketIfNotExists", "(", "[", "]", "byte", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "b", ".", "Put", "(", "[", "]", "byte", "(", "\"", "\"", ")", ",", "idxBytes", ")", "\n", "}", "\n\n", "if", "err", ":=", "tx", ".", "Commit", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "if", "err", ":=", "db", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "}" ]
20,794
all-20795
[ "DesiredTerminal", "returns", "true", "if", "the", "cgroup", "s", "desired", "status", "is", "REMOVED" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "DesiredTerminal", "(", ")", "bool", "{", "cgroup", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "cgroup", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "cgroup", ".", "desiredStatusUnsafe", "==", "resourcestatus", ".", "ResourceStatus", "(", "CgroupRemoved", ")", "\n", "}" ]
20,795
all-20796
[ "SaveDBFrom", "saves", "snapshot", "of", "the", "database", "from", "the", "given", "reader", ".", "It", "guarantees", "the", "save", "operation", "is", "atomic", "." ]
[ "func", "(", "s", "*", "Snapshotter", ")", "SaveDBFrom", "(", "r", "io", ".", "Reader", ",", "id", "uint64", ")", "(", "int64", ",", "error", ")", "{", "start", ":=", "time", ".", "Now", "(", ")", "\n\n", "f", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "s", ".", "dir", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "var", "n", "int64", "\n", "n", ",", "err", "=", "io", ".", "Copy", "(", "f", ",", "r", ")", "\n", "if", "err", "==", "nil", "{", "fsyncStart", ":=", "time", ".", "Now", "(", ")", "\n", "err", "=", "fileutil", ".", "Fsync", "(", "f", ")", "\n", "snapDBFsyncSec", ".", "Observe", "(", "time", ".", "Since", "(", "fsyncStart", ")", ".", "Seconds", "(", ")", ")", "\n", "}", "\n", "f", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "os", ".", "Remove", "(", "f", ".", "Name", "(", ")", ")", "\n", "return", "n", ",", "err", "\n", "}", "\n", "fn", ":=", "s", ".", "dbFilePath", "(", "id", ")", "\n", "if", "fileutil", ".", "Exist", "(", "fn", ")", "{", "os", ".", "Remove", "(", "f", ".", "Name", "(", ")", ")", "\n", "return", "n", ",", "nil", "\n", "}", "\n", "err", "=", "os", ".", "Rename", "(", "f", ".", "Name", "(", ")", ",", "fn", ")", "\n", "if", "err", "!=", "nil", "{", "os", ".", "Remove", "(", "f", ".", "Name", "(", ")", ")", "\n", "return", "n", ",", "err", "\n", "}", "\n\n", "if", "s", ".", "lg", "!=", "nil", "{", "s", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "fn", ")", ",", "zap", ".", "Int64", "(", "\"", "\"", ",", "n", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "humanize", ".", "Bytes", "(", "uint64", "(", "n", ")", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n\n", "snapDBSaveSec", ".", "Observe", "(", "<mask>", ".", "Since", "(", "start", ")", ".", "Seconds", "(", ")", ")", "\n", "return", "n", ",", "nil", "\n", "}" ]
20,796
all-20797
[ "Split", "a", "non", "-", "contiguous", "(", "i", ".", "e", ".", "comma", "-", "separated", ")", "sequence", "into", "a", "list", "of", "sequences", "that", "each", "use", "consistent", "stepping" ]
[ "func", "(", "s", "*", "FileSequence", ")", "Split", "(", ")", "FileSequences", "{", "if", "s", ".", "frameSet", "==", "nil", "{", "// Return a copy", "return", "FileSequences", "{", "s", ".", "Copy", "(", ")", "}", "\n", "}", "\n\n", "franges", ":=", "strings", ".", "Split", "(", "s", ".", "frameSet", ".", "FrameRange", "(", ")", ",", "\"", "\"", ")", "\n", "if", "len", "(", "franges", ")", "==", "1", "{", "// Return a copy", "return", "FileSequences", "{", "s", ".", "Copy", "(", ")", "}", "\n", "}", "\n\n", "var", "buf", "strings", ".", "Builder", "\n\n", "// Write the dir and base components once", "buf", ".", "WriteString", "(", "s", ".", "dir", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "basename", ")", "\n\n", "list", ":=", "make", "(", "FileSequences", ",", "len", "(", "franges", ")", ")", "\n", "var", "seq", "*", "FileSequence", "\n", "for", "i", ",", "frange", ":=", "range", "franges", "{", "buf", ".", "WriteString", "(", "frange", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "padChar", ")", "\n", "buf", ".", "WriteString", "(", "s", ".", "ext", ")", "\n\n", "seq", ",", "_", "=", "NewFileSequence", "(", "buf", ".", "String", "(", ")", ")", "\n", "<mask>", "[", "i", "]", "=", "seq", "\n\n", "buf", ".", "Reset", "(", ")", "\n", "}", "\n", "return", "list", "\n", "}" ]
20,797
all-20798
[ "RunGitHookServer", "starts", "the", "webhook", "server" ]
[ "func", "RunGitHookServer", "(", "address", "string", ",", "etcdAddress", "string", ",", "etcdPrefix", "string", ")", "error", "{", "c", ",", "err", ":=", "client", ".", "NewFromAddress", "(", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "etcdClient", ",", "err", ":=", "etcd", ".", "New", "(", "etcd", ".", "Config", "{", "Endpoints", ":", "[", "]", "string", "{", "etcdAddress", "}", ",", "DialOptions", ":", "client", ".", "DefaultDialOptions", "(", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "<mask>", ",", "err", ":=", "github", ".", "New", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "s", ":=", "&", "gitHookServer", "{", "hook", ",", "c", ",", "etcdClient", ",", "ppsdb", ".", "Pipelines", "(", "etcdClient", ",", "etcdPrefix", ")", ",", "}", "\n", "return", "http", ".", "ListenAndServe", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "GitHookPort", ")", ",", "s", ")", "\n", "}" ]
20,798
all-20799
[ "ActivateChannel", "tries", "to", "activate", "a", "given", "channel", "." ]
[ "func", "(", "p", "*", "Processor", ")", "ActivateChannel", "(", "<mask>", ",", "jobCreator", "string", ",", "agent", "bool", ")", "(", "string", ",", "error", ")", "{", "var", "jobType", "string", "\n", "if", "agent", "{", "jobType", "=", "data", ".", "JobAgentPreServiceUnsuspend", "\n", "}", "else", "{", "jobType", "=", "data", ".", "JobClientPreServiceUnsuspend", "\n", "}", "\n\n", "return", "p", ".", "alterServiceStatus", "(", "id", ",", "jobCreator", ",", "jobType", ",", "\"", "\"", ",", "activateTransitions", ",", "false", ")", "\n", "}" ]
20,799
all-20800
[ "compressGoroutine", "reads", "all", "input", "from", "src", "and", "writes", "its", "compressed", "equivalent", "to", "dest", "." ]
[ "func", "compressGoroutine", "(", "dest", "*", "io", ".", "PipeWriter", ",", "src", "io", ".", "Reader", ")", "{", "err", ":=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "defer", "func", "(", ")", "{", "// Note that this is not the same as {defer dest.CloseWithError(err)}; we need err to be evaluated lazily.", "<mask>", ".", "CloseWithError", "(", "err", ")", "// CloseWithError(nil) is equivalent to Close()", "\n", "}", "(", ")", "\n\n", "zipper", ":=", "pgzip", ".", "NewWriter", "(", "dest", ")", "\n", "defer", "zipper", ".", "Close", "(", ")", "\n\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "zipper", ",", "src", ")", "// Sets err to nil, i.e. causes dest.Close()", "\n", "}" ]