id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
21,600
all-21601
[ "HasId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardList", ")", "HasId", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "Id", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
21,601
all-21602
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PageTimings", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,602
all-21603
[ "PodAddrs", "extracts", "the", "addresses", "from", "a", "list", "of", "pods", ".", "This", "is", "a", "separate", "method", "so", "that", "we", "can", "unit", "test", "this", "without", "having", "to", "setup", "complicated", "K8S", "cluster", "scenarios", ".", "It", "shouldn", "t", "generally", "be", "called", "externally", "." ]
[ "func", "PodAddrs", "(", "pods", "*", "corev1", ".", "PodList", ",", "args", "map", "[", "string", "]", "string", ",", "l", "*", "log", ".", "Logger", ")", "(", "[", "]", "string", ",", "error", ")", "{", "hostNetwork", ":=", "false", "\n", "if", "v", ":=", "args", "[", "\"", "\"", "]", ";", "v", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "hostNetwork", ",", "err", "=", "strconv", ".", "ParseBool", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "var", "addrs", "[", "]", "string", "\n", "PodLoop", ":", "for", "_", ",", "pod", ":=", "range", "pods", ".", "Items", "{", "if", "pod", ".", "Status", ".", "Phase", "!=", "corev1", ".", "PodRunning", "{", "l", ".", "Printf", "(", "\"", "\"", ",", "pod", ".", "Name", ",", "pod", ".", "Status", ".", "Phase", ")", "\n", "continue", "\n", "}", "\n\n", "// If there is a Ready condition available, we need that to be true.", "// If no ready condition is set, then we accept this pod regardless.", "for", "_", ",", "condition", ":=", "range", "pod", ".", "Status", ".", "Conditions", "{", "if", "condition", ".", "Type", "==", "corev1", ".", "PodReady", "&&", "condition", ".", "Status", "!=", "corev1", ".", "ConditionTrue", "{", "l", ".", "Printf", "(", "\"", "\"", ",", "pod", ".", "Name", ")", "\n", "continue", "PodLoop", "\n", "}", "\n", "}", "\n\n", "// Get the IP address that we will join.", "addr", ":=", "pod", ".", "Status", ".", "PodIP", "\n", "if", "hostNetwork", "{", "addr", "=", "pod", ".", "Status", ".", "HostIP", "\n", "}", "\n", "if", "addr", "==", "\"", "\"", "{", "// This can be empty according to the API docs, so we protect that.", "l", ".", "Printf", "(", "\"", "\"", ",", "pod", ".", "Name", ")", "\n", "continue", "\n", "}", "\n\n", "// We only use the port if it is specified as an annotation. The", "// annotation value can be a name or a number.", "if", "v", ":=", "pod", ".", "Annotations", "[", "AnnotationKeyPort", "]", ";", "v", "!=", "\"", "\"", "{", "port", ",", "err", ":=", "podPort", "(", "&", "pod", ",", "v", ",", "hostNetwork", ")", "\n", "if", "err", "!=", "nil", "{", "l", ".", "Printf", "(", "\"", "\"", ",", "pod", ".", "<mask>", ",", "err", ")", "\n", "continue", "\n", "}", "\n\n", "addr", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "addr", ",", "port", ")", "\n", "}", "\n\n", "addrs", "=", "append", "(", "addrs", ",", "addr", ")", "\n", "}", "\n\n", "return", "addrs", ",", "nil", "\n", "}" ]
21,603
all-21604
[ "UpdateOrgUsers", "-" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "UpdateOrgUsers", "(", ")", "error", "{", "uaacUsers", ",", "err", ":=", "m", ".", "UAAMgr", ".", "ListUsers", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgConfigs", ",", "err", ":=", "m", ".", "Cfg", ".", "GetOrgConfigs", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "input", ":=", "<mask>", "orgConfigs", "{", "if", "err", ":=", "m", ".", "updateOrgUsers", "(", "&", "input", ",", "uaacUsers", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,604
all-21605
[ "GetMargin", "returns", "the", "Margin", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetMargin", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "Margin", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "Margin", "\n", "}" ]
21,605
all-21606
[ "recursively", "set", "the", "Source", "attribute", "of", "the", "Options" ]
[ "func", "(", "m", "*", "Merger", ")", "setSource", "(", "v", "reflect", ".", "Value", ")", "{", "if", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "v", "=", "v", ".", "Elem", "(", ")", "\n", "}", "\n", "switch", "v", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Map", ":", "for", "_", ",", "key", ":=", "range", "v", ".", "MapKeys", "(", ")", "{", "keyval", ":=", "v", ".", "MapIndex", "(", "key", ")", "\n", "if", "keyval", ".", "Kind", "(", ")", "==", "reflect", ".", "Struct", "&&", "keyval", ".", "FieldByName", "(", "\"", "\"", ")", ".", "IsValid", "(", ")", "{", "// map values are immutable, so we need to copy the value", "// update the value, then re-insert the value to the map", "newval", ":=", "reflect", ".", "New", "(", "keyval", ".", "Type", "(", ")", ")", "\n", "newval", ".", "Elem", "(", ")", ".", "<mask>", "(", "keyval", ")", "\n", "m", ".", "setSource", "(", "newval", ")", "\n", "v", ".", "SetMapIndex", "(", "key", ",", "newval", ".", "Elem", "(", ")", ")", "\n", "}", "\n", "}", "\n", "case", "reflect", ".", "Struct", ":", "if", "v", ".", "CanAddr", "(", ")", "{", "if", "option", ",", "ok", ":=", "v", ".", "Addr", "(", ")", ".", "Interface", "(", ")", ".", "(", "option", ")", ";", "ok", "{", "if", "option", ".", "IsDefined", "(", ")", "{", "option", ".", "SetSource", "(", "m", ".", "sourceFile", ")", "\n", "}", "\n", "return", "\n", "}", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "v", ".", "NumField", "(", ")", ";", "i", "++", "{", "structField", ":=", "v", ".", "Type", "(", ")", ".", "Field", "(", "i", ")", "\n", "// PkgPath is empty for upper case (exported) field names.", "if", "structField", ".", "PkgPath", "!=", "\"", "\"", "{", "// unexported field, skipping", "continue", "\n", "}", "\n", "m", ".", "setSource", "(", "v", ".", "Field", "(", "i", ")", ")", "\n", "}", "\n", "case", "reflect", ".", "Array", ":", "fallthrough", "\n", "case", "reflect", ".", "Slice", ":", "for", "i", ":=", "0", ";", "i", "<", "v", ".", "Len", "(", ")", ";", "i", "++", "{", "m", ".", "setSource", "(", "v", ".", "Index", "(", "i", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
21,606
all-21607
[ "MustLoadCodec", "panics", "if", "word", "bank", "is", "missing", "only", "for", "tests" ]
[ "func", "MustLoadCodec", "(", "bank", "<mask>", ")", "*", "WordCodec", "{", "codec", ",", "err", ":=", "LoadCodec", "(", "bank", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "codec", "\n", "}" ]
21,607
all-21608
[ "MakeCommand", "returns", "a", "download", "command", "." ]
[ "func", "MakeCommand", "(", ")", "*", "cobra", ".", "Command", "{", "flags", ":=", "&", "flags", "{", "}", "\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`Finds and downloads the coverage profile file from the latest healthy build \nstored in given gcs directory.`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "<mask>", "(", "flags", ",", "cmd", ",", "args", ")", "\n", "}", ",", "}", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "flags", ".", "outputFile", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "flags", ".", "artifactsDirName", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "cmd", ".", "Flags", "(", ")", ".", "StringVarP", "(", "&", "flags", ".", "profileName", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "cmd", "\n", "}" ]
21,608
all-21609
[ "export", "goListBoxFilterFuncs" ]
[ "func", "goListBoxFilterFuncs", "(", "<mask>", "*", "C", ".", "GtkListBoxRow", ",", "userData", "C", ".", "gpointer", ")", "C", ".", "gboolean", "{", "id", ":=", "int", "(", "uintptr", "(", "userData", ")", ")", "\n\n", "listBoxFilterFuncRegistry", ".", "Lock", "(", ")", "\n", "r", ":=", "listBoxFilterFuncRegistry", ".", "m", "[", "id", "]", "\n", "// TODO: figure out a way to determine when we can clean up", "//delete(printSettingsCallbackRegistry.m, id)", "listBoxFilterFuncRegistry", ".", "Unlock", "(", ")", "\n\n", "return", "gbool", "(", "r", ".", "fn", "(", "wrapListBoxRow", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "row", ")", ")", ")", ",", "r", ".", "userData", ")", ")", "\n", "}" ]
21,609
all-21610
[ "GetInvertedOk", "returns", "a", "tuple", "with", "the", "Inverted", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardConditionalFormat", ")", "GetInvertedOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Inverted", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Inverted", ",", "<mask>", "\n", "}" ]
21,610
all-21611
[ "A", "load", "from", "pkg", "/", "time", "/", "format", ".", "go", "of", "golang", "source", "code", ".", "formatNano", "appends", "a", "fractional", "second", "as", "nanoseconds", "to", "b", "and", "returns", "the", "result", "." ]
[ "func", "formatNano", "(", "nanosec", "uint", ",", "n", "int", ",", "trim", "bool", ")", "[", "]", "byte", "{", "u", ":=", "nanosec", "\n", "var", "buf", "[", "9", "]", "<mask>", "\n", "for", "start", ":=", "len", "(", "buf", ")", ";", "start", ">", "0", ";", "{", "start", "--", "\n", "buf", "[", "start", "]", "=", "byte", "(", "u", "%", "10", "+", "'0'", ")", "\n", "u", "/=", "10", "\n", "}", "\n\n", "if", "n", ">", "9", "{", "n", "=", "9", "\n", "}", "\n", "if", "trim", "{", "for", "n", ">", "0", "&&", "buf", "[", "n", "-", "1", "]", "==", "'0'", "{", "n", "--", "\n", "}", "\n", "if", "n", "==", "0", "{", "return", "buf", "[", ":", "0", "]", "\n", "}", "\n", "}", "\n", "return", "buf", "[", ":", "n", "]", "\n", "}" ]
21,611
all-21612
[ "CheckInt", "is", "a", "convenience", "method", "which", "does", "an", "unchecked", "type", "conversion", "from", "an", "int", "to", "a", "float64", "." ]
[ "func", "(", "r", "*", "<mask>", ")", "CheckInt", "(", "val", "int", ")", "bool", "{", "return", "r", ".", "Check", "(", "float64", "(", "val", ")", ")", "\n", "}" ]
21,612
all-21613
[ "SeekToFirst", "seeks", "position", "at", "the", "first", "entry", "in", "list", ".", "Final", "state", "of", "iterator", "is", "Valid", "()", "iff", "list", "is", "not", "empty", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "SeekToFirst", "(", ")", "{", "it", ".", "setNode", "(", "it", ".", "<mask>", ".", "getNext", "(", "it", ".", "list", ".", "head", ",", "0", ")", ",", "false", ")", "\n", "}" ]
21,613
all-21614
[ "dumpResponse", "dumps", "the", "response", "and", "optionally", "the", "request", "(", "in", "case", "of", "JSON", "format", ")", "according", "to", "DumpFormat", ".", "It", "also", "checks", "whether", "the", "special", "recorder", "pipe", "is", "opened", "and", "if", "so", "writes", "the", "dump", "to", "it", "." ]
[ "func", "(", "d", "*", "dumpClient", ")", "dumpResponse", "(", "resp", "*", "http", ".", "Response", ",", "req", "*", "<mask>", ".", "Request", ",", "reqBody", "[", "]", "byte", ")", "{", "df", ":=", "d", ".", "dumpFormat", "(", ")", "\n", "if", "df", "==", "NoDump", "{", "return", "\n", "}", "\n", "respBody", ",", "_", ":=", "dumpRespBody", "(", "resp", ")", "\n", "if", "df", ".", "IsDebug", "(", ")", "{", "var", "buffer", "bytes", ".", "Buffer", "\n", "buffer", ".", "WriteString", "(", "\"", "\"", "+", "resp", ".", "Proto", "+", "\"", "\"", "+", "resp", ".", "Status", "+", "\"", "\\n", "\"", ")", "\n", "d", ".", "writeHeaders", "(", "&", "buffer", ",", "resp", ".", "Header", ")", "\n", "if", "respBody", "!=", "nil", "{", "buffer", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "buffer", ".", "Write", "(", "respBody", ")", "\n", "buffer", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "OsStderr", ",", "buffer", ".", "String", "(", ")", ")", "\n", "}", "else", "if", "df", ".", "IsJSON", "(", ")", "{", "reqHeaders", ":=", "make", "(", "http", ".", "Header", ")", "\n", "hh", ":=", "d", ".", "hiddenHeaders", "(", ")", "\n", "filterHeaders", "(", "df", ",", "hh", ",", "req", ".", "Header", ",", "func", "(", "name", "string", ",", "value", "[", "]", "string", ")", "{", "reqHeaders", "[", "name", "]", "=", "value", "\n", "}", ")", "\n", "respHeaders", ":=", "make", "(", "http", ".", "Header", ")", "\n", "filterHeaders", "(", "df", ",", "hh", ",", "resp", ".", "Header", ",", "func", "(", "name", "string", ",", "value", "[", "]", "string", ")", "{", "respHeaders", "[", "name", "]", "=", "value", "\n", "}", ")", "\n", "dumped", ":=", "recording", ".", "RequestResponse", "{", "Verb", ":", "req", ".", "Method", ",", "URI", ":", "req", ".", "URL", ".", "String", "(", ")", ",", "ReqHeader", ":", "reqHeaders", ",", "ReqBody", ":", "string", "(", "reqBody", ")", ",", "Status", ":", "resp", ".", "StatusCode", ",", "RespHeader", ":", "respHeaders", ",", "RespBody", ":", "string", "(", "respBody", ")", ",", "}", "\n", "b", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "dumped", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "return", "\n", "}", "\n", "if", "df", ".", "IsRecord", "(", ")", "{", "f", ":=", "os", ".", "NewFile", "(", "10", ",", "\"", "\"", ")", "\n", "_", ",", "err", "=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "==", "nil", "{", "// fd 10 is open, dump to it (used by recorder)", "fmt", ".", "Fprintf", "(", "f", ",", "\"", "\\n", "\"", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "OsStderr", ",", "string", "(", "b", ")", ")", "\n", "}", "\n", "}" ]
21,614
all-21615
[ "MetadataAsOperation", "turns", "the", "Response", "metadata", "into", "an", "Operation" ]
[ "func", "(", "r", "*", "Response", ")", "MetadataAsOperation", "(", ")", "(", "*", "<mask>", ",", "error", ")", "{", "op", ":=", "Operation", "{", "}", "\n", "err", ":=", "r", ".", "MetadataAsStruct", "(", "&", "op", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "op", ",", "nil", "\n", "}" ]
21,615
all-21616
[ "NewGlyphCache", "initializes", "a", "GlyphCache" ]
[ "func", "NewGlyphCache", "(", ")", "*", "GlyphCacheImp", "{", "glyphs", ":=", "make", "(", "map", "[", "string", "]", "<mask>", "[", "rune", "]", "*", "Glyph", ")", "\n", "return", "&", "GlyphCacheImp", "{", "glyphs", ":", "glyphs", ",", "}", "\n", "}" ]
21,616
all-21617
[ "New", "constructs", "a", "new", "label", "from", "components", "." ]
[ "func", "New", "(", "repo", ",", "pkg", ",", "<mask>", "string", ")", "Label", "{", "return", "Label", "{", "Repo", ":", "repo", ",", "Pkg", ":", "pkg", ",", "Name", ":", "name", "}", "\n", "}" ]
21,617
all-21618
[ "ValidatePath", "checks", "if", "a", "file", "path", "is", "legal" ]
[ "func", "ValidatePath", "(", "path", "string", ")", "error", "{", "path", "=", "<mask>", "(", "path", ")", "\n", "match", ",", "_", ":=", "regexp", ".", "MatchString", "(", "\"", "\"", ",", "path", ")", "\n\n", "if", "!", "match", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "if", "IsGlob", "(", "path", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "path", ",", "globRegex", ".", "FindString", "(", "path", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,618
all-21619
[ "decodeToObjOrFieldWithTag", "decodes", "the", "buf", "into", "obj", "s", "field", "having", "the", "specified", "jwt", "tagName", ".", "If", "the", "provided", "obj", "s", "has", "the", "same", "type", "as", "defaultObj", "then", "the", "obj", "is", "set", "to", "the", "defaultObj", "otherwise", "an", "attempt", "is", "made", "to", "json", ".", "Decode", "the", "buf", "into", "obj", "." ]
[ "func", "decodeToObjOrFieldWithTag", "(", "buf", "[", "]", "byte", ",", "obj", "interface", "{", "}", ",", "tagName", "string", ",", "defaultObj", "interface", "{", "}", ")", "error", "{", "// reflect values", "objValElem", ":=", "reflect", ".", "ValueOf", "(", "obj", ")", ".", "Elem", "(", ")", "\n", "defaultObjValElem", ":=", "reflect", ".", "ValueOf", "(", "defaultObj", ")", ".", "Elem", "(", ")", "\n\n", "// first check type, if same type, then set", "if", "objValElem", ".", "Type", "(", ")", "==", "defaultObjValElem", ".", "Type", "(", ")", "{", "objValElem", ".", "Set", "(", "defaultObjValElem", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// get field with specified jwt tagName (if any)", "fieldVal", ":=", "getFieldWithTag", "(", "obj", ",", "tagName", ")", "\n", "if", "fieldVal", "!=", "nil", "{", "// check field type and defaultObj type, if same, set", "if", "fieldVal", ".", "<mask>", "(", ")", "==", "defaultObjValElem", ".", "Type", "(", ")", "{", "fieldVal", ".", "Set", "(", "defaultObjValElem", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// otherwise, assign obj address of field", "obj", "=", "fieldVal", ".", "Addr", "(", ")", ".", "Interface", "(", ")", "\n", "}", "\n\n", "// decode json", "d", ":=", "json", ".", "NewDecoder", "(", "bytes", ".", "NewBuffer", "(", "buf", ")", ")", "\n", "d", ".", "UseNumber", "(", ")", "\n", "return", "d", ".", "Decode", "(", "obj", ")", "\n", "}" ]
21,619
all-21620
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ClearCompilationCacheParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage76", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,620
all-21621
[ "GetWarningRecovery", "returns", "the", "WarningRecovery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ThresholdCount", ")", "GetWarningRecovery", "(", ")", "json", ".", "Number", "{", "if", "t", "==", "nil", "||", "t", ".", "WarningRecovery", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "<mask>", "*", "t", ".", "WarningRecovery", "\n", "}" ]
21,621
all-21622
[ "RegisterGRPC", "registers", "all", "API", "services", "with", "the", "given", "server", "." ]
[ "func", "(", "api", "*", "API", ")", "RegisterGRPC", "(", "srv", "*", "grpc", ".", "Server", ")", "{", "if", "api", ".", "enableAdmin", "{", "<mask>", ".", "RegisterAdminServer", "(", "srv", ",", "NewAdmin", "(", "api", ".", "db", ")", ")", "\n", "}", "else", "{", "pb", ".", "RegisterAdminServer", "(", "srv", ",", "&", "AdminDisabled", "{", "}", ")", "\n", "}", "\n", "}" ]
21,622
all-21623
[ "PUT", "/", "api", "/", "catalog", "/", "catalogs", "/", ":", "catalog_id", "/", "applications", "/", ":", "id", "Update", "the", "content", "of", "an", "existing", "Application", "." ]
[ "func", "(", "loc", "*", "ApplicationLocator", ")", "Update", "(", "options", "rsapi", ".", "APIParams", ")", "error", "{", "var", "params", "rsapi", ".", "APIParams", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "}", "\n", "var", "compiledCatOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "compiledCatOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "compiledCatOpt", "\n", "}", "\n", "var", "longDescriptionOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "longDescriptionOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "longDescriptionOpt", "\n", "}", "\n", "var", "nameOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "nameOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "nameOpt", "\n", "}", "\n", "var", "scheduleRequiredOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "scheduleRequiredOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "scheduleRequiredOpt", "\n", "}", "\n", "var", "schedulesOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "schedulesOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "schedulesOpt", "\n", "}", "\n", "var", "shortDescriptionOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "shortDescriptionOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "shortDescriptionOpt", "\n", "}", "\n", "var", "templateHrefOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "templateHrefOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "templateHrefOpt", "\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", ",", "<mask>", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,623
all-21624
[ "Key", "returns", "the", "key", "associated", "with", "the", "current", "iterator" ]
[ "func", "(", "s", "*", "MergeIterator", ")", "Key", "(", ")", "[", "]", "byte", "{", "if", "len", "(", "s", ".", "h", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "s", ".", "h", "[", "0", "]", ".", "itr", ".", "<mask>", "(", ")", "\n", "}" ]
21,624
all-21625
[ "KNearest", "just", "to", "satisfy", "an", "interface", ".", "Doesn", "t", "make", "much", "sense", "for", "count", "index", "." ]
[ "func", "(", "index", "*", "CountIndex", ")", "KNearest", "(", "point", "Point", ",", "k", "int", ",", "maxDistance", "Meters", ",", "<mask>", "func", "(", "p", "Point", ")", "bool", ")", "[", "]", "Point", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
21,625
all-21626
[ "nolint", ":", "deadcode", "used", "from", "unit", "test" ]
[ "func", "namespaceToNamespaceSummary", "(", "namespace", "*", "sd", ".", "Namespace", ")", "*", "sd", ".", "NamespaceSummary", "{", "if", "namespace", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "return", "&", "sd", ".", "NamespaceSummary", "{", "Id", ":", "namespace", ".", "Id", ",", "Type", ":", "namespace", ".", "<mask>", ",", "Name", ":", "namespace", ".", "Name", ",", "Arn", ":", "namespace", ".", "Arn", ",", "}", "\n", "}" ]
21,626
all-21627
[ "Stop", "stops", "the", "mock", "server", "immediately", "closing", "all", "open", "connections", "and", "listeners", "." ]
[ "func", "(", "ms", "*", "MockServers", ")", "Stop", "(", ")", "{", "for", "idx", ":=", "range", "ms", ".", "Servers", "{", "ms", ".", "StopAt", "(", "idx", ")", "\n", "}", "\n", "<mask>", ".", "wg", ".", "Wait", "(", ")", "\n", "}" ]
21,627
all-21628
[ "isSafeRetryMutableRPC", "returns", "true", "when", "a", "mutable", "request", "is", "safe", "for", "retry", ".", "mutable", "requests", "(", "e", ".", "g", ".", "Put", "Delete", "Txn", ")", "should", "only", "be", "retried", "when", "the", "status", "code", "is", "codes", ".", "Unavailable", "when", "initial", "connection", "has", "not", "been", "established", "(", "no", "endpoint", "is", "up", ")", ".", "Returning", "false", "means", "retry", "should", "stop", "otherwise", "it", "violates", "write", "-", "at", "-", "most", "-", "once", "semantics", "." ]
[ "func", "isSafeRetryMutableRPC", "(", "err", "error", ")", "bool", "{", "if", "ev", ",", "<mask>", ":=", "status", ".", "FromError", "(", "err", ")", ";", "ok", "&&", "ev", ".", "Code", "(", ")", "!=", "codes", ".", "Unavailable", "{", "// not safe for mutable RPCs", "// e.g. interrupted by non-transient error that client cannot handle itself,", "// or transient error while the connection has already been established", "return", "false", "\n", "}", "\n", "desc", ":=", "rpctypes", ".", "ErrorDesc", "(", "err", ")", "\n", "return", "desc", "==", "\"", "\"", "||", "desc", "==", "\"", "\"", "\n", "}" ]
21,628
all-21629
[ "convertOptions", "converts", "an", "option", "value", "based", "on", "name", "value", "pairs", "." ]
[ "func", "convertOptions", "(", "q", "url", ".", "Values", ",", "pairs", "...", "string", ")", "url", ".", "Values", "{", "n", ":=", "make", "(", "url", ".", "Values", ")", "\n", "for", "k", ",", "v", ":=", "<mask>", "q", "{", "x", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "v", ")", ")", "\n", "for", "i", ",", "z", ":=", "range", "v", "{", "for", "j", ":=", "0", ";", "j", "<", "len", "(", "pairs", ")", ";", "j", "+=", "2", "{", "if", "pairs", "[", "j", "]", "==", "z", "{", "z", "=", "pairs", "[", "j", "+", "1", "]", "\n", "}", "\n", "}", "\n", "x", "[", "i", "]", "=", "z", "\n", "}", "\n", "n", "[", "k", "]", "=", "x", "\n", "}", "\n\n", "return", "n", "\n", "}" ]
21,629
all-21630
[ "CreateMnemonic", "generates", "a", "new", "key", "and", "persists", "it", "to", "storage", "encrypted", "using", "the", "passphrase", ".", "It", "returns", "the", "generated", "seedphrase", "(", "mnemonic", ")", "and", "the", "key", "Info", ".", "It", "returns", "an", "error", "if", "it", "fails", "to", "generate", "a", "key", "for", "the", "given", "algo", "type", "or", "if", "another", "key", "is", "already", "stored", "under", "the", "same", "name", "." ]
[ "func", "(", "kb", "dbKeybase", ")", "CreateMnemonic", "(", "name", ",", "passphrase", "string", ",", "algo", "SignAlgo", ")", "(", "Info", ",", "string", ",", "error", ")", "{", "// NOTE: secret is SHA256 hashed by secp256k1 and ed25519.", "// 16 byte secret corresponds to 12 BIP39 words.", "// XXX: Ledgers use 24 words now - should we ?", "secret", ":=", "crypto", ".", "CRandBytes", "(", "16", ")", "\n", "priv", ",", "err", ":=", "generate", "(", "algo", ",", "secret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "// encrypt and persist the key", "info", ":=", "kb", ".", "writeLocalKey", "(", "priv", ",", "name", ",", "passphrase", ")", "\n\n", "// we append the type byte to the serialized secret to help with", "// recovery", "// ie [secret] = [type] + [secret]", "typ", ":=", "cryptoAlgoToByte", "(", "algo", ")", "\n", "secret", "=", "append", "(", "[", "]", "byte", "{", "typ", "}", ",", "secret", "...", ")", "\n\n", "// return the mnemonic phrase", "words", ",", "err", ":=", "kb", ".", "codec", ".", "BytesToWords", "(", "secret", ")", "\n", "seed", ":=", "strings", ".", "Join", "(", "words", ",", "\"", "\"", ")", "\n", "return", "<mask>", ",", "seed", ",", "err", "\n", "}" ]
21,630
all-21631
[ "Pop", "one", "segment", "from", "tail", "of", "stack", ".", "Returns", "nil", "nil", "nil", "if", "depth", "is", "0" ]
[ "func", "(", "s", "*", "Stack", ")", "Pop", "(", ")", "(", "header", ",", "data", "[", "]", "byte", ",", "err", "error", ")", "{", "if", "s", ".", "depth", "==", "0", "{", "return", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "s", ".", "guard", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "s", ".", "lastAccess", "=", "time", ".", "Now", "(", ")", "\n", "file", ",", "err", ":=", "s", ".", "getFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "data", "=", "make", "(", "[", "]", "byte", ",", "s", ".", "currentBlock", ".", "DataSize", ")", "\n", "header", "=", "make", "(", "[", "]", "byte", ",", "s", ".", "currentBlock", ".", "HeaderSize", ")", "\n", "// Read header", "_", ",", "err", "=", "file", ".", "ReadAt", "(", "header", ",", "int64", "(", "s", ".", "currentBlock", ".", "HeaderPoint", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "// Read data", "_", ",", "err", "=", "file", ".", "ReadAt", "(", "data", ",", "int64", "(", "s", ".", "currentBlock", ".", "DataPoint", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "// Read new block if current block is not head", "var", "newBlock", "fileBlock", "\n", "if", "s", ".", "currentBlockPos", "!=", "0", "{", "newBlock", ",", "err", "=", "readBlockAt", "(", "file", ",", "int64", "(", "s", ".", "currentBlock", ".", "PrevBlock", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "// Remove tail", "err", "=", "file", ".", "Truncate", "(", "int64", "(", "s", ".", "currentBlockPos", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "s", ".", "depth", "--", "\n", "s", ".", "currentBlockPos", "=", "int64", "(", "s", ".", "currentBlock", ".", "PrevBlock", ")", "\n", "s", ".", "currentBlock", "=", "newBlock", "\n\n", "return", "header", ",", "data", ",", "nil", "\n", "}" ]
21,631
all-21632
[ "Seek", "searches", "for", "the", "record", "with", "the", "given", "key", ".", "If", "it", "is", "present", "in", "the", "skiplist", "then", "Seek", "positions", "the", "iterator", "on", "that", "record", "and", "returns", "true", ".", "If", "the", "record", "is", "not", "present", "then", "Seek", "positions", "the", "iterator", "on", "the", "following", "node", "(", "if", "it", "exists", ")", "and", "returns", "false", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Seek", "(", "key", "[", "]", "byte", ")", "(", "found", "bool", ")", "{", "var", "<mask>", "*", "node", "\n", "_", ",", "next", ",", "found", "=", "it", ".", "seekForBaseSplice", "(", "key", ")", "\n", "present", ":=", "it", ".", "setNode", "(", "next", ",", "false", ")", "\n", "return", "found", "&&", "present", "\n", "}" ]
21,632
all-21633
[ "GetEntryAt", "gets", "an", "entry", "from", "the", "geoindex", "if", "missing", "returns", "an", "empty", "entry", "without", "changing", "the", "index", "." ]
[ "func", "(", "geoIndex", "*", "geoIndex", ")", "GetEntryAt", "(", "point", "Point", ")", "interface", "{", "}", "{", "square", ":=", "cellOf", "(", "point", ",", "geoIndex", ".", "resolution", ")", "\n\n", "entries", ",", "ok", ":=", "geoIndex", ".", "index", "[", "square", "]", "\n", "if", "!", "<mask>", "{", "return", "geoIndex", ".", "newEntry", "(", ")", "\n", "}", "\n\n", "return", "entries", "\n", "}" ]
21,633
all-21634
[ "UpdateNetwork", "updates", "the", "network", "to", "match", "the", "provided", "Network", "struct" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "UpdateNetwork", "(", "name", "string", ",", "network", "api", ".", "NetworkPut", ",", "ETag", "string", ")", "error", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "_", ",", "_", ",", "err", ":=", "r", ".", "query", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "<mask>", ")", ")", ",", "network", ",", "ETag", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,634
all-21635
[ "msb64", "returns", "the", "number", "of", "bits", "required", "to", "store", "the", "value", "x" ]
[ "func", "msb64", "(", "n", "uint64", ")", "int", "{", "if", "n", "<=", "0", "{", "return", "-", "1", "\n", "}", "\n", "<mask>", "r", ",", "v", "uint", "\n", "if", "n", ">=", "1", "<<", "32", "{", "r", "+=", "32", "\n", "v", "=", "uint", "(", "n", ">>", "32", ")", "\n", "}", "else", "{", "v", "=", "uint", "(", "n", ")", "\n", "}", "\n", "if", "v", ">=", "1", "<<", "16", "{", "r", "+=", "16", "\n", "v", ">>=", "16", "\n", "}", "\n", "if", "v", ">=", "1", "<<", "8", "{", "r", "+=", "8", "\n", "v", ">>=", "8", "\n", "}", "\n", "if", "v", ">=", "1", "<<", "4", "{", "r", "+=", "4", "\n", "v", ">>=", "4", "\n", "}", "\n", "if", "v", ">=", "1", "<<", "2", "{", "r", "+=", "2", "\n", "v", ">>=", "2", "\n", "}", "\n", "r", "+=", "v", ">>", "1", "\n", "return", "int", "(", "r", ")", "\n", "}" ]
21,635
all-21636
[ "parse", "a", "value", "as", "the", "appropriate", "type", "and", "store", "it", "in", "the", "struct" ]
[ "func", "setSlice", "(", "dest", "reflect", ".", "Value", ",", "values", "[", "]", "string", ",", "trunc", "bool", ")", "error", "{", "if", "!", "dest", ".", "CanSet", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "ptr", "bool", "\n", "elem", ":=", "dest", ".", "Type", "(", ")", ".", "Elem", "(", ")", "\n", "if", "elem", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "&&", "!", "elem", ".", "Implements", "(", "textUnmarshalerType", ")", "{", "ptr", "=", "true", "\n", "elem", "=", "elem", ".", "Elem", "(", ")", "\n", "}", "\n\n", "// Truncate the dest slice in case default values exist", "if", "trunc", "&&", "!", "dest", ".", "IsNil", "(", ")", "{", "dest", ".", "SetLen", "(", "0", ")", "\n", "}", "\n\n", "for", "_", ",", "s", ":=", "range", "<mask>", "{", "v", ":=", "reflect", ".", "New", "(", "elem", ")", "\n", "if", "err", ":=", "scalar", ".", "ParseValue", "(", "v", ".", "Elem", "(", ")", ",", "s", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "ptr", "{", "v", "=", "v", ".", "Elem", "(", ")", "\n", "}", "\n", "dest", ".", "Set", "(", "reflect", ".", "Append", "(", "dest", ",", "v", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,636
all-21637
[ "WithDialTimeout", "instructs", "the", "New", "*", "functions", "to", "use", "t", "as", "the", "deadline", "to", "connect", "to", "pachd" ]
[ "func", "WithDialTimeout", "(", "t", "<mask>", ".", "Duration", ")", "Option", "{", "return", "func", "(", "settings", "*", "clientSettings", ")", "error", "{", "settings", ".", "dialTimeout", "=", "t", "\n", "return", "nil", "\n", "}", "\n", "}" ]
21,637
all-21638
[ "Native", "returns", "a", "pointer", "to", "the", "underlying", "GtkAllocation", "." ]
[ "func", "(", "v", "*", "Allocation", ")", "native", "(", ")", "*", "C", ".", "GtkAllocation", "{", "<mask>", "(", "*", "C", ".", "GtkAllocation", ")", "(", "unsafe", ".", "Pointer", "(", "&", "v", ".", "GdkRectangle", ")", ")", "\n", "}" ]
21,638
all-21639
[ "AcquireDirectoryLock", "acquires", "exclusive", "access", "to", "a", "directory", "." ]
[ "func", "acquireDirectoryLock", "(", "dirPath", "string", ",", "pidFileName", "string", ",", "readOnly", "bool", ")", "(", "*", "directoryLockGuard", ",", "error", ")", "{", "if", "readOnly", "{", "return", "nil", ",", "ErrWindowsNotSupported", "\n", "}", "\n\n", "// Convert to absolute path so that Release still works even if we do an unbalanced", "// chdir in the meantime.", "absLockFilePath", ",", "err", ":=", "filepath", ".", "Abs", "(", "filepath", ".", "Join", "(", "dirPath", ",", "pidFileName", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// This call creates a file handler in memory that only one process can use at a time. When", "// that process ends, the file is deleted by the system.", "// FILE_ATTRIBUTE_TEMPORARY is used to tell Windows to try to create the handle in memory.", "// FILE_FLAG_DELETE_ON_CLOSE is not specified in syscall_windows.go but tells Windows to delete", "// the file when all processes holding the handler are closed.", "// XXX: this works but it's a bit klunky. i'd prefer to use LockFileEx but it needs unsafe pkg.", "h", ",", "err", ":=", "syscall", ".", "CreateFile", "(", "syscall", ".", "StringToUTF16Ptr", "(", "absLockFilePath", ")", ",", "0", ",", "0", ",", "nil", ",", "syscall", ".", "OPEN_ALWAYS", ",", "uint32", "(", "FILE_ATTRIBUTE_TEMPORARY", "|", "FILE_FLAG_DELETE_ON_CLOSE", ")", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "absLockFilePath", ")", "\n", "}", "\n\n", "return", "&", "directoryLockGuard", "{", "h", ":", "h", ",", "<mask>", ":", "absLockFilePath", "}", ",", "nil", "\n", "}" ]
21,639
all-21640
[ "HasLimit", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetProcessQuery", ")", "HasLimit", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Limit", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
21,640
all-21641
[ "create", "transform", "feedback", "objects" ]
[ "func", "CreateTransformFeedbacks", "(", "n", "int32", ",", "<mask>", "*", "uint32", ")", "{", "C", ".", "glowCreateTransformFeedbacks", "(", "gpCreateTransformFeedbacks", ",", "(", "C", ".", "GLsizei", ")", "(", "n", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "ids", ")", ")", ")", "\n", "}" ]
21,641
all-21642
[ "/", "*", "One", "can", "use", "this", "method", "to", "get", "a", "list", "of", "all", "the", "channels", "in", "an", "application", "." ]
[ "func", "(", "c", "*", "Client", ")", "Channels", "(", "additionalQueries", "map", "[", "string", "]", "string", ")", "(", "*", "ChannelsList", ",", "error", ")", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "AppId", ")", "\n", "u", ",", "err", ":=", "createRequestURL", "(", "\"", "\"", ",", "c", ".", "Host", ",", "path", ",", "c", ".", "<mask>", ",", "c", ".", "Secret", ",", "authTimestamp", "(", ")", ",", "c", ".", "Secure", ",", "nil", ",", "additionalQueries", ",", "c", ".", "Cluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "response", ",", "err", ":=", "c", ".", "request", "(", "\"", "\"", ",", "u", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "unmarshalledChannelsList", "(", "response", ")", "\n", "}" ]
21,642
all-21643
[ "NewReference", "returns", "an", "OCI", "reference", "for", "a", "file", "and", "a", "image", "." ]
[ "func", "NewReference", "(", "file", ",", "image", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "resolved", ",", "err", ":=", "explicitfilepath", ".", "ResolvePathToFullyExplicit", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "internal", ".", "ValidateOCIPath", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "internal", ".", "ValidateImageName", "(", "image", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "ociArchiveReference", "{", "file", ":", "file", ",", "resolvedFile", ":", "resolved", ",", "image", ":", "image", "}", ",", "nil", "\n", "}" ]
21,643
all-21644
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetManifestForFrameParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,644
all-21645
[ "Size", "gets", "the", "size", "of", "the", "pod", "log", ".", "Note", ":", "this", "function", "makes", "the", "same", "network", "call", "as", "reading", "the", "entire", "file", "." ]
[ "func", "(", "a", "*", "PodLogArtifact", ")", "Size", "(", ")", "(", "int64", ",", "error", ")", "{", "logs", ",", "err", ":=", "a", ".", "jobAgent", ".", "GetJobLog", "(", "a", ".", "<mask>", ",", "a", ".", "buildID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "int64", "(", "len", "(", "logs", ")", ")", ",", "nil", "\n\n", "}" ]
21,645
all-21646
[ "GetId", "returns", "the", "Id", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardListItem", ")", "GetId", "(", ")", "int", "{", "if", "d", "==", "nil", "||", "d", ".", "<mask>", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "d", ".", "Id", "\n", "}" ]
21,646
all-21647
[ "GetShadowType", "is", "a", "wrapper", "around", "gtk_scrolled_window_get_shadow_type", "()", "." ]
[ "func", "(", "v", "*", "ScrolledWindow", ")", "GetShadowType", "(", ")", "ShadowType", "{", "c", ":=", "C", ".", "gtk_scrolled_window_get_shadow_type", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "ShadowType", "(", "c", ")", "\n", "}" ]
21,647
all-21648
[ "Add", "inserts", "a", "word", "into", "the", "dictionary", "and", "returns", "whether", "or", "not", "that", "word", "was", "a", "new", "word", ".", "Time", "complexity", ":", "O", "(", "m", ")", "where", "m", "is", "the", "length", "of", "word", "." ]
[ "func", "(", "dict", "*", "Dictionary", ")", "Add", "(", "word", "string", ")", "(", "wasAdded", "bool", ")", "{", "if", "dict", ".", "root", "==", "nil", "{", "dict", ".", "root", "=", "&", "trieNode", "{", "}", "\n", "}", "\n\n", "cursor", ":=", "dict", ".", "root", "\n\n", "for", "len", "(", "word", ")", ">", "0", "{", "if", "cursor", ".", "Children", "==", "nil", "{", "cursor", ".", "Children", "=", "make", "(", "<mask>", "[", "rune", "]", "*", "trieNode", ")", "\n", "}", "\n\n", "nextLetter", ":=", "rune", "(", "word", "[", "0", "]", ")", "\n\n", "next", ",", "ok", ":=", "cursor", ".", "Children", "[", "nextLetter", "]", "\n", "if", "!", "ok", "{", "next", "=", "&", "trieNode", "{", "}", "\n", "cursor", ".", "Children", "[", "nextLetter", "]", "=", "next", "\n", "}", "\n", "cursor", "=", "next", "\n", "word", "=", "word", "[", "1", ":", "]", "\n", "}", "\n", "wasAdded", "=", "!", "cursor", ".", "IsWord", "\n", "if", "wasAdded", "{", "dict", ".", "size", "++", "\n", "}", "\n", "cursor", ".", "IsWord", "=", "true", "\n", "return", "\n", "}" ]
21,648
all-21649
[ "List", "implements", "ClientInterface" ]
[ "func", "(", "c", "*", "Client", ")", "List", "(", "opts", "v1", ".", "ListOptions", ")", "(", "Collection", ",", "error", ")", "{", "result", ":=", "c", ".", "NewCollection", "(", ")", "\n", "err", ":=", "c", ".", "cl", ".", "Get", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "<mask>", "(", "c", ".", "t", ".", "Plural", ")", ".", "VersionedParams", "(", "&", "opts", ",", "c", ".", "codec", ")", ".", "Do", "(", ")", ".", "Into", "(", "result", ")", "\n", "return", "result", ",", "err", "\n", "}" ]
21,649
all-21650
[ "constructVPCSubnetAttributes", "returns", "vpc", "and", "subnet", "IDs", "of", "the", "instance", "as", "an", "attribute", "list" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "constructVPCSubnetAttributes", "(", ")", "[", "]", "*", "ecs", ".", "Attribute", "{", "return", "[", "]", "*", "ecs", ".", "<mask>", "{", "{", "Name", ":", "aws", ".", "String", "(", "vpcIDAttributeName", ")", ",", "Value", ":", "aws", ".", "String", "(", "agent", ".", "vpc", ")", ",", "}", ",", "{", "Name", ":", "aws", ".", "String", "(", "subnetIDAttributeName", ")", ",", "Value", ":", "aws", ".", "String", "(", "agent", ".", "subnet", ")", ",", "}", ",", "}", "\n", "}" ]
21,650
all-21651
[ "BuildClusterClients", "returns", "Pod", "clients", "for", "build", "clusters", "." ]
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "BuildClusterClients", "(", "namespace", "string", ",", "dryRun", "bool", ")", "(", "buildClusterClients", "map", "[", "string", "]", "corev1", ".", "PodInterface", ",", "err", "error", ")", "{", "if", "err", ":=", "o", ".", "resolve", "(", "dryRun", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "o", ".", "dryRun", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "buildClients", ":=", "map", "[", "string", "]", "corev1", ".", "PodInterface", "{", "}", "\n", "for", "context", ",", "client", ":=", "range", "o", ".", "kubernetesClientsByContext", "{", "buildClients", "[", "context", "]", "=", "client", ".", "CoreV1", "(", ")", ".", "Pods", "(", "namespace", ")", "\n", "}", "\n", "return", "buildClients", ",", "nil", "\n", "}" ]
21,651
all-21652
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SkipWaitingParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker6", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
21,652
all-21653
[ "HasLogQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostmapRequest", ")", "HasLogQuery", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "LogQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
21,653
all-21654
[ "onSteadyStateIsResolved", "defines", "a", "relationship", "where", "a", "target", "cannot", "be", "created", "until", "dependency", "has", "reached", "the", "steady", "state", ".", "Transitions", "include", "pulling", "." ]
[ "func", "onSteadyStateIsResolved", "(", "<mask>", "*", "apicontainer", ".", "Container", ",", "run", "*", "apicontainer", ".", "Container", ")", "bool", "{", "return", "target", ".", "GetDesiredStatus", "(", ")", ">=", "apicontainerstatus", ".", "ContainerCreated", "&&", "run", ".", "GetKnownStatus", "(", ")", ">=", "run", ".", "GetSteadyStateStatus", "(", ")", "\n", "}" ]
21,654
all-21655
[ "control", "the", "front", "and", "/", "or", "back", "writing", "of", "individual", "bits", "in", "the", "stencil", "planes" ]
[ "func", "StencilMaskSeparate", "(", "face", "uint32", ",", "<mask>", "uint32", ")", "{", "C", ".", "glowStencilMaskSeparate", "(", "gpStencilMaskSeparate", ",", "(", "C", ".", "GLenum", ")", "(", "face", ")", ",", "(", "C", ".", "GLuint", ")", "(", "mask", ")", ")", "\n", "}" ]
21,655
all-21656
[ "CompactPrintCommit", "renders", "c", "as", "a", "compact", "string", "e", ".", "g", ".", "myrepo" ]
[ "func", "CompactPrintCommit", "(", "c", "*", "pfs", ".", "Commit", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Repo", ".", "<mask>", ",", "c", ".", "ID", ")", "\n", "}" ]
21,656
all-21657
[ "GetTextOk", "returns", "a", "tuple", "with", "the", "Text", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "Event", ")", "GetTextOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "Text", ",", "true", "\n", "}" ]
21,657
all-21658
[ "CloseAndReportTraces", "tries", "to", "close", "the", "global", "tracer", "which", "in", "the", "case", "of", "the", "Jaeger", "tracer", "causes", "it", "to", "send", "any", "unreported", "traces", "to", "the", "collector" ]
[ "func", "CloseAndReportTraces", "(", ")", "{", "if", "c", ",", "ok", ":=", "opentracing", ".", "GlobalTracer", "(", ")", ".", "(", "io", ".", "Closer", ")", ";", "<mask>", "{", "c", ".", "Close", "(", ")", "\n", "}", "\n", "}" ]
21,658
all-21659
[ "Cancel", "an", "in", "-", "progress", "Call", "with", "the", "given", "sid", ".", "Cancel", "will", "not", "affect", "in", "-", "progress", "Calls", "only", "those", "in", "queued", "or", "ringing", "." ]
[ "func", "(", "c", "*", "CallService", ")", "Cancel", "(", "sid", "string", ")", "(", "*", "Call", ",", "error", ")", "{", "data", ":=", "<mask>", ".", "Values", "{", "}", "\n", "data", ".", "Set", "(", "\"", "\"", ",", "string", "(", "StatusCanceled", ")", ")", "\n", "return", "c", ".", "Update", "(", "context", ".", "Background", "(", ")", ",", "sid", ",", "data", ")", "\n", "}" ]
21,659
all-21660
[ "loggingMiddleware", "logs", "requests", "to", "the", "proxy" ]
[ "func", "loggingMiddleware", "(", "next", "http", ".", "Handler", ")", "<mask>", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "r", ".", "RemoteAddr", ",", "r", ".", "RequestURI", ")", "\n", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n", "}" ]
21,660
all-21661
[ "AddBytesKV", "adds", "key", "=", "value", "argument", ".", "Multiple", "values", "for", "the", "same", "key", "may", "be", "added", "." ]
[ "func", "(", "a", "*", "Args", ")", "AddBytesKV", "(", "key", ",", "<mask>", "[", "]", "byte", ")", "{", "a", ".", "args", "=", "appendArg", "(", "a", ".", "args", ",", "b2s", "(", "key", ")", ",", "b2s", "(", "value", ")", ",", "argsHasValue", ")", "\n", "}" ]
21,661
all-21662
[ "StrokeStringAt", "draws", "the", "contour", "of", "the", "text", "at", "point", "(", "x", "y", ")" ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "StrokeStringAt", "(", "<mask>", "string", ",", "x", ",", "y", "float64", ")", "(", "cursor", "float64", ")", "{", "return", "gc", ".", "drawString", "(", "text", ",", "stroked", ",", "x", ",", "y", ")", "\n", "}" ]
21,662
all-21663
[ "AskInt", "asks", "the", "user", "to", "enter", "an", "integer", "between", "a", "min", "and", "max", "value" ]
[ "func", "AskInt", "(", "question", "string", ",", "min", "int64", ",", "max", "int64", ",", "defaultAnswer", "string", ")", "int64", "{", "for", "{", "answer", ":=", "askQuestion", "(", "question", ",", "defaultAnswer", ")", "\n\n", "result", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "answer", ",", "10", ",", "64", ")", "\n\n", "if", "err", "==", "nil", "&&", "(", "<mask>", "==", "-", "1", "||", "result", ">=", "min", ")", "&&", "(", "max", "==", "-", "1", "||", "result", "<=", "max", ")", "{", "return", "result", "\n", "}", "\n\n", "invalidInput", "(", ")", "\n", "}", "\n", "}" ]
21,663
all-21664
[ "Do", "executes", "Debugger", ".", "getPossibleBreakpoints", "against", "the", "provided", "context", ".", "returns", ":", "locations", "-", "List", "of", "the", "possible", "breakpoint", "locations", "." ]
[ "func", "(", "p", "*", "GetPossibleBreakpointsParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "locations", "[", "]", "*", "BreakLocation", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetPossibleBreakpointsReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetPossibleBreakpoints", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Locations", ",", "nil", "\n", "}" ]
21,664
all-21665
[ "GetCompareTo", "returns", "the", "CompareTo", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetCompareTo", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "CompareTo", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "CompareTo", "\n", "}" ]
21,665
all-21666
[ "GetContractResources", "returns", "list", "of", "contract", "resources" ]
[ "func", "(", "c", "*", "Client", ")", "GetContractResources", "(", ")", "(", "*", "ContractResources", ",", "error", ")", "{", "url", ":=", "contractResourcePath", "(", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "<mask>", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "ContractResources", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n\n", "}" ]
21,666
all-21667
[ "GetBoolPolicy", "reads", "a", "ResourceData", "and", "returns", "an", "appropriate", "BoolPolicy", "for", "the", "state", "of", "the", "definition", ".", "nil", "is", "returned", "if", "it", "does", "not", "exist", "." ]
[ "func", "GetBoolPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "key", "string", ")", "*", "<mask>", ".", "BoolPolicy", "{", "v", ",", "e", ":=", "d", ".", "GetOkExists", "(", "key", ")", "\n", "if", "e", "{", "return", "BoolPolicy", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,667
all-21668
[ "ReferenceProperties", "is", "a", "convenience", "method", "that", "wraps", "fetching", "the", "Network", "MO", "from", "a", "NetworkReference", ".", "Note", "that", "regardless", "of", "the", "network", "type", "this", "only", "fetches", "the", "Network", "MO", "and", "not", "any", "of", "the", "extended", "properties", "of", "that", "network", "." ]
[ "func", "ReferenceProperties", "(", "client", "*", "govmomi", ".", "Client", ",", "net", "<mask>", ".", "NetworkReference", ")", "(", "*", "mo", ".", "Network", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "var", "props", "mo", ".", "Network", "\n", "nc", ":=", "object", ".", "NewCommon", "(", "client", ".", "Client", ",", "net", ".", "Reference", "(", ")", ")", "\n", "if", "err", ":=", "nc", ".", "Properties", "(", "ctx", ",", "nc", ".", "Reference", "(", ")", ",", "nil", ",", "&", "props", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "props", ",", "nil", "\n", "}" ]
21,668
all-21669
[ "GetAssetCode12", "retrieves", "the", "AssetCode12", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "AllowTrustOpAsset", ")", "GetAssetCode12", "(", ")", "(", "result", "[", "12", "]", "byte", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "<mask>", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "AssetCode12", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
21,669
all-21670
[ "Release", "removes", "an", "IncomingPhoneNumber", "from", "your", "account", "." ]
[ "func", "(", "ipn", "*", "IncomingNumberService", ")", "Release", "(", "ctx", "context", ".", "<mask>", ",", "sid", "string", ")", "error", "{", "return", "ipn", ".", "client", ".", "DeleteResource", "(", "ctx", ",", "numbersPathPart", ",", "sid", ")", "\n", "}" ]
21,670
all-21671
[ "Run", "runs", "all", "the", "operations", "queued", "up", "." ]
[ "func", "(", "b", "*", "Bulk", ")", "Run", "(", ")", "(", "*", "BulkResult", ",", "error", ")", "{", "op", ":=", "&", "insertOp", "{", "b", ".", "c", ".", "FullName", ",", "b", ".", "inserts", ",", "0", "}", "\n", "if", "!", "b", ".", "ordered", "{", "op", ".", "<mask>", "=", "1", "// ContinueOnError", "\n", "}", "\n", "_", ",", "err", ":=", "b", ".", "c", ".", "writeQuery", "(", "op", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "&", "bulkError", "{", "err", "}", "\n", "}", "\n", "return", "&", "BulkResult", "{", "}", ",", "nil", "\n", "}" ]
21,671
all-21672
[ "Right", "right", "-", "pads", "the", "string", "with", "pad", "up", "to", "len", "runes" ]
[ "func", "Right", "(", "str", "string", ",", "length", "int", ",", "pad", "string", ")", "string", "{", "return", "str", "+", "times", "(", "pad", ",", "<mask>", "-", "len", "(", "str", ")", ")", "\n", "}" ]
21,672
all-21673
[ "title", ":", "remove", "role", "path", ":", "/", "roles", "/", "{", "name", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "Role", "removed", "401", ":", "Unauthorized", "404", ":", "Role", "not", "found", "412", ":", "Role", "with", "users" ]
[ "func", "removeRole", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleDelete", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "roleName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeRole", ",", "Value", ":", "roleName", "}", ",", "Kind", ":", "permission", ".", "PermRoleDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermRoleReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "usersWithRole", ",", "err", ":=", "auth", ".", "ListUsersWithRole", "(", "roleName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "usersWithRole", ")", "!=", "0", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusPreconditionFailed", ",", "<mask>", ":", "permTypes", ".", "ErrRemoveRoleWithUsers", ".", "Error", "(", ")", "}", "\n", "}", "\n", "err", "=", "permission", ".", "DestroyRole", "(", "roleName", ")", "\n", "if", "err", "==", "permTypes", ".", "ErrRoleNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "return", "err", "\n", "}" ]
21,673
all-21674
[ "GenerateRandomID", "returns", "an", "unique", "id" ]
[ "func", "GenerateRandomID", "(", ")", "string", "{", "for", "{", "id", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "rand", ".", "Reader", ",", "<mask>", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "// This shouldn't happen", "\n", "}", "\n", "value", ":=", "hex", ".", "EncodeToString", "(", "id", ")", "\n", "// if we try to parse the truncated for as an int and we don't have", "// an error then the value is all numeric and causes issues when", "// used as a hostname. ref #3869", "if", "_", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "TruncateID", "(", "value", ")", ",", "10", ",", "64", ")", ";", "err", "==", "nil", "{", "continue", "\n", "}", "\n", "return", "value", "\n", "}", "\n", "}" ]
21,674
all-21675
[ "Run", "will", "launch", "the", "queue", "watchers", "and", "task", "workers", "in", "the", "background", "." ]
[ "func", "(", "p", "*", "Pool", ")", "Run", "(", ")", "{", "// start all queues", "for", "queue", ":=", "range", "p", ".", "queues", "{", "queue", ".", "start", "(", "p", ")", "\n", "}", "\n\n", "// start all tasks", "for", "_", ",", "task", ":=", "range", "p", ".", "tasks", "{", "task", ".", "<mask>", "(", "p", ")", "\n", "}", "\n", "}" ]
21,675
all-21676
[ "UpdateRecords", "updates", "records", "for", "a", "given", "slice", "of", "endpoints" ]
[ "func", "(", "p", "*", "dnsimpleProvider", ")", "UpdateRecords", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "error", "{", "<mask>", "p", ".", "submitChanges", "(", "newDnsimpleChanges", "(", "dnsimpleUpdate", ",", "endpoints", ")", ")", "\n", "}" ]
21,676
all-21677
[ "BeginningOfQuarter", "beginning", "of", "quarter" ]
[ "func", "(", "now", "*", "Now", ")", "BeginningOfQuarter", "(", ")", "time", ".", "Time", "{", "month", ":=", "<mask>", ".", "BeginningOfMonth", "(", ")", "\n", "offset", ":=", "(", "int", "(", "month", ".", "Month", "(", ")", ")", "-", "1", ")", "%", "3", "\n", "return", "month", ".", "AddDate", "(", "0", ",", "-", "offset", ",", "0", ")", "\n", "}" ]
21,677
all-21678
[ "WriteDeflate", "writes", "deflated", "p", "to", "w", "and", "returns", "the", "number", "of", "compressed", "bytes", "written", "to", "w", "." ]
[ "func", "WriteDeflate", "(", "w", "io", ".", "Writer", ",", "p", "[", "]", "<mask>", ")", "(", "int", ",", "error", ")", "{", "return", "WriteDeflateLevel", "(", "w", ",", "p", ",", "CompressDefaultCompression", ")", "\n", "}" ]
21,678
all-21679
[ "NewOutgoingVideo", "creates", "a", "new", "outgoing", "video", "file", "." ]
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVideo", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "<mask>", "io", ".", "Reader", ")", "*", "OutgoingVideo", "{", "return", "&", "OutgoingVideo", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":", "api", ",", "Recipient", ":", "recipient", ",", "}", ",", "}", ",", "outgoingFileBase", ":", "outgoingFileBase", "{", "fileName", ":", "fileName", ",", "r", ":", "reader", ",", "}", ",", "}", "\n", "}" ]
21,679
all-21680
[ "GetDefaultText", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_widget_get_default_text", "()", ".", "In", "case", "when", "gtk_app_chooser_widget_get_default_text", "()", "returns", "a", "nil", "string", "GetDefaultText", "()", "returns", "a", "non", "-", "nil", "error", "." ]
[ "func", "(", "v", "*", "AppChooserWidget", ")", "GetDefaultText", "(", ")", "(", "string", ",", "error", ")", "{", "cstr", ":=", "C", ".", "gtk_app_chooser_widget_get_default_text", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "cstr", "==", "nil", "{", "return", "\"", "\"", ",", "nilPtrErr", "\n", "}", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "cstr", ")", ")", ",", "nil", "\n", "}" ]
21,680
all-21681
[ "ValidateGitCloneURL", "returns", "an", "error", "if", "the", "provided", "URL", "is", "invalid" ]
[ "func", "ValidateGitCloneURL", "(", "url", "string", ")", "error", "{", "exampleURL", ":=", "\"", "\"", "\n", "if", "url", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "exampleURL", ")", "\n", "}", "\n", "// Use the git client's validator to make sure its a valid URL", "o", ":=", "&", "<mask>", ".", "CloneOptions", "{", "URL", ":", "url", ",", "}", "\n", "if", "err", ":=", "o", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Make sure its the type that we want. Of the following we", "// only accept the 'clone' type of url:", "// git_url: \"git://github.com/sjezewski/testgithook.git\",", "// ssh_url: \"[email protected]:sjezewski/testgithook.git\",", "// clone_url: \"https://github.com/sjezewski/testgithook.git\",", "// svn_url: \"https://github.com/sjezewski/testgithook\",", "invalidErr", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "exampleURL", ")", "\n\n", "if", "!", "strings", ".", "HasSuffix", "(", "url", ",", "\"", "\"", ")", "{", "// svn_url case", "return", "invalidErr", "\n", "}", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "url", ",", "\"", "\"", ")", "{", "// git_url or ssh_url cases", "return", "invalidErr", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,681
all-21682
[ "Fail", "outputs", "Failed", "log" ]
[ "func", "Fail", "(", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "glg", ".", "<mask>", "(", "FAIL", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
21,682
all-21683
[ "MustParseInLocation", "must", "parse", "string", "to", "time", "in", "location", "or", "will", "panic" ]
[ "func", "MustParseInLocation", "(", "loc", "*", "<mask>", ".", "Location", ",", "strs", "...", "string", ")", "time", ".", "Time", "{", "return", "New", "(", "time", ".", "Now", "(", ")", ".", "In", "(", "loc", ")", ")", ".", "MustParse", "(", "strs", "...", ")", "\n", "}" ]
21,683
all-21684
[ "set", "the", "polygon", "stippling", "pattern" ]
[ "func", "PolygonStipple", "(", "<mask>", "*", "uint8", ")", "{", "C", ".", "glowPolygonStipple", "(", "gpPolygonStipple", ",", "(", "*", "C", ".", "GLubyte", ")", "(", "unsafe", ".", "Pointer", "(", "mask", ")", ")", ")", "\n", "}" ]
21,684
all-21685
[ "StartTime", "implements", "the", "Storage", "interface", "." ]
[ "func", "(", "s", "*", "ReadyStorage", ")", "StartTime", "(", ")", "(", "int64", ",", "error", ")", "{", "if", "x", ":=", "s", ".", "<mask>", "(", ")", ";", "x", "!=", "nil", "{", "return", "x", ".", "StartTime", "(", ")", "\n", "}", "\n", "return", "int64", "(", "model", ".", "Latest", ")", ",", "ErrNotReady", "\n", "}" ]
21,685
all-21686
[ "SyncUsers" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "SyncUsers", "(", "uaaUsers", "*", "uaa", ".", "Users", ",", "usersInput", "UsersInput", ")", "error", "{", "roleUsers", ",", "err", ":=", "usersInput", ".", "ListUsers", "(", "usersInput", ",", "uaaUsers", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "lo", ".", "G", ".", "Debugf", "(", "\"", "\"", ",", "roleUsers", ".", "Users", "(", ")", ")", "\n\n", "if", "err", ":=", "m", ".", "SyncLdapUsers", "(", "roleUsers", ",", "uaaUsers", ",", "usersInput", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "roleUsers", ".", "Users", "(", ")", ")", ">", "0", "{", "lo", ".", "G", ".", "Debugf", "(", "\"", "\"", ",", "roleUsers", ".", "Users", "(", ")", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "SyncInternalUsers", "(", "roleUsers", ",", "uaaUsers", ",", "usersInput", ")", ";", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "roleUsers", ".", "Users", "(", ")", ")", ">", "0", "{", "lo", ".", "G", ".", "Debugf", "(", "\"", "\"", ",", "roleUsers", ".", "Users", "(", ")", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "SyncSamlUsers", "(", "roleUsers", ",", "uaaUsers", ",", "usersInput", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "roleUsers", ".", "Users", "(", ")", ")", ">", "0", "{", "lo", ".", "G", ".", "Debugf", "(", "\"", "\"", ",", "roleUsers", ".", "Users", "(", ")", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "RemoveUsers", "(", "roleUsers", ",", "usersInput", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,686
all-21687
[ "Write", "-", "satisfies", "writer", "interface" ]
[ "func", "(", "r", "*", "MockReadWriteCloser", ")", "Write", "(", "p", "[", "]", "<mask>", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "err", "=", "r", ".", "WriteErr", ";", "err", "!=", "nil", "{", "r", ".", "BytesWritten", "=", "p", "\n", "n", "=", "len", "(", "p", ")", "\n", "}", "\n", "return", "\n", "}" ]
21,687
all-21688
[ "ListDatacenters", "lists", "all", "data", "centers" ]
[ "func", "(", "c", "*", "Client", ")", "ListDatacenters", "(", ")", "(", "*", "Datacenters", ",", "error", ")", "{", "url", ":=", "dcColPath", "(", ")", "+", "`?depth=`", "+", "c", ".", "<mask>", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Datacenters", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
21,688
all-21689
[ "Chain", "builds", "a", "slice", "of", "*", "x509", ".", "Certificate", "from", "this", "CA", "and", "its", "issuers", "." ]
[ "func", "(", "id", "*", "Identity", ")", "Chain", "(", ")", "[", "]", "*", "x509", ".", "Certificate", "{", "chain", ":=", "[", "]", "*", "x509", ".", "Certificate", "{", "}", "\n", "for", "this", ":=", "<mask>", ";", "this", "!=", "nil", ";", "this", "=", "this", ".", "Issuer", "{", "chain", "=", "append", "(", "chain", ",", "this", ".", "Certificate", ")", "\n", "}", "\n\n", "return", "chain", "\n", "}" ]
21,689
all-21690
[ "Print", "error", "message", "and", "exit", "with", "code", "1" ]
[ "func", "fail", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "if", "!", "strings", ".", "HasSuffix", "(", "format", ",", "\"", "\\n", "\"", ")", "{", "<mask>", "+=", "\"", "\\n", "\"", "\n", "}", "\n", "fmt", ".", "Println", "(", "fmt", ".", "Sprintf", "(", "format", ",", "v", "...", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}" ]
21,690
all-21691
[ "UnmarshalJSON", "identifies", "the", "data", "structure", "at", "runtime", "and", "unmarshals", "in", "the", "appropriate", "type" ]
[ "func", "(", "this", "*", "ScopeExpressionTemplate", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "this", "==", "nil", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "this", ".", "RawMessage", "=", "append", "(", "(", "this", ".", "RawMessage", ")", "[", "0", ":", "0", "]", ",", "data", "...", ")", "\n", "var", "tempObj", "interface", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "this", ".", "RawMessage", ",", "&", "tempObj", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "switch", "t", ":=", "tempObj", ".", "(", "type", ")", "{", "case", "string", ":", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "RequiredScope", "=", "new", "(", "RequiredScope", ")", "\n", "*", "(", "this", ".", "RequiredScope", ")", "=", "RequiredScope", "(", "t", ")", "\n", "case", "map", "[", "string", "]", "interface", "{", "}", ":", "j", ",", "err", ":=", "json", ".", "Marshal", "(", "t", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "if", "_", ",", "exists", ":=", "t", "[", "\"", "\"", "]", ";", "exists", "{", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "AnyOf", "=", "new", "(", "Disjunction", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "j", ",", "this", ".", "AnyOf", ")", "\n", "}", "\n", "if", "_", ",", "exists", ":=", "t", "[", "\"", "\"", "]", ";", "exists", "{", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "AllOf", "=", "new", "(", "Conjunction", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "j", ",", "this", ".", "AllOf", ")", "\n", "}", "\n", "if", "_", ",", "exists", ":=", "t", "[", "\"", "\"", "]", ";", "exists", "{", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "IfThen", "=", "new", "(", "Conditional", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "j", ",", "this", ".", "IfThen", ")", "\n", "}", "\n", "if", "_", ",", "exists", ":=", "t", "[", "\"", "\"", "]", ";", "exists", "{", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "ForEachIn", "=", "new", "(", "ForAll", ")", "\n", "err", "=", "json", ".", "Unmarshal", "(", "j", ",", "this", ".", "ForEachIn", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "// for old style scopesets [][]string (normal disjunctive form)", "case", "[", "]", "interface", "{", "}", ":", "this", ".", "Type", "=", "\"", "\"", "\n", "this", ".", "AnyOf", "=", "&", "Disjunction", "{", "AnyOf", ":", "make", "(", "[", "]", "ScopeExpressionTemplate", ",", "len", "(", "t", ")", ",", "len", "(", "t", ")", ")", ",", "}", "\n", "for", "i", ",", "j", ":=", "range", "t", "{", "allOf", ":=", "j", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "this", ".", "AnyOf", ".", "AnyOf", "[", "i", "]", "=", "ScopeExpressionTemplate", "{", "Type", ":", "\"", "\"", ",", "AllOf", ":", "&", "Conjunction", "{", "AllOf", ":", "make", "(", "[", "]", "ScopeExpressionTemplate", ",", "len", "(", "allOf", ")", ",", "len", "(", "allOf", ")", ")", ",", "}", ",", "}", "\n", "for", "k", ",", "l", ":=", "range", "allOf", "{", "rs", ":=", "RequiredScope", "(", "l", ".", "(", "string", ")", ")", "\n", "this", ".", "AnyOf", ".", "AnyOf", "[", "i", "]", ".", "AllOf", ".", "AllOf", "[", "k", "]", "=", "ScopeExpressionTemplate", "{", "Type", ":", "\"", "\"", ",", "RequiredScope", ":", "&", "rs", ",", "}", "\n", "}", "\n", "}", "\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ",", "string", "(", "data", ")", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,691
all-21692
[ "GetNextConferencesInRange", "retrieves", "the", "page", "at", "the", "nextPageURI", "and", "continues", "retrieving", "pages", "until", "any", "results", "are", "found", "in", "the", "range", "given", "by", "start", "or", "end", "or", "we", "determine", "there", "are", "no", "more", "records", "to", "be", "found", "in", "that", "range", ".", "If", "ConferencePage", "is", "non", "-", "nil", "it", "will", "have", "at", "least", "one", "result", "." ]
[ "func", "(", "c", "*", "ConferenceService", ")", "GetNextConferencesInRange", "(", "start", "time", ".", "Time", ",", "end", "time", ".", "Time", ",", "nextPageURI", "string", ")", "ConferencePageIterator", "{", "if", "nextPageURI", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "iter", ":=", "NewNextPageIterator", "(", "c", ".", "client", ",", "conferencePathPart", ")", "\n", "iter", ".", "SetNextPageURI", "(", "<mask>", ".", "NullString", "{", "Valid", ":", "true", ",", "String", ":", "nextPageURI", "}", ")", "\n", "return", "&", "conferenceDateIterator", "{", "start", ":", "start", ",", "end", ":", "end", ",", "p", ":", "iter", ",", "}", "\n", "}" ]
21,692
all-21693
[ "ImageGetPools", "get", "the", "names", "of", "all", "storage", "pools", "on", "which", "a", "given", "image", "exists", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageGetPools", "(", "imageFingerprint", "string", ")", "(", "[", "]", "int64", ",", "error", ")", "{", "poolID", ":=", "int64", "(", "-", "1", ")", "\n", "query", ":=", "\"", "\"", "\n", "inargs", ":=", "[", "]", "<mask>", "{", "}", "{", "c", ".", "nodeID", ",", "imageFingerprint", ",", "StoragePoolVolumeTypeImage", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "poolID", "}", "\n\n", "result", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "int64", "{", "}", ",", "err", "\n", "}", "\n\n", "poolIDs", ":=", "[", "]", "int64", "{", "}", "\n", "for", "_", ",", "r", ":=", "range", "result", "{", "poolIDs", "=", "append", "(", "poolIDs", ",", "r", "[", "0", "]", ".", "(", "int64", ")", ")", "\n", "}", "\n\n", "return", "poolIDs", ",", "nil", "\n", "}" ]
21,693
all-21694
[ "Calculates", "the", "per", "-", "element", "bit", "-", "wise", "“exclusive", "or”", "operation", "on", "an", "array", "and", "a", "scalar", "with", "a", "mask", "." ]
[ "func", "XorScalarWithMask", "(", "src", "*", "IplImage", ",", "value", "Scalar", ",", "dst", ",", "mask", "*", "IplImage", ")", "{", "C", ".", "cvXorS", "(", "unsafe", ".", "Pointer", "(", "src", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "value", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "<mask>", ")", ",", ")", "\n", "}" ]
21,694
all-21695
[ "UnmarshalText", "implements", "encoding", ".", "TextUnmarshaler", ".", "It", "will", "unmarshal", "to", "a", "null", "Bool", "if", "the", "input", "is", "a", "blank", "or", "not", "an", "integer", ".", "It", "will", "return", "an", "error", "if", "the", "input", "is", "not", "an", "integer", "blank", "or", "null", "." ]
[ "func", "(", "b", "*", "Bool", ")", "UnmarshalText", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "str", ":=", "string", "(", "text", ")", "\n", "switch", "str", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "b", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "case", "\"", "\"", ":", "b", ".", "Bool", "=", "true", "\n", "case", "\"", "\"", ":", "b", ".", "Bool", "=", "false", "\n", "default", ":", "b", ".", "Valid", "=", "false", "\n", "return", "errors", ".", "New", "(", "\"", "\"", "+", "str", ")", "\n", "}", "\n", "b", ".", "Valid", "=", "true", "\n", "return", "nil", "\n", "}" ]
21,695
all-21696
[ "checkLeaderTransition", "waits", "for", "leader", "transition", "returning", "the", "new", "leader", "ID", "." ]
[ "func", "checkLeaderTransition", "(", "m", "*", "member", ",", "oldLead", "uint64", ")", "uint64", "{", "interval", ":=", "time", ".", "Duration", "(", "m", ".", "s", ".", "Cfg", ".", "TickMs", ")", "*", "<mask>", ".", "Millisecond", "\n", "for", "m", ".", "s", ".", "Lead", "(", ")", "==", "0", "||", "(", "m", ".", "s", ".", "Lead", "(", ")", "==", "oldLead", ")", "{", "time", ".", "Sleep", "(", "interval", ")", "\n", "}", "\n", "return", "m", ".", "s", ".", "Lead", "(", ")", "\n", "}" ]
21,696
all-21697
[ "Merge", "in", "the", "given", "info", "and", "public", "message", "parts", "into", "this", "error" ]
[ "func", "(", "e", "*", "err", ")", "mergeIn", "(", "info", "Info", ",", "publicMsgParts", "[", "]", "interface", "{", "}", ")", "{", "for", "key", ",", "val", ":=", "range", "info", "{", "for", "e", ".", "info", "[", "key", "]", "!=", "nil", "{", "key", "=", "key", "+", "\"", "\"", "\n", "}", "\n", "e", ".", "<mask>", "[", "key", "]", "=", "val", "\n", "}", "\n", "publicMsgPrefix", ":=", "concatArgs", "(", "publicMsgParts", "...", ")", "\n", "if", "publicMsgPrefix", "==", "\"", "\"", "{", "// do nothing", "}", "else", "if", "e", ".", "publicMsg", "==", "\"", "\"", "{", "e", ".", "publicMsg", "=", "publicMsgPrefix", "\n", "}", "else", "{", "e", ".", "publicMsg", "=", "publicMsgPrefix", "+", "\"", "\"", "+", "e", ".", "publicMsg", "\n", "}", "\n", "}" ]
21,697
all-21698
[ "NewMongoStore", "returns", "a", "new", "MongoStore", ".", "Set", "ensureTTL", "to", "true", "let", "the", "database", "auto", "-", "remove", "expired", "object", "by", "maxAge", "." ]
[ "func", "NewMongoStore", "(", "c", "*", "mgo", ".", "Collection", ",", "maxAge", "int", ",", "ensureTTL", "bool", ",", "keyPairs", "...", "[", "]", "byte", ")", "*", "MongoStore", "{", "store", ":=", "&", "MongoStore", "{", "Codecs", ":", "securecookie", ".", "CodecsFromPairs", "(", "keyPairs", "...", ")", ",", "Options", ":", "&", "sessions", ".", "Options", "{", "Path", ":", "\"", "\"", ",", "MaxAge", ":", "maxAge", ",", "}", ",", "Token", ":", "&", "CookieToken", "{", "}", ",", "coll", ":", "c", ",", "}", "\n\n", "store", ".", "MaxAge", "(", "maxAge", ")", "\n\n", "if", "ensureTTL", "{", "c", ".", "EnsureIndex", "(", "mgo", ".", "Index", "{", "Key", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Background", ":", "<mask>", ",", "Sparse", ":", "true", ",", "ExpireAfter", ":", "time", ".", "Duration", "(", "maxAge", ")", "*", "time", ".", "Second", ",", "}", ")", "\n", "}", "\n\n", "return", "store", "\n", "}" ]
21,698
all-21699
[ "GetServiceService", "returns", "the", "ServiceService", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetServiceService", "(", ")", "<mask>", "{", "if", "w", "==", "nil", "||", "w", ".", "ServiceService", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "ServiceService", "\n", "}" ]
21,699
all-21700
[ "title", ":", "list", "provisioner", "clusters", "path", ":", "/", "provisioner", "/", "clusters", "method", ":", "GET", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "204", ":", "No", "Content", "401", ":", "Unauthorized" ]
[ "func", "listClusters", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "<mask>", ")", "(", "err", "error", ")", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermClusterRead", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "clusters", ",", "err", ":=", "servicemanager", ".", "Cluster", ".", "List", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "provTypes", ".", "ErrNoCluster", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "for", "i", ":=", "range", "clusters", "{", "clusters", "[", "i", "]", ".", "ClientKey", "=", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "clusters", ")", "\n", "}" ]