id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
6,400
all-6401
[ "HandleBasic", "adds", "handlers", "to", "a", "mux", "for", "serving", "JSON", "etcd", "client", "requests", "that", "do", "not", "access", "the", "v2", "store", "." ]
[ "func", "HandleBasic", "(", "mux", "*", "http", ".", "ServeMux", ",", "server", "etcdserver", ".", "ServerPeer", ")", "{", "mux", ".", "HandleFunc", "(", "varsPath", ",", "serveVars", ")", "\n\n", "// TODO: deprecate '/config/local/log' in v3.5", "mux", ".", "HandleFunc", "(", "configPath", "+", "\"", "\"", ",", "logHandleFunc", ")", "\n\n", "HandleMetricsHealth", "(", "mux", ",", "<mask>", ")", "\n", "mux", ".", "HandleFunc", "(", "versionPath", ",", "versionHandler", "(", "server", ".", "Cluster", "(", ")", ",", "serveVersion", ")", ")", "\n", "}" ]
6,401
all-6402
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetResourceTreeReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage30", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,402
all-6403
[ "Uint64ToBytes", "using", "big", "endian", "." ]
[ "func", "Uint64ToBytes", "(", "x", "uint64", ")", "[", "8", "]", "byte", "{", "<mask>", "xBytes", "[", "8", "]", "byte", "\n", "binary", ".", "BigEndian", ".", "PutUint64", "(", "xBytes", "[", ":", "]", ",", "x", ")", "\n", "return", "xBytes", "\n", "}" ]
6,403
all-6404
[ "PutManifest", "writes", "manifest", "to", "the", "destination", ".", "FIXME?", "This", "should", "also", "receive", "a", "MIME", "type", "if", "known", "to", "differentiate", "between", "schema", "versions", ".", "If", "the", "destination", "is", "in", "principle", "available", "refuses", "this", "manifest", "type", "(", "e", ".", "g", ".", "it", "does", "not", "recognize", "the", "schema", ")", "but", "may", "accept", "a", "different", "manifest", "type", "the", "returned", "error", "must", "be", "an", "ManifestTypeRejectedError", "." ]
[ "func", "(", "d", "*", "ostreeImageDestination", ")", "PutManifest", "(", "ctx", "context", ".", "Context", ",", "manifestBlob", "[", "]", "byte", ")", "error", "{", "d", ".", "manifest", "=", "string", "(", "manifestBlob", ")", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "manifestBlob", ",", "&", "d", ".", "schema", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "manifestPath", ":=", "filepath", ".", "Join", "(", "d", ".", "tmpDirPath", ",", "d", ".", "<mask>", ".", "manifestPath", "(", ")", ")", "\n", "if", "err", ":=", "ensureParentDirectoryExists", "(", "manifestPath", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "digest", ",", "err", ":=", "manifest", ".", "Digest", "(", "manifestBlob", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d", ".", "digest", "=", "digest", "\n\n", "return", "ioutil", ".", "WriteFile", "(", "manifestPath", ",", "manifestBlob", ",", "0644", ")", "\n", "}" ]
6,404
all-6405
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventContextDestroyed", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,405
all-6406
[ "Return", "dumpable", "representation", "of", "given", "object" ]
[ "func", "prettify", "(", "o", "<mask>", "{", "}", ")", "string", "{", "s", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "o", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "o", ")", "\n", "}", "\n", "return", "string", "(", "s", ")", "\n", "}" ]
6,406
all-6407
[ "FetchTemplate", "returns", "a", "TemplateSource", "representing", "the", "template", "at", "path", "path", ".", "Paths", "are", "searched", "relative", "to", "the", "paths", "given", "to", "NewFileTemplateFetcher", "()" ]
[ "func", "(", "l", "*", "FileTemplateFetcher", ")", "FetchTemplate", "(", "<mask>", "string", ")", "(", "TemplateSource", ",", "error", ")", "{", "if", "filepath", ".", "IsAbs", "(", "path", ")", "{", "return", "nil", ",", "ErrAbsolutePathNotAllowed", "\n", "}", "\n\n", "for", "_", ",", "dir", ":=", "range", "l", ".", "Paths", "{", "fullpath", ":=", "filepath", ".", "Join", "(", "dir", ",", "path", ")", "\n\n", "_", ",", "err", ":=", "os", ".", "Stat", "(", "fullpath", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "return", "NewFileSource", "(", "fullpath", ")", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "ErrTemplateNotFound", "\n", "}" ]
6,407
all-6408
[ "String", "returns", "a", "human", "readable", "version", "of", "the", "ENI", "object" ]
[ "func", "(", "eni", "*", "ENI", ")", "String", "(", ")", "string", "{", "var", "ipv4Addresses", "[", "]", "string", "\n", "for", "_", ",", "addr", ":=", "range", "eni", ".", "IPV4Addresses", "{", "ipv4Addresses", "=", "append", "(", "ipv4Addresses", ",", "addr", ".", "<mask>", ")", "\n", "}", "\n", "var", "ipv6Addresses", "[", "]", "string", "\n", "for", "_", ",", "addr", ":=", "range", "eni", ".", "IPV6Addresses", "{", "ipv6Addresses", "=", "append", "(", "ipv6Addresses", ",", "addr", ".", "Address", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "eni", ".", "ID", ",", "eni", ".", "MacAddress", ",", "eni", ".", "GetHostname", "(", ")", ",", "strings", ".", "Join", "(", "ipv4Addresses", ",", "\"", "\"", ")", ",", "strings", ".", "Join", "(", "ipv6Addresses", ",", "\"", "\"", ")", ",", "strings", ".", "Join", "(", "eni", ".", "DomainNameServers", ",", "\"", "\"", ")", ",", "strings", ".", "Join", "(", "eni", ".", "DomainNameSearchList", ",", "\"", "\"", ")", ",", "eni", ".", "SubnetGatewayIPV4Address", ")", "\n", "}" ]
6,408
all-6409
[ "Fetch", "fetches", "a", "glyph", "from", "the", "cache", "calling", "renderGlyph", "first", "if", "it", "doesn", "t", "already", "exist" ]
[ "func", "(", "glyphCache", "*", "GlyphCacheImp", ")", "Fetch", "(", "gc", "draw2d", ".", "GraphicContext", ",", "fontName", "string", ",", "chr", "rune", ")", "*", "Glyph", "{", "if", "glyphCache", ".", "glyphs", "[", "fontName", "]", "==", "nil", "{", "glyphCache", ".", "glyphs", "[", "fontName", "]", "=", "<mask>", "(", "map", "[", "rune", "]", "*", "Glyph", ",", "60", ")", "\n", "}", "\n", "if", "glyphCache", ".", "glyphs", "[", "fontName", "]", "[", "chr", "]", "==", "nil", "{", "glyphCache", ".", "glyphs", "[", "fontName", "]", "[", "chr", "]", "=", "renderGlyph", "(", "gc", ",", "fontName", ",", "chr", ")", "\n", "}", "\n", "return", "glyphCache", ".", "glyphs", "[", "fontName", "]", "[", "chr", "]", ".", "Copy", "(", ")", "\n", "}" ]
6,409
all-6410
[ "populate", "record", "with", "message" ]
[ "func", "loadmessage", "(", "mesg", "string", ")", "IP2Locationrecord", "{", "<mask>", "x", "IP2Locationrecord", "\n", "x", ".", "Country_short", "=", "mesg", "\n", "x", ".", "Country_long", "=", "mesg", "\n", "x", ".", "Region", "=", "mesg", "\n", "x", ".", "City", "=", "mesg", "\n", "x", ".", "Isp", "=", "mesg", "\n", "x", ".", "Domain", "=", "mesg", "\n", "x", ".", "Zipcode", "=", "mesg", "\n", "x", ".", "Timezone", "=", "mesg", "\n", "x", ".", "Netspeed", "=", "mesg", "\n", "x", ".", "Iddcode", "=", "mesg", "\n", "x", ".", "Areacode", "=", "mesg", "\n", "x", ".", "Weatherstationcode", "=", "mesg", "\n", "x", ".", "Weatherstationname", "=", "mesg", "\n", "x", ".", "Mcc", "=", "mesg", "\n", "x", ".", "Mnc", "=", "mesg", "\n", "x", ".", "Mobilebrand", "=", "mesg", "\n", "x", ".", "Usagetype", "=", "mesg", "\n", "return", "x", "\n", "}" ]
6,410
all-6411
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Media", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss31", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,411
all-6412
[ "NewMicrosoftClient", "creates", "a", "microsoft", "client", ":", "container", "-", "Azure", "Blob", "Container", "name", "accountName", "-", "Azure", "Storage", "Account", "name", "accountKey", "-", "Azure", "Storage", "Account", "key" ]
[ "func", "NewMicrosoftClient", "(", "container", "string", ",", "accountName", "string", ",", "accountKey", "string", ")", "(", "Client", ",", "error", ")", "{", "return", "newMicrosoftClient", "(", "<mask>", ",", "accountName", ",", "accountKey", ")", "\n", "}" ]
6,412
all-6413
[ "See", "bcd", ".", "Tracer", ".", "ClearOptions", "()", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "ClearOptions", "(", ")", "{", "t", ".", "m", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "m", ".", "Unlock", "(", ")", "\n\n", "t", ".", "<mask>", "=", "nil", "\n", "}" ]
6,413
all-6414
[ "GetEnvironment", "returns", "a", "SMTP", "Server", "configuration", "for", "the", "specified", "environment", "in", "parameter" ]
[ "func", "(", "se", "*", "SMTPEnvironment", ")", "GetEnvironment", "(", "<mask>", "string", ")", "interface", "{", "}", "{", "for", "env", ",", "conf", ":=", "range", "se", ".", "Env", "{", "if", "strings", ".", "Compare", "(", "environment", ",", "env", ")", "==", "0", "{", "return", "conf", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,414
all-6415
[ "GetRegistries", "loads", "and", "returns", "the", "registries", "specified", "in", "the", "config", ".", "Note", "the", "parsed", "content", "of", "registry", "config", "files", "is", "cached", ".", "For", "reloading", "use", "InvalidateCache", "and", "re", "-", "call", "GetRegistries", "." ]
[ "func", "GetRegistries", "(", "ctx", "*", "<mask>", ".", "SystemContext", ")", "(", "[", "]", "Registry", ",", "error", ")", "{", "configPath", ":=", "getConfigPath", "(", "ctx", ")", "\n\n", "configMutex", ".", "Lock", "(", ")", "\n", "defer", "configMutex", ".", "Unlock", "(", ")", "\n", "// if the config has already been loaded, return the cached registries", "if", "registries", ",", "inCache", ":=", "configCache", "[", "configPath", "]", ";", "inCache", "{", "return", "registries", ",", "nil", "\n", "}", "\n\n", "// load the config", "config", ",", "err", ":=", "loadRegistryConf", "(", "configPath", ")", "\n", "if", "err", "!=", "nil", "{", "// Return an empty []Registry if we use the default config,", "// which implies that the config path of the SystemContext", "// isn't set. Note: if ctx.SystemRegistriesConfPath points to", "// the default config, we will still return an error.", "if", "os", ".", "IsNotExist", "(", "err", ")", "&&", "(", "ctx", "==", "nil", "||", "ctx", ".", "SystemRegistriesConfPath", "==", "\"", "\"", ")", "{", "return", "[", "]", "Registry", "{", "}", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "registries", ":=", "config", ".", "Registries", "\n\n", "// backwards compatibility for v1 configs", "v1Registries", ",", "err", ":=", "getV1Registries", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "v1Registries", ")", ">", "0", "{", "if", "len", "(", "registries", ")", ">", "0", "{", "return", "nil", ",", "&", "InvalidRegistries", "{", "s", ":", "\"", "\"", "}", "\n", "}", "\n", "registries", "=", "v1Registries", "\n", "}", "\n\n", "registries", ",", "err", "=", "postProcessRegistries", "(", "registries", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// populate the cache", "configCache", "[", "configPath", "]", "=", "registries", "\n\n", "return", "registries", ",", "err", "\n", "}" ]
6,415
all-6416
[ "Write", "serializes", "the", "command", "to", "the", "given", "buffered", "output", "satisfies", "the", "Command", "interface", "." ]
[ "func", "(", "c", "Identify", ")", "Write", "(", "w", "*", "bufio", ".", "Writer", ")", "(", "err", "error", ")", "{", "var", "data", "[", "]", "byte", "\n\n", "if", "data", ",", "err", "=", "json", ".", "Marshal", "(", "identifyBody", "{", "ClientID", ":", "c", ".", "ClientID", ",", "Hostname", ":", "c", ".", "Hostname", ",", "UserAgent", ":", "c", ".", "UserAgent", ",", "MessageTimeout", ":", "int", "(", "c", ".", "MessageTimeout", "/", "time", ".", "Millisecond", ")", ",", "}", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "if", "_", ",", "err", "=", "w", ".", "WriteString", "(", "\"", "\\n", "\"", ")", ";", "err", "!=", "nil", "{", "err", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "if", "err", "=", "<mask>", ".", "Write", "(", "w", ",", "binary", ".", "BigEndian", ",", "uint32", "(", "len", "(", "data", ")", ")", ")", ";", "err", "!=", "nil", "{", "err", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "if", "_", ",", "err", "=", "w", ".", "Write", "(", "data", ")", ";", "err", "!=", "nil", "{", "err", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "return", "\n", "}" ]
6,416
all-6417
[ "GetInsecureRegistries", "returns", "an", "array", "of", "strings", "that", "contain", "the", "names", "of", "the", "insecure", "registries", "as", "defined", "in", "the", "system", "-", "wide", "registries", "file", ".", "it", "returns", "an", "empty", "array", "if", "none", "are", "defined" ]
[ "func", "GetInsecureRegistries", "(", "sys", "*", "<mask>", ".", "SystemContext", ")", "(", "[", "]", "string", ",", "error", ")", "{", "config", ",", "err", ":=", "loadRegistryConf", "(", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "config", ".", "Registries", ".", "Insecure", ".", "Registries", ",", "nil", "\n", "}" ]
6,417
all-6418
[ "Warn", "outputs", "Warn", "level", "log" ]
[ "func", "Warn", "(", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "glg", ".", "out", "(", "<mask>", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
6,418
all-6419
[ "monitorVersions", "checks", "the", "member", "s", "version", "every", "monitorVersionInterval", ".", "It", "updates", "the", "cluster", "version", "if", "all", "members", "agrees", "on", "a", "higher", "one", ".", "It", "prints", "out", "log", "if", "there", "is", "a", "member", "with", "a", "higher", "version", "than", "the", "local", "version", "." ]
[ "func", "(", "s", "*", "EtcdServer", ")", "monitorVersions", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "s", ".", "forceVersionC", ":", "case", "<-", "time", ".", "After", "(", "monitorVersionInterval", ")", ":", "case", "<-", "s", ".", "stopping", ":", "return", "\n", "}", "\n\n", "if", "s", ".", "Leader", "(", ")", "!=", "s", ".", "ID", "(", ")", "{", "continue", "\n", "}", "\n\n", "v", ":=", "decideClusterVersion", "(", "s", ".", "getLogger", "(", ")", ",", "getVersions", "(", "s", ".", "getLogger", "(", ")", ",", "s", ".", "cluster", ",", "s", ".", "<mask>", ",", "s", ".", "peerRt", ")", ")", "\n", "if", "v", "!=", "nil", "{", "// only keep major.minor version for comparison", "v", "=", "&", "semver", ".", "Version", "{", "Major", ":", "v", ".", "Major", ",", "Minor", ":", "v", ".", "Minor", ",", "}", "\n", "}", "\n\n", "// if the current version is nil:", "// 1. use the decided version if possible", "// 2. or use the min cluster version", "if", "s", ".", "cluster", ".", "Version", "(", ")", "==", "nil", "{", "verStr", ":=", "version", ".", "MinClusterVersion", "\n", "if", "v", "!=", "nil", "{", "verStr", "=", "v", ".", "String", "(", ")", "\n", "}", "\n", "s", ".", "goAttach", "(", "func", "(", ")", "{", "s", ".", "updateClusterVersion", "(", "verStr", ")", "}", ")", "\n", "continue", "\n", "}", "\n\n", "// update cluster version only if the decided version is greater than", "// the current cluster version", "if", "v", "!=", "nil", "&&", "s", ".", "cluster", ".", "Version", "(", ")", ".", "LessThan", "(", "*", "v", ")", "{", "s", ".", "goAttach", "(", "func", "(", ")", "{", "s", ".", "updateClusterVersion", "(", "v", ".", "String", "(", ")", ")", "}", ")", "\n", "}", "\n", "}", "\n", "}" ]
6,419
all-6420
[ "<template", "-", "param", ">", "::", "=", "T_", "::", "=", "T", "<", "(", "parameter", "-", "2", "non", "-", "negative", ")", "number", ">", "_", "When", "a", "template", "parameter", "is", "a", "substitution", "candidate", "any", "reference", "to", "that", "substitution", "refers", "to", "the", "template", "parameter", "with", "the", "same", "index", "in", "the", "currently", "active", "template", "not", "to", "whatever", "the", "template", "parameter", "would", "be", "expanded", "to", "here", ".", "We", "sort", "this", "out", "in", "substitution", "and", "simplify", "." ]
[ "func", "(", "st", "*", "state", ")", "templateParam", "(", ")", "AST", "{", "if", "len", "(", "st", ".", "templates", ")", "==", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "off", ":=", "st", ".", "off", "\n\n", "st", ".", "checkChar", "(", "'T'", ")", "\n", "n", ":=", "st", ".", "compactNumber", "(", ")", "\n\n", "<mask>", ":=", "st", ".", "templates", "[", "len", "(", "st", ".", "templates", ")", "-", "1", "]", "\n\n", "if", "template", "==", "nil", "{", "// We are parsing a cast operator. If the cast is", "// itself a template, then this is a forward", "// reference. Fill it in later.", "return", "&", "TemplateParam", "{", "Index", ":", "n", ",", "Template", ":", "nil", "}", "\n", "}", "\n\n", "if", "n", ">=", "len", "(", "template", ".", "Args", ")", "{", "st", ".", "failEarlier", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ",", "len", "(", "template", ".", "Args", ")", ")", ",", "st", ".", "off", "-", "off", ")", "\n", "}", "\n\n", "return", "&", "TemplateParam", "{", "Index", ":", "n", ",", "Template", ":", "template", "}", "\n", "}" ]
6,420
all-6421
[ "WithProviderSpecific", "attaches", "a", "key", "/", "value", "pair", "to", "the", "Endpoint", "and", "returns", "the", "Endpoint", ".", "This", "can", "be", "used", "to", "pass", "additional", "data", "through", "the", "stages", "of", "ExternalDNS", "s", "Endpoint", "processing", ".", "The", "assumption", "is", "that", "most", "of", "the", "time", "this", "will", "be", "provider", "specific", "metadata", "that", "doesn", "t", "warrant", "its", "own", "field", "on", "the", "Endpoint", "object", "itself", ".", "It", "differs", "from", "Labels", "in", "the", "fact", "that", "it", "s", "not", "persisted", "in", "the", "Registry", "but", "only", "kept", "in", "memory", "during", "a", "single", "record", "synchronization", "." ]
[ "func", "(", "e", "*", "Endpoint", ")", "WithProviderSpecific", "(", "key", ",", "value", "string", ")", "*", "Endpoint", "{", "if", "e", ".", "ProviderSpecific", "==", "nil", "{", "e", ".", "ProviderSpecific", "=", "ProviderSpecific", "{", "}", "\n", "}", "\n\n", "e", ".", "ProviderSpecific", "=", "append", "(", "e", ".", "ProviderSpecific", ",", "ProviderSpecificProperty", "{", "Name", ":", "<mask>", ",", "Value", ":", "value", "}", ")", "\n", "return", "e", "\n", "}" ]
6,421
all-6422
[ "readBlockHeader", "returns", "the", "next", "block", "header", "in", "the", "archive", ".", "It", "will", "return", "io", ".", "EOF", "if", "there", "were", "no", "bytes", "read", "." ]
[ "func", "(", "a", "*", "archive15", ")", "readBlockHeader", "(", ")", "(", "*", "blockHeader15", ",", "error", ")", "{", "var", "err", "error", "\n", "b", ":=", "a", ".", "buf", "[", ":", "7", "]", "\n", "r", ":=", "io", ".", "Reader", "(", "a", ".", "v", ")", "\n", "if", "a", ".", "encrypted", "{", "salt", ":=", "a", ".", "buf", "[", ":", "saltSize", "]", "\n", "_", ",", "err", "=", "io", ".", "ReadFull", "(", "r", ",", "salt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "key", ",", "iv", ":=", "a", ".", "getKeys", "(", "salt", ")", "\n", "r", "=", "newAesDecryptReader", "(", "r", ",", "key", ",", "iv", ")", "\n", "err", "=", "readFull", "(", "r", ",", "b", ")", "\n", "}", "else", "{", "_", ",", "err", "=", "io", ".", "ReadFull", "(", "r", ",", "b", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "crc", ":=", "b", ".", "uint16", "(", ")", "\n", "hash", ":=", "crc32", ".", "NewIEEE", "(", ")", "\n", "hash", ".", "Write", "(", "b", ")", "\n", "h", ":=", "new", "(", "blockHeader15", ")", "\n", "h", ".", "htype", "=", "b", ".", "byte", "(", ")", "\n", "h", ".", "<mask>", "=", "b", ".", "uint16", "(", ")", "\n", "size", ":=", "b", ".", "uint16", "(", ")", "\n", "if", "size", "<", "7", "{", "return", "nil", ",", "errCorruptHeader", "\n", "}", "\n", "size", "-=", "7", "\n", "if", "int", "(", "size", ")", ">", "cap", "(", "a", ".", "buf", ")", "{", "a", ".", "buf", "=", "readBuf", "(", "make", "(", "[", "]", "byte", ",", "size", ")", ")", "\n", "}", "\n", "h", ".", "data", "=", "a", ".", "buf", "[", ":", "size", "]", "\n", "if", "err", ":=", "readFull", "(", "r", ",", "h", ".", "data", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "hash", ".", "Write", "(", "h", ".", "data", ")", "\n", "if", "crc", "!=", "uint16", "(", "hash", ".", "Sum32", "(", ")", ")", "{", "return", "nil", ",", "errBadHeaderCrc", "\n", "}", "\n", "if", "h", ".", "flags", "&", "blockHasData", ">", "0", "{", "if", "len", "(", "h", ".", "data", ")", "<", "4", "{", "return", "nil", ",", "errCorruptHeader", "\n", "}", "\n", "h", ".", "dataSize", "=", "int64", "(", "h", ".", "data", ".", "uint32", "(", ")", ")", "\n", "}", "\n", "if", "(", "h", ".", "htype", "==", "blockService", "||", "h", ".", "htype", "==", "blockFile", ")", "&&", "h", ".", "flags", "&", "fileLargeData", ">", "0", "{", "if", "len", "(", "h", ".", "data", ")", "<", "25", "{", "return", "nil", ",", "errCorruptHeader", "\n", "}", "\n", "b", ":=", "h", ".", "data", "[", "21", ":", "25", "]", "\n", "h", ".", "dataSize", "|=", "int64", "(", "b", ".", "uint32", "(", ")", ")", "<<", "32", "\n", "}", "\n", "return", "h", ",", "nil", "\n", "}" ]
6,422
all-6423
[ "Creates", "a", "binding", "between", "source", "property", "on", "source", "and", "target", "property", "on", "target", ".", "Whenever", "the", "source", "property", "is", "changed", "the", "target_property", "is", "updated", "using", "the", "same", "value", "." ]
[ "func", "BindProperty", "(", "source", "*", "Object", ",", "sourceProperty", "string", ",", "<mask>", "*", "Object", ",", "targetProperty", "string", ",", "flags", "BindingFlags", ")", "*", "Binding", "{", "srcStr", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "sourceProperty", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "srcStr", ")", ")", "\n", "tgtStr", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "targetProperty", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "tgtStr", ")", ")", "\n", "obj", ":=", "C", ".", "g_object_bind_property", "(", "C", ".", "gpointer", "(", "source", ".", "GObject", ")", ",", "srcStr", ",", "C", ".", "gpointer", "(", "target", ".", "GObject", ")", ",", "tgtStr", ",", "C", ".", "GBindingFlags", "(", "flags", ")", ",", ")", "\n", "if", "obj", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Binding", "{", "wrapObject", "(", "unsafe", ".", "Pointer", "(", "obj", ")", ")", "}", "\n", "}" ]
6,423
all-6424
[ "/", "*", "Set1D", "sets", "a", "particular", "element", "in", "them", "matrix" ]
[ "func", "(", "m", "*", "Mat", ")", "Set1D", "(", "x", "int", ",", "<mask>", "Scalar", ")", "{", "C", ".", "cvSet1D", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "C", ".", "int", "(", "x", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "value", ")", ")", "\n", "}" ]
6,424
all-6425
[ "IsNotExist", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockOS", ")", "IsNotExist", "(", "arg0", "error", ")", "bool", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "bool", ")", "\n", "return", "ret0", "\n", "}" ]
6,425
all-6426
[ "newPRMExactRepository", "is", "NewPRMExactRepository", "except", "it", "resturns", "the", "private", "type", "." ]
[ "func", "newPRMExactRepository", "(", "dockerRepository", "string", ")", "(", "*", "prmExactRepository", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "dockerRepository", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "dockerRepository", ",", "err", ".", "Error", "(", ")", ")", ")", "\n", "}", "\n", "return", "&", "prmExactRepository", "{", "prmCommon", ":", "prmCommon", "{", "<mask>", ":", "prmTypeExactRepository", "}", ",", "DockerRepository", ":", "dockerRepository", ",", "}", ",", "nil", "\n", "}" ]
6,426
all-6427
[ "OptImportStatusChannel", "is", "a", "channel", "which", "carry", "import", "status", "information", ".", "Make", "sure", "to", "read", "from", "this", "channel", "otherwise", "the", "import", "process", "will", "stall", "." ]
[ "func", "OptImportStatusChannel", "(", "statusChan", "chan", "<-", "ImportStatusUpdate", ")", "ImportOption", "{", "return", "func", "(", "options", "*", "ImportOptions", ")", "error", "{", "<mask>", ".", "statusChan", "=", "statusChan", "\n", "return", "nil", "\n", "}", "\n", "}" ]
6,427
all-6428
[ "mutateRecords", "takes", "a", "list", "of", "endpoints", "and", "creates", "replaces", "or", "deletes", "them", "based", "on", "the", "changetype" ]
[ "func", "(", "p", "*", "PDNSProvider", ")", "mutateRecords", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "changetype", "pdnsChangeType", ")", "error", "{", "zonelist", ",", "err", ":=", "p", ".", "ConvertEndpointsToZones", "(", "endpoints", ",", "changetype", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "zone", ":=", "range", "zonelist", "{", "jso", ",", "err", ":=", "json", ".", "Marshal", "(", "zone", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "log", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "string", "(", "jso", ")", ")", "\n", "}", "\n\n", "resp", ",", "err", ":=", "p", ".", "client", ".", "PatchZone", "(", "<mask>", ".", "Id", ",", "zone", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "stringifyHTTPResponseBody", "(", "resp", ")", ")", "\n", "return", "err", "\n", "}", "\n\n", "}", "\n", "return", "nil", "\n", "}" ]
6,428
all-6429
[ "GetStorageType", "()", "is", "a", "wrapper", "around", "gtk_image_get_storage_type", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetStorageType", "(", ")", "ImageType", "{", "c", ":=", "C", ".", "gtk_image_get_storage_type", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "ImageType", "(", "c", ")", "\n", "}" ]
6,429
all-6430
[ "Step", "increases", "ProgressBar", "value", "by", "1", "if", "the", "value", "is", "less", "than", "ProgressBar", "high", "limit" ]
[ "func", "(", "b", "*", "ProgressBar", ")", "Step", "(", ")", "int", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n", "b", ".", "value", "++", "\n\n", "if", "b", ".", "value", ">", "b", ".", "<mask>", "{", "b", ".", "value", "=", "b", ".", "max", "\n", "}", "\n\n", "return", "b", ".", "value", "\n", "}" ]
6,430
all-6431
[ "HasTimezone", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "HasTimezone", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "Timezone", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,431
all-6432
[ "names", "should", "have", "been", "sorted", "based", "on", "sequence", "number", ".", "isValidSeq", "checks", "whether", "seq", "increases", "continuously", "." ]
[ "func", "isValidSeq", "(", "lg", "*", "zap", ".", "Logger", ",", "names", "[", "]", "string", ")", "bool", "{", "var", "lastSeq", "uint64", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "curSeq", ",", "_", ",", "err", ":=", "parseWALName", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "<mask>", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "lastSeq", "!=", "0", "&&", "lastSeq", "!=", "curSeq", "-", "1", "{", "return", "false", "\n", "}", "\n", "lastSeq", "=", "curSeq", "\n", "}", "\n", "return", "true", "\n", "}" ]
6,432
all-6433
[ "HasResource", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "Comment", ")", "HasResource", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Resource", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,433
all-6434
[ "copies", "environment", "variables", "to", "new", "names", "without", "overwriting", "existing", "values" ]
[ "func", "remapEnv", "(", "mapping", "map", "[", "string", "]", "string", ")", "{", "for", "k", ",", "v", ":=", "range", "mapping", "{", "currentVal", ":=", "os", ".", "Getenv", "(", "k", ")", "\n", "newVal", ":=", "<mask>", ".", "Getenv", "(", "v", ")", "\n", "if", "currentVal", "==", "\"", "\"", "&&", "newVal", "!=", "\"", "\"", "{", "os", ".", "Setenv", "(", "k", ",", "newVal", ")", "\n", "}", "\n", "}", "\n", "}" ]
6,434
all-6435
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "SetOptionsResultCode" ]
[ "func", "(", "e", "SetOptionsResultCode", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "<mask>", ":=", "setOptionsResultCodeMap", "[", "v", "]", "\n", "return", "ok", "\n", "}" ]
6,435
all-6436
[ "Open", "returns", "a", "new", "storage", "backed", "by", "a", "TSDB", "database", "that", "is", "configured", "for", "Prometheus", "." ]
[ "func", "Open", "(", "path", "string", ",", "l", "<mask>", ".", "Logger", ",", "r", "prometheus", ".", "Registerer", ",", "opts", "*", "Options", ")", "(", "*", "tsdb", ".", "DB", ",", "error", ")", "{", "if", "opts", ".", "MinBlockDuration", ">", "opts", ".", "MaxBlockDuration", "{", "opts", ".", "MaxBlockDuration", "=", "opts", ".", "MinBlockDuration", "\n", "}", "\n", "// Start with smallest block duration and create exponential buckets until the exceed the", "// configured maximum block duration.", "rngs", ":=", "tsdb", ".", "ExponentialBlockRanges", "(", "int64", "(", "time", ".", "Duration", "(", "opts", ".", "MinBlockDuration", ")", ".", "Seconds", "(", ")", "*", "1000", ")", ",", "10", ",", "3", ")", "\n\n", "for", "i", ",", "v", ":=", "range", "rngs", "{", "if", "v", ">", "int64", "(", "time", ".", "Duration", "(", "opts", ".", "MaxBlockDuration", ")", ".", "Seconds", "(", ")", "*", "1000", ")", "{", "rngs", "=", "rngs", "[", ":", "i", "]", "\n", "break", "\n", "}", "\n", "}", "\n\n", "db", ",", "err", ":=", "tsdb", ".", "Open", "(", "path", ",", "l", ",", "r", ",", "&", "tsdb", ".", "Options", "{", "WALSegmentSize", ":", "int", "(", "opts", ".", "WALSegmentSize", ")", ",", "RetentionDuration", ":", "uint64", "(", "time", ".", "Duration", "(", "opts", ".", "RetentionDuration", ")", ".", "Seconds", "(", ")", "*", "1000", ")", ",", "MaxBytes", ":", "int64", "(", "opts", ".", "MaxBytes", ")", ",", "BlockRanges", ":", "rngs", ",", "NoLockfile", ":", "opts", ".", "NoLockfile", ",", "AllowOverlappingBlocks", ":", "opts", ".", "AllowOverlappingBlocks", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "registerMetrics", "(", "db", ",", "r", ")", "\n\n", "return", "db", ",", "nil", "\n", "}" ]
6,436
all-6437
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "ListVMReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "<mask>", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "200", ":", "result", ":=", "NewListVMOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewListVMNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewListVMDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
6,437
all-6438
[ "Parse", "Link", "headers", "returning", "a", "map", "from", "Rel", "to", "URL", ".", "Only", "understands", "the", "URI", "and", "rel", "parameter", ".", "Very", "limited", ".", "See", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc5988#section", "-", "5" ]
[ "func", "parseLinks", "(", "h", "string", ")", "map", "[", "string", "]", "string", "{", "<mask>", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "_", ",", "m", ":=", "range", "lre", ".", "FindAllStringSubmatch", "(", "h", ",", "10", ")", "{", "if", "len", "(", "m", ")", "!=", "3", "{", "continue", "\n", "}", "\n", "links", "[", "m", "[", "2", "]", "]", "=", "m", "[", "1", "]", "\n", "}", "\n", "return", "links", "\n", "}" ]
6,438
all-6439
[ "Range", "returns", "points", "or", "count", "points", "depending", "on", "the", "size", "of", "the", "topLeft", "and", "bottomRight", "range", "." ]
[ "func", "(", "index", "*", "ClusteringIndex", ")", "Range", "(", "topLeft", "Point", ",", "bottomRight", "<mask>", ")", "[", "]", "Point", "{", "dist", ":=", "distance", "(", "topLeft", ",", "bottomRight", ")", "\n\n", "if", "dist", "<", "streetLevel", "{", "return", "index", ".", "streetLevel", ".", "Range", "(", "topLeft", ",", "bottomRight", ")", "\n", "}", "else", "if", "dist", "<", "cityLevel", "{", "return", "index", ".", "cityLevel", ".", "Range", "(", "topLeft", ",", "bottomRight", ")", "\n", "}", "else", "{", "return", "index", ".", "worldLevel", ".", "Range", "(", "topLeft", ",", "bottomRight", ")", "\n", "}", "\n", "}" ]
6,439
all-6440
[ "gitCmdWithKey", "is", "used", "for", "private", "repositories", "and", "requires", "an", "ssh", "key", ".", "Note", ":", "currently", "only", "limited", "to", "Linux", "and", "OSX", "." ]
[ "func", "(", "r", "*", "Repo", ")", "gitCmdWithKey", "(", "params", "[", "]", "string", ",", "dir", "string", ")", "error", "{", "var", "gitSSH", ",", "script", "gitos", ".", "File", "\n", "// ensure temporary files deleted after usage", "defer", "func", "(", ")", "{", "if", "gitSSH", "!=", "nil", "{", "gos", ".", "Remove", "(", "gitSSH", ".", "Name", "(", ")", ")", "\n", "}", "\n", "if", "script", "!=", "nil", "{", "gos", ".", "Remove", "(", "script", ".", "Name", "(", ")", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "var", "err", "error", "\n", "// write git.sh script to temp file", "gitSSH", ",", "err", "=", "writeScriptFile", "(", "gitWrapperScript", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// write git bash script to file", "<mask>", ",", "err", "=", "writeScriptFile", "(", "bashScript", "(", "gitSSH", ".", "Name", "(", ")", ",", "r", ",", "params", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "runCmd", "(", "script", ".", "Name", "(", ")", ",", "nil", ",", "dir", ")", "\n", "}" ]
6,440
all-6441
[ "GetParentId", "returns", "the", "ParentId", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetParentId", "(", ")", "int", "{", "if", "d", "==", "nil", "||", "d", ".", "ParentId", "==", "nil", "{", "return", "0", "\n", "}", "\n", "<mask>", "*", "d", ".", "ParentId", "\n", "}" ]
6,441
all-6442
[ "Do", "executes", "Debugger", ".", "getStackTrace", "against", "the", "provided", "context", ".", "returns", ":", "stackTrace" ]
[ "func", "(", "p", "*", "GetStackTraceParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "stackTrace", "*", "runtime", ".", "StackTrace", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetStackTraceReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetStackTrace", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "StackTrace", ",", "nil", "\n", "}" ]
6,442
all-6443
[ "NewPermission", "initialize", "permission" ]
[ "func", "(", "role", "*", "Role", ")", "NewPermission", "(", ")", "*", "Permission", "{", "return", "&", "Permission", "{", "<mask>", ":", "role", ",", "AllowedRoles", ":", "map", "[", "PermissionMode", "]", "[", "]", "string", "{", "}", ",", "DeniedRoles", ":", "map", "[", "PermissionMode", "]", "[", "]", "string", "{", "}", ",", "}", "\n", "}" ]
6,443
all-6444
[ "Accept", "waits", "for", "and", "returns", "the", "next", "connection", "to", "the", "listener", "." ]
[ "func", "(", "s", "*", "listener", ")", "Accept", "(", ")", "(", "<mask>", ".", "Conn", ",", "error", ")", "{", "s", ".", "incRef", "(", ")", "\n", "defer", "s", ".", "decRef", "(", ")", "\n", "return", "s", ".", "Listener", ".", "Accept", "(", ")", "\n", "}" ]
6,444
all-6445
[ "IsRetryable", "determines", "if", "an", "operation", "should", "be", "retried", "given", "an", "error" ]
[ "func", "IsRetryable", "(", "<mask>", "Client", ",", "err", "error", ")", "bool", "{", "return", "isNetRetryable", "(", "err", ")", "||", "client", ".", "IsRetryable", "(", "err", ")", "\n", "}" ]
6,445
all-6446
[ "Stop", "stops", "the", "server", "gracefully", "and", "shuts", "down", "the", "running", "goroutine", ".", "Stop", "should", "be", "called", "after", "a", "Start", "(", "s", ")", "otherwise", "it", "will", "block", "forever", ".", "When", "stopping", "leader", "Stop", "transfers", "its", "leadership", "to", "one", "of", "its", "peers", "before", "stopping", "the", "server", ".", "Stop", "terminates", "the", "Server", "and", "performs", "any", "necessary", "finalization", ".", "Do", "and", "Process", "cannot", "be", "called", "after", "Stop", "has", "been", "invoked", "." ]
[ "func", "(", "s", "*", "EtcdServer", ")", "Stop", "(", ")", "{", "if", "err", ":=", "s", ".", "TransferLeadership", "(", ")", ";", "err", "!=", "nil", "{", "if", "lg", ":=", "s", ".", "getLogger", "(", ")", ";", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "ID", "(", ")", ".", "String", "(", ")", ")", ",", "zap", ".", "<mask>", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "s", ".", "ID", "(", ")", ",", "err", ")", "\n", "}", "\n", "}", "\n", "s", ".", "HardStop", "(", ")", "\n", "}" ]
6,446
all-6447
[ "SimpleHashFromTwoHashes", "is", "the", "basic", "operation", "of", "the", "Merkle", "tree", ":", "Hash", "(", "left", "|", "right", ")", "." ]
[ "func", "SimpleHashFromTwoHashes", "(", "left", ",", "<mask>", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "hasher", "=", "tmhash", ".", "New", "(", ")", "\n", "err", ":=", "encodeByteSlice", "(", "hasher", ",", "left", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "err", "=", "encodeByteSlice", "(", "hasher", ",", "right", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "hasher", ".", "Sum", "(", "nil", ")", "\n", "}" ]
6,447
all-6448
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventSetChildNodes", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom57", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,448
all-6449
[ "Freezer", "functions" ]
[ "func", "(", "c", "*", "containerLXC", ")", "Freeze", "(", ")", "error", "{", "ctxMap", ":=", "log", ".", "Ctx", "{", "\"", "\"", ":", "c", ".", "project", ",", "\"", "\"", ":", "c", ".", "name", ",", "\"", "\"", ":", "c", ".", "creationDate", ",", "\"", "\"", ":", "c", ".", "ephemeral", ",", "\"", "\"", ":", "c", ".", "lastUsedDate", "}", "\n\n", "// Check that we're running", "if", "!", "c", ".", "IsRunning", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Check if the CGroup is available", "if", "!", "c", ".", "state", ".", "OS", ".", "CGroupFreezerController", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// Check that we're not already frozen", "if", "c", ".", "IsFrozen", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ",", "ctxMap", ")", "\n\n", "// Load the go-lxc struct", "err", ":=", "c", ".", "initLXC", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "ctxMap", "[", "\"", "\"", "]", "=", "err", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "c", ".", "Freeze", "(", ")", "\n", "if", "err", "!=", "nil", "{", "ctxMap", "[", "\"", "\"", "]", "=", "err", "\n", "logger", ".", "Error", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "return", "err", "\n", "}", "\n\n", "logger", ".", "Info", "(", "\"", "\"", ",", "ctxMap", ")", "\n", "eventSendLifecycle", "(", "c", ".", "project", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "<mask>", ")", ",", "nil", ")", "\n\n", "return", "err", "\n", "}" ]
6,449
all-6450
[ "getVal", "returns", "byte", "slice", "at", "offset", ".", "The", "given", "size", "should", "be", "just", "the", "value", "size", "and", "should", "NOT", "include", "the", "meta", "bytes", "." ]
[ "func", "(", "s", "*", "Arena", ")", "getVal", "(", "offset", "uint32", ",", "<mask>", "uint16", ")", "(", "ret", "y", ".", "ValueStruct", ")", "{", "ret", ".", "Decode", "(", "s", ".", "buf", "[", "offset", ":", "offset", "+", "uint32", "(", "size", ")", "]", ")", "\n", "return", "\n", "}" ]
6,450
all-6451
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkSearchEntry", "." ]
[ "func", "(", "v", "*", "SearchEntry", ")", "native", "(", ")", "*", "C", ".", "GtkSearchEntry", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkSearchEntry", "(", "p", ")", "\n", "}" ]
6,451
all-6452
[ "LinkButtonNewWithLabel", "is", "a", "wrapper", "around", "gtk_link_button_new_with_label", "()", "." ]
[ "func", "LinkButtonNewWithLabel", "(", "uri", ",", "<mask>", "string", ")", "(", "*", "LinkButton", ",", "error", ")", "{", "curi", ":=", "C", ".", "CString", "(", "uri", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "curi", ")", ")", "\n", "clabel", ":=", "C", ".", "CString", "(", "label", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "clabel", ")", ")", "\n", "c", ":=", "C", ".", "gtk_link_button_new_with_label", "(", "(", "*", "C", ".", "gchar", ")", "(", "curi", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "clabel", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapLinkButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
6,452
all-6453
[ "Push", "a", "point", "to", "the", "database", ".", "This", "appends", "to", "current", "batchpoint" ]
[ "func", "(", "i", "*", "InfluxDB", ")", "Push", "(", "tags", "map", "[", "string", "]", "string", ",", "fields", "map", "[", "string", "]", "interface", "{", "}", ",", "date", "time", ".", "Time", ")", "error", "{", "pt", ",", "err", ":=", "influxdb", ".", "NewPoint", "(", "i", ".", "measurement", ",", "mergeTags", "(", "i", ".", "tags", ",", "tags", ")", ",", "fields", ",", "date", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "i", ".", "<mask>", ".", "AddPoint", "(", "pt", ")", "\n", "i", ".", "batchSize", "++", "\n\n", "return", "nil", "\n", "}" ]
6,453
all-6454
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Return", "a", "list", "of", "the", "most", "recent", "errors", "encountered", "by", "a", "worker", "type", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "reference", "/", "core", "/", "ec2", "-", "manager", "/", "api", "-", "docs#workerTypeErrors" ]
[ "func", "(", "eC2Manager", "*", "EC2Manager", ")", "WorkerTypeErrors", "(", "workerType", "string", ")", "(", "*", "Errors", ",", "error", ")", "{", "<mask>", ":=", "tcclient", ".", "Client", "(", "*", "eC2Manager", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerType", ")", "+", "\"", "\"", ",", "new", "(", "Errors", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "Errors", ")", ",", "err", "\n", "}" ]
6,454
all-6455
[ "flattenVAppConfig", "reads", "in", "the", "vAppConfig", "from", "a", "running", "virtual", "machine", "and", "sets", "all", "keys", "in", "vapp", "." ]
[ "func", "flattenVAppConfig", "(", "d", "*", "schema", ".", "ResourceData", ",", "config", "types", ".", "BaseVmConfigInfo", ")", "error", "{", "if", "config", "==", "nil", "{", "d", ".", "Set", "(", "\"", "\"", ",", "[", "]", "string", "{", "}", ")", "\n", "return", "nil", "\n", "}", "\n", "// Set `vapp_config here while config is available to avoid extra API calls", "d", ".", "Set", "(", "\"", "\"", ",", "config", ".", "GetVmConfigInfo", "(", ")", ".", "OvfEnvironmentTransport", ")", "\n\n", "props", ":=", "config", ".", "GetVmConfigInfo", "(", ")", ".", "Property", "\n", "if", "len", "(", "props", ")", "<", "1", "{", "// No props to read is a no-op", "return", "nil", "\n", "}", "\n", "vac", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "_", ",", "v", ":=", "range", "props", "{", "if", "v", ".", "Value", "!=", "\"", "\"", "&&", "v", ".", "Value", "!=", "v", ".", "DefaultValue", "{", "vac", "[", "v", ".", "Id", "]", "=", "v", ".", "Value", "\n", "}", "\n", "}", "\n", "// Only set if properties exist to prevent creating an unnecessary diff", "if", "len", "(", "vac", ")", ">", "0", "{", "return", "d", ".", "Set", "(", "\"", "\"", ",", "[", "]", "interface", "{", "}", "{", "map", "[", "string", "]", "<mask>", "{", "}", "{", "\"", "\"", ":", "vac", ",", "}", ",", "}", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,455
all-6456
[ "cmps", "guards", "the", "txn", "from", "updates", "to", "read", "set" ]
[ "func", "(", "s", "*", "stm", ")", "cmps", "(", ")", "[", "]", "v3", ".", "Cmp", "{", "cmps", ":=", "make", "(", "[", "]", "v3", ".", "Cmp", ",", "0", ",", "len", "(", "s", ".", "rset", ")", ")", "\n", "for", "k", ",", "rk", ":=", "<mask>", "s", ".", "rset", "{", "cmps", "=", "append", "(", "cmps", ",", "isKeyCurrent", "(", "k", ",", "rk", ")", ")", "\n", "}", "\n", "return", "cmps", "\n", "}" ]
6,456
all-6457
[ "SetAccelsForAction", "is", "a", "wrapper", "around", "gtk_application_set_accels_for_action", "()", "." ]
[ "func", "(", "v", "*", "Application", ")", "SetAccelsForAction", "(", "act", "string", ",", "accels", "[", "]", "string", ")", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "act", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "caccels", ":=", "C", ".", "make_strings", "(", "C", ".", "int", "(", "len", "(", "accels", ")", "+", "1", ")", ")", "\n", "defer", "C", ".", "destroy_strings", "(", "caccels", ")", "\n\n", "for", "i", ",", "accel", ":=", "range", "accels", "{", "cstr", ":=", "C", ".", "CString", "(", "accel", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "set_string", "(", "caccels", ",", "C", ".", "int", "(", "i", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}", "\n\n", "C", ".", "set_string", "(", "caccels", ",", "C", ".", "int", "(", "len", "(", "accels", ")", ")", ",", "nil", ")", "\n\n", "C", ".", "gtk_application_set_accels_for_action", "(", "v", ".", "native", "(", ")", ",", "cstr1", ",", "caccels", ")", "\n", "}" ]
6,457
all-6458
[ "PutFileSplit", "writes", "a", "file", "to", "PFS", "from", "a", "reader", "delimiter", "is", "used", "to", "tell", "PFS", "how", "to", "break", "the", "input", "into", "blocks" ]
[ "func", "(", "c", "APIClient", ")", "PutFileSplit", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ",", "delimiter", "pfs", ".", "Delimiter", ",", "targetFileDatums", "int64", ",", "targetFileBytes", "int64", ",", "headerRecords", "int64", ",", "overwrite", "bool", ",", "reader", "<mask>", ".", "Reader", ")", "(", "_", "int", ",", "retErr", "error", ")", "{", "// TODO(msteffen) update", "pfc", ",", "err", ":=", "c", ".", "newOneoffPutFileClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "return", "pfc", ".", "PutFileSplit", "(", "repoName", ",", "commitID", ",", "path", ",", "delimiter", ",", "targetFileDatums", ",", "targetFileBytes", ",", "headerRecords", ",", "overwrite", ",", "reader", ")", "\n", "}" ]
6,458
all-6459
[ "MetricWithPrefix", "is", "the", "default", "mapping", "for", "metrics", "to", "statsd", "keys", "." ]
[ "func", "MetricWithPrefix", "(", "prefix", ",", "name", "string", ",", "tags", "map", "[", "string", "]", "string", ")", "string", "{", "buf", ":=", "bufPool", ".", "Get", "(", ")", ".", "(", "*", "bytes", ".", "Buffer", ")", "\n", "buf", ".", "Reset", "(", ")", "\n\n", "if", "prefix", "!=", "\"", "\"", "{", "buf", ".", "WriteString", "(", "prefix", ")", "\n", "}", "\n", "buf", ".", "WriteString", "(", "name", ")", "\n\n", "addKeys", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "5", ")", "\n", "switch", "{", "case", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", ":", "addKeys", "=", "append", "(", "addKeys", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", "{", "addKeys", "=", "append", "(", "addKeys", ",", "\"", "\"", ")", "\n", "}", "\n", "case", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", ":", "addKeys", "=", "append", "(", "addKeys", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n\n", "for", "_", ",", "k", ":=", "range", "addKeys", "{", "buf", ".", "WriteByte", "(", "'.'", ")", "\n", "v", ",", "<mask>", ":=", "tags", "[", "k", "]", "\n", "if", "ok", "{", "writeClean", "(", "buf", ",", "v", ")", "\n", "}", "else", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "buf", ".", "WriteString", "(", "k", ")", "\n", "}", "\n", "}", "\n\n", "m", ":=", "buf", ".", "String", "(", ")", "\n", "bufPool", ".", "Put", "(", "buf", ")", "\n", "return", "m", "\n", "}" ]
6,459
all-6460
[ "save", "reads", "the", "applied", "ipvsadm", "rules", "from", "the", "host", "and", "saves", "them", "as", "i", ".", "Services" ]
[ "func", "(", "i", "*", "Ipvs", ")", "Save", "(", ")", "error", "{", "out", ",", "err", ":=", "backendRun", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "i", ".", "Services", "=", "make", "(", "[", "]", "Service", ",", "0", ",", "0", ")", "\n", "serviceStrings", ":=", "strings", ".", "Split", "(", "string", "(", "out", ")", ",", "\"", "\"", ")", "\n", "for", "j", ":=", "<mask>", "serviceStrings", "{", "if", "serviceStrings", "[", "j", "]", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "serverStrings", ":=", "strings", ".", "Split", "(", "serviceStrings", "[", "j", "]", ",", "\"", "\"", ")", "\n", "serviceString", ":=", "serverStrings", "[", "0", "]", "\n", "serverStrings", "=", "serverStrings", "[", "1", ":", "]", "\n", "// fmt.Println(\"Service: \", serviceString)", "service", ":=", "parseService", "(", "serviceString", ")", "\n", "for", "k", ":=", "range", "serverStrings", "{", "// fmt.Println(\"Server: \", serverStrings[j])", "server", ":=", "parseServer", "(", "serverStrings", "[", "k", "]", ")", "\n", "service", ".", "Servers", "=", "append", "(", "service", ".", "Servers", ",", "server", ")", "\n", "}", "\n", "i", ".", "Services", "=", "append", "(", "i", ".", "Services", ",", "service", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,460
all-6461
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RequestMemoryDumpParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTracing3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,461
all-6462
[ "GetUnknown", "returns", "the", "Unknown", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ThresholdCount", ")", "GetUnknown", "(", ")", "json", ".", "Number", "{", "if", "t", "==", "nil", "||", "t", ".", "Unknown", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "<mask>", "\n", "}" ]
6,462
all-6463
[ "GetCurrentUri", "is", "a", "wrapper", "around", "gtk_label_get_current_uri", "()", "." ]
[ "func", "(", "v", "*", "Label", ")", "GetCurrentUri", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_label_get_current_uri", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
6,463
all-6464
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventFrameRequestedNavigation", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage63", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,464
all-6465
[ "Only", "available", "from", "2", ".", "42", "//", "SetPriority", "is", "a", "wrapper", "around", "g_notification_set_priority", "()", ".", "func", "(", "v", "*", "Notification", ")", "SetPriority", "(", "prio", "NotificationPriority", ")", "{", "C", ".", "g_notification_set_priority", "(", "v", ".", "native", "()", "C", ".", "GNotificationPriority", "(", "prio", "))", "}", "SetDefaultAction", "is", "a", "wrapper", "around", "g_notification_set_default_action", "()", "." ]
[ "func", "(", "v", "*", "Notification", ")", "SetDefaultAction", "(", "detailedAction", "string", ")", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "detailedAction", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "C", ".", "g_notification_set_default_action", "(", "v", ".", "native", "(", ")", ",", "cstr1", ")", "\n", "}" ]
6,465
all-6466
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform1ui", "(", "program", "uint32", ",", "location", "int32", ",", "v0", "uint32", ")", "{", "C", ".", "glowProgramUniform1ui", "(", "gpProgramUniform1ui", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "v0", ")", ")", "\n", "}" ]
6,466
all-6467
[ "WaitForMark", "waits", "until", "the", "given", "index", "is", "marked", "as", "done", "." ]
[ "func", "(", "w", "*", "WaterMark", ")", "WaitForMark", "(", "ctx", "context", ".", "Context", ",", "index", "uint64", ")", "error", "{", "if", "w", ".", "DoneUntil", "(", ")", ">=", "index", "{", "return", "nil", "\n", "}", "\n", "waitCh", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "w", ".", "markCh", "<-", "mark", "{", "<mask>", ":", "index", ",", "waiter", ":", "waitCh", "}", "\n\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "ctx", ".", "Err", "(", ")", "\n", "case", "<-", "waitCh", ":", "return", "nil", "\n", "}", "\n", "}" ]
6,467
all-6468
[ "ConvertPath", "converts", "a", "paths", "to", "the", "pdf", "api" ]
[ "func", "ConvertPath", "(", "path", "*", "draw2d", ".", "Path", ",", "pdf", "Vectorizer", ")", "{", "var", "startX", ",", "startY", "float64", "=", "0", ",", "0", "\n", "i", ":=", "0", "\n", "for", "_", ",", "cmp", ":=", "range", "path", ".", "Components", "{", "switch", "cmp", "{", "case", "draw2d", ".", "MoveToCmp", ":", "startX", ",", "startY", "=", "path", ".", "Points", "[", "i", "]", ",", "path", ".", "Points", "[", "i", "+", "1", "]", "\n", "pdf", ".", "MoveTo", "(", "startX", ",", "startY", ")", "\n", "i", "+=", "2", "\n", "case", "draw2d", ".", "LineToCmp", ":", "pdf", ".", "LineTo", "(", "path", ".", "Points", "[", "i", "]", ",", "path", ".", "Points", "[", "i", "+", "1", "]", ")", "\n", "i", "+=", "2", "\n", "case", "draw2d", ".", "QuadCurveToCmp", ":", "pdf", ".", "CurveTo", "(", "path", ".", "Points", "[", "i", "]", ",", "path", ".", "Points", "[", "i", "+", "1", "]", ",", "path", ".", "Points", "[", "i", "+", "2", "]", ",", "path", ".", "Points", "[", "i", "+", "3", "]", ")", "\n", "i", "+=", "4", "\n", "case", "draw2d", ".", "CubicCurveToCmp", ":", "pdf", ".", "CurveBezierCubicTo", "(", "path", ".", "Points", "[", "i", "]", ",", "path", ".", "Points", "[", "i", "+", "1", "]", ",", "path", ".", "Points", "[", "i", "+", "2", "]", ",", "<mask>", ".", "Points", "[", "i", "+", "3", "]", ",", "path", ".", "Points", "[", "i", "+", "4", "]", ",", "path", ".", "Points", "[", "i", "+", "5", "]", ")", "\n", "i", "+=", "6", "\n", "case", "draw2d", ".", "ArcToCmp", ":", "pdf", ".", "ArcTo", "(", "path", ".", "Points", "[", "i", "]", ",", "path", ".", "Points", "[", "i", "+", "1", "]", ",", "path", ".", "Points", "[", "i", "+", "2", "]", ",", "path", ".", "Points", "[", "i", "+", "3", "]", ",", "0", ",", "// degRotate", "path", ".", "Points", "[", "i", "+", "4", "]", "*", "deg", ",", "// degStart = startAngle", "(", "path", ".", "Points", "[", "i", "+", "4", "]", "-", "path", ".", "Points", "[", "i", "+", "5", "]", ")", "*", "deg", ")", "// degEnd = startAngle-angle", "\n", "i", "+=", "6", "\n", "case", "draw2d", ".", "CloseCmp", ":", "pdf", ".", "LineTo", "(", "startX", ",", "startY", ")", "\n", "pdf", ".", "ClosePath", "(", ")", "\n", "}", "\n", "}", "\n", "}" ]
6,468
all-6469
[ "Cat", "the", "content", "at", "the", "given", "path", ".", "Callers", "need", "to", "drain", "and", "close", "the", "returned", "reader", "after", "usage", "." ]
[ "func", "(", "s", "*", "Shell", ")", "Cat", "(", "path", "string", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "resp", ",", "err", ":=", "s", ".", "Request", "(", "\"", "\"", ",", "path", ")", ".", "Send", "(", "context", ".", "Background", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "resp", ".", "<mask>", "!=", "nil", "{", "return", "nil", ",", "resp", ".", "Error", "\n", "}", "\n\n", "return", "resp", ".", "Output", ",", "nil", "\n", "}" ]
6,469
all-6470
[ "Draw", "a", "tiger" ]
[ "func", "Draw", "(", "gc", "draw2d", ".", "GraphicContext", ",", "filename", "string", ")", "{", "// Open the postscript", "src", ",", "err", ":=", "os", ".", "OpenFile", "(", "filename", ",", "0", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "defer", "src", ".", "Close", "(", ")", "\n", "<mask>", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "src", ")", "\n", "reader", ":=", "strings", ".", "NewReader", "(", "string", "(", "bytes", ")", ")", "\n\n", "// Initialize and interpret the postscript", "interpreter", ":=", "ps", ".", "NewInterpreter", "(", "gc", ")", "\n", "interpreter", ".", "Execute", "(", "reader", ")", "\n", "}" ]
6,470
all-6471
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "GetName", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "Name", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "<mask>", "\n", "}" ]
6,471
all-6472
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "SDConfig", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "<mask>", "{", "}", ")", "error", ")", "error", "{", "*", "c", "=", "DefaultSDConfig", "\n", "type", "plain", "SDConfig", "\n", "err", ":=", "unmarshal", "(", "(", "*", "plain", ")", "(", "c", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "c", ".", "Region", "==", "\"", "\"", "{", "sess", ",", "err", ":=", "session", ".", "NewSession", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "metadata", ":=", "ec2metadata", ".", "New", "(", "sess", ")", "\n", "region", ",", "err", ":=", "metadata", ".", "Region", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "Region", "=", "region", "\n", "}", "\n", "for", "_", ",", "f", ":=", "range", "c", ".", "Filters", "{", "if", "len", "(", "f", ".", "Values", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,472
all-6473
[ "merge", "merges", "two", "similar", "Args", "zapping", "out", "differences", "." ]
[ "func", "(", "a", "*", "Args", ")", "merge", "(", "r", "*", "Args", ")", "Args", "{", "out", ":=", "Args", "{", "Values", ":", "make", "(", "[", "]", "Arg", ",", "len", "(", "a", ".", "Values", ")", ")", ",", "Elided", ":", "a", ".", "Elided", ",", "}", "\n", "for", "i", ",", "l", ":=", "<mask>", "a", ".", "Values", "{", "if", "l", "!=", "r", ".", "Values", "[", "i", "]", "{", "out", ".", "Values", "[", "i", "]", ".", "Name", "=", "\"", "\"", "\n", "out", ".", "Values", "[", "i", "]", ".", "Value", "=", "l", ".", "Value", "\n", "}", "else", "{", "out", ".", "Values", "[", "i", "]", "=", "l", "\n", "}", "\n", "}", "\n", "return", "out", "\n", "}" ]
6,473
all-6474
[ "SearchWorksheets", "returns", "worksheets", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "worksheets", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchWorksheets", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Worksheet", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "<mask>", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchWorksheets", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "WorksheetPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "worksheets", "[", "]", "Worksheet", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "worksheets", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "worksheets", ",", "nil", "\n", "}" ]
6,474
all-6475
[ "ProfileConfig", "gets", "the", "profile", "configuration", "map", "from", "the", "DB", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ProfileConfig", "(", "project", ",", "name", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasProfiles", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "<mask>", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "key", ",", "value", "string", "\n", "query", ":=", "`\n SELECT\n key, value\n FROM profiles_config\n JOIN profiles ON profiles_config.profile_id=profiles.id\n JOIN projects ON projects.id = profiles.project_id\n WHERE projects.name=? AND profiles.name=?`", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", ",", "name", "}", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "key", ",", "value", "}", "\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "if", "len", "(", "results", ")", "==", "0", "{", "/*\n\t\t * If we didn't get any rows here, let's check to make sure the\n\t\t * profile really exists; if it doesn't, let's send back a 404.\n\t\t */", "query", ":=", "\"", "\"", "\n", "var", "id", "int", "\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "[", "]", "interface", "{", "}", "{", "name", "}", ",", "[", "]", "interface", "{", "}", "{", "id", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "results", ")", "==", "0", "{", "return", "nil", ",", "ErrNoSuchObject", "\n", "}", "\n", "}", "\n\n", "config", ":=", "map", "[", "string", "]", "string", "{", "}", "\n\n", "for", "_", ",", "r", ":=", "range", "results", "{", "key", "=", "r", "[", "0", "]", ".", "(", "string", ")", "\n", "value", "=", "r", "[", "1", "]", ".", "(", "string", ")", "\n\n", "config", "[", "key", "]", "=", "value", "\n", "}", "\n\n", "return", "config", ",", "nil", "\n", "}" ]
6,475
all-6476
[ "HasPalette", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostmapStyle", ")", "HasPalette", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "Palette", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
6,476
all-6477
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TextBoxSnapshot", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
6,477
all-6478
[ "ParamsEscape", "returns", "escapred", "params", "result", ".", "e", ".", "g", ".", "ctx", ".", "ParamsEscape", "(", ":", "uname", ")" ]
[ "func", "(", "ctx", "*", "Context", ")", "ParamsEscape", "(", "name", "string", ")", "string", "{", "return", "template", ".", "HTMLEscapeString", "(", "ctx", ".", "Params", "(", "<mask>", ")", ")", "\n", "}" ]
6,478
all-6479
[ "SetDockerAuthConfig", "sets", "the", "credentials", "to", "pull", "from", "ECR", "in", "the", "auth" ]
[ "func", "(", "auth", "*", "ASMAuthData", ")", "SetDockerAuthConfig", "(", "dac", "types", ".", "AuthConfig", ")", "{", "auth", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "auth", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "auth", ".", "dockerAuthConfig", "=", "dac", "\n", "}" ]
6,479
all-6480
[ "GetDisabled", "returns", "the", "Disabled", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetDisabled", "(", ")", "bool", "{", "if", "d", "==", "nil", "||", "d", ".", "Disabled", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "d", ".", "Disabled", "\n", "}" ]
6,480
all-6481
[ "Do", "executes", "Animation", ".", "getPlaybackRate", "against", "the", "provided", "context", ".", "returns", ":", "playbackRate", "-", "Playback", "rate", "for", "animations", "on", "page", "." ]
[ "func", "(", "p", "*", "GetPlaybackRateParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "playbackRate", "float64", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetPlaybackRateReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetPlaybackRate", ",", "nil", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "PlaybackRate", ",", "nil", "\n", "}" ]
6,481
all-6482
[ "specify", "storage", "for", "a", "two", "-", "dimensional", "multisample", "array", "texture" ]
[ "func", "TexStorage3DMultisample", "(", "target", "uint32", ",", "samples", "int32", ",", "internalformat", "uint32", ",", "<mask>", "int32", ",", "height", "int32", ",", "depth", "int32", ",", "fixedsamplelocations", "bool", ")", "{", "syscall", ".", "Syscall9", "(", "gpTexStorage3DMultisample", ",", "7", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "samples", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "uintptr", "(", "depth", ")", ",", "boolToUintptr", "(", "fixedsamplelocations", ")", ",", "0", ",", "0", ")", "\n", "}" ]
6,482
all-6483
[ "WriteInt16", "writes", "an", "int16", "." ]
[ "func", "(", "w", "*", "Writer", ")", "WriteInt16", "(", "i", "int16", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "<mask>", ".", "LittleEndian", ".", "PutUint16", "(", "w", ".", "b", "[", ":", "2", "]", ",", "uint16", "(", "i", ")", ")", "\n", "w", ".", "wr", ".", "Write", "(", "w", ".", "b", "[", ":", "2", "]", ")", "\n", "}" ]
6,483
all-6484
[ "Throttle", "client", "to", "a", "rate", "of", "at", "most", "hourlyTokens", "requests", "per", "hour", "allowing", "burst", "tokens", "." ]
[ "func", "(", "c", "*", "Client", ")", "Throttle", "(", "hourlyTokens", ",", "burst", "int", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "hourlyTokens", ",", "burst", ")", "\n", "c", ".", "throttle", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "throttle", ".", "lock", ".", "Unlock", "(", ")", "\n", "previouslyThrottled", ":=", "c", ".", "throttle", ".", "ticker", "!=", "nil", "\n", "if", "hourlyTokens", "<=", "0", "||", "burst", "<=", "0", "{", "// Disable throttle", "if", "previouslyThrottled", "{", "// Unwrap clients if necessary", "c", ".", "client", "=", "c", ".", "throttle", ".", "http", "\n", "c", ".", "gqlc", "=", "c", ".", "throttle", ".", "graph", "\n", "c", ".", "throttle", ".", "ticker", ".", "Stop", "(", ")", "\n", "c", ".", "throttle", ".", "ticker", "=", "nil", "\n", "}", "\n", "return", "\n", "}", "\n", "rate", ":=", "time", ".", "Hour", "/", "time", ".", "Duration", "(", "hourlyTokens", ")", "\n", "ticker", ":=", "time", ".", "NewTicker", "(", "rate", ")", "\n", "throttle", ":=", "make", "(", "chan", "time", ".", "Time", ",", "burst", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "burst", ";", "i", "++", "{", "// Fill up the channel", "throttle", "<-", "time", ".", "Now", "(", ")", "\n", "}", "\n", "go", "func", "(", ")", "{", "// Refill the channel", "for", "t", ":=", "range", "ticker", ".", "C", "{", "<mask>", "{", "case", "throttle", "<-", "t", ":", "default", ":", "}", "\n", "}", "\n", "}", "(", ")", "\n", "if", "!", "previouslyThrottled", "{", "// Wrap clients if we haven't already", "c", ".", "throttle", ".", "http", "=", "c", ".", "client", "\n", "c", ".", "throttle", ".", "graph", "=", "c", ".", "gqlc", "\n", "c", ".", "client", "=", "&", "c", ".", "throttle", "\n", "c", ".", "gqlc", "=", "&", "c", ".", "throttle", "\n", "}", "\n", "c", ".", "throttle", ".", "ticker", "=", "ticker", "\n", "c", ".", "throttle", ".", "throttle", "=", "throttle", "\n", "}" ]
6,484
all-6485
[ "Returns", "a", "signed", "URL", "for", "AzureAccounts", "valid", "for", "the", "specified", "duration", ".", "Required", "scopes", ":", "auth", ":", "azure", "-", "table", ":", "list", "-", "accounts", "See", "AzureAccounts", "for", "more", "details", "." ]
[ "func", "(", "auth", "*", "Auth", ")", "AzureAccounts_SignedURL", "(", "duration", "time", ".", "Duration", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "auth", ")", "\n", "return", "(", "&", "cd", ")", ".", "SignedURL", "(", "\"", "\"", ",", "nil", ",", "duration", ")", "\n", "}" ]
6,485
all-6486
[ "NetworkCreatePending", "creates", "a", "new", "pending", "network", "on", "the", "node", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NetworkCreatePending", "(", "<mask>", ",", "name", "string", ",", "conf", "map", "[", "string", "]", "string", ")", "error", "{", "// First check if a network with the given name exists, and, if", "// so, that it's in the pending state.", "network", ":=", "struct", "{", "id", "int64", "\n", "state", "int", "\n", "}", "{", "}", "\n\n", "var", "errConsistency", "error", "\n", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "// Sanity check that there is at most one pool with the given name.", "if", "i", "!=", "0", "{", "errConsistency", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "network", ".", "id", ",", "&", "network", ".", "state", "}", "\n", "}", "\n", "stmt", ",", "err", ":=", "c", ".", "tx", ".", "Prepare", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "err", "=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "errConsistency", "!=", "nil", "{", "return", "errConsistency", "\n", "}", "\n\n", "var", "networkID", "=", "network", ".", "id", "\n", "if", "networkID", "==", "0", "{", "// No existing network with the given name was found, let's create", "// one.", "columns", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "name", "}", "\n", "networkID", ",", "err", "=", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "// Check that the existing network is in the pending state.", "if", "network", ".", "state", "!=", "networkPending", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Get the ID of the node with the given name.", "nodeInfo", ",", "err", ":=", "c", ".", "NodeByName", "(", "node", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Check that no network entry for this node and network exists yet.", "count", ",", "err", ":=", "query", ".", "Count", "(", "c", ".", "tx", ",", "\"", "\"", ",", "\"", "\"", ",", "networkID", ",", "nodeInfo", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "count", "!=", "0", "{", "return", "ErrAlreadyDefined", "\n", "}", "\n\n", "// Insert the node-specific configuration.", "columns", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "networkID", ",", "nodeInfo", ".", "ID", "}", "\n", "_", ",", "err", "=", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "c", ".", "NetworkConfigAdd", "(", "networkID", ",", "nodeInfo", ".", "ID", ",", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,486
all-6487
[ "GetFontSizeOk", "returns", "a", "tuple", "with", "the", "FontSize", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "f", "*", "FreeTextDefinition", ")", "GetFontSizeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "f", "==", "nil", "||", "f", ".", "FontSize", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "f", ".", "FontSize", ",", "true", "\n", "}" ]
6,487
all-6488
[ "RetryClusterClient", "implements", "a", "ClusterClient", "." ]
[ "func", "RetryClusterClient", "(", "c", "*", "Client", ")", "<mask>", ".", "ClusterClient", "{", "return", "&", "retryClusterClient", "{", "cc", ":", "pb", ".", "NewClusterClient", "(", "c", ".", "conn", ")", ",", "}", "\n", "}" ]
6,488
all-6489
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HeatmapDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "TitleSize", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
6,489
all-6490
[ "Route", "returns", "the", "subrouter", "for", "a", "pettern" ]
[ "func", "(", "r", "*", "Router", ")", "Route", "(", "pattern", "string", ")", "*", "Router", "{", "c", ":=", "r", ".", "pattern", "(", "<mask>", ")", "\n", "return", "r", ".", "clone", "(", "c", ")", "\n", "}" ]
6,490
all-6491
[ "MutateChangeTrust", "for", "Asset", "sets", "the", "ChangeTrustOp", "s", "Line", "field" ]
[ "func", "(", "m", "<mask>", ")", "MutateChangeTrust", "(", "o", "*", "xdr", ".", "ChangeTrustOp", ")", "(", "err", "error", ")", "{", "if", "m", ".", "Native", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "o", ".", "Line", ",", "err", "=", "m", ".", "ToXdrObject", "(", ")", "\n", "return", "\n", "}" ]
6,491
all-6492
[ "KeyPairAndCA", "returns", "a", "CertInfo", "object", "with", "a", "reference", "to", "the", "key", "pair", "and", "(", "optionally", ")", "CA", "certificate", "located", "in", "the", "given", "directory", "and", "having", "the", "given", "name", "prefix", "The", "naming", "conversion", "for", "the", "various", "files", "is", ":", "<prefix", ">", ".", "crt", "-", ">", "public", "key", "<prefix", ">", ".", "key", "-", ">", "private", "key", "<prefix", ">", ".", "ca", "-", ">", "CA", "certificate", "If", "no", "public", "/", "private", "key", "files", "are", "found", "a", "new", "key", "pair", "will", "be", "generated", "and", "saved", "on", "disk", ".", "If", "a", "CA", "certificate", "is", "found", "it", "will", "be", "returned", "as", "well", "as", "second", "return", "value", "(", "otherwise", "it", "will", "be", "nil", ")", "." ]
[ "func", "KeyPairAndCA", "(", "dir", ",", "prefix", "string", ",", "kind", "CertKind", ")", "(", "*", "CertInfo", ",", "error", ")", "{", "certFilename", ":=", "filepath", ".", "Join", "(", "dir", ",", "<mask>", "+", "\"", "\"", ")", "\n", "keyFilename", ":=", "filepath", ".", "Join", "(", "dir", ",", "prefix", "+", "\"", "\"", ")", "\n\n", "// Ensure that the certificate exists, or create a new one if it does", "// not.", "err", ":=", "FindOrGenCert", "(", "certFilename", ",", "keyFilename", ",", "kind", "==", "CertClient", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Load the certificate.", "keypair", ",", "err", ":=", "tls", ".", "LoadX509KeyPair", "(", "certFilename", ",", "keyFilename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// If available, load the CA data as well.", "caFilename", ":=", "filepath", ".", "Join", "(", "dir", ",", "prefix", "+", "\"", "\"", ")", "\n", "var", "ca", "*", "x509", ".", "Certificate", "\n", "if", "PathExists", "(", "caFilename", ")", "{", "ca", ",", "err", "=", "ReadCert", "(", "caFilename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "info", ":=", "&", "CertInfo", "{", "keypair", ":", "keypair", ",", "ca", ":", "ca", ",", "}", "\n", "return", "info", ",", "nil", "\n", "}" ]
6,492
all-6493
[ "ExecSudo", "executes", "a", "command", "under", "sudo", "." ]
[ "func", "ExecSudo", "(", "cmd", "string", ",", "args", "...", "string", ")", "error", "{", "return", "Exec", "(", "\"", "\"", ",", "<mask>", "(", "[", "]", "string", "{", "cmd", "}", ",", "args", "...", ")", "...", ")", "\n", "}" ]
6,493
all-6494
[ "copy", "all", "or", "part", "of", "the", "data", "store", "of", "a", "buffer", "object", "to", "the", "data", "store", "of", "another", "buffer", "object" ]
[ "func", "CopyBufferSubData", "(", "readTarget", "uint32", ",", "writeTarget", "uint32", ",", "readOffset", "int", ",", "writeOffset", "int", ",", "size", "int", ")", "{", "C", ".", "glowCopyBufferSubData", "(", "gpCopyBufferSubData", ",", "(", "C", ".", "GLenum", ")", "(", "readTarget", ")", ",", "(", "C", ".", "GLenum", ")", "(", "writeTarget", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "readOffset", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "writeOffset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "<mask>", ")", ")", "\n", "}" ]
6,494
all-6495
[ "See", "http", ":", "//", "www", ".", "vt100", ".", "net", "/", "emu", "/", "vt500_parser", ".", "png", "for", "description", "of", "the", "complex", "byte", "ranges", "below" ]
[ "func", "getEscapeToGroundBytes", "(", ")", "[", "]", "byte", "{", "escapeToGroundBytes", ":=", "getByteRange", "(", "0x30", ",", "0x4F", ")", "\n", "escapeToGroundBytes", "=", "append", "(", "escapeToGroundBytes", ",", "getByteRange", "(", "0x51", ",", "0x57", ")", "...", ")", "\n", "escapeToGroundBytes", "=", "append", "(", "escapeToGroundBytes", ",", "0x59", ")", "\n", "escapeToGroundBytes", "=", "append", "(", "escapeToGroundBytes", ",", "0x5A", ")", "\n", "escapeToGroundBytes", "=", "<mask>", "(", "escapeToGroundBytes", ",", "0x5C", ")", "\n", "escapeToGroundBytes", "=", "append", "(", "escapeToGroundBytes", ",", "getByteRange", "(", "0x60", ",", "0x7E", ")", "...", ")", "\n", "return", "escapeToGroundBytes", "\n", "}" ]
6,495
all-6496
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetFrameOwnerReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom40", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,496
all-6497
[ "newClient", "creates", "a", "new", "Pact", "client", "manager", "with", "the", "provided", "services" ]
[ "func", "newClient", "(", "MockServiceManager", "client", ".", "Service", ",", "verificationServiceManager", "client", ".", "Service", ",", "messageServiceManager", "client", ".", "Service", ",", "publishServiceManager", "<mask>", ".", "Service", ")", "*", "PactClient", "{", "MockServiceManager", ".", "Setup", "(", ")", "\n", "verificationServiceManager", ".", "Setup", "(", ")", "\n", "messageServiceManager", ".", "Setup", "(", ")", "\n", "publishServiceManager", ".", "Setup", "(", ")", "\n\n", "return", "&", "PactClient", "{", "pactMockSvcManager", ":", "MockServiceManager", ",", "verificationSvcManager", ":", "verificationServiceManager", ",", "messageSvcManager", ":", "messageServiceManager", ",", "publishSvcManager", ":", "publishServiceManager", ",", "TimeoutDuration", ":", "10", "*", "time", ".", "Second", ",", "}", "\n", "}" ]
6,497
all-6498
[ "Serialize", "action", "parameters" ]
[ "func", "parameters", "(", "a", "*", "gen", ".", "Action", ")", "string", "{", "var", "m", "=", "a", ".", "MandatoryParams", "(", ")", "\n", "var", "hasOptional", "=", "a", ".", "HasOptionalParams", "(", ")", "\n", "<mask>", "countParams", "=", "len", "(", "m", ")", "\n", "if", "hasOptional", "{", "countParams", "++", "\n", "}", "\n", "var", "params", "=", "make", "(", "[", "]", "string", ",", "countParams", ")", "\n", "for", "i", ",", "param", ":=", "range", "m", "{", "params", "[", "i", "]", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fixReserved", "(", "param", ".", "VarName", ")", ",", "param", ".", "Signature", "(", ")", ")", "\n", "}", "\n", "if", "hasOptional", "{", "params", "[", "countParams", "-", "1", "]", "=", "\"", "\"", "\n", "}", "\n\n", "return", "strings", ".", "Join", "(", "params", ",", "\"", "\"", ")", "\n", "}" ]
6,498
all-6499
[ "return", "the", "polygon", "stipple", "pattern" ]
[ "func", "GetPolygonStipple", "(", "mask", "*", "uint8", ")", "{", "syscall", ".", "Syscall", "(", "gpGetPolygonStipple", ",", "1", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
6,499
all-6500
[ "Given", "a", "path", "and", "an", "http", "method", "return", "all", "the", "matching", "routes", "." ]
[ "func", "(", "t", "*", "Trie", ")", "FindRoutes", "(", "httpMethod", ",", "path", "string", ")", "[", "]", "*", "Match", "{", "context", ":=", "newFindContext", "(", ")", "\n", "matches", ":=", "[", "]", "*", "Match", "{", "}", "\n", "<mask>", ".", "matchFunc", "=", "func", "(", "httpMethod", ",", "path", "string", ",", "node", "*", "node", ")", "{", "if", "node", ".", "HttpMethodToRoute", "[", "httpMethod", "]", "!=", "nil", "{", "// path and method match, found a route !", "matches", "=", "append", "(", "matches", ",", "&", "Match", "{", "Route", ":", "node", ".", "HttpMethodToRoute", "[", "httpMethod", "]", ",", "Params", ":", "context", ".", "paramsAsMap", "(", ")", ",", "}", ",", ")", "\n", "}", "\n", "}", "\n", "t", ".", "root", ".", "find", "(", "httpMethod", ",", "path", ",", "context", ")", "\n", "return", "matches", "\n", "}" ]