id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
19,200
all-19201
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ScriptPosition", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger22", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
19,201
all-19202
[ "SetAppliedStatus", "sets", "the", "applied", "status", "of", "resource", "and", "returns", "whether", "the", "resource", "is", "already", "in", "a", "transition" ]
[ "func", "(", "vol", "*", "VolumeResource", ")", "SetAppliedStatus", "(", "status", "resourcestatus", ".", "ResourceStatus", ")", "bool", "{", "vol", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "vol", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "if", "vol", ".", "appliedStatusUnsafe", "!=", "resourcestatus", ".", "ResourceStatus", "(", "VolumeStatusNone", ")", "{", "// return false to indicate the set operation failed", "return", "false", "\n", "}", "\n\n", "vol", ".", "appliedStatusUnsafe", "=", "status", "\n", "return", "true", "\n", "}" ]
19,202
all-19203
[ "GetPath", "is", "a", "wrapper", "around", "gtk_tree_row_reference_get_path", "." ]
[ "func", "(", "v", "*", "TreeRowReference", ")", "GetPath", "(", ")", "*", "TreePath", "{", "c", ":=", "C", ".", "gtk_tree_row_reference_get_path", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "t", ":=", "&", "TreePath", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "t", ",", "(", "*", "TreePath", ")", ".", "<mask>", ")", "\n", "return", "t", "\n", "}" ]
19,203
all-19204
[ "NewConn", "creates", "a", "new", "Conn", "object", "." ]
[ "func", "NewConn", "(", ")", "(", "*", "Conn", ",", "error", ")", "{", "id", ",", "err", ":=", "shortid", ".", "UUID", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "c", ":=", "&", "Conn", "{", "ID", ":", "id", ",", "Session", ":", "cmap", ".", "New", "(", ")", ",", "resRoutes", ":", "cmap", ".", "New", "(", ")", ",", "deadline", ":", "time", ".", "Second", "*", "time", ".", "Duration", "(", "300", ")", ",", "disconnHandler", ":", "func", "(", "c", "*", "Conn", ")", "{", "}", ",", "}", "\n", "c", ".", "connected", ".", "<mask>", "(", "false", ")", "\n", "return", "c", ",", "nil", "\n", "}" ]
19,204
all-19205
[ "Check", "this", "node", "s", "version", "and", "possibly", "run", "LXD_CLUSTER_UPDATE", "." ]
[ "func", "maybeUpdate", "(", "state", "*", "state", ".", "State", ")", "{", "shouldUpdate", ":=", "false", "\n\n", "enabled", ",", "err", ":=", "Enabled", "(", "state", ".", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "if", "!", "enabled", "{", "return", "\n", "}", "\n\n", "err", "=", "state", ".", "Cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "outdated", ",", "err", ":=", "tx", ".", "NodeIsOutdated", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "shouldUpdate", "=", "outdated", "\n", "return", "nil", "\n", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "// Just log the error and return.", "logger", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "if", "!", "shouldUpdate", "{", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "logger", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "updateExecutable", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "updateExecutable", "==", "\"", "\"", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "logger", ".", "Infof", "(", "\"", "\"", ",", "updateExecutable", ")", "\n\n", "_", ",", "err", "=", "shared", ".", "RunCommand", "(", "updateExecutable", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "return", "\n", "}", "\n", "}" ]
19,205
all-19206
[ "processConfigurationLogEntry", "takes", "a", "log", "entry", "and", "updates", "the", "latest", "configuration", "if", "the", "entry", "results", "in", "a", "new", "configuration", ".", "This", "must", "only", "be", "called", "from", "the", "main", "thread", "or", "from", "NewRaft", "()", "before", "any", "threads", "have", "begun", "." ]
[ "func", "(", "r", "*", "Raft", ")", "processConfigurationLogEntry", "(", "<mask>", "*", "Log", ")", "{", "if", "entry", ".", "Type", "==", "LogConfiguration", "{", "r", ".", "configurations", ".", "committed", "=", "r", ".", "configurations", ".", "latest", "\n", "r", ".", "configurations", ".", "committedIndex", "=", "r", ".", "configurations", ".", "latestIndex", "\n", "r", ".", "configurations", ".", "latest", "=", "decodeConfiguration", "(", "entry", ".", "Data", ")", "\n", "r", ".", "configurations", ".", "latestIndex", "=", "entry", ".", "Index", "\n", "}", "else", "if", "entry", ".", "Type", "==", "LogAddPeerDeprecated", "||", "entry", ".", "Type", "==", "LogRemovePeerDeprecated", "{", "r", ".", "configurations", ".", "committed", "=", "r", ".", "configurations", ".", "latest", "\n", "r", ".", "configurations", ".", "committedIndex", "=", "r", ".", "configurations", ".", "latestIndex", "\n", "r", ".", "configurations", ".", "latest", "=", "decodePeers", "(", "entry", ".", "Data", ",", "r", ".", "trans", ")", "\n", "r", ".", "configurations", ".", "latestIndex", "=", "entry", ".", "Index", "\n", "}", "\n", "}" ]
19,206
all-19207
[ "Peek", "returns", "the", "topmost", "item", "without", "removing", "it", "from", "the", "stack", "." ]
[ "func", "(", "s", "*", "VecStack", ")", "Peek", "(", ")", "(", "<mask>", "*", "Vec", ",", "exists", "bool", ")", "{", "exists", "=", "false", "\n", "if", "s", ".", "size", ">", "0", "{", "value", "=", "s", ".", "top", ".", "value", "\n", "exists", "=", "true", "\n", "}", "\n", "return", "\n", "}" ]
19,207
all-19208
[ "Execute", "uses", "the", "context", "s", "message", "executor", "to", "send", "a", "command", "or", "event", "method", "marshaling", "the", "provided", "parameters", "and", "unmarshaling", "to", "res", "." ]
[ "func", "Execute", "(", "ctx", "context", ".", "Context", ",", "method", "string", ",", "params", "easyjson", ".", "Marshaler", ",", "<mask>", "easyjson", ".", "Unmarshaler", ")", "error", "{", "if", "executor", ":=", "ctx", ".", "Value", "(", "executorKey", ")", ";", "executor", "!=", "nil", "{", "return", "executor", ".", "(", "Executor", ")", ".", "Execute", "(", "ctx", ",", "method", ",", "params", ",", "res", ")", "\n", "}", "\n", "return", "ErrInvalidContext", "\n", "}" ]
19,208
all-19209
[ "KNearest", "returns", "the", "K", "-", "Nearest", "points", "near", "point", "within", "maxDistance", "that", "match", "the", "accept", "function", "." ]
[ "func", "(", "index", "*", "ClusteringIndex", ")", "KNearest", "(", "point", "Point", ",", "k", "int", ",", "maxDistance", "Meters", ",", "accept", "func", "(", "p", "Point", ")", "bool", ")", "[", "]", "Point", "{", "return", "index", ".", "streetLevel", ".", "KNearest", "(", "<mask>", ",", "k", ",", "maxDistance", ",", "accept", ")", "\n", "}" ]
19,209
all-19210
[ "RunnableBindingLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "RunnableBindingLocator", "(", "href", "<mask>", ")", "*", "RunnableBindingLocator", "{", "return", "&", "RunnableBindingLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
19,210
all-19211
[ "Broadcast", "returns", "the", "set", "of", "peer", "names", "that", "should", "be", "notified", "when", "we", "receive", "a", "broadcast", "message", "originating", "from", "the", "named", "peer", "based", "on", "established", "and", "symmetric", "connections", "." ]
[ "func", "(", "r", "*", "routes", ")", "Broadcast", "(", "<mask>", "PeerName", ")", "[", "]", "PeerName", "{", "return", "r", ".", "lookupOrCalculate", "(", "name", ",", "&", "r", ".", "broadcast", ",", "true", ")", "\n", "}" ]
19,211
all-19212
[ "Set", "parses", "out", "overrides", "from", "user", "input" ]
[ "func", "(", "a", "*", "orgRepoFormat", ")", "Set", "(", "value", "string", ")", "error", "{", "templ", ",", "err", ":=", "<mask>", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "a", ".", "raw", "=", "value", "\n", "a", ".", "format", "=", "templ", "\n", "return", "nil", "\n", "}" ]
19,212
all-19213
[ "Initialize", "internal", "logger", "to", "log", "to", "no", "-", "op", "(", "ioutil", ".", "Discard", ")", "by", "default", "." ]
[ "func", "init", "(", ")", "{", "logger", "=", "internalLogger", "{", "<mask>", ".", "New", "(", "ioutil", ".", "Discard", ",", "\"", "\"", ",", "log", ".", "LstdFlags", ")", ",", "false", ",", "}", "\n", "}" ]
19,213
all-19214
[ "Run", "executes", "the", "exception", "into", "a", "secret", "to", "determine", "if", "it", "s", "an", "exception", "or", "not", "." ]
[ "func", "(", "x", "*", "Exception", ")", "Run", "(", "s", "*", "Secret", ")", "bool", "{", "match", ":=", "true", "\n\n", "if", "match", "&&", "x", ".", "Rule", "!=", "nil", "&&", "!", "x", ".", "Rule", ".", "MatchString", "(", "s", ".", "Rule", ".", "Name", ")", "{", "match", "=", "false", "\n", "}", "\n\n", "if", "match", "&&", "x", ".", "Object", "!=", "nil", "&&", "!", "x", ".", "<mask>", ".", "MatchString", "(", "s", ".", "Object", ".", "Name", ")", "{", "match", "=", "false", "\n", "}", "\n\n", "if", "match", "&&", "x", ".", "Nline", "!=", "nil", "&&", "*", "x", ".", "Nline", "!=", "s", ".", "Nline", "{", "match", "=", "false", "\n", "}", "\n\n", "if", "match", "&&", "x", ".", "Content", "!=", "nil", "&&", "!", "x", ".", "Content", ".", "MatchString", "(", "s", ".", "Line", ")", "{", "match", "=", "false", "\n", "}", "\n\n", "return", "match", "\n", "}" ]
19,214
all-19215
[ "ToIRSA", "will", "format", "the", "provided", "string", "in", "IRSA", ".", "International", "Radio", "-", "Telephony", "Spelling", "Alphabet" ]
[ "func", "ToIRSA", "(", "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", ":=", "strings", ".", "ToLower", "(", "string", "(", "i", ")", ")", "\n", "if", "_", ",", "ok", ":=", "irsa", "[", "key", "]", ";", "<mask>", "{", "buffer", ".", "WriteString", "(", "irsa", "[", "key", "]", "+", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "buffer", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
19,215
all-19216
[ "newDockerClient", "returns", "a", "new", "dockerClient", "instance", "for", "the", "given", "registry", "and", "reference", ".", "The", "reference", "is", "used", "to", "query", "the", "registry", "configuration", "and", "can", "either", "be", "a", "registry", "(", "e", ".", "g", "registry", ".", "com", "[", ":", "5000", "]", ")", "a", "repository", "(", "e", ".", "g", ".", "registry", ".", "com", "[", ":", "5000", "]", "[", "/", "some", "/", "namespace", "]", "/", "repo", ")", ".", "Please", "note", "that", "newDockerClient", "does", "not", "set", "all", "members", "of", "dockerClient", "(", "e", ".", "g", ".", "username", "and", "password", ")", ";", "those", "must", "be", "set", "by", "callers", "if", "necessary", "." ]
[ "func", "newDockerClient", "(", "sys", "*", "types", ".", "SystemContext", ",", "registry", ",", "reference", "string", ")", "(", "*", "dockerClient", ",", "error", ")", "{", "hostName", ":=", "registry", "\n", "if", "registry", "==", "dockerHostname", "{", "registry", "=", "dockerRegistry", "\n", "}", "\n", "tlsClientConfig", ":=", "serverDefault", "(", ")", "\n\n", "// It is undefined whether the host[:port] string for dockerHostname should be dockerHostname or dockerRegistry,", "// because docker/docker does not read the certs.d subdirectory at all in that case. We use the user-visible", "// dockerHostname here, because it is more symmetrical to read the configuration in that case as well, and because", "// generally the UI hides the existence of the different dockerRegistry. But note that this behavior is", "// undocumented and may change if docker/docker changes.", "certDir", ",", "err", ":=", "dockerCertDir", "(", "sys", ",", "hostName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "tlsclientconfig", ".", "SetupCertificates", "(", "certDir", ",", "tlsClientConfig", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Check if TLS verification shall be skipped (default=false) which can", "// be specified in the sysregistriesv2 configuration.", "skipVerify", ":=", "false", "\n", "reg", ",", "err", ":=", "sysregistriesv2", ".", "FindRegistry", "(", "sys", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "reg", "!=", "nil", "{", "skipVerify", "=", "reg", ".", "Insecure", "\n", "}", "\n", "tlsClientConfig", ".", "InsecureSkipVerify", "=", "skipVerify", "\n\n", "return", "&", "dockerClient", "{", "sys", ":", "sys", ",", "registry", ":", "registry", ",", "tlsClientConfig", ":", "tlsClientConfig", ",", "}", ",", "nil", "\n", "}" ]
19,216
all-19217
[ "Part", "accepts", "the", "room", "id", "to", "part", "." ]
[ "func", "(", "c", "*", "Client", ")", "Part", "(", "roomId", ",", "<mask>", "string", ")", "{", "c", ".", "connection", ".", "MUCPart", "(", "roomId", "+", "\"", "\"", "+", "name", ")", "\n", "}" ]
19,217
all-19218
[ "NewGRPC17Health", "returns", "a", "new", "health", "balancer", "with", "gRPC", "v1", ".", "7", "." ]
[ "func", "NewGRPC17Health", "(", "eps", "[", "]", "string", ",", "timeout", "time", ".", "Duration", ",", "dialFunc", "DialFunc", ",", ")", "*", "GRPC17Health", "{", "notifyCh", ":=", "make", "(", "chan", "[", "]", "grpc", ".", "Address", ")", "\n", "addrs", ":=", "eps2addrs", "(", "eps", ")", "\n", "hb", ":=", "&", "GRPC17Health", "{", "addrs", ":", "addrs", ",", "eps", ":", "eps", ",", "notifyCh", ":", "notifyCh", ",", "readyc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "healthCheck", ":", "func", "(", "ep", "string", ")", "(", "bool", ",", "error", ")", "{", "return", "grpcHealthCheck", "(", "ep", ",", "dialFunc", ")", "}", ",", "unhealthyHostPorts", ":", "make", "(", "map", "[", "string", "]", "time", ".", "Time", ")", ",", "upc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "stopc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "downc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "donec", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "updateAddrsC", ":", "make", "(", "chan", "NotifyMsg", ")", ",", "hostPort2ep", ":", "getHostPort2ep", "(", "eps", ")", ",", "}", "\n", "if", "timeout", "<", "minHealthRetryDuration", "{", "timeout", "=", "minHealthRetryDuration", "\n", "}", "\n", "hb", ".", "healthCheckTimeout", "=", "timeout", "\n\n", "<mask>", "(", "hb", ".", "downc", ")", "\n", "go", "hb", ".", "updateNotifyLoop", "(", ")", "\n", "hb", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "defer", "hb", ".", "wg", ".", "Done", "(", ")", "\n", "hb", ".", "updateUnhealthy", "(", ")", "\n", "}", "(", ")", "\n", "return", "hb", "\n", "}" ]
19,218
all-19219
[ "Seek", "implements", "storage", ".", "SeriesIterator", "." ]
[ "func", "(", "c", "*", "concreteSeriesIterator", ")", "Seek", "(", "t", "int64", ")", "bool", "{", "c", ".", "cur", "=", "<mask>", ".", "Search", "(", "len", "(", "c", ".", "series", ".", "samples", ")", ",", "func", "(", "n", "int", ")", "bool", "{", "return", "c", ".", "series", ".", "samples", "[", "n", "]", ".", "Timestamp", ">=", "t", "\n", "}", ")", "\n", "return", "c", ".", "cur", "<", "len", "(", "c", ".", "series", ".", "samples", ")", "\n", "}" ]
19,219
all-19220
[ "SelectURIs", "returns", "a", "list", "of", "LXD", "API", "URI", "strings", "for", "the", "resource", "yielded", "by", "the", "given", "query", ".", "The", "f", "argument", "must", "be", "a", "function", "that", "formats", "the", "entity", "URI", "using", "the", "columns", "yielded", "by", "the", "query", "." ]
[ "func", "SelectURIs", "(", "stmt", "*", "sql", ".", "Stmt", ",", "f", "func", "(", "a", "...", "interface", "{", "}", ")", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "[", "]", "string", ",", "error", ")", "{", "rows", ",", "err", ":=", "stmt", ".", "Query", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "columns", ",", "err", ":=", "rows", ".", "Columns", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "params", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "columns", ")", ")", "\n\n", "dest", ":=", "<mask>", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "params", ")", ")", "\n", "for", "i", ":=", "range", "params", "{", "params", "[", "i", "]", "=", "\"", "\"", "\n", "dest", "[", "i", "]", "=", "&", "params", "[", "i", "]", "\n", "}", "\n\n", "uris", ":=", "[", "]", "string", "{", "}", "\n\n", "for", "rows", ".", "Next", "(", ")", "{", "err", ":=", "rows", ".", "Scan", "(", "dest", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "uri", ":=", "f", "(", "params", "...", ")", "\n", "uris", "=", "append", "(", "uris", ",", "uri", ")", "\n", "}", "\n\n", "err", "=", "rows", ".", "Err", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "uris", ",", "nil", "\n", "}" ]
19,220
all-19221
[ "GetFillMinOk", "returns", "a", "tuple", "with", "the", "FillMin", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostmapStyle", ")", "GetFillMinOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "h", "==", "nil", "||", "h", ".", "FillMin", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "h", ".", "FillMin", ",", "<mask>", "\n", "}" ]
19,221
all-19222
[ "specify", "a", "three", "-", "dimensional", "texture", "subimage", "in", "a", "compressed", "format" ]
[ "func", "CompressedTexSubImage3D", "(", "target", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "zoffset", "int32", ",", "width", "int32", ",", "<mask>", "int32", ",", "depth", "int32", ",", "format", "uint32", ",", "imageSize", "int32", ",", "data", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowCompressedTexSubImage3D", "(", "gpCompressedTexSubImage3D", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLint", ")", "(", "xoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "yoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "zoffset", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "depth", ")", ",", "(", "C", ".", "GLenum", ")", "(", "format", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "imageSize", ")", ",", "data", ")", "\n", "}" ]
19,222
all-19223
[ "getURL", "with", "the", "following", "order", "of", "precedence", "-", "user", "input", "(", "cli", ")", "-", "user", "ENV", "-", "sane", "defaults" ]
[ "func", "(", "db", "*", "Database", ")", "getURL", "(", ")", "{", "// If not set use defaults", "if", "len", "(", "strings", ".", "TrimSpace", "(", "db", ".", "Index", ")", ")", "==", "0", "{", "db", ".", "Index", "=", "defaultIndex", "\n", "}", "\n", "if", "len", "(", "strings", ".", "TrimSpace", "(", "db", ".", "Type", ")", ")", "==", "0", "{", "db", ".", "Type", "=", "defaultType", "\n", "}", "\n", "if", "len", "(", "strings", ".", "TrimSpace", "(", "db", ".", "Host", ")", ")", "==", "0", "{", "db", ".", "Host", "=", "defaultHost", "\n", "}", "\n", "if", "len", "(", "strings", ".", "TrimSpace", "(", "db", ".", "Port", ")", ")", "==", "0", "{", "db", ".", "Port", "=", "defaultPort", "\n", "}", "\n\n", "// If user set URL param use it", "if", "len", "(", "strings", ".", "TrimSpace", "(", "<mask>", ".", "URL", ")", ")", "==", "0", "{", "db", ".", "URL", "=", "defaultURL", "\n", "}", "\n\n", "// If running in docker use `elasticsearch`", "if", "_", ",", "exists", ":=", "os", ".", "LookupEnv", "(", "\"", "\"", ")", ";", "exists", "{", "log", ".", "WithField", "(", "\"", "\"", ",", "db", ".", "URL", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "// TODO: change MALICE_ELASTICSEARCH to MALICE_ELASTICSEARCH_HOST", "db", ".", "URL", "=", "utils", ".", "Getopt", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "\"", "\"", ",", "db", ".", "Port", ")", ")", "\n", "return", "\n", "}", "\n\n", "db", ".", "URL", "=", "utils", ".", "Getopts", "(", "db", ".", "URL", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "db", ".", "Host", ",", "db", ".", "Port", ")", ")", "\n", "}" ]
19,223
all-19224
[ "Version", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngine", ")", "Version", "(", ")", "(", "string", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "string", ")", "\n", "ret1", ",", "_", ":=", "<mask>", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
19,224
all-19225
[ "GetName", "safely", "returns", "the", "name", "of", "the", "resource" ]
[ "func", "(", "secret", "*", "SSMSecretResource", ")", "GetName", "(", ")", "string", "{", "secret", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "<mask>", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "ResourceName", "\n", "}" ]
19,225
all-19226
[ "Me", "returns", "the", "user", "object", "for", "the", "pushbullet", "user" ]
[ "func", "(", "c", "*", "Client", ")", "Me", "(", ")", "(", "*", "User", ",", "error", ")", "{", "req", ":=", "c", ".", "buildRequest", "(", "\"", "\"", ",", "nil", ")", "\n", "resp", ",", "err", ":=", "c", ".", "Client", ".", "Do", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "var", "errjson", "errorResponse", "\n", "dec", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "<mask>", ")", "\n", "err", "=", "dec", ".", "Decode", "(", "&", "errjson", ")", "\n", "if", "err", "==", "nil", "{", "return", "nil", ",", "&", "errjson", ".", "ErrResponse", "\n", "}", "\n\n", "return", "nil", ",", "errors", ".", "New", "(", "resp", ".", "Status", ")", "\n", "}", "\n\n", "var", "userResponse", "User", "\n", "dec", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", "\n", "err", "=", "dec", ".", "Decode", "(", "&", "userResponse", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "userResponse", ",", "nil", "\n", "}" ]
19,226
all-19227
[ "Helper", "function" ]
[ "func", "(", "p", "*", "RcodeZeroProvider", ")", "fetchZones", "(", ")", "(", "[", "]", "*", "rc0", ".", "Zone", ",", "error", ")", "{", "var", "allZones", "[", "]", "*", "rc0", ".", "Zone", "\n\n", "listOptions", ":=", "rc0", ".", "NewListOptions", "(", ")", "\n\n", "for", "{", "zones", ",", "page", ",", "err", ":=", "p", ".", "Client", ".", "Zones", ".", "<mask>", "(", "listOptions", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "allZones", "=", "append", "(", "allZones", ",", "zones", "...", ")", "\n\n", "if", "page", "==", "nil", "||", "page", ".", "IsLastPage", "(", ")", "{", "break", "\n", "}", "\n\n", "listOptions", ".", "SetPageNumber", "(", "page", ".", "CurrentPage", "+", "1", ")", "\n", "}", "\n\n", "return", "allZones", ",", "nil", "\n", "}" ]
19,227
all-19228
[ "/", "*", "KMeans", "finds", "centers", "of", "k", "clusters", "in", "data", "and", "groups", "input", "samples", "around", "the", "clusters", ".", "It", "returns", "a", "matrix", "that", "stores", "the", "cluster", "indices", "for", "every", "sample", "and", "a", "matrix", "that", "stores", "the", "cluster", "centers", "." ]
[ "func", "KMeans", "(", "data", "*", "Mat", ",", "k", "int", ",", "termcrit", "TermCriteria", ",", "attempts", "int", ",", "rng", "RNG", ",", "flags", "int", ")", "(", "labels", ",", "centers", "*", "Mat", ")", "{", "<mask>", "compactness", "C", ".", "double", "\n\n", "labels", "=", "CreateMat", "(", "data", ".", "Rows", "(", ")", ",", "1", ",", "CV_32S", ")", "\n", "centers", "=", "CreateMat", "(", "k", ",", "1", ",", "data", ".", "Type", "(", ")", ")", "\n\n", "C", ".", "cvKMeans2", "(", "unsafe", ".", "Pointer", "(", "data", ")", ",", "C", ".", "int", "(", "k", ")", ",", "unsafe", ".", "Pointer", "(", "labels", ")", ",", "(", "C", ".", "CvTermCriteria", ")", "(", "termcrit", ")", ",", "C", ".", "int", "(", "attempts", ")", ",", "(", "*", "C", ".", "CvRNG", ")", "(", "&", "rng", ")", ",", "C", ".", "int", "(", "flags", ")", ",", "unsafe", ".", "Pointer", "(", "centers", ")", ",", "&", "compactness", ")", "\n\n", "return", "labels", ",", "centers", "\n", "}" ]
19,228
all-19229
[ "EntriesService", "is", "an", "option", "that", "sets", "the", "Google", "API", "entry", "service", "to", "use", "with", "Stackdriver", "." ]
[ "func", "EntriesService", "(", "service", "*", "logging", ".", "EntriesService", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "sh", ".", "<mask>", "=", "service", "\n", "return", "nil", "\n", "}", "\n", "}" ]
19,229
all-19230
[ "NextSystemGID", "returns", "the", "next", "free", "system", "group", "id", "to", "use", "." ]
[ "func", "NextSystemGID", "(", ")", "(", "int", ",", "error", ")", "{", "db", ",", "gid", ",", "err", ":=", "nextGUID", "(", "<mask>", ")", "\n", "db", ".", "close", "(", ")", "\n", "return", "gid", ",", "err", "\n", "}" ]
19,230
all-19231
[ "GetContainer", "returns", "the", "container", "entry", "for", "the", "provided", "name" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetContainer", "(", "name", "string", ")", "(", "*", "api", ".", "Container", ",", "string", ",", "error", ")", "{", "container", ":=", "api", ".", "Container", "{", "}", "\n\n", "// Fetch the raw value", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "container", ",", "etag", ",", "nil", "\n", "}" ]
19,231
all-19232
[ "Add", "a", "container", "template", "file" ]
[ "func", "containerMetadataTemplatesPostPut", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "Response", "{", "project", ":=", "projectParam", "(", "r", ")", "\n", "name", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "// Handle requests targeted to a container on a different node", "response", ",", "err", ":=", "ForwardedResponseIfContainerIsRemote", "(", "d", ",", "r", ",", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "// Load the container", "c", ",", "err", ":=", "containerLoadByProjectAndName", "(", "d", ".", "State", "(", ")", ",", "project", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "// Start the storage if needed", "ourStart", ",", "err", ":=", "c", ".", "StorageStart", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "if", "ourStart", "{", "defer", "c", ".", "StorageStop", "(", ")", "\n", "}", "\n\n", "// Look at the request", "templateName", ":=", "r", ".", "FormValue", "(", "\"", "\"", ")", "\n", "if", "templateName", "==", "\"", "\"", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "// Check if the template already exists", "templatePath", ",", "err", ":=", "getContainerTemplatePath", "(", "c", ",", "templateName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "if", "r", ".", "Method", "==", "\"", "\"", "&&", "shared", ".", "PathExists", "(", "templatePath", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "// Write the new template", "template", ",", "err", ":=", "os", ".", "OpenFile", "(", "templatePath", ",", "os", ".", "O_WRONLY", "|", "os", ".", "O_CREATE", "|", "os", ".", "O_TRUNC", ",", "0644", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "defer", "<mask>", ".", "Close", "(", ")", "\n\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "template", ",", "r", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "return", "EmptySyncResponse", "\n", "}" ]
19,232
all-19233
[ "PaperSizeNewFromIpp", "is", "a", "wrapper", "around", "gtk_paper_size_new_from_ipp", "()", "." ]
[ "func", "PaperSizeNewFromIPP", "(", "name", "string", ",", "width", ",", "<mask>", "float64", ")", "(", "*", "PaperSize", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n\n", "c", ":=", "C", ".", "gtk_paper_size_new_from_ipp", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gdouble", "(", "width", ")", ",", "C", ".", "gdouble", "(", "height", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "t", ":=", "&", "PaperSize", "{", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "t", ",", "(", "*", "PaperSize", ")", ".", "free", ")", "\n", "return", "t", ",", "nil", "\n", "}" ]
19,233
all-19234
[ "newAzureClient", "creates", "an", "AzureClient", "helper", "from", "the", "Driver", "context", "and", "initiates", "authentication", "if", "required", "." ]
[ "func", "(", "d", "*", "Driver", ")", "newAzureClient", "(", ")", "(", "*", "azureutil", ".", "AzureClient", ",", "error", ")", "{", "env", ",", "<mask>", ":=", "environments", "[", "d", ".", "Environment", "]", "\n", "if", "!", "ok", "{", "valid", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "environments", ")", ")", "\n", "for", "k", ":=", "range", "environments", "{", "valid", "=", "append", "(", "valid", ",", "k", ")", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "Environment", ",", "strings", ".", "Join", "(", "valid", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "var", "(", "token", "*", "azure", ".", "ServicePrincipalToken", "\n", "err", "error", "\n", ")", "\n", "if", "d", ".", "ClientID", "!=", "\"", "\"", "&&", "d", ".", "ClientSecret", "!=", "\"", "\"", "{", "// use Service Principal auth", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "token", ",", "err", "=", "azureutil", ".", "AuthenticateServicePrincipal", "(", "env", ",", "d", ".", "SubscriptionID", ",", "d", ".", "ClientID", ",", "d", ".", "ClientSecret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "else", "{", "// use browser-based device auth", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "token", ",", "err", "=", "azureutil", ".", "AuthenticateDeviceFlow", "(", "env", ",", "d", ".", "SubscriptionID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "azureutil", ".", "New", "(", "env", ",", "d", ".", "SubscriptionID", ",", "token", ")", ",", "nil", "\n", "}" ]
19,234
all-19235
[ "Get", "information", "about", "a", "single", "role", "including", "the", "set", "of", "scopes", "that", "the", "role", "expands", "to", ".", "See", "#role" ]
[ "func", "(", "auth", "*", "Auth", ")", "Role", "(", "roleId", "string", ")", "(", "*", "GetRoleResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "auth", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "<mask>", ".", "QueryEscape", "(", "roleId", ")", ",", "new", "(", "GetRoleResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "GetRoleResponse", ")", ",", "err", "\n", "}" ]
19,235
all-19236
[ "UnmarshalBinary", "unmarshals", "a", "byte", "slice", "into", "a", "ConfigArg", ".", "If", "the", "byte", "slice", "does", "not", "contain", "enough", "data", "to", "form", "a", "valid", "ConfigArg", "or", "config", "string", "length", "is", "greater", "than", "the", "number", "of", "remaining", "bytes", "in", "b", "io", ".", "ErrUnexpectedEOF", "is", "returned", ".", "If", "config", "string", "length", "is", "greater", "than", "1024", "ErrorBadArgumentParameter", "is", "returned", "." ]
[ "func", "(", "c", "*", "ConfigArg", ")", "UnmarshalBinary", "(", "b", "[", "]", "byte", ")", "error", "{", "// Must contain minimum length for argument", "if", "len", "(", "b", ")", "<", "configArgLen", "{", "return", "<mask>", ".", "ErrUnexpectedEOF", "\n", "}", "\n\n", "// Retrieve basic data", "c", ".", "BufferCount", "=", "binary", ".", "BigEndian", ".", "Uint16", "(", "b", "[", "0", ":", "2", "]", ")", "\n", "c", ".", "FirmwareVersion", "=", "binary", ".", "BigEndian", ".", "Uint16", "(", "b", "[", "2", ":", "4", "]", ")", "\n", "c", ".", "SectorCount", "=", "b", "[", "4", "]", "\n\n", "// Version is most significant 4 bits", "c", ".", "Version", "=", "uint8", "(", "b", "[", "5", "]", ">>", "4", ")", "\n\n", "// Command is least significant 4 bits of byte 5", "c", ".", "Command", "=", "ConfigCommand", "(", "b", "[", "5", "]", "&", "0x0f", ")", "\n\n", "// StringLength cannot be larger than the number of bytes remaining", "// in the buffer", "c", ".", "StringLength", "=", "binary", ".", "BigEndian", ".", "Uint16", "(", "b", "[", "6", ":", "8", "]", ")", "\n", "if", "len", "(", "b", "[", "8", ":", "]", ")", "<", "int", "(", "c", ".", "StringLength", ")", "{", "return", "io", ".", "ErrUnexpectedEOF", "\n", "}", "\n", "// StringLength must not be greater than 1024, per AoEr11, Section 3.2.", "if", "c", ".", "StringLength", ">", "1024", "{", "return", "ErrorBadArgumentParameter", "\n", "}", "\n\n", "// Copy config string for use", "d", ":=", "make", "(", "[", "]", "byte", ",", "c", ".", "StringLength", ")", "\n", "copy", "(", "d", ",", "b", "[", "8", ":", "]", ")", "\n", "c", ".", "String", "=", "d", "\n\n", "return", "nil", "\n", "}" ]
19,236
all-19237
[ "Value", "implements", "the", "driver", "Valuer", "interface", "." ]
[ "func", "(", "t", "Time", ")", "<mask>", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "if", "!", "t", ".", "Valid", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "t", ".", "Time", ",", "nil", "\n", "}" ]
19,237
all-19238
[ "DecodeIntWithPrecision", "decodes", "the", "provided", "integer", "geohash", "with", "bits", "of", "precision", "to", "a", "(", "lat", "lng", ")", "point", "." ]
[ "func", "DecodeIntWithPrecision", "(", "hash", "uint64", ",", "<mask>", "uint", ")", "(", "lat", ",", "lng", "float64", ")", "{", "box", ":=", "BoundingBoxIntWithPrecision", "(", "hash", ",", "bits", ")", "\n", "return", "box", ".", "Round", "(", ")", "\n", "}" ]
19,238
all-19239
[ "addContainerUnsafe", "adds", "a", "container", "to", "the", "map", "of", "containers", "being", "watched", "." ]
[ "func", "(", "engine", "*", "DockerStatsEngine", ")", "addContainerUnsafe", "(", "dockerID", "string", ")", "(", "*", "StatsContainer", ",", "error", ")", "{", "// Make sure that this container belongs to a task and that the task", "// is not terminal.", "task", ",", "err", ":=", "engine", ".", "resolver", ".", "ResolveTask", "(", "dockerID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dockerID", ")", "\n", "}", "\n\n", "if", "len", "(", "task", ".", "Arn", ")", "==", "0", "||", "len", "(", "task", ".", "Family", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "task", ".", "Family", ")", "\n", "}", "\n\n", "if", "task", ".", "GetKnownStatus", "(", ")", ".", "Terminal", "(", ")", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "dockerID", ",", "task", ".", "Arn", ")", "\n", "}", "\n\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "dockerID", ",", "task", ".", "Arn", ")", "\n", "statsContainer", ":=", "newStatsContainer", "(", "dockerID", ",", "engine", ".", "client", ",", "engine", ".", "resolver", ")", "\n", "engine", ".", "tasksToDefinitions", "[", "task", ".", "Arn", "]", "=", "&", "taskDefinition", "{", "family", ":", "task", ".", "Family", ",", "version", ":", "task", ".", "<mask>", "}", "\n\n", "watchStatsContainer", ":=", "false", "\n", "if", "!", "engine", ".", "disableMetrics", "{", "// Adding container to the map for collecting stats", "watchStatsContainer", "=", "engine", ".", "addToStatsContainerMapUnsafe", "(", "task", ".", "Arn", ",", "dockerID", ",", "statsContainer", ",", "engine", ".", "containerMetricsMapUnsafe", ")", "\n", "}", "\n\n", "if", "dockerContainer", ",", "err", ":=", "engine", ".", "resolver", ".", "ResolveContainer", "(", "dockerID", ")", ";", "err", "!=", "nil", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "dockerID", ",", "err", ")", "\n", "}", "else", "if", "dockerContainer", ".", "Container", ".", "HealthStatusShouldBeReported", "(", ")", "{", "// Track the container health status", "engine", ".", "addToStatsContainerMapUnsafe", "(", "task", ".", "Arn", ",", "dockerID", ",", "statsContainer", ",", "engine", ".", "healthCheckContainerMapUnsafe", ")", "\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "dockerID", ",", "task", ".", "Arn", ")", "\n", "}", "\n\n", "if", "!", "watchStatsContainer", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "statsContainer", ",", "nil", "\n", "}" ]
19,239
all-19240
[ "tenantIDPath", "returns", "the", "full", "path", "the", "tenant", "ID", "for", "the", "given", "subscription", "should", "be", "saved", "at", ".", "f" ]
[ "func", "tenantIDPath", "(", "subscriptionID", "<mask>", ")", "string", "{", "return", "filepath", ".", "Join", "(", "azureCredsPath", "(", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "subscriptionID", ")", ")", "\n", "}" ]
19,240
all-19241
[ "Validate", "ensures", "that", "the", "set", "of", "options", "are", "self", "-", "consistent", "and", "valid" ]
[ "func", "(", "o", "*", "Options", ")", "Validate", "(", ")", "error", "{", "if", "len", "(", "o", ".", "Args", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "o", ".", "<mask>", ".", "Validate", "(", ")", "\n", "}" ]
19,241
all-19242
[ "NewVaultListQuery", "creates", "a", "new", "datacenter", "dependency", "." ]
[ "func", "NewVaultListQuery", "(", "s", "string", ")", "(", "*", "VaultListQuery", ",", "error", ")", "{", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "s", "=", "strings", ".", "Trim", "(", "s", ",", "\"", "\"", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "}", "\n\n", "return", "&", "VaultListQuery", "{", "stopCh", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "<mask>", ":", "s", ",", "}", ",", "nil", "\n", "}" ]
19,242
all-19243
[ "GetDesiredStatus", "gets", "the", "desired", "status", "of", "the", "container" ]
[ "func", "(", "c", "*", "Container", ")", "GetDesiredStatus", "(", ")", "apicontainerstatus", ".", "ContainerStatus", "{", "c", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "DesiredStatusUnsafe", "\n", "}" ]
19,243
all-19244
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "l", "*", "LogStreamDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "l", "!=", "nil", "&&", "l", ".", "TitleSize", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
19,244
all-19245
[ "NewEncoder", "returns", "a", "new", "encoder", "that", "outputs", "to", "w", "." ]
[ "func", "(", "c", "Codec", ")", "NewEncoder", "(", "w", "<mask>", ".", "Writer", ")", "*", "Encoder", "{", "return", "NewEncoder", "(", "c", ".", "NewEmitter", "(", "w", ")", ")", "\n", "}" ]
19,245
all-19246
[ "Exports", "the", "current", "node", "table", "." ]
[ "func", "(", "s", "*", "Server", ")", "Nodes", "(", ")", "(", "nis", "[", "]", "krpc", ".", "NodeInfo", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "s", ".", "table", ".", "forNodes", "(", "func", "(", "n", "*", "node", ")", "bool", "{", "nis", "=", "append", "(", "nis", ",", "krpc", ".", "NodeInfo", "{", "Addr", ":", "n", ".", "addr", ".", "KRPC", "(", ")", ",", "ID", ":", "n", ".", "id", ".", "AsByteArray", "(", ")", ",", "}", ")", "\n", "return", "<mask>", "\n", "}", ")", "\n", "return", "\n", "}" ]
19,246
all-19247
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "APIKey", ")", "GetName", "(", ")", "string", "{", "if", "a", "==", "nil", "||", "a", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "a", ".", "Name", "\n", "}" ]
19,247
all-19248
[ "SetKind", "changes", "the", "kind", "of", "rule", "this", "is", "." ]
[ "func", "(", "r", "*", "Rule", ")", "SetKind", "(", "kind", "string", ")", "{", "r", ".", "kind", "=", "kind", "\n", "r", ".", "<mask>", "=", "true", "\n", "}" ]
19,248
all-19249
[ "SetWordWrap", "enables", "or", "disables", "wordwrap", "mode" ]
[ "func", "(", "l", "*", "TextView", ")", "SetWordWrap", "(", "<mask>", "bool", ")", "{", "if", "wrap", "!=", "l", ".", "wordWrap", "{", "l", ".", "wordWrap", "=", "wrap", "\n", "l", ".", "calculateVirtualSize", "(", ")", "\n", "l", ".", "recalculateTopLine", "(", ")", "\n", "l", ".", "Draw", "(", ")", "\n", "}", "\n", "}" ]
19,249
all-19250
[ "GetProtoConfig", "returns", "the", "proto", "language", "configuration", ".", "If", "the", "proto", "extension", "was", "not", "run", "it", "will", "return", "nil", "." ]
[ "func", "GetProtoConfig", "(", "c", "*", "config", ".", "Config", ")", "*", "ProtoConfig", "{", "<mask>", ":=", "c", ".", "Exts", "[", "protoName", "]", "\n", "if", "pc", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "pc", ".", "(", "*", "ProtoConfig", ")", "\n", "}" ]
19,250
all-19251
[ "RemoveGauge", "removes", "a", "gauge" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "RemoveGauge", "(", "metric", "string", ")", "{", "m", ".", "gm", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "gm", ".", "Unlock", "(", ")", "\n", "<mask>", "(", "m", ".", "gauges", ",", "metric", ")", "\n", "}" ]
19,251
all-19252
[ "ToAddrs", "returns", "a", "copy", "of", "MailBuilder", "with", "the", "specified", "To", "addresses", "." ]
[ "func", "(", "p", "MailBuilder", ")", "ToAddrs", "(", "to", "[", "]", "mail", ".", "<mask>", ")", "MailBuilder", "{", "p", ".", "to", "=", "to", "\n", "return", "p", "\n", "}" ]
19,252
all-19253
[ "GetActionWidget", "()", "is", "a", "wrapper", "around", "gtk_notebook_get_action_widget", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "GetActionWidget", "(", "packType", "PackType", ")", "(", "*", "Widget", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_notebook_get_action_widget", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkPackType", "(", "packType", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapWidget", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
19,253
all-19254
[ "keyFunc", "returns", "the", "key", "of", "a", "request", "which", "is", "used", "to", "look", "up", "its", "caching", "response", "in", "the", "cache", "." ]
[ "func", "keyFunc", "(", "req", "*", "<mask>", ".", "RangeRequest", ")", "string", "{", "// TODO: use marshalTo to reduce allocation", "b", ",", "err", ":=", "req", ".", "Marshal", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "string", "(", "b", ")", "\n", "}" ]
19,254
all-19255
[ "Write", "writes", "current", "records", "to", "file", "." ]
[ "func", "(", "r", "*", "CSVReport", ")", "Write", "(", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "OpenFile", "(", "r", ".", "Filename", ",", "os", ".", "O_WRONLY", "|", "os", ".", "O_CREATE", "|", "<mask>", ".", "O_TRUNC", ",", "0640", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "writer", ":=", "csv", ".", "NewWriter", "(", "file", ")", "\n", "err", "=", "writer", ".", "WriteAll", "(", "r", ".", "records", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logf", "(", "\"", "\"", ",", "r", ".", "Filename", ")", "\n", "return", "nil", "\n", "}" ]
19,255
all-19256
[ "send", "persists", "state", "to", "stable", "storage", "and", "then", "sends", "to", "its", "mailbox", "." ]
[ "func", "(", "r", "*", "raft", ")", "send", "(", "m", "pb", ".", "<mask>", ")", "{", "m", ".", "From", "=", "r", ".", "id", "\n", "if", "m", ".", "Type", "==", "pb", ".", "MsgVote", "||", "m", ".", "Type", "==", "pb", ".", "MsgVoteResp", "||", "m", ".", "Type", "==", "pb", ".", "MsgPreVote", "||", "m", ".", "Type", "==", "pb", ".", "MsgPreVoteResp", "{", "if", "m", ".", "Term", "==", "0", "{", "// All {pre-,}campaign messages need to have the term set when", "// sending.", "// - MsgVote: m.Term is the term the node is campaigning for,", "// non-zero as we increment the term when campaigning.", "// - MsgVoteResp: m.Term is the new r.Term if the MsgVote was", "// granted, non-zero for the same reason MsgVote is", "// - MsgPreVote: m.Term is the term the node will campaign,", "// non-zero as we use m.Term to indicate the next term we'll be", "// campaigning for", "// - MsgPreVoteResp: m.Term is the term received in the original", "// MsgPreVote if the pre-vote was granted, non-zero for the", "// same reasons MsgPreVote is", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "Type", ")", ")", "\n", "}", "\n", "}", "else", "{", "if", "m", ".", "Term", "!=", "0", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "Type", ",", "m", ".", "Term", ")", ")", "\n", "}", "\n", "// do not attach term to MsgProp, MsgReadIndex", "// proposals are a way to forward to the leader and", "// should be treated as local message.", "// MsgReadIndex is also forwarded to leader.", "if", "m", ".", "Type", "!=", "pb", ".", "MsgProp", "&&", "m", ".", "Type", "!=", "pb", ".", "MsgReadIndex", "{", "m", ".", "Term", "=", "r", ".", "Term", "\n", "}", "\n", "}", "\n", "r", ".", "msgs", "=", "append", "(", "r", ".", "msgs", ",", "m", ")", "\n", "}" ]
19,256
all-19257
[ "stopTrackingContainerUnsafe", "removes", "the", "StatsContainer", "from", "stats", "engine", "and", "returns", "true", "if", "the", "container", "is", "stopped", "or", "no", "longer", "tracked", "in", "agent", ".", "Otherwise", "it", "does", "nothing", "and", "return", "false" ]
[ "func", "(", "engine", "*", "DockerStatsEngine", ")", "stopTrackingContainerUnsafe", "(", "container", "*", "StatsContainer", ",", "taskARN", "string", ")", "bool", "{", "terminal", ",", "err", ":=", "container", ".", "terminal", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// Error determining if the container is terminal. This means that the container", "// id could not be resolved to a container that is being tracked by the", "// docker task engine. If the docker task engine has already removed", "// the container from its state, there's no point in stats engine tracking the", "// container. So, clean-up anyway.", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "<mask>", ".", "containerMetadata", ".", "DockerID", ",", "err", ")", "\n", "engine", ".", "doRemoveContainerUnsafe", "(", "container", ",", "taskARN", ")", "\n", "return", "true", "\n", "}", "\n", "if", "terminal", "{", "// Container is in known terminal state. Stop collection metrics.", "seelog", ".", "Infof", "(", "\"", "\"", ",", "container", ".", "containerMetadata", ".", "DockerID", ")", "\n", "engine", ".", "doRemoveContainerUnsafe", "(", "container", ",", "taskARN", ")", "\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
19,257
all-19258
[ "NewInlineQueryResultVideo", "returns", "a", "new", "InlineQueryResultVideo", "with", "all", "mandatory", "fields", "set", "." ]
[ "func", "NewInlineQueryResultVideo", "(", "id", ",", "videoURL", ",", "thumbURL", ",", "title", ",", "text", "string", ",", "mimeType", "MIMEType", ")", "*", "InlineQueryResultVideo", "{", "return", "&", "InlineQueryResultVideo", "{", "InlineQueryResultBase", ":", "InlineQueryResultBase", "{", "<mask>", ":", "PhotoResult", ",", "ID", ":", "id", ",", "}", ",", "VideoURL", ":", "videoURL", ",", "MIMEType", ":", "mimeType", ",", "ThumbURL", ":", "thumbURL", ",", "Title", ":", "title", ",", "Text", ":", "text", ",", "}", "\n", "}" ]
19,258
all-19259
[ "Export", "all", "the", "known", "values", "in", "the", "context", ".", "Note", "this", "can", "t", "reach", "up", "into", "other", "implemenations", "of", "context", ".", "Context", "." ]
[ "func", "(", "c", "*", "Context", ")", "export", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "m", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "if", "c", ".", "outer", "!=", "nil", "{", "for", "k", ",", "v", ":=", "range", "c", ".", "outer", ".", "export", "(", ")", "{", "m", "[", "k", "]", "=", "v", "\n", "}", "\n", "}", "\n", "for", "k", ",", "v", ":=", "range", "c", ".", "<mask>", "{", "m", "[", "k", "]", "=", "v", "\n", "}", "\n\n", "return", "m", "\n", "}" ]
19,259
all-19260
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventWebSocketWillSendHandshakeRequest", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork40", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
19,260
all-19261
[ "Do", "executes", "Debugger", ".", "enable", "against", "the", "provided", "context", ".", "returns", ":", "debuggerID", "-", "Unique", "identifier", "of", "the", "debugger", "." ]
[ "func", "(", "p", "*", "EnableParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "debuggerID", "runtime", ".", "UniqueDebuggerID", ",", "err", "error", ")", "{", "// execute", "var", "res", "EnableReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandEnable", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "DebuggerID", ",", "nil", "\n", "}" ]
19,261
all-19262
[ "AddFlags", "injects", "Kubernetes", "options", "into", "the", "given", "FlagSet", "." ]
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "AddFlags", "(", "fs", "*", "<mask>", ".", "FlagSet", ")", "{", "fs", ".", "StringVar", "(", "&", "o", ".", "buildCluster", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "kubeconfig", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fs", ".", "StringVar", "(", "&", "o", ".", "DeckURI", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}" ]
19,262
all-19263
[ "choose", "selects", "watchers", "from", "the", "watcher", "group", "to", "update" ]
[ "func", "(", "wg", "*", "watcherGroup", ")", "choose", "(", "maxWatchers", "int", ",", "curRev", ",", "compactRev", "int64", ")", "(", "*", "watcherGroup", ",", "int64", ")", "{", "if", "len", "(", "wg", ".", "watchers", ")", "<", "maxWatchers", "{", "return", "wg", ",", "wg", ".", "chooseAll", "(", "curRev", ",", "compactRev", ")", "\n", "}", "\n", "ret", ":=", "newWatcherGroup", "(", ")", "\n", "for", "w", ":=", "range", "wg", ".", "watchers", "{", "if", "maxWatchers", "<=", "0", "{", "break", "\n", "}", "\n", "maxWatchers", "--", "\n", "ret", ".", "add", "(", "w", ")", "\n", "}", "\n", "return", "&", "<mask>", ",", "ret", ".", "chooseAll", "(", "curRev", ",", "compactRev", ")", "\n", "}" ]
19,263
all-19264
[ "Do", "executes", "Page", ".", "screencastFrameAck", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ScreencastFrameAckParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandScreencastFrameAck", ",", "p", ",", "nil", ")", "\n", "}" ]
19,264
all-19265
[ "WithUnmodifiedText", "text", "that", "would", "have", "been", "generated", "by", "the", "keyboard", "if", "no", "modifiers", "were", "pressed", "(", "except", "for", "shift", ")", ".", "Useful", "for", "shortcut", "(", "accelerator", ")", "key", "handling", "(", "default", ":", ")", "." ]
[ "func", "(", "p", "DispatchKeyEventParams", ")", "WithUnmodifiedText", "(", "unmodifiedText", "<mask>", ")", "*", "DispatchKeyEventParams", "{", "p", ".", "UnmodifiedText", "=", "unmodifiedText", "\n", "return", "&", "p", "\n", "}" ]
19,265
all-19266
[ "/", "*", "AddSafe", "adds", "an", "entry", "to", "the", "idmap", "set", "breaking", "apart", "any", "ranges", "that", "the", "new", "idmap", "intersects", "with", "in", "the", "process", "." ]
[ "func", "(", "m", "*", "IdmapSet", ")", "AddSafe", "(", "i", "IdmapEntry", ")", "error", "{", "result", ":=", "[", "]", "IdmapEntry", "{", "}", "\n", "added", ":=", "false", "\n", "for", "_", ",", "e", ":=", "range", "m", ".", "Idmap", "{", "if", "!", "e", ".", "Intersects", "(", "i", ")", "{", "<mask>", "=", "append", "(", "result", ",", "e", ")", "\n", "continue", "\n", "}", "\n\n", "if", "e", ".", "HostidsIntersect", "(", "i", ")", "{", "return", "ErrHostIdIsSubId", "\n", "}", "\n\n", "added", "=", "true", "\n\n", "lower", ":=", "IdmapEntry", "{", "Isuid", ":", "e", ".", "Isuid", ",", "Isgid", ":", "e", ".", "Isgid", ",", "Hostid", ":", "e", ".", "Hostid", ",", "Nsid", ":", "e", ".", "Nsid", ",", "Maprange", ":", "i", ".", "Nsid", "-", "e", ".", "Nsid", ",", "}", "\n\n", "upper", ":=", "IdmapEntry", "{", "Isuid", ":", "e", ".", "Isuid", ",", "Isgid", ":", "e", ".", "Isgid", ",", "Hostid", ":", "e", ".", "Hostid", "+", "lower", ".", "Maprange", "+", "i", ".", "Maprange", ",", "Nsid", ":", "i", ".", "Nsid", "+", "i", ".", "Maprange", ",", "Maprange", ":", "e", ".", "Maprange", "-", "i", ".", "Maprange", "-", "lower", ".", "Maprange", ",", "}", "\n\n", "if", "lower", ".", "Maprange", ">", "0", "{", "result", "=", "append", "(", "result", ",", "lower", ")", "\n", "}", "\n", "result", "=", "append", "(", "result", ",", "i", ")", "\n", "if", "upper", ".", "Maprange", ">", "0", "{", "result", "=", "append", "(", "result", ",", "upper", ")", "\n", "}", "\n", "}", "\n\n", "if", "!", "added", "{", "result", "=", "append", "(", "result", ",", "i", ")", "\n", "}", "\n\n", "m", ".", "Idmap", "=", "result", "\n", "return", "nil", "\n", "}" ]
19,266
all-19267
[ "GetPixbuf", "is", "a", "wrapper", "around", "gdk_pixbuf_loader_get_pixbuf", "()", "." ]
[ "func", "(", "v", "*", "PixbufLoader", ")", "GetPixbuf", "(", ")", "(", "*", "Pixbuf", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_pixbuf_loader_get_pixbuf", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "obj", ":=", "&", "glib", ".", "<mask>", "{", "glib", ".", "ToGObject", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "p", ":=", "&", "Pixbuf", "{", "obj", "}", "\n", "//obj.Ref() // Don't call Ref here, gdk_pixbuf_loader_get_pixbuf already did that for us.", "runtime", ".", "SetFinalizer", "(", "p", ",", "func", "(", "_", "interface", "{", "}", ")", "{", "obj", ".", "Unref", "(", ")", "}", ")", "\n", "return", "p", ",", "nil", "\n", "}" ]
19,267
all-19268
[ "CreateTokenHandlers", "goes", "through", "the", "list", "of", "token", "files", "and", "create", "handlers" ]
[ "func", "CreateTokenHandlers", "(", "tokenFiles", "[", "]", "string", ",", "influxdb", "*", "InfluxDB", ")", "(", "[", "]", "TokenHandler", ",", "error", ")", "{", "tokens", ":=", "[", "]", "TokenHandler", "{", "}", "\n", "for", "_", ",", "tokenFile", ":=", "range", "tokenFiles", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "tokenFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "tokenFile", ",", "err", ")", "\n", "}", "\n", "token", ",", "err", ":=", "CreateTokenHandler", "(", "f", ",", "influxdb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "tokenFile", ",", "err", ")", "\n", "}", "\n", "tokens", "=", "<mask>", "(", "tokens", ",", "*", "token", ")", "\n", "}", "\n", "return", "tokens", ",", "nil", "\n", "}" ]
19,268
all-19269
[ "For", "CopyOnWrite", "mappings", "OrigSource", "returns", "the", "file", "/", "offset", "of", "the", "original", "copy", "of", "the", "data", "or", "0", "if", "none", "." ]
[ "func", "(", "m", "*", "Mapping", ")", "OrigSource", "(", ")", "(", "string", ",", "int64", ")", "{", "if", "m", ".", "origF", "==", "nil", "{", "return", "\"", "\"", ",", "0", "\n", "}", "\n", "return", "m", ".", "origF", ".", "<mask>", "(", ")", ",", "m", ".", "origOff", "\n", "}" ]
19,269
all-19270
[ "NewHandler", "returns", "a", "handler", "that", "logs", "HTTP", "requests", ".", "It", "logs", "information", "about", "remote", "address", "X", "-", "Forwarded", "-", "For", "or", "X", "-", "Real", "-", "Ip", "HTTP", "method", "request", "URI", "HTTP", "protocol", "HTTP", "response", "status", "total", "bytes", "written", "to", "http", ".", "ResponseWriter", "response", "duration", "HTTP", "referrer", "and", "HTTP", "client", "user", "agent", "." ]
[ "func", "NewHandler", "(", "h", "http", ".", "Handler", ",", "logger", "*", "logging", ".", "Logger", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "startTime", ":=", "time", ".", "Now", "(", ")", "\n", "rl", ":=", "&", "responseLogger", "{", "w", ",", "0", ",", "0", "}", "\n", "h", ".", "ServeHTTP", "(", "rl", ",", "r", ")", "\n", "referrer", ":=", "r", ".", "Referer", "(", ")", "\n", "if", "referrer", "==", "\"", "\"", "{", "referrer", "=", "\"", "\"", "\n", "}", "\n", "userAgent", ":=", "r", ".", "UserAgent", "(", ")", "\n", "if", "userAgent", "==", "\"", "\"", "{", "userAgent", "=", "\"", "\"", "\n", "}", "\n", "ips", ":=", "[", "]", "string", "{", "}", "\n", "xfr", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "xfr", "!=", "\"", "\"", "{", "ips", "=", "append", "(", "ips", ",", "xfr", ")", "\n", "}", "\n", "xri", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "xri", "!=", "\"", "\"", "{", "ips", "=", "append", "(", "ips", ",", "xri", ")", "\n", "}", "\n", "xips", ":=", "\"", "\"", "\n", "if", "len", "(", "ips", ")", ">", "0", "{", "xips", "=", "strings", ".", "Join", "(", "ips", ",", "\"", "\"", ")", "\n", "}", "\n", "var", "level", "logging", ".", "Level", "\n", "switch", "{", "case", "rl", ".", "status", ">=", "500", ":", "level", "=", "logging", ".", "ERROR", "\n", "case", "rl", ".", "<mask>", ">=", "400", ":", "level", "=", "logging", ".", "WARNING", "\n", "case", "rl", ".", "status", ">=", "300", ":", "level", "=", "logging", ".", "INFO", "\n", "case", "rl", ".", "status", ">=", "200", ":", "level", "=", "logging", ".", "INFO", "\n", "default", ":", "level", "=", "logging", ".", "DEBUG", "\n", "}", "\n", "logger", ".", "Logf", "(", "level", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "r", ".", "RemoteAddr", ",", "xips", ",", "r", ".", "Method", ",", "r", ".", "RequestURI", ",", "r", ".", "Proto", ",", "rl", ".", "status", ",", "rl", ".", "size", ",", "time", ".", "Since", "(", "startTime", ")", ".", "Seconds", "(", ")", ",", "referrer", ",", "userAgent", ")", "\n", "}", ")", "\n", "}" ]
19,270
all-19271
[ "ReceiveIssueEvent", "is", "a", "wrapper", "on", "plugin", ".", "ReceiveIssueEvent", "()" ]
[ "func", "(", "o", "*", "FakeCommentPluginWrapper", ")", "ReceiveIssueEvent", "(", "event", "sql", ".", "IssueEvent", ")", "[", "]", "Point", "{", "// Pass through", "return", "o", ".", "plugin", ".", "ReceiveIssueEvent", "(", "<mask>", ")", "\n", "}" ]
19,271
all-19272
[ "Add", "adds", "a", "point", "." ]
[ "func", "(", "index", "*", "ClusteringIndex", ")", "Add", "(", "point", "<mask>", ")", "{", "index", ".", "streetLevel", ".", "Add", "(", "point", ")", "\n", "index", ".", "cityLevel", ".", "Add", "(", "point", ")", "\n", "index", ".", "worldLevel", ".", "Add", "(", "point", ")", "\n", "}" ]
19,272
all-19273
[ "=====", "Actions", "POST", "/", "api", "/", "repositories", "/", ":", "id", "/", "cookbook_import", "Performs", "a", "Cookbook", "import", "which", "allows", "you", "to", "use", "the", "specified", "cookbooks", "in", "your", "design", "objects", ".", "Required", "parameters", ":", "asset_hrefs", ":", "Hrefs", "of", "the", "assets", "that", "should", "be", "imported", ".", "Optional", "parameters", ":", "follow", ":", "A", "flag", "indicating", "whether", "imported", "cookbooks", "should", "be", "followed", ".", "namespace", ":", "The", "namespace", "to", "import", "into", ".", "repository_commit_reference", ":", "Optional", "commit", "reference", "indicating", "last", "succeeded", "commit", ".", "Must", "match", "the", "Repository", "s", "fetch_status", ".", "succeeded_commit", "attribute", "or", "the", "import", "will", "not", "be", "performed", ".", "with_dependencies", ":", "A", "flag", "indicating", "whether", "dependencies", "should", "automatically", "be", "imported", "." ]
[ "func", "(", "loc", "*", "RepositoryLocator", ")", "CookbookImport", "(", "assetHrefs", "[", "]", "string", ",", "options", "rsapi", ".", "APIParams", ")", "error", "{", "if", "len", "(", "assetHrefs", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "\"", "\"", ":", "assetHrefs", ",", "}", "\n", "var", "followOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "followOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "followOpt", "\n", "}", "\n", "var", "namespaceOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "namespaceOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "namespaceOpt", "\n", "}", "\n", "var", "repositoryCommitReferenceOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "repositoryCommitReferenceOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "repositoryCommitReferenceOpt", "\n", "}", "\n", "<mask>", "withDependenciesOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "withDependenciesOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "withDependenciesOpt", "\n", "}", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "Path", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "sr", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "sr", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,273
all-19274
[ "Stroke", "strokes", "the", "paths", "with", "the", "color", "specified", "by", "SetStrokeColor" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "Stroke", "(", "paths", "...", "*", "draw2d", ".", "Path", ")", "{", "gc", ".", "drawPaths", "(", "stroked", ",", "paths", "...", ")", "\n", "gc", ".", "Current", ".", "<mask>", ".", "Clear", "(", ")", "\n", "}" ]
19,274
all-19275
[ "DatabasePingCheck", "returns", "a", "Check", "that", "validates", "connectivity", "to", "a", "database", "/", "sql", ".", "DB", "using", "Ping", "()", "." ]
[ "func", "DatabasePingCheck", "(", "database", "*", "sql", ".", "DB", ",", "timeout", "time", ".", "Duration", ")", "Check", "{", "return", "func", "(", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "timeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "<mask>", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "database", ".", "PingContext", "(", "ctx", ")", "\n", "}", "\n", "}" ]
19,275
all-19276
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform3iv", "(", "<mask>", "int32", ",", "count", "int32", ",", "value", "*", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpUniform3iv", ",", "3", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "count", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
19,276
all-19277
[ "initializeDockerVolumes", "checks", "the", "volume", "resource", "in", "the", "task", "to", "determine", "if", "the", "agent", "should", "create", "the", "volume", "before", "creating", "the", "container" ]
[ "func", "(", "task", "*", "Task", ")", "initializeDockerVolumes", "(", "sharedVolumeMatchFullConfig", "bool", ",", "dockerClient", "dockerapi", ".", "DockerClient", ",", "ctx", "context", ".", "Context", ")", "error", "{", "for", "i", ",", "vol", ":=", "range", "task", ".", "Volumes", "{", "// No need to do this for non-docker volume, eg: host bind/empty volume", "if", "vol", ".", "Type", "!=", "DockerVolumeType", "{", "continue", "\n", "}", "\n\n", "dockerVolume", ",", "ok", ":=", "vol", ".", "Volume", ".", "(", "*", "taskresourcevolume", ".", "DockerVolumeConfig", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "// Agent needs to create task-scoped volume", "if", "dockerVolume", ".", "Scope", "==", "taskresourcevolume", ".", "TaskScope", "{", "err", ":=", "task", ".", "addTaskScopedVolumes", "(", "ctx", ",", "dockerClient", ",", "&", "task", ".", "Volumes", "[", "i", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "// Agent needs to create shared volume if that's auto provisioned", "err", ":=", "<mask>", ".", "addSharedVolumes", "(", "sharedVolumeMatchFullConfig", ",", "ctx", ",", "dockerClient", ",", "&", "task", ".", "Volumes", "[", "i", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,277
all-19278
[ "FilterLogs", "executes", "a", "Ethereum", "filter", "query", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "FilterLogs", "(", "ctx", "context", ".", "Context", ",", "q", "ethereum", ".", "FilterQuery", ")", "(", "[", "]", "types", ".", "<mask>", ",", "error", ")", "{", "return", "b", ".", "conn", ".", "ethClient", "(", ")", ".", "FilterLogs", "(", "ctx", ",", "q", ")", "\n", "}" ]
19,278
all-19279
[ "OnGossip", "receives", "broadcasts", "of", "TopologyGossipData", ".", "It", "returns", "an", "improved", "version", "of", "the", "received", "update", ".", "See", "peers", ".", "ApplyUpdate", "." ]
[ "func", "(", "router", "*", "Router", ")", "OnGossip", "(", "update", "[", "]", "byte", ")", "(", "GossipData", ",", "error", ")", "{", "_", ",", "newUpdate", ",", "err", ":=", "router", ".", "applyTopologyUpdate", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "newUpdate", ")", "==", "0", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "topologyGossipData", "{", "peers", ":", "router", ".", "Peers", ",", "update", ":", "newUpdate", "}", ",", "nil", "\n", "}" ]
19,279
all-19280
[ "ToURL", "will", "format", "the", "provided", "string", "as", "a", "URL", ".", "HTTP", "and", "HTTPS", "are", "the", "only", "supported", "protocols", "at", "this", "time", "." ]
[ "func", "ToURL", "(", "theString", ",", "subdomain", "string", ",", "secure", "bool", ")", "(", "string", ",", "error", ")", "{", "f", ":=", "New", "(", "theString", ")", "\n\n", "if", "f", ".", "length", "<", "4", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "lengthError", ")", "\n", "}", "\n\n", "f", ".", "makeLower", "(", ")", "\n\n", "if", "<mask>", "{", "if", "len", "(", "subdomain", ")", ">", "0", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "subdomain", ",", "f", ".", "theString", ")", ",", "nil", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "theString", ")", ",", "nil", "\n", "}", "\n\n", "if", "len", "(", "subdomain", ")", ">", "0", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "subdomain", ",", "f", ".", "theString", ")", ",", "nil", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "theString", ")", ",", "nil", "\n", "}" ]
19,280
all-19281
[ "ExecutorName", "sets", "the", "ExecutorName" ]
[ "func", "(", "e", "*", "execStreamerBuilder", ")", "ExecutorName", "(", "executorName", "string", ")", "ExecStreamerBuilder", "{", "e", ".", "d", ".", "ExecutorName", "=", "executorName", "\n", "<mask>", "e", "\n", "}" ]
19,281
all-19282
[ "WithRoute", "adds", "the", "route", "to", "the", "patch", "apps", "app", "routes", "route", "params" ]
[ "func", "(", "o", "*", "PatchAppsAppRoutesRouteParams", ")", "WithRoute", "(", "<mask>", "string", ")", "*", "PatchAppsAppRoutesRouteParams", "{", "o", ".", "SetRoute", "(", "route", ")", "\n", "return", "o", "\n", "}" ]
19,282
all-19283
[ "PrintHorizontal", "-", "Prints", "horizontal", "table", "from", "a", "map", "." ]
[ "func", "PrintHorizontal", "(", "m", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "<mask>", ":=", "New", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ")", "\n", "rows", ":=", "mapToRows", "(", "m", ")", "\n", "for", "_", ",", "row", ":=", "range", "rows", "{", "table", ".", "AddRow", "(", "row", ")", "\n", "}", "\n", "table", ".", "HideHead", "=", "true", "\n", "table", ".", "Print", "(", ")", "\n", "}" ]
19,283
all-19284
[ "Omnimatch", "runs", "all", "matchers", "against", "the", "password" ]
[ "func", "Omnimatch", "(", "password", "string", ",", "userInputs", "[", "]", "string", ",", "filters", "...", "func", "(", "match", ".", "Matcher", ")", "bool", ")", "(", "matches", "[", "]", "match", ".", "Match", ")", "{", "//Can I run into the issue where nil is not equal to nil?", "if", "dictionaryMatchers", "==", "nil", "||", "adjacencyGraphs", "==", "nil", "{", "loadFrequencyList", "(", ")", "\n", "}", "\n\n", "if", "userInputs", "!=", "nil", "{", "userInputMatcher", ":=", "buildDictMatcher", "(", "\"", "\"", ",", "buildRankedDict", "(", "userInputs", ")", ")", "\n", "matches", "=", "userInputMatcher", "(", "password", ")", "\n", "}", "\n\n", "for", "_", ",", "matcher", ":=", "range", "matchers", "{", "shouldBeFiltered", ":=", "false", "\n", "for", "i", ":=", "range", "filters", "{", "if", "filters", "[", "i", "]", "(", "matcher", ")", "{", "shouldBeFiltered", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "shouldBeFiltered", "{", "matches", "=", "<mask>", "(", "matches", ",", "matcher", ".", "MatchingFunc", "(", "password", ")", "...", ")", "\n", "}", "\n", "}", "\n", "sort", ".", "Sort", "(", "match", ".", "Matches", "(", "matches", ")", ")", "\n", "return", "matches", "\n", "}" ]
19,284
all-19285
[ "MonitoredResource", "is", "an", "option", "that", "sets", "the", "monitored", "resource", "to", "send", "with", "each", "log", "entry", "." ]
[ "func", "MonitoredResource", "(", "<mask>", "*", "logging", ".", "MonitoredResource", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "sh", ".", "resource", "=", "resource", "\n", "return", "nil", "\n", "}", "\n", "}" ]
19,285
all-19286
[ "Dispose", "disposes", "the", "image", "data", ".", "After", "disposing", "most", "of", "image", "functions", "do", "nothing", "and", "returns", "meaningless", "values", ".", "Dispose", "is", "useful", "to", "save", "memory", ".", "When", "the", "image", "is", "disposed", "Dipose", "does", "nothing", ".", "Dipose", "always", "return", "nil", "as", "of", "1", ".", "5", ".", "0", "-", "alpha", "." ]
[ "func", "(", "i", "*", "<mask>", ")", "Dispose", "(", ")", "error", "{", "i", ".", "copyCheck", "(", ")", "\n", "if", "i", ".", "isDisposed", "(", ")", "{", "return", "nil", "\n", "}", "\n", "if", "i", ".", "isSubImage", "(", ")", "{", "return", "nil", "\n", "}", "\n", "i", ".", "mipmap", ".", "dispose", "(", ")", "\n", "i", ".", "resolvePendingPixels", "(", "false", ")", "\n", "return", "nil", "\n", "}" ]
19,286
all-19287
[ "NewClient", "creates", "a", "new", "Client", "." ]
[ "func", "NewClient", "(", "logger", "log", ".", "Logger", ",", "address", "string", ",", "transport", "string", ",", "timeout", "time", ".", "Duration", ",", "prefix", "string", ")", "*", "Client", "{", "if", "logger", "==", "nil", "{", "logger", "=", "<mask>", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "return", "&", "Client", "{", "logger", ":", "logger", ",", "address", ":", "address", ",", "transport", ":", "transport", ",", "timeout", ":", "timeout", ",", "prefix", ":", "prefix", ",", "}", "\n", "}" ]
19,287
all-19288
[ "Do", "executes", "DOM", ".", "requestNode", "against", "the", "provided", "context", ".", "returns", ":", "nodeID", "-", "Node", "id", "for", "given", "object", "." ]
[ "func", "(", "p", "*", "RequestNodeParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "nodeID", "cdp", ".", "NodeID", ",", "err", "error", ")", "{", "// execute", "var", "res", "RequestNodeReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRequestNode", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "NodeID", ",", "nil", "\n", "}" ]
19,288
all-19289
[ "ExecuteFunc", "calls", "f", "on", "each", "template", "tag", "(", "placeholder", ")", "occurrence", ".", "Returns", "the", "number", "of", "bytes", "written", "to", "w", ".", "This", "function", "is", "optimized", "for", "constantly", "changing", "templates", ".", "Use", "Template", ".", "ExecuteFunc", "for", "frozen", "templates", "." ]
[ "func", "ExecuteFunc", "(", "template", ",", "startTag", ",", "endTag", "string", ",", "w", "io", ".", "Writer", ",", "f", "TagFunc", ")", "(", "int64", ",", "error", ")", "{", "s", ":=", "unsafeString2Bytes", "(", "template", ")", "\n", "a", ":=", "unsafeString2Bytes", "(", "startTag", ")", "\n", "b", ":=", "unsafeString2Bytes", "(", "endTag", ")", "\n\n", "var", "nn", "int64", "\n", "var", "ni", "int", "\n", "var", "err", "error", "\n", "for", "{", "n", ":=", "bytes", ".", "Index", "(", "s", ",", "a", ")", "\n", "if", "n", "<", "0", "{", "break", "\n", "}", "\n", "ni", ",", "err", "=", "w", ".", "Write", "(", "s", "[", ":", "n", "]", ")", "\n", "nn", "+=", "int64", "(", "ni", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nn", ",", "err", "\n", "}", "\n\n", "s", "=", "s", "[", "n", "+", "len", "(", "a", ")", ":", "]", "\n", "n", "=", "bytes", ".", "<mask>", "(", "s", ",", "b", ")", "\n", "if", "n", "<", "0", "{", "// cannot find end tag - just write it to the output.", "ni", ",", "_", "=", "w", ".", "Write", "(", "a", ")", "\n", "nn", "+=", "int64", "(", "ni", ")", "\n", "break", "\n", "}", "\n\n", "ni", ",", "err", "=", "f", "(", "w", ",", "unsafeBytes2String", "(", "s", "[", ":", "n", "]", ")", ")", "\n", "nn", "+=", "int64", "(", "ni", ")", "\n", "s", "=", "s", "[", "n", "+", "len", "(", "b", ")", ":", "]", "\n", "}", "\n", "ni", ",", "err", "=", "w", ".", "Write", "(", "s", ")", "\n", "nn", "+=", "int64", "(", "ni", ")", "\n\n", "return", "nn", ",", "err", "\n", "}" ]
19,289
all-19290
[ "Set", "creates", "or", "replace", "the", "node", "at", "nodePath", "." ]
[ "func", "(", "s", "*", "store", ")", "Set", "(", "nodePath", "string", ",", "dir", "bool", ",", "value", "string", ",", "expireOpts", "TTLOptionSet", ")", "(", "*", "Event", ",", "error", ")", "{", "var", "err", "*", "v2error", ".", "Error", "\n\n", "s", ".", "worldLock", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "worldLock", ".", "Unlock", "(", ")", "\n\n", "defer", "func", "(", ")", "{", "if", "err", "==", "nil", "{", "s", ".", "Stats", ".", "Inc", "(", "SetSuccess", ")", "\n", "reportWriteSuccess", "(", "Set", ")", "\n", "return", "\n", "}", "\n\n", "s", ".", "Stats", ".", "Inc", "(", "SetFail", ")", "\n", "reportWriteFailure", "(", "Set", ")", "\n", "}", "(", ")", "\n\n", "// Get prevNode value", "n", ",", "getErr", ":=", "s", ".", "internalGet", "(", "nodePath", ")", "\n", "if", "getErr", "!=", "nil", "&&", "getErr", ".", "ErrorCode", "!=", "v2error", ".", "EcodeKeyNotFound", "{", "err", "=", "getErr", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "expireOpts", ".", "Refresh", "{", "if", "getErr", "!=", "nil", "{", "err", "=", "getErr", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "value", "=", "n", ".", "Value", "\n", "}", "\n\n", "// Set new value", "e", ",", "err", ":=", "s", ".", "internalCreate", "(", "nodePath", ",", "dir", ",", "value", ",", "false", ",", "true", ",", "expireOpts", ".", "ExpireTime", ",", "Set", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "e", ".", "EtcdIndex", "=", "s", ".", "CurrentIndex", "\n\n", "// Put prevNode into event", "if", "getErr", "==", "nil", "{", "prev", ":=", "newEvent", "(", "Get", ",", "nodePath", ",", "n", ".", "ModifiedIndex", ",", "n", ".", "CreatedIndex", ")", "\n", "prev", ".", "Node", ".", "loadInternalNode", "(", "n", ",", "false", ",", "false", ",", "s", ".", "<mask>", ")", "\n", "e", ".", "PrevNode", "=", "prev", ".", "Node", "\n", "}", "\n\n", "if", "!", "expireOpts", ".", "Refresh", "{", "s", ".", "WatcherHub", ".", "notify", "(", "e", ")", "\n", "}", "else", "{", "e", ".", "SetRefresh", "(", ")", "\n", "s", ".", "WatcherHub", ".", "add", "(", "e", ")", "\n", "}", "\n\n", "return", "e", ",", "nil", "\n", "}" ]
19,290
all-19291
[ "ChangeState", "is", "a", "wrapper", "around", "g_action_change_state" ]
[ "func", "(", "v", "*", "<mask>", ")", "ChangeState", "(", "value", "*", "Variant", ")", "{", "C", ".", "g_action_change_state", "(", "v", ".", "native", "(", ")", ",", "value", ".", "native", "(", ")", ")", "\n", "}" ]
19,291
all-19292
[ "GetPulseStep", "is", "a", "wrapper", "around", "gtk_progress_bar_get_pulse_step", "()", "." ]
[ "func", "(", "v", "*", "ProgressBar", ")", "GetPulseStep", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_progress_bar_get_pulse_step", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "float64", "(", "c", ")", "\n", "}" ]
19,292
all-19293
[ "NewResource", "creates", "a", "new", "Boskos", "Resource", "." ]
[ "func", "NewResource", "(", "name", ",", "rtype", ",", "state", ",", "owner", "string", ",", "t", "<mask>", ".", "Time", ")", "Resource", "{", "return", "Resource", "{", "Name", ":", "name", ",", "Type", ":", "rtype", ",", "State", ":", "state", ",", "Owner", ":", "owner", ",", "LastUpdate", ":", "t", ",", "UserData", ":", "&", "UserData", "{", "}", ",", "}", "\n", "}" ]
19,293
all-19294
[ "PkgSrc", "is", "one", "directory", "plus", "the", "file", "name", "of", "the", "source", "file", "." ]
[ "func", "(", "c", "*", "Call", ")", "PkgSrc", "(", ")", "string", "{", "return", "filepath", ".", "Join", "(", "filepath", ".", "<mask>", "(", "filepath", ".", "Dir", "(", "c", ".", "SrcPath", ")", ")", ",", "c", ".", "SrcName", "(", ")", ")", "\n", "}" ]
19,294
all-19295
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ConnectionType", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
19,295
all-19296
[ "WithFields", "filters", "the", "fields", "and", "passes", "them", "on", "to", "the", "wrapped", "loggers", "WithFields" ]
[ "func", "(", "f", "*", "Filtered", ")", "WithFields", "(", "fields", "log", ".", "Fields", ")", "<mask>", ".", "Interface", "{", "res", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "len", "(", "fields", ")", ")", "\n\n", "for", "k", ",", "v", ":=", "range", "fields", "{", "val", ":=", "v", "\n\n", "// apply the filters", "for", "_", ",", "filter", ":=", "range", "f", ".", "filters", "{", "val", "=", "filter", ".", "Filter", "(", "k", ",", "val", ")", "\n", "}", "\n\n", "res", "[", "k", "]", "=", "val", "\n", "}", "\n\n", "return", "&", "Filtered", "{", "Interface", ":", "f", ".", "Interface", ".", "WithFields", "(", "res", ")", ",", "filters", ":", "f", ".", "filters", ",", "}", "\n", "}" ]
19,296
all-19297
[ "InsertRow", "()", "is", "a", "wrapper", "around", "gtk_grid_insert_row", "()", "." ]
[ "func", "(", "v", "*", "Grid", ")", "InsertRow", "(", "position", "int", ")", "{", "C", ".", "gtk_grid_insert_row", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
19,297
all-19298
[ "ReadArgs", "reads", "the", "*", "Args", "from", "the", "given", "call", "." ]
[ "func", "ReadArgs", "(", "call", "*", "tchannel", ".", "InboundCall", ")", "(", "*", "Args", ",", "error", ")", "{", "var", "args", "Args", "\n", "args", ".", "Caller", "=", "<mask>", ".", "CallerName", "(", ")", "\n", "args", ".", "Format", "=", "call", ".", "Format", "(", ")", "\n", "args", ".", "Method", "=", "string", "(", "call", ".", "Method", "(", ")", ")", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "call", ".", "Arg2Reader", "(", ")", ")", ".", "Read", "(", "&", "args", ".", "Arg2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "call", ".", "Arg3Reader", "(", ")", ")", ".", "Read", "(", "&", "args", ".", "Arg3", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "args", ",", "nil", "\n", "}" ]
19,298
all-19299
[ "/", "*", "Signal", "sends", "the", "passed", "in", "signal", "to", "all", "the", "processes", "started", "by", "Run", ".", "It", "does", "not", "wait", "for", "the", "processes", "to", "exit", "." ]
[ "func", "Signal", "(", "signal", "os", ".", "Signal", ")", "{", "trackedSessionsMutex", ".", "Lock", "(", ")", "\n", "defer", "trackedSessionsMutex", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "session", ":=", "<mask>", "trackedSessions", "{", "session", ".", "Signal", "(", "signal", ")", "\n", "}", "\n", "}" ]
19,299
all-19300
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "MixedContentType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]