id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
3,600
all-3601
[ "CONTRACT", ":", "two", "nodes", "are", "compatible", "if", "the", "major", "/", "minor", "versions", "match", "and", "network", "match" ]
[ "func", "(", "<mask>", "*", "NodeInfo", ")", "CompatibleWith", "(", "other", "*", "NodeInfo", ")", "error", "{", "iMajor", ",", "iMinor", ",", "_", ",", "iErr", ":=", "splitVersion", "(", "info", ".", "Version", ")", "\n", "oMajor", ",", "oMinor", ",", "_", ",", "oErr", ":=", "splitVersion", "(", "other", ".", "Version", ")", "\n\n", "// if our own version number is not formatted right, we messed up", "if", "iErr", "!=", "nil", "{", "return", "iErr", "\n", "}", "\n\n", "// version number must be formatted correctly (\"x.x.x\")", "if", "oErr", "!=", "nil", "{", "return", "oErr", "\n", "}", "\n\n", "// major version must match", "if", "iMajor", "!=", "oMajor", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "oMajor", ",", "iMajor", ")", "\n", "}", "\n\n", "// minor version must match", "if", "iMinor", "!=", "oMinor", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "oMinor", ",", "iMinor", ")", "\n", "}", "\n\n", "// nodes must be on the same network", "if", "info", ".", "Network", "!=", "other", ".", "Network", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "other", ".", "Network", ",", "info", ".", "Network", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
3,601
all-3602
[ "Compare", "compares", "the", "two", "label", "sets", ".", "The", "result", "will", "be", "0", "if", "a", "==", "b", "<0", "if", "a", "<", "b", "and", ">", "0", "if", "a", ">", "b", "." ]
[ "func", "Compare", "(", "a", ",", "b", "Labels", ")", "int", "{", "l", ":=", "len", "(", "a", ")", "\n", "if", "len", "(", "b", ")", "<", "l", "{", "l", "=", "len", "(", "b", ")", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "l", ";", "i", "++", "{", "if", "d", ":=", "strings", ".", "Compare", "(", "a", "[", "i", "]", ".", "Name", ",", "b", "[", "i", "]", ".", "Name", ")", ";", "d", "!=", "0", "{", "return", "d", "\n", "}", "\n", "if", "d", ":=", "strings", ".", "Compare", "(", "a", "[", "i", "]", ".", "Value", ",", "b", "[", "i", "]", ".", "<mask>", ")", ";", "d", "!=", "0", "{", "return", "d", "\n", "}", "\n", "}", "\n", "// If all labels so far were in common, the set with fewer labels comes first.", "return", "len", "(", "a", ")", "-", "len", "(", "b", ")", "\n", "}" ]
3,602
all-3603
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoveInstrumentationBreakpointParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
3,603
all-3604
[ "WithBody", "adds", "the", "body", "to", "the", "find", "vms", "by", "filters", "params" ]
[ "func", "(", "o", "*", "FindVmsByFiltersParams", ")", "WithBody", "(", "<mask>", "*", "models", ".", "VMFilter", ")", "*", "FindVmsByFiltersParams", "{", "o", ".", "SetBody", "(", "body", ")", "\n", "return", "o", "\n", "}" ]
3,604
all-3605
[ "NewServerList", "returns", "a", "new", "ServerList", "with", "the", "given", "servers", ".", "All", "servers", "have", "the", "same", "weight", ".", "To", "give", "a", "server", "more", "weight", "list", "it", "multiple", "times", ".", "NewServerList", "returns", "an", "error", "if", "any", "of", "the", "received", "addresses", "is", "not", "valid", "or", "fails", "to", "resolve", "but", "it", "doesn", "t", "try", "to", "connect", "to", "the", "provided", "servers", "." ]
[ "func", "NewServerList", "(", "servers", "...", "string", ")", "(", "*", "ServerList", ",", "error", ")", "{", "addrs", ":=", "make", "(", "[", "]", "*", "Addr", ",", "len", "(", "servers", ")", ")", "\n", "for", "i", ",", "server", ":=", "range", "servers", "{", "if", "strings", ".", "Contains", "(", "server", ",", "\"", "\"", ")", "{", "addr", ",", "err", ":=", "net", ".", "ResolveUnixAddr", "(", "\"", "\"", ",", "server", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "addrs", "[", "i", "]", "=", "NewAddr", "(", "addr", ")", "\n", "}", "else", "{", "tcpaddr", ",", "err", ":=", "<mask>", ".", "ResolveTCPAddr", "(", "\"", "\"", ",", "server", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "addrs", "[", "i", "]", "=", "NewAddr", "(", "tcpaddr", ")", "\n", "}", "\n", "}", "\n", "return", "&", "ServerList", "{", "addrs", ":", "addrs", "}", ",", "nil", "\n", "}" ]
3,605
all-3606
[ "New", "creates", "a", "new", "API", "Client", "for", "a", "Telegram", "bot", "using", "the", "apiKey", "provided", ".", "It", "will", "call", "the", "GetMe", "method", "to", "retrieve", "the", "bots", "id", "name", "and", "username", ".", "This", "bot", "uses", "long", "polling", "to", "retrieve", "its", "updates", ".", "If", "a", "webhook", "was", "set", "for", "the", "given", "apiKey", "this", "will", "remove", "it", "." ]
[ "func", "New", "(", "apiKey", "string", ")", "(", "*", "TelegramBotAPI", ",", "error", ")", "{", "toReturn", ":=", "TelegramBotAPI", "{", "Updates", ":", "make", "(", "chan", "BotUpdate", ")", ",", "baseURIs", ":", "createEndpoints", "(", "fmt", ".", "Sprintf", "(", "apiBaseURI", ",", "apiKey", ")", ")", ",", "closed", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "c", ":", "newClient", "(", "fmt", ".", "Sprintf", "(", "apiBaseURI", ",", "apiKey", ")", ")", ",", "updateC", ":", "newClient", "(", "fmt", ".", "Sprintf", "(", "apiBaseURI", ",", "apiKey", ")", ")", ",", "}", "\n", "user", ",", "err", ":=", "toReturn", ".", "GetMe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "toReturn", ".", "ID", "=", "user", ".", "User", ".", "ID", "\n", "toReturn", ".", "Name", "=", "user", ".", "User", ".", "FirstName", "\n", "toReturn", ".", "Username", "=", "*", "<mask>", ".", "User", ".", "Username", "\n\n", "err", "=", "toReturn", ".", "removeWebhook", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "toReturn", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "toReturn", ".", "updateLoop", "(", ")", "\n\n", "return", "&", "toReturn", ",", "nil", "\n", "}" ]
3,606
all-3607
[ "expandStorageDrsPodConfigSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "StorageDrsPodConfigSpec", "." ]
[ "func", "expandStorageDrsPodConfigSpec", "(", "d", "*", "schema", ".", "ResourceData", ",", "version", "viapi", ".", "VSphereVersion", ")", "*", "types", ".", "StorageDrsPodConfigSpec", "{", "obj", ":=", "&", "types", ".", "StorageDrsPodConfigSpec", "{", "DefaultIntraVmAffinity", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "DefaultVmBehavior", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Enabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "IoLoadBalanceConfig", ":", "expandStorageDrsIoLoadBalanceConfig", "(", "d", ",", "<mask>", ")", ",", "IoLoadBalanceEnabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "LoadBalanceInterval", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "SpaceLoadBalanceConfig", ":", "expandStorageDrsSpaceLoadBalanceConfig", "(", "d", ",", "version", ")", ",", "Option", ":", "expandStorageDrsOptionSpec", "(", "d", ")", ",", "}", "\n\n", "if", "version", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "version", ".", "Product", ",", "Major", ":", "6", "}", ")", "{", "obj", ".", "AutomationOverrides", "=", "expandStorageDrsAutomationConfig", "(", "d", ")", "\n", "}", "\n\n", "return", "obj", "\n", "}" ]
3,607
all-3608
[ "fileDescriptor", "returns", "the", "file", "descriptor", "associated", "with", "the", "writer", "or", "(", "0", "false", ")", "if", "no", "file", "descriptor", "is", "available", "." ]
[ "func", "fileDescriptor", "(", "w", "io", ".", "Writer", ")", "(", "fd", "int", ",", "<mask>", "bool", ")", "{", "file", ",", "ok", ":=", "w", ".", "(", "interface", "{", "Fd", "(", ")", "uintptr", "}", ")", "\n", "if", "ok", "{", "fd", "=", "int", "(", "file", ".", "Fd", "(", ")", ")", "\n", "}", "\n", "return", "fd", ",", "ok", "\n", "}" ]
3,608
all-3609
[ "UnmarshalText", "from", "TOML" ]
[ "func", "(", "d", "*", "Duration", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n", "d", ".", "Duration", ",", "err", "=", "<mask>", ".", "ParseDuration", "(", "string", "(", "text", ")", ")", "\n", "return", "err", "\n", "}" ]
3,609
all-3610
[ "cephRBDVolumeMap", "maps", "a", "given", "RBD", "storage", "volume", "This", "will", "ensure", "that", "the", "RBD", "storage", "volume", "is", "accessible", "as", "a", "block", "device", "in", "the", "/", "dev", "directory", "and", "is", "therefore", "necessary", "in", "order", "to", "mount", "it", "." ]
[ "func", "cephRBDVolumeMap", "(", "clusterName", "string", ",", "poolName", "string", ",", "volumeName", "string", ",", "volumeType", "string", ",", "userName", "string", ")", "(", "string", ",", "error", ")", "{", "devPath", ",", "err", ":=", "shared", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "userName", ",", "\"", "\"", ",", "clusterName", ",", "\"", "\"", ",", "poolName", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "volumeType", ",", "volumeName", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "idx", ":=", "strings", ".", "<mask>", "(", "devPath", ",", "\"", "\"", ")", "\n", "if", "idx", "<", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "devPath", "=", "devPath", "[", "idx", ":", "]", "\n", "return", "strings", ".", "TrimSpace", "(", "devPath", ")", ",", "nil", "\n", "}" ]
3,610
all-3611
[ "Get", "fetches", "the", "raw", "config", "from", "cache" ]
[ "func", "(", "c", "*", "cachedLoader", ")", "Get", "(", "key", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "c", ".", "cacheLock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "cacheLock", ".", "RUnlock", "(", ")", "\n\n", "compiledKey", ":=", "c", ".", "namespace", "+", "divider", "+", "<mask>", "\n", "if", "ret", ",", "ok", ":=", "c", ".", "cache", "[", "compiledKey", "]", ";", "ok", "{", "return", "ret", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "compiledKey", ")", "\n", "}" ]
3,611
all-3612
[ "DataType", "converts", "a", "type", "code", "into", "one", "of", "the", "supported", "data", "types", "by", "the", "driver", "." ]
[ "func", "(", "k", "TypeCode", ")", "DataType", "(", ")", "DataType", "{", "<mask>", "k", "{", "default", ":", "return", "DtUnknown", "\n", "case", "tcTinyint", ":", "return", "DtTinyint", "\n", "case", "tcSmallint", ":", "return", "DtSmallint", "\n", "case", "tcInteger", ":", "return", "DtInteger", "\n", "case", "tcBigint", ":", "return", "DtBigint", "\n", "case", "tcReal", ":", "return", "DtReal", "\n", "case", "tcDouble", ":", "return", "DtDouble", "\n", "case", "tcDate", ",", "tcTime", ",", "tcTimestamp", ",", "tcLongdate", ",", "tcSeconddate", ",", "tcDaydate", ",", "tcSecondtime", ":", "return", "DtTime", "\n", "case", "tcDecimal", ":", "return", "DtDecimal", "\n", "case", "tcChar", ",", "tcVarchar", ",", "tcString", ",", "tcNchar", ",", "tcNvarchar", ",", "tcNstring", ":", "return", "DtString", "\n", "case", "tcBinary", ",", "tcVarbinary", ":", "return", "DtBytes", "\n", "case", "tcBlob", ",", "tcClob", ",", "tcNclob", ":", "return", "DtLob", "\n", "}", "\n", "}" ]
3,612
all-3613
[ "LimitListener", "returns", "a", "Listener", "that", "accepts", "at", "most", "n", "simultaneous", "connections", "from", "the", "provided", "Listener", "." ]
[ "func", "LimitListener", "(", "l", "net", ".", "Listener", ",", "n", "int", ")", "net", ".", "Listener", "{", "return", "&", "limitListener", "{", "l", ",", "<mask>", "(", "chan", "struct", "{", "}", ",", "n", ")", "}", "\n", "}" ]
3,613
all-3614
[ "ParseRoute", "parses", "a", "API", "1", ".", "5", "route", "and", "returns", "corresponding", "path", "patterns", "." ]
[ "func", "ParseRoute", "(", "moniker", "string", ",", "routes", "[", "]", "string", ")", "(", "pathPatterns", "[", "]", "*", "gen", ".", "PathPattern", ")", "{", "// :(((( some routes are empty", "var", "paths", "[", "]", "string", "\n", "var", "method", "string", "\n", "switch", "moniker", "{", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "case", "\"", "\"", ":", "method", ",", "paths", "=", "\"", "\"", ",", "[", "]", "string", "{", "\"", "\"", "}", "\n", "default", ":", "for", "_", ",", "route", ":=", "range", "routes", "{", "bound", ":=", "routeRegexp", ".", "FindStringIndex", "(", "route", ")", "\n", "match", ":=", "route", "[", "0", ":", "bound", "[", "0", "]", "]", "\n", "method", "=", "strings", ".", "TrimRight", "(", "match", "[", "0", ":", "7", "]", ",", "\"", "\"", ")", "\n", "path", ":=", "strings", ".", "TrimRight", "(", "match", "[", "7", ":", "]", ",", "\"", "\"", ")", "\n", "path", "=", "strings", ".", "TrimSuffix", "(", "path", ",", "\"", "\"", ")", "\n", "if", "isDeprecated", "(", "path", ")", "||", "isCustom", "(", "method", ",", "path", ")", "{", "continue", "\n", "}", "\n", "paths", "=", "append", "(", "paths", ",", "path", ")", "\n", "}", "\n", "}", "\n", "pathPatterns", "=", "make", "(", "[", "]", "*", "gen", ".", "PathPattern", ",", "len", "(", "paths", ")", ")", "\n", "for", "i", ",", "p", ":=", "range", "paths", "{", "rx", ":=", "routeVariablesRegexp", ".", "ReplaceAllLiteralString", "(", "regexp", ".", "QuoteMeta", "(", "p", ")", ",", "`/([^/]+)`", ")", "\n", "rx", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rx", ")", "\n", "pattern", ":=", "gen", ".", "PathPattern", "{", "HTTPMethod", ":", "method", ",", "Path", ":", "p", ",", "<mask>", ":", "routeVariablesRegexp", ".", "ReplaceAllLiteralString", "(", "p", ",", "\"", "\"", ")", ",", "Regexp", ":", "rx", ",", "}", "\n", "matches", ":=", "routeVariablesRegexp", ".", "FindAllStringSubmatch", "(", "p", ",", "-", "1", ")", "\n", "if", "len", "(", "matches", ")", ">", "0", "{", "pattern", ".", "Variables", "=", "make", "(", "[", "]", "string", ",", "len", "(", "matches", ")", ")", "\n", "for", "i", ",", "m", ":=", "range", "matches", "{", "pattern", ".", "Variables", "[", "i", "]", "=", "m", "[", "1", "]", "\n", "}", "\n", "}", "\n", "pathPatterns", "[", "i", "]", "=", "&", "pattern", "\n", "}", "\n", "return", "\n", "}" ]
3,614
all-3615
[ "URLsFromFlag", "returns", "a", "slices", "from", "url", "got", "from", "the", "flag", "." ]
[ "func", "URLsFromFlag", "(", "fs", "*", "flag", ".", "FlagSet", ",", "urlsFlagName", "string", ")", "[", "]", "url", ".", "<mask>", "{", "return", "[", "]", "url", ".", "URL", "(", "*", "fs", ".", "Lookup", "(", "urlsFlagName", ")", ".", "Value", ".", "(", "*", "URLsValue", ")", ")", "\n", "}" ]
3,615
all-3616
[ "GetSingleCommit", "returns", "a", "single", "commit", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "GetSingleCommit", "(", "org", ",", "repo", ",", "SHA", "<mask>", ")", "(", "github", ".", "SingleCommit", ",", "error", ")", "{", "return", "f", ".", "Commits", "[", "SHA", "]", ",", "nil", "\n", "}" ]
3,616
all-3617
[ "getBaseQueryString", "gets", "a", "Querystring", "representing", "this", "message", "." ]
[ "func", "(", "op", "*", "outgoingBase", ")", "getBaseQueryString", "(", ")", "querystring", "{", "toReturn", ":=", "<mask>", "[", "string", "]", "string", "{", "}", "\n", "if", "op", ".", "Recipient", ".", "isChannel", "(", ")", "{", "//Channel", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "*", "op", ".", "Recipient", ".", "ChannelID", ")", "\n", "}", "else", "{", "toReturn", "[", "\"", "\"", "]", "=", "fmt", ".", "Sprint", "(", "*", "op", ".", "Recipient", ".", "ChatID", ")", "\n", "}", "\n\n", "return", "querystring", "(", "toReturn", ")", "\n", "}" ]
3,617
all-3618
[ "BotName", "returns", "the", "login", "of", "the", "authenticated", "identity", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "users", "/", "#get", "-", "the", "-", "authenticated", "-", "user" ]
[ "func", "(", "c", "*", "<mask>", ")", "BotName", "(", ")", "(", "string", ",", "error", ")", "{", "c", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mut", ".", "Unlock", "(", ")", "\n", "if", "c", ".", "botName", "==", "\"", "\"", "{", "if", "err", ":=", "c", ".", "getUserData", "(", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "c", ".", "botName", ",", "nil", "\n", "}" ]
3,618
all-3619
[ "Rescan", "the", "target", ".", "Normally", "used", "for", "finding", "differences", "between", "scans", "at", "two", "points", "in", "time", "." ]
[ "func", "(", "h", "Host", ")", "Rescan", "(", ")", "(", "scan", "Scan", ")", "{", "return", "Init", "(", ")", ".", "AddPorts", "(", "h", ".", "parentScan", ".", "configPorts", "...", ")", ".", "AddTCPPorts", "(", "h", ".", "parentScan", ".", "configTCPPorts", "...", ")", ".", "AddUDPPorts", "(", "h", ".", "parentScan", ".", "configUDPPorts", "...", ")", ".", "AddHosts", "(", "h", ".", "<mask>", ")", ".", "AddFlags", "(", "h", ".", "parentScan", ".", "configOpts", "...", ")", "\n", "}" ]
3,619
all-3620
[ "WriteToRequest", "writes", "these", "params", "to", "a", "swagger", "request" ]
[ "func", "(", "o", "*", "FindVmsByStatesParams", ")", "WriteToRequest", "(", "r", "runtime", ".", "ClientRequest", ",", "reg", "strfmt", ".", "Registry", ")", "error", "{", "if", "err", ":=", "r", ".", "SetTimeout", "(", "o", ".", "timeout", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "<mask>", "res", "[", "]", "error", "\n\n", "valuesStates", ":=", "o", ".", "States", "\n\n", "joinedStates", ":=", "swag", ".", "JoinByFormat", "(", "valuesStates", ",", "\"", "\"", ")", "\n", "// query array param states", "if", "err", ":=", "r", ".", "SetQueryParam", "(", "\"", "\"", ",", "joinedStates", "...", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,620
all-3621
[ "Html", "retruns", "a", "TemplateView", "witch", "uses", "HTML", "templates", "internally", "." ]
[ "func", "Html", "(", "<mask>", ",", "contentType", ",", "charSet", "string", ")", "template", "{", "if", "htmlTemp", ".", "Template", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "contentType", "==", "\"", "\"", "{", "contentType", "=", "ContentTypeHTML", "\n", "}", "\n", "if", "charSet", "==", "\"", "\"", "{", "charSet", "=", "CharSetUTF8", "\n", "}", "\n", "header", ":=", "make", "(", "http", ".", "Header", ")", "\n", "header", ".", "Set", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "contentType", ",", "charSet", ")", ")", "\n", "return", "template", "{", "&", "htmlTemp", ",", "name", ",", "header", "}", "\n", "}" ]
3,621
all-3622
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "BeginFrameParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
3,622
all-3623
[ "Do", "executes", "Page", ".", "setAdBlockingEnabled", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetAdBlockingEnabledParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetAdBlockingEnabled", ",", "p", ",", "nil", ")", "\n", "}" ]
3,623
all-3624
[ "NewBoard", "generates", "a", "new", "Board", "with", "giving", "a", "size", "." ]
[ "func", "NewBoard", "(", "<mask>", "int", ")", "(", "*", "Board", ",", "error", ")", "{", "b", ":=", "&", "Board", "{", "size", ":", "size", ",", "tiles", ":", "map", "[", "*", "Tile", "]", "struct", "{", "}", "{", "}", ",", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "2", ";", "i", "++", "{", "if", "err", ":=", "addRandomTile", "(", "b", ".", "tiles", ",", "b", ".", "size", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "b", ",", "nil", "\n", "}" ]
3,624
all-3625
[ "GetVerifiedOk", "returns", "a", "tuple", "with", "the", "Verified", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetVerifiedOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Verified", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "Verified", ",", "<mask>", "\n", "}" ]
3,625
all-3626
[ "DrawTriangles", "draws", "a", "triangle", "with", "the", "specified", "vertices", "and", "their", "indices", ".", "If", "len", "(", "indices", ")", "is", "not", "multiple", "of", "3", "DrawTriangles", "panics", ".", "If", "len", "(", "indices", ")", "is", "more", "than", "MaxIndicesNum", "DrawTriangles", "panics", ".", "The", "rule", "in", "which", "DrawTriangles", "works", "effectively", "is", "same", "as", "DrawImage", "s", ".", "When", "the", "image", "i", "is", "disposed", "DrawTriangles", "does", "nothing", ".", "Internal", "mipmap", "is", "not", "used", "on", "DrawTriangles", ".", "Note", "that", "this", "API", "is", "experimental", "." ]
[ "func", "(", "i", "*", "Image", ")", "DrawTriangles", "(", "vertices", "[", "]", "Vertex", ",", "indices", "[", "]", "uint16", ",", "img", "*", "Image", ",", "options", "*", "DrawTrianglesOptions", ")", "{", "i", ".", "copyCheck", "(", ")", "\n", "if", "i", ".", "isDisposed", "(", ")", "{", "return", "\n", "}", "\n\n", "if", "i", ".", "isSubImage", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "img", ".", "resolvePendingPixels", "(", "true", ")", "\n", "i", ".", "resolvePendingPixels", "(", "true", ")", "\n\n", "if", "len", "(", "indices", ")", "%", "3", "!=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "indices", ")", ">", "MaxIndicesNum", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// TODO: Check the maximum value of indices and len(vertices)?", "if", "options", "==", "nil", "{", "options", "=", "&", "DrawTrianglesOptions", "{", "}", "\n", "}", "\n\n", "mode", ":=", "graphics", ".", "CompositeMode", "(", "options", ".", "CompositeMode", ")", "\n\n", "filter", ":=", "graphics", ".", "FilterNearest", "\n", "if", "options", ".", "Filter", "!=", "FilterDefault", "{", "filter", "=", "graphics", ".", "Filter", "(", "options", ".", "Filter", ")", "\n", "}", "else", "if", "img", ".", "filter", "!=", "FilterDefault", "{", "filter", "=", "graphics", ".", "Filter", "(", "img", ".", "filter", ")", "\n", "}", "\n\n", "vs", ":=", "<mask>", "(", "[", "]", "float32", ",", "len", "(", "vertices", ")", "*", "graphics", ".", "VertexFloatNum", ")", "\n", "src", ":=", "img", ".", "mipmap", ".", "original", "(", ")", "\n", "r", ":=", "img", ".", "Bounds", "(", ")", "\n", "for", "idx", ",", "v", ":=", "range", "vertices", "{", "src", ".", "PutVertex", "(", "vs", "[", "idx", "*", "graphics", ".", "VertexFloatNum", ":", "(", "idx", "+", "1", ")", "*", "graphics", ".", "VertexFloatNum", "]", ",", "float32", "(", "v", ".", "DstX", ")", ",", "float32", "(", "v", ".", "DstY", ")", ",", "v", ".", "SrcX", ",", "v", ".", "SrcY", ",", "float32", "(", "r", ".", "Min", ".", "X", ")", ",", "float32", "(", "r", ".", "Min", ".", "Y", ")", ",", "float32", "(", "r", ".", "Max", ".", "X", ")", ",", "float32", "(", "r", ".", "Max", ".", "Y", ")", ",", "v", ".", "ColorR", ",", "v", ".", "ColorG", ",", "v", ".", "ColorB", ",", "v", ".", "ColorA", ")", "\n", "}", "\n", "i", ".", "mipmap", ".", "original", "(", ")", ".", "DrawTriangles", "(", "img", ".", "mipmap", ".", "original", "(", ")", ",", "vs", ",", "indices", ",", "options", ".", "ColorM", ".", "impl", ",", "mode", ",", "filter", ",", "graphics", ".", "Address", "(", "options", ".", "Address", ")", ")", "\n", "i", ".", "disposeMipmaps", "(", ")", "\n", "}" ]
3,626
all-3627
[ "OfferingMessage", "returns", "new", "Offering", "message" ]
[ "func", "OfferingMessage", "(", "agent", "*", "data", ".", "Account", ",", "template", "*", "data", ".", "<mask>", ",", "offering", "*", "data", ".", "Offering", ")", "*", "Message", "{", "msg", ":=", "&", "Message", "{", "AgentPubKey", ":", "agent", ".", "PublicKey", ",", "TemplateHash", ":", "template", ".", "Hash", ",", "Country", ":", "offering", ".", "Country", ",", "ServiceSupply", ":", "offering", ".", "Supply", ",", "UnitName", ":", "offering", ".", "UnitName", ",", "UnitType", ":", "offering", ".", "UnitType", ",", "BillingType", ":", "offering", ".", "BillingType", ",", "SetupPrice", ":", "offering", ".", "SetupPrice", ",", "UnitPrice", ":", "offering", ".", "UnitPrice", ",", "MinUnits", ":", "offering", ".", "MinUnits", ",", "MaxUnit", ":", "offering", ".", "MaxUnit", ",", "BillingInterval", ":", "offering", ".", "BillingInterval", ",", "MaxBillingUnitLag", ":", "offering", ".", "MaxBillingUnitLag", ",", "MaxSuspendTime", ":", "offering", ".", "MaxSuspendTime", ",", "MaxInactiveTimeSec", ":", "offering", ".", "MaxInactiveTimeSec", ",", "FreeUnits", ":", "offering", ".", "FreeUnits", ",", "Nonce", ":", "offering", ".", "ID", ",", "ServiceSpecificParameters", ":", "offering", ".", "AdditionalParams", ",", "}", "\n", "return", "msg", "\n", "}" ]
3,627
all-3628
[ "GetListeners", "returns", "the", "socket", "-", "activated", "network", "listeners", "if", "any", ".", "The", "start", "parameter", "must", "be", "SystemdListenFDsStart", "except", "in", "unit", "tests", "see", "the", "docstring", "of", "SystemdListenFDsStart", "below", "." ]
[ "func", "GetListeners", "(", "start", "int", ")", "[", "]", "net", ".", "Listener", "{", "defer", "func", "(", ")", "{", "<mask>", ".", "Unsetenv", "(", "\"", "\"", ")", "\n", "os", ".", "Unsetenv", "(", "\"", "\"", ")", "\n", "}", "(", ")", "\n\n", "pid", ",", "err", ":=", "strconv", ".", "Atoi", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "pid", "!=", "os", ".", "Getpid", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "fds", ",", "err", ":=", "strconv", ".", "Atoi", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n\n", "listeners", ":=", "[", "]", "net", ".", "Listener", "{", "}", "\n\n", "for", "i", ":=", "start", ";", "i", "<", "start", "+", "fds", ";", "i", "++", "{", "syscall", ".", "CloseOnExec", "(", "i", ")", "\n\n", "file", ":=", "os", ".", "NewFile", "(", "uintptr", "(", "i", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "i", ")", ")", "\n", "listener", ",", "err", ":=", "net", ".", "FileListener", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n\n", "listeners", "=", "append", "(", "listeners", ",", "listener", ")", "\n", "}", "\n\n", "return", "listeners", "\n", "}" ]
3,628
all-3629
[ "Critf", "logs", "at", "the", "CRITICAL", "log", "level", "using", "a", "standard", "printf", "format", "string" ]
[ "func", "Critf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "if", "<mask>", "!=", "nil", "{", "Log", ".", "Crit", "(", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", ")", "\n", "}", "\n", "}" ]
3,629
all-3630
[ "GetManifest", "returns", "the", "image", "s", "manifest", "along", "with", "its", "MIME", "type", "(", "which", "may", "be", "empty", "when", "it", "can", "t", "be", "determined", "but", "the", "manifest", "is", "available", ")", ".", "It", "may", "use", "a", "remote", "(", "=", "slow", ")", "service", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ";", "this", "never", "happens", "if", "the", "primary", "manifest", "is", "not", "a", "manifest", "list", "(", "e", ".", "g", ".", "if", "the", "source", "never", "returns", "manifest", "lists", ")", "." ]
[ "func", "(", "s", "*", "dockerImageSource", ")", "GetManifest", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "byte", ",", "string", ",", "error", ")", "{", "if", "instanceDigest", "!=", "nil", "{", "return", "s", ".", "fetchManifest", "(", "ctx", ",", "instanceDigest", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "err", ":=", "s", ".", "ensureManifestIsLoaded", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "s", ".", "cachedManifest", ",", "s", ".", "cachedManifestMIMEType", ",", "nil", "\n", "}" ]
3,630
all-3631
[ "WithDepth", "the", "maximum", "depth", "at", "which", "children", "should", "be", "retrieved", "defaults", "to", "1", ".", "Use", "-", "1", "for", "the", "entire", "subtree", "or", "provide", "an", "integer", "larger", "than", "0", "." ]
[ "func", "(", "p", "DescribeNodeParams", ")", "WithDepth", "(", "<mask>", "int64", ")", "*", "DescribeNodeParams", "{", "p", ".", "Depth", "=", "depth", "\n", "return", "&", "p", "\n", "}" ]
3,631
all-3632
[ "RESTClient", "returns", "a", "RESTClient", "that", "is", "used", "to", "communicate", "with", "API", "server", "by", "this", "client", "implementation", "." ]
[ "func", "(", "c", "*", "ProwV1Client", ")", "RESTClient", "(", ")", "<mask>", ".", "Interface", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "c", ".", "restClient", "\n", "}" ]
3,632
all-3633
[ "===", "timestamp", "(", "Vector", "ValueTypeVector", ")", "Vector", "===" ]
[ "func", "funcTimestamp", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "vec", ":=", "vals", "[", "0", "]", ".", "(", "Vector", ")", "\n", "for", "_", ",", "el", ":=", "range", "vec", "{", "enh", ".", "out", "=", "<mask>", "(", "enh", ".", "out", ",", "Sample", "{", "Metric", ":", "enh", ".", "dropMetricName", "(", "el", ".", "Metric", ")", ",", "Point", ":", "Point", "{", "V", ":", "float64", "(", "el", ".", "T", ")", "/", "1000", "}", ",", "}", ")", "\n", "}", "\n", "return", "enh", ".", "out", "\n", "}" ]
3,633
all-3634
[ "Handle", "handles", "an", "incoming", "TChannel", "call", "and", "forwards", "it", "to", "the", "correct", "handler", "." ]
[ "func", "(", "s", "*", "Server", ")", "Handle", "(", "ctx", "context", ".", "Context", ",", "call", "*", "tchannel", ".", "InboundCall", ")", "{", "op", ":=", "<mask>", ".", "MethodString", "(", ")", "\n", "service", ",", "method", ",", "ok", ":=", "getServiceMethod", "(", "op", ")", "\n", "if", "!", "ok", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "op", ")", "\n", "}", "\n\n", "s", ".", "RLock", "(", ")", "\n", "handler", ",", "ok", ":=", "s", ".", "handlers", "[", "service", "]", "\n", "s", ".", "RUnlock", "(", ")", "\n", "if", "!", "ok", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "service", ")", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "handle", "(", "ctx", ",", "handler", ",", "method", ",", "call", ")", ";", "err", "!=", "nil", "{", "s", ".", "onError", "(", "call", ",", "err", ")", "\n", "}", "\n", "}" ]
3,634
all-3635
[ "DefaultLoader", "sets", "up", "and", "assigns", "the", "default", "loader", "to", "be", "used", "by", "Xslate", "." ]
[ "func", "DefaultLoader", "(", "tx", "*", "Xslate", ",", "args", "Args", ")", "error", "{", "var", "tmp", "interface", "{", "}", "\n\n", "tmp", ",", "ok", ":=", "args", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "ok", "{", "tmp", ",", "_", "=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "}", "\n", "cacheDir", ":=", "tmp", ".", "(", "string", ")", "\n\n", "tmp", ",", "ok", "=", "args", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "ok", "{", "cwd", ",", "_", ":=", "os", ".", "Getwd", "(", ")", "\n", "tmp", "=", "[", "]", "string", "{", "cwd", "}", "\n", "}", "\n", "paths", ":=", "tmp", ".", "(", "[", "]", "string", ")", "\n\n", "cache", ",", "err", ":=", "loader", ".", "NewFileCache", "(", "cacheDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "fetcher", ",", "err", ":=", "loader", ".", "NewFileTemplateFetcher", "(", "paths", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "tmp", ",", "ok", "=", "args", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "!", "ok", "{", "tmp", "=", "1", "\n", "}", "\n", "cacheLevel", ":=", "tmp", ".", "(", "int", ")", "\n", "tx", ".", "Loader", "=", "loader", ".", "NewCachedByteCodeLoader", "(", "<mask>", ",", "loader", ".", "CacheStrategy", "(", "cacheLevel", ")", ",", "fetcher", ",", "tx", ".", "Parser", ",", "tx", ".", "Compiler", ")", "\n", "return", "nil", "\n", "}" ]
3,635
all-3636
[ "GetStyleOk", "returns", "a", "tuple", "with", "the", "Style", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinition", ")", "GetStyleOk", "(", ")", "(", "Style", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Style", "==", "nil", "{", "return", "Style", "{", "}", ",", "<mask>", "\n", "}", "\n", "return", "*", "g", ".", "Style", ",", "true", "\n", "}" ]
3,636
all-3637
[ "FontButtonNewWithFont", "is", "a", "wrapper", "around", "gtk_font_button_new_with_font", "()", "." ]
[ "func", "FontButtonNewWithFont", "(", "fontname", "string", ")", "(", "*", "FontButton", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "fontname", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_font_button_new_with_font", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapFontButton", "(", "obj", ")", ",", "nil", "\n", "}" ]
3,637
all-3638
[ "return", "the", "address", "of", "the", "specified", "generic", "vertex", "attribute", "pointer" ]
[ "func", "GetVertexAttribPointerv", "(", "index", "uint32", ",", "pname", "uint32", ",", "pointer", "*", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall", "(", "gpGetVertexAttribPointerv", ",", "3", ",", "uintptr", "(", "index", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ")", "\n", "}" ]
3,638
all-3639
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GObject", "as", "a", "GtkEditable", "." ]
[ "func", "(", "v", "*", "Editable", ")", "native", "(", ")", "*", "C", ".", "GtkEditable", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkEditable", "(", "p", ")", "\n", "}" ]
3,639
all-3640
[ "MustEnvelope", "retrieves", "the", "Envelope", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "StellarMessage", ")", "MustEnvelope", "(", ")", "ScpEnvelope", "{", "val", ",", "ok", ":=", "u", ".", "GetEnvelope", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
3,640
all-3641
[ "DFSRecursion", "does", "depth", "-", "first", "search", "recursively", ".", "0", ".", "DFS", "(", "G", "v", ")", ":", "1", ".", "2", ".", "if", "v", "is", "visited", ":", "3", ".", "return", "4", ".", "5", ".", "label", "v", "as", "visited", "6", ".", "7", ".", "for", "each", "vertex", "u", "adjacent", "to", "v", ":", "8", ".", "9", ".", "if", "u", "is", "not", "visited", "yet", ":", "10", ".", "recursive", "DFS", "(", "G", "u", ")" ]
[ "func", "DFSRecursion", "(", "g", "Graph", ",", "id", "ID", ")", "[", "]", "ID", "{", "if", "_", ",", "err", ":=", "g", ".", "GetNode", "(", "id", ")", ";", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n\n", "visited", ":=", "make", "(", "<mask>", "[", "ID", "]", "bool", ")", "\n", "rs", ":=", "[", "]", "ID", "{", "}", "\n\n", "dfsRecursion", "(", "g", ",", "id", ",", "visited", ",", "&", "rs", ")", "\n\n", "return", "rs", "\n", "}" ]
3,641
all-3642
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "ISBN10", "." ]
[ "func", "(", "u", "*", "ISBN10", ")", "DeepCopy", "(", ")", "*", "ISBN10", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "ISBN10", ")", "\n", "u", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "<mask>", "\n", "}" ]
3,642
all-3643
[ "GetResourceByType", "gets", "a", "resource", "by", "type" ]
[ "func", "(", "c", "*", "Client", ")", "GetResourceByType", "(", "resourcetype", "string", ",", "resourceid", "string", ")", "(", "*", "Resource", ",", "error", ")", "{", "url", ":=", "umResourcesTypePath", "(", "resourcetype", ",", "resourceid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "<mask>", ":=", "&", "Resource", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
3,643
all-3644
[ "PTCAddress", "returns", "Privatix", "token", "contract", "address", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PTCAddress", "(", ")", "<mask>", ".", "Address", "{", "return", "common", ".", "HexToAddress", "(", "b", ".", "cfg", ".", "Contract", ".", "PTCAddrHex", ")", "\n", "}" ]
3,644
all-3645
[ "SeekFirst", "moves", "cursor", "to", "the", "start" ]
[ "func", "(", "it", "*", "Iterator", ")", "SeekFirst", "(", ")", "{", "it", ".", "prev", "=", "it", ".", "s", ".", "<mask>", "\n", "it", ".", "curr", ",", "_", "=", "it", ".", "s", ".", "head", ".", "getNext", "(", "0", ")", "\n", "it", ".", "valid", "=", "true", "\n", "}" ]
3,645
all-3646
[ "SetLongPolicy", "sets", "a", "ResourceData", "field", "depending", "on", "if", "a", "LongPolicy", "exists", "or", "not", ".", "The", "field", "is", "not", "set", "if", "it", "s", "nil", "." ]
[ "func", "SetLongPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "key", "string", ",", "val", "*", "<mask>", ".", "LongPolicy", ")", "error", "{", "if", "val", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "err", ":=", "d", ".", "Set", "(", "key", ",", "val", ".", "Value", ")", "\n", "return", "err", "\n", "}" ]
3,646
all-3647
[ "Name", "returns", "the", "command", "s", "name", ":", "the", "first", "word", "in", "the", "usage", "line", "." ]
[ "func", "(", "c", "*", "command", ")", "Name", "(", ")", "string", "{", "name", ":=", "c", ".", "UsageLine", "\n", "i", ":=", "strings", ".", "IndexRune", "(", "name", ",", "' '", ")", "\n", "if", "i", ">=", "0", "{", "name", "=", "name", "[", ":", "i", "]", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
3,647
all-3648
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "RecordMode", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
3,648
all-3649
[ "EditRepoHook", "updates", "an", "existing", "hook", "with", "new", "info", "(", "events", "/", "url", "/", "secret", ")", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "hooks", "/", "#edit", "-", "a", "-", "hook" ]
[ "func", "(", "c", "*", "Client", ")", "EditRepoHook", "(", "org", ",", "repo", "string", ",", "id", "int", ",", "req", "HookRequest", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "id", ")", "\n", "return", "c", ".", "editHook", "(", "org", ",", "&", "repo", ",", "<mask>", ",", "req", ")", "\n", "}" ]
3,649
all-3650
[ "dot", "returns", "the", "type", "of", "typ", ".", "name", "making", "its", "decision", "using", "the", "type", "information", "in", "cfg", "." ]
[ "func", "(", "typ", "*", "Type", ")", "dot", "(", "cfg", "*", "TypeConfig", ",", "name", "string", ")", "string", "{", "if", "typ", ".", "Field", "!=", "nil", "{", "if", "t", ":=", "typ", ".", "Field", "[", "name", "]", ";", "t", "!=", "\"", "\"", "{", "return", "t", "\n", "}", "\n", "}", "\n", "if", "typ", ".", "Method", "!=", "nil", "{", "if", "t", ":=", "typ", ".", "Method", "[", "name", "]", ";", "t", "!=", "\"", "\"", "{", "return", "t", "\n", "}", "\n", "}", "\n\n", "for", "_", ",", "e", ":=", "<mask>", "typ", ".", "Embed", "{", "etyp", ":=", "cfg", ".", "Type", "[", "e", "]", "\n", "if", "etyp", "!=", "nil", "{", "if", "t", ":=", "etyp", ".", "dot", "(", "cfg", ",", "name", ")", ";", "t", "!=", "\"", "\"", "{", "return", "t", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
3,650
all-3651
[ "Describe", "implements", "prometheus", ".", "Collector", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Describe", "(", "ch", "chan", "<-", "*", "prometheus", ".", "Desc", ")", "{", "ch", "<-", "c", ".", "ignoredSamples", ".", "Desc", "(", ")", "\n", "}" ]
3,651
all-3652
[ "Likes", "returns", "friends", "and", "a", "total", "count", "of", "users", "who", "have", "liked", "this", "venue", ".", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "likes" ]
[ "func", "(", "s", "*", "VenueService", ")", "Likes", "(", "id", "string", ")", "(", "*", "LikesResp", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "likes", ":=", "new", "(", "venueLikesResp", ")", "\n", "response", ":=", "<mask>", "(", "Response", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "id", "+", "\"", "\"", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "likes", ")", "\n", "}", "\n\n", "return", "&", "likes", ".", "Likes", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
3,652
all-3653
[ "expandHostNasVolumeSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostNasVolumeSpec", "." ]
[ "func", "expandHostNasVolumeSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "<mask>", ".", "HostNasVolumeSpec", "{", "obj", ":=", "&", "types", ".", "HostNasVolumeSpec", "{", "AccessMode", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "LocalPath", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "RemoteHost", ":", "structure", ".", "SliceInterfacesToStrings", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "[", "]", "interface", "{", "}", ")", ")", "[", "0", "]", ",", "RemoteHostNames", ":", "structure", ".", "SliceInterfacesToStrings", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "[", "]", "interface", "{", "}", ")", ")", ",", "RemotePath", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "SecurityType", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "Type", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n\n", "return", "obj", "\n", "}" ]
3,653
all-3654
[ "ListPeers", "returns", "a", "list", "of", "peers", "we", "are", "connected", "to", "in", "the", "given", "topic", "." ]
[ "func", "(", "p", "*", "PubSub", ")", "ListPeers", "(", "topic", "string", ")", "[", "]", "peer", ".", "ID", "{", "out", ":=", "make", "(", "chan", "[", "]", "peer", ".", "<mask>", ")", "\n", "p", ".", "getPeers", "<-", "&", "listPeerReq", "{", "resp", ":", "out", ",", "topic", ":", "topic", ",", "}", "\n", "return", "<-", "out", "\n", "}" ]
3,654
all-3655
[ "NewMockTaskEngineState", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockTaskEngineState", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockTaskEngineState", "{", "mock", ":=", "&", "MockTaskEngineState", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockTaskEngineStateMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
3,655
all-3656
[ "nextGUID", "returns", "the", "next", "free", "group", "id", "to", "use", "according", "to", "whether", "it", "is", "a", "system", "s", "group", "." ]
[ "func", "nextGUID", "(", "isSystem", "bool", ")", "(", "db", "*", "dbfile", ",", "gid", "int", ",", "err", "error", ")", "{", "loadConfig", "(", ")", "\n\n", "db", ",", "err", "=", "openDBFile", "(", "_GROUP_FILE", ",", "os", ".", "O_RDWR", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Seek to file half size.", "info", ",", "err", ":=", "db", ".", "file", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "db", ".", "close", "(", ")", "\n", "return", "nil", ",", "0", ",", "err", "\n", "}", "\n", "if", "_", ",", "err", "=", "db", ".", "file", ".", "Seek", "(", "info", ".", "Size", "(", ")", "/", "2", ",", "os", ".", "SEEK_SET", ")", ";", "err", "!=", "nil", "{", "db", ".", "<mask>", "(", ")", "\n", "return", "nil", ",", "0", ",", "err", "\n", "}", "\n", "// To starting to read from a new line", "if", "_", ",", "_", ",", "err", "=", "db", ".", "rd", ".", "ReadLine", "(", ")", ";", "err", "!=", "nil", "{", "db", ".", "close", "(", ")", "\n", "return", "nil", ",", "0", ",", "err", "\n", "}", "\n\n", "var", "minGid", ",", "maxGid", "int", "\n", "if", "isSystem", "{", "minGid", ",", "maxGid", "=", "config", ".", "login", ".", "SYS_GID_MIN", ",", "config", ".", "login", ".", "SYS_GID_MAX", "\n", "}", "else", "{", "minGid", ",", "maxGid", "=", "config", ".", "login", ".", "GID_MIN", ",", "config", ".", "login", ".", "GID_MAX", "\n", "}", "\n\n", "for", "{", "line", ",", "_", ",", "err", ":=", "db", ".", "rd", ".", "ReadLine", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n\n", "gr", ",", "err", ":=", "parseGroup", "(", "string", "(", "line", ")", ")", "\n", "if", "err", "!=", "nil", "{", "db", ".", "close", "(", ")", "\n", "return", "nil", ",", "0", ",", "err", "\n", "}", "\n", "if", "gr", ".", "GID", ">=", "minGid", "&&", "gr", ".", "GID", "<=", "maxGid", "{", "gid", "=", "gr", ".", "GID", "\n", "}", "\n", "}", "\n\n", "gid", "++", "\n", "if", "gid", "==", "maxGid", "{", "return", "nil", ",", "0", ",", "&", "IdRangeError", "{", "maxGid", ",", "isSystem", ",", "false", "}", "\n", "}", "\n", "return", "\n", "}" ]
3,656
all-3657
[ "WithWorldName", "an", "optional", "name", "which", "is", "reported", "in", "the", "Execution", "Context", "." ]
[ "func", "(", "p", "CreateIsolatedWorldParams", ")", "WithWorldName", "(", "worldName", "<mask>", ")", "*", "CreateIsolatedWorldParams", "{", "p", ".", "WorldName", "=", "worldName", "\n", "return", "&", "p", "\n", "}" ]
3,657
all-3658
[ "overrideCgroupParent", "updates", "hostconfig", "with", "cgroup", "parent", "when", "task", "cgroups", "are", "enabled" ]
[ "func", "(", "task", "*", "Task", ")", "overrideCgroupParent", "(", "hostConfig", "*", "dockercontainer", ".", "HostConfig", ")", "error", "{", "task", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "<mask>", ".", "lock", ".", "RUnlock", "(", ")", "\n", "if", "task", ".", "MemoryCPULimitsEnabled", "{", "cgroupRoot", ",", "err", ":=", "task", ".", "BuildCgroupRoot", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "task", ".", "Arn", ")", "\n", "}", "\n", "hostConfig", ".", "CgroupParent", "=", "cgroupRoot", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,658
all-3659
[ "parseExpr", "parses", "a", "single", "expression", "from", "the", "input", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "parseExpr", "(", ")", "(", "expr", "Expr", ",", "err", "error", ")", "{", "defer", "p", ".", "recover", "(", "&", "err", ")", "\n\n", "for", "p", ".", "peek", "(", ")", ".", "typ", "!=", "ItemEOF", "{", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemComment", "{", "continue", "\n", "}", "\n", "if", "expr", "!=", "nil", "{", "p", ".", "errorf", "(", "\"", "\"", ",", "p", ".", "lex", ".", "input", "[", "p", ".", "lex", ".", "lastPos", ":", "]", ")", "\n", "}", "\n", "expr", "=", "p", ".", "expr", "(", ")", "\n", "}", "\n\n", "if", "expr", "==", "nil", "{", "p", ".", "errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "\n", "}" ]
3,659
all-3660
[ "check", "if", "the", "rendering", "context", "has", "not", "been", "lost", "due", "to", "software", "or", "hardware", "issues" ]
[ "func", "GetGraphicsResetStatus", "(", ")", "uint32", "{", "<mask>", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpGetGraphicsResetStatus", ",", "0", ",", "0", ",", "0", ",", "0", ")", "\n", "return", "(", "uint32", ")", "(", "ret", ")", "\n", "}" ]
3,660
all-3661
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetFramesWithManifestsReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
3,661
all-3662
[ "HasMonitorId", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "HasMonitorId", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "MonitorId", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
3,662
all-3663
[ "ProfileUsedByRef", "returns", "entities", "used", "by", "profiles", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProfileUsedByRef", "(", "filter", "ProfileFilter", ")", "(", "map", "[", "string", "]", "map", "[", "string", "]", "[", "]", "string", ",", "error", ")", "{", "// Result slice.", "objects", ":=", "make", "(", "[", "]", "struct", "{", "Project", "string", "\n", "Name", "string", "\n", "Value", "string", "\n", "}", ",", "0", ")", "\n\n", "// Check which filter criteria are active.", "criteria", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "if", "filter", ".", "Project", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "<mask>", "\n", "}", "\n", "if", "filter", ".", "Name", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Name", "\n", "}", "\n\n", "// Pick the prepared statement and arguments to use based on active criteria.", "var", "stmt", "*", "sql", ".", "Stmt", "\n", "var", "args", "[", "]", "interface", "{", "}", "\n\n", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "&&", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileUsedByRefByProjectAndName", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Project", ",", "filter", ".", "Name", ",", "}", "\n", "}", "else", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileUsedByRefByProject", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Project", ",", "}", "\n", "}", "else", "{", "stmt", "=", "c", ".", "stmt", "(", "profileUsedByRef", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "\n\n", "// Dest function for scanning a row.", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "objects", "=", "append", "(", "objects", ",", "struct", "{", "Project", "string", "\n", "Name", "string", "\n", "Value", "string", "\n", "}", "{", "}", ")", "\n", "return", "[", "]", "interface", "{", "}", "{", "&", "objects", "[", "i", "]", ".", "Project", ",", "&", "objects", "[", "i", "]", ".", "Name", ",", "&", "objects", "[", "i", "]", ".", "Value", ",", "}", "\n", "}", "\n\n", "// Select.", "err", ":=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ",", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Build index by primary name.", "index", ":=", "map", "[", "string", "]", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n\n", "for", "_", ",", "object", ":=", "range", "objects", "{", "_", ",", "ok", ":=", "index", "[", "object", ".", "Project", "]", "\n", "if", "!", "ok", "{", "subIndex", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "index", "[", "object", ".", "Project", "]", "=", "subIndex", "\n", "}", "\n\n", "item", ",", "ok", ":=", "index", "[", "object", ".", "Project", "]", "[", "object", ".", "Name", "]", "\n", "if", "!", "ok", "{", "item", "=", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "index", "[", "object", ".", "Project", "]", "[", "object", ".", "Name", "]", "=", "append", "(", "item", ",", "object", ".", "Value", ")", "\n", "}", "\n\n", "return", "index", ",", "nil", "\n", "}" ]
3,663
all-3664
[ "NewKeepAliveListener", "returns", "a", "listener", "that", "listens", "on", "the", "given", "address", ".", "Be", "careful", "when", "wrap", "around", "KeepAliveListener", "with", "another", "Listener", "if", "TLSInfo", "is", "not", "nil", ".", "Some", "pkgs", "(", "like", "go", "/", "http", ")", "might", "expect", "Listener", "to", "return", "TLSConn", "type", "to", "start", "TLS", "handshake", ".", "http", ":", "//", "tldp", ".", "org", "/", "HOWTO", "/", "TCP", "-", "Keepalive", "-", "HOWTO", "/", "overview", ".", "html" ]
[ "func", "NewKeepAliveListener", "(", "l", "net", ".", "Listener", ",", "scheme", "string", ",", "tlscfg", "*", "tls", ".", "Config", ")", "(", "<mask>", ".", "Listener", ",", "error", ")", "{", "if", "scheme", "==", "\"", "\"", "{", "if", "tlscfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "newTLSKeepaliveListener", "(", "l", ",", "tlscfg", ")", ",", "nil", "\n", "}", "\n\n", "return", "&", "keepaliveListener", "{", "Listener", ":", "l", ",", "}", ",", "nil", "\n", "}" ]
3,664
all-3665
[ "server_cmd_path", "returns", "the", "string", "/", "datacenters", "/", "<dcid", ">", "/", "servers", "/", "<srvid", ">", "/", "<cmd", ">" ]
[ "func", "serverCommandPath", "(", "dcid", ",", "srvid", ",", "cmd", "<mask>", ")", "string", "{", "return", "serverPath", "(", "dcid", ",", "srvid", ")", "+", "slash", "(", "cmd", ")", "\n", "}" ]
3,665
all-3666
[ "Eval", "evaluates", "the", "rule", "and", "then", "overrides", "the", "metric", "names", "and", "labels", "accordingly", "." ]
[ "func", "(", "rule", "*", "RecordingRule", ")", "Eval", "(", "ctx", "context", ".", "Context", ",", "ts", "time", ".", "Time", ",", "query", "QueryFunc", ",", "_", "*", "url", ".", "URL", ")", "(", "promql", ".", "<mask>", ",", "error", ")", "{", "vector", ",", "err", ":=", "query", "(", "ctx", ",", "rule", ".", "vector", ".", "String", "(", ")", ",", "ts", ")", "\n", "if", "err", "!=", "nil", "{", "rule", ".", "SetHealth", "(", "HealthBad", ")", "\n", "rule", ".", "SetLastError", "(", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "// Override the metric name and labels.", "for", "i", ":=", "range", "vector", "{", "sample", ":=", "&", "vector", "[", "i", "]", "\n\n", "lb", ":=", "labels", ".", "NewBuilder", "(", "sample", ".", "Metric", ")", "\n\n", "lb", ".", "Set", "(", "labels", ".", "MetricName", ",", "rule", ".", "name", ")", "\n\n", "for", "_", ",", "l", ":=", "range", "rule", ".", "labels", "{", "if", "l", ".", "Value", "==", "\"", "\"", "{", "lb", ".", "Del", "(", "l", ".", "Name", ")", "\n", "}", "else", "{", "lb", ".", "Set", "(", "l", ".", "Name", ",", "l", ".", "Value", ")", "\n", "}", "\n", "}", "\n\n", "sample", ".", "Metric", "=", "lb", ".", "Labels", "(", ")", "\n", "}", "\n", "rule", ".", "SetHealth", "(", "HealthGood", ")", "\n", "rule", ".", "SetLastError", "(", "err", ")", "\n", "return", "vector", ",", "nil", "\n", "}" ]
3,666
all-3667
[ "Finalize", "ensures", "the", "configuration", "has", "no", "nil", "pointers", "and", "sets", "default", "values", "." ]
[ "func", "(", "c", "*", "TemplateConfigs", ")", "Finalize", "(", ")", "{", "if", "c", "==", "nil", "{", "*", "c", "=", "*", "DefaultTemplateConfigs", "(", ")", "\n", "}", "\n\n", "for", "_", ",", "t", ":=", "<mask>", "*", "c", "{", "t", ".", "Finalize", "(", ")", "\n", "}", "\n", "}" ]
3,667
all-3668
[ "If", "full", "is", "false", "exclude", "potentially", "large", "fields", "such", "as", "Objects", "and", "Children" ]
[ "func", "nodeToFileInfo", "(", "ci", "*", "pfs", ".", "CommitInfo", ",", "<mask>", "string", ",", "node", "*", "hashtree", ".", "NodeProto", ",", "full", "bool", ")", "*", "pfs", ".", "FileInfo", "{", "fileInfo", ":=", "&", "pfs", ".", "FileInfo", "{", "File", ":", "&", "pfs", ".", "File", "{", "Commit", ":", "ci", ".", "Commit", ",", "Path", ":", "path", ",", "}", ",", "SizeBytes", ":", "uint64", "(", "node", ".", "SubtreeSize", ")", ",", "Hash", ":", "node", ".", "Hash", ",", "Committed", ":", "ci", ".", "Finished", ",", "}", "\n", "if", "node", ".", "FileNode", "!=", "nil", "{", "fileInfo", ".", "FileType", "=", "pfs", ".", "FileType_FILE", "\n", "if", "full", "{", "fileInfo", ".", "Objects", "=", "node", ".", "FileNode", ".", "Objects", "\n", "fileInfo", ".", "BlockRefs", "=", "node", ".", "FileNode", ".", "BlockRefs", "\n", "}", "\n", "}", "else", "if", "node", ".", "DirNode", "!=", "nil", "{", "fileInfo", ".", "FileType", "=", "pfs", ".", "FileType_DIR", "\n", "if", "full", "{", "fileInfo", ".", "Children", "=", "node", ".", "DirNode", ".", "Children", "\n", "}", "\n", "}", "\n", "return", "fileInfo", "\n", "}" ]
3,668
all-3669
[ "WriteTo", "writes", "the", "peer", "s", "public", "key", "to", "w", "." ]
[ "func", "(", "p", "*", "Peer", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "var", "n_", "int", "\n", "wire", ".", "WriteString", "(", "p", ".", "Key", ",", "w", ",", "&", "n_", ",", "&", "err", ")", "\n", "n", "+=", "int64", "(", "n_", ")", "\n", "return", "\n", "}" ]
3,669
all-3670
[ "SetFormat", "sets", "the", "Format", "call", "option", "(", "as", "transport", "header", ")", "." ]
[ "func", "(", "cb", "*", "ContextBuilder", ")", "SetFormat", "(", "f", "Format", ")", "*", "ContextBuilder", "{", "if", "cb", ".", "CallOptions", "==", "nil", "{", "cb", ".", "CallOptions", "=", "<mask>", "(", "CallOptions", ")", "\n", "}", "\n", "cb", ".", "CallOptions", ".", "Format", "=", "f", "\n", "return", "cb", "\n", "}" ]
3,670
all-3671
[ "newElement", "creates", "and", "returns", "an", "element", "." ]
[ "func", "newElement", "(", "ln", "*", "line", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "(", "element", ",", "error", ")", "{", "var", "e", "element", "\n", "var", "err", "error", "\n\n", "switch", "{", "case", "<mask>", "!=", "nil", "&&", "parent", ".", "ContainPlainText", "(", ")", ":", "e", "=", "newPlainTextInner", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "parent", ".", "InsertBr", "(", ")", ",", "opts", ")", "\n", "case", "ln", ".", "isEmpty", "(", ")", ":", "e", "=", "newEmptyElement", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isComment", "(", ")", ":", "e", "=", "newComment", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHTMLComment", "(", ")", ":", "e", "=", "newHTMLComment", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethod", "(", ")", ":", "switch", "{", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameConditionalComment", ")", ":", "e", ",", "err", "=", "newHelperMethodConditionalComment", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameContent", ")", ":", "e", ",", "err", "=", "newHelperMethodContent", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameCSS", ")", ":", "e", "=", "newHelperMethodCSS", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameDoctype", ")", ":", "e", ",", "err", "=", "newHelperMethodDoctype", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameInclude", ")", ":", "e", ",", "err", "=", "newHelperMethodInclude", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameJavascript", ")", ":", "e", "=", "newHelperMethodJavascript", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isHelperMethodOf", "(", "helperMethodNameYield", ")", ":", "e", ",", "err", "=", "newHelperMethodYield", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "default", ":", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ln", ".", "fileName", "(", ")", ",", "ln", ".", "no", ")", "\n", "}", "\n", "case", "ln", ".", "isPlainText", "(", ")", ":", "e", "=", "newPlainText", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "case", "ln", ".", "isAction", "(", ")", ":", "e", "=", "newAction", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "default", ":", "e", ",", "err", "=", "newHTMLTag", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", "\n", "}", "\n\n", "return", "e", ",", "err", "\n", "}" ]
3,671
all-3672
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "DialogType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "DialogType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "DialogTypeAlert", ":", "*", "t", "=", "DialogTypeAlert", "\n", "<mask>", "DialogTypeConfirm", ":", "*", "t", "=", "DialogTypeConfirm", "\n", "case", "DialogTypePrompt", ":", "*", "t", "=", "DialogTypePrompt", "\n", "case", "DialogTypeBeforeunload", ":", "*", "t", "=", "DialogTypeBeforeunload", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
3,672
all-3673
[ "Do", "executes", "HeapProfiler", ".", "getHeapObjectId", "against", "the", "provided", "context", ".", "returns", ":", "heapSnapshotObjectID", "-", "Id", "of", "the", "heap", "snapshot", "object", "corresponding", "to", "the", "passed", "remote", "object", "id", "." ]
[ "func", "(", "p", "*", "GetHeapObjectIDParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "heapSnapshotObjectID", "HeapSnapshotObjectID", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetHeapObjectIDReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetHeapObjectID", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "HeapSnapshotObjectID", ",", "nil", "\n", "}" ]
3,673
all-3674
[ "GetReadOnly", "returns", "the", "ReadOnly", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Dashboard", ")", "GetReadOnly", "(", ")", "bool", "{", "if", "d", "==", "nil", "||", "d", ".", "ReadOnly", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "d", ".", "ReadOnly", "\n", "}" ]
3,674
all-3675
[ "Expanded", "expands", "the", "ref", "fields", "in", "the", "spec", "document", "and", "returns", "a", "new", "spec", "document" ]
[ "func", "(", "d", "*", "Document", ")", "Expanded", "(", "options", "...", "*", "spec", ".", "ExpandOptions", ")", "(", "*", "<mask>", ",", "error", ")", "{", "swspec", ":=", "new", "(", "spec", ".", "Swagger", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "d", ".", "raw", ",", "swspec", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "expandOptions", "*", "spec", ".", "ExpandOptions", "\n", "if", "len", "(", "options", ")", ">", "0", "{", "expandOptions", "=", "options", "[", "0", "]", "\n", "}", "else", "{", "expandOptions", "=", "&", "spec", ".", "ExpandOptions", "{", "RelativeBase", ":", "d", ".", "specFilePath", ",", "}", "\n", "}", "\n\n", "if", "err", ":=", "spec", ".", "ExpandSpec", "(", "swspec", ",", "expandOptions", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "dd", ":=", "&", "Document", "{", "Analyzer", ":", "analysis", ".", "New", "(", "swspec", ")", ",", "spec", ":", "swspec", ",", "specFilePath", ":", "d", ".", "specFilePath", ",", "schema", ":", "spec", ".", "MustLoadSwagger20Schema", "(", ")", ",", "raw", ":", "d", ".", "raw", ",", "origSpec", ":", "d", ".", "origSpec", ",", "}", "\n", "return", "dd", ",", "nil", "\n", "}" ]
3,675
all-3676
[ "Returns", "time", "in", "RightScale", "API", "supported", "format" ]
[ "func", "formatTime", "(", "tm", "time", ".", "Time", ")", "string", "{", "year", ",", "month", ",", "<mask>", ":=", "tm", ".", "Date", "(", ")", "\n", "return", "time", ".", "Date", "(", "year", ",", "month", ",", "date", ",", "0", ",", "0", ",", "0", ",", "0", ",", "time", ".", "UTC", ")", ".", "Format", "(", "\"", "\"", ")", "\n", "}" ]
3,676
all-3677
[ "bind", "a", "buffer", "to", "a", "vertex", "buffer", "bind", "point" ]
[ "func", "BindVertexBuffer", "(", "bindingindex", "uint32", ",", "buffer", "uint32", ",", "offset", "int", ",", "stride", "int32", ")", "{", "C", ".", "glowBindVertexBuffer", "(", "gpBindVertexBuffer", ",", "(", "C", ".", "GLuint", ")", "(", "bindingindex", ")", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "stride", ")", ")", "\n", "}" ]
3,677
all-3678
[ "Using", "the", "classic", "API", "posts", "a", "count", "to", "a", "stat", "at", "a", "specific", "time", "." ]
[ "func", "(", "r", "*", "BasicReporter", ")", "PostCountTime", "(", "statKey", ",", "userKey", "string", ",", "count", "int", ",", "timestamp", "int64", ")", "error", "{", "x", ":=", "newClassicStatCount", "(", "statKey", ",", "userKey", ",", "count", ")", "\n", "x", ".", "Timestamp", "=", "timestamp", "\n", "r", ".", "<mask>", "(", "x", ")", "\n", "return", "nil", "\n", "}" ]
3,678
all-3679
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventBindingCalled", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime36", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
3,679
all-3680
[ "Async", "converts", "a", "Check", "into", "an", "asynchronous", "check", "that", "runs", "in", "a", "background", "goroutine", "at", "a", "fixed", "interval", ".", "The", "check", "is", "called", "at", "a", "fixed", "rate", "not", "with", "a", "fixed", "delay", "between", "invocations", ".", "If", "your", "check", "takes", "longer", "than", "the", "interval", "to", "execute", "the", "next", "execution", "will", "happen", "immediately", ".", "Note", ":", "if", "you", "need", "to", "clean", "up", "the", "background", "goroutine", "use", "AsyncWithContext", "()", "." ]
[ "func", "Async", "(", "check", "Check", ",", "interval", "time", ".", "Duration", ")", "Check", "{", "return", "AsyncWithContext", "(", "<mask>", ".", "Background", "(", ")", ",", "check", ",", "interval", ")", "\n", "}" ]
3,680
all-3681
[ "Copy", "()", "is", "a", "wrapper", "around", "gtk_print_settings_copy", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "Copy", "(", ")", "(", "*", "PrintSettings", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_print_settings_copy", "(", "ps", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapPrintSettings", "(", "obj", ")", ",", "nil", "\n", "}" ]
3,681
all-3682
[ "RegexPath", "returns", "a", "handler", "that", "serves", "HTTP", "requests", "with", "the", "first", "match", "of", "the", "the", "given", "regex", "from", "the", "request", "URL", "s", "Path", "and", "invoking", "the", "handler", "h", ".", "RegexPath", "handles", "a", "request", "for", "a", "path", "that", "doesn", "t", "match", "by", "replying", "with", "an", "HTTP", "404", "not", "found", "error", "." ]
[ "func", "RegexPath", "(", "reg", "*", "regexp", ".", "Regexp", ",", "h", "http", ".", "Handler", ")", "<mask>", ".", "Handler", "{", "if", "reg", "==", "nil", "{", "return", "h", "\n", "}", "\n\n", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "matches", ":=", "reg", ".", "FindStringSubmatch", "(", "r", ".", "URL", ".", "Path", ")", "\n", "if", "len", "(", "matches", ")", ">", "1", "{", "r", ".", "URL", ".", "Path", "=", "matches", "[", "1", "]", "\n", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "else", "{", "http", ".", "NotFound", "(", "w", ",", "r", ")", "\n", "}", "\n", "}", ")", "\n", "}" ]
3,682
all-3683
[ "GetSnapshots", "returns", "the", "list", "of", "current", "live", "snapshots", "This", "API", "is", "mainly", "for", "debugging", "purpose" ]
[ "func", "(", "m", "*", "Nitro", ")", "GetSnapshots", "(", ")", "[", "]", "*", "Snapshot", "{", "<mask>", "snaps", "[", "]", "*", "Snapshot", "\n", "buf", ":=", "m", ".", "snapshots", ".", "MakeBuf", "(", ")", "\n", "defer", "m", ".", "snapshots", ".", "FreeBuf", "(", "buf", ")", "\n", "iter", ":=", "m", ".", "snapshots", ".", "NewIterator", "(", "CompareSnapshot", ",", "buf", ")", "\n", "iter", ".", "SeekFirst", "(", ")", "\n", "for", ";", "iter", ".", "Valid", "(", ")", ";", "iter", ".", "Next", "(", ")", "{", "snaps", "=", "append", "(", "snaps", ",", "(", "*", "Snapshot", ")", "(", "iter", ".", "Get", "(", ")", ")", ")", "\n", "}", "\n\n", "return", "snaps", "\n", "}" ]
3,683
all-3684
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "ScopeType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
3,684
all-3685
[ "raft", ".", "Node", "does", "not", "have", "locks", "in", "Raft", "package" ]
[ "func", "(", "r", "*", "raftNode", ")", "<mask>", "(", ")", "{", "r", ".", "tickMu", ".", "Lock", "(", ")", "\n", "r", ".", "Tick", "(", ")", "\n", "r", ".", "tickMu", ".", "Unlock", "(", ")", "\n", "}" ]
3,685
all-3686
[ "SetSentStatus", "safely", "sets", "the", "SentStatus", "of", "the", "task" ]
[ "func", "(", "task", "*", "Task", ")", "SetSentStatus", "(", "status", "apitaskstatus", ".", "TaskStatus", ")", "{", "task", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "task", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "task", ".", "SentStatusUnsafe", "=", "status", "\n", "}" ]
3,686
all-3687
[ "ReadFileToString", "reads", "the", "file", "at", "the", "provided", "path", "to", "a", "string", "." ]
[ "func", "ReadFileToString", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "f", ")", "\n", "scanner", ".", "Scan", "(", ")", "\n\n", "return", "scanner", ".", "<mask>", "(", ")", ",", "nil", "\n", "}" ]
3,687
all-3688
[ "ForceSave", "saves", "the", "given", "State", "to", "a", "file", ".", "It", "is", "an", "atomic", "operation", "on", "POSIX", "systems", "(", "by", "Renaming", "over", "the", "target", "file", ")", ".", "This", "function", "logs", "errors", "at", "will", "and", "does", "not", "necessarily", "expect", "the", "caller", "to", "handle", "the", "error", "because", "there", "s", "little", "a", "caller", "can", "do", "in", "general", "other", "than", "just", "keep", "going", ".", "In", "addition", "the", "StateManager", "internally", "buffers", "save", "requests", "in", "order", "to", "only", "save", "at", "most", "every", "STATE_SAVE_INTERVAL", "." ]
[ "func", "(", "manager", "*", "basicStateManager", ")", "ForceSave", "(", ")", "error", "{", "manager", ".", "savingLock", ".", "Lock", "(", ")", "\n", "defer", "manager", ".", "savingLock", ".", "Unlock", "(", ")", "\n", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "s", ":=", "manager", ".", "state", "\n", "s", ".", "Version", "=", "ECSDataVersion", "\n\n", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "return", "manager", ".", "writeFile", "(", "<mask>", ")", "\n", "}" ]
3,688
all-3689
[ "Infom", "executes", "the", "same", "function", "on", "the", "default", "Base", "instance" ]
[ "func", "Infom", "(", "m", "*", "Attrs", ",", "<mask>", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "curDefault", ".", "Infom", "(", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
3,689
all-3690
[ "Find", "the", "price", "in", "the", "given", "package", "that", "has", "the", "specified", "category" ]
[ "func", "FindPerformancePrice", "(", "productPackage", "datatypes", ".", "Product_Package", ",", "priceCategory", "string", ")", "(", "datatypes", ".", "Product_Item_Price", ",", "error", ")", "{", "for", "_", ",", "item", ":=", "range", "productPackage", ".", "Items", "{", "for", "_", ",", "price", ":=", "range", "<mask>", ".", "Prices", "{", "// Only collect prices from valid location groups.", "if", "price", ".", "LocationGroupId", "!=", "nil", "{", "continue", "\n", "}", "\n", "if", "!", "hasCategory", "(", "price", ".", "Categories", ",", "priceCategory", ")", "{", "continue", "\n", "}", "\n", "return", "price", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "datatypes", ".", "Product_Item_Price", "{", "}", ",", "bosherr", ".", "Error", "(", "\"", "\"", ")", "\n", "}" ]
3,690
all-3691
[ "VisibleArea", "returns", "which", "rows", "and", "columns", "are", "currently", "visible", ".", "It", "can", "be", "used", "instead", "of", "OnBeforeDraw", "event", "to", "prepare", "the", "data", "for", "drawing", "without", "waiting", "until", "TableView", "starts", "drawing", "itself", ".", "It", "can", "be", "useful", "in", "case", "of", "you", "update", "your", "database", "so", "at", "the", "same", "moment", "you", "can", "request", "the", "visible", "area", "and", "update", "database", "cache", "-", "it", "can", "improve", "performance", ".", "Returns", ":", "*", "firstCol", "-", "first", "visible", "column", "*", "firstRow", "-", "first", "visible", "row", "*", "colCount", "-", "the", "number", "of", "visible", "columns", "*", "rowCount", "-", "the", "number", "of", "visible", "rows" ]
[ "func", "(", "l", "*", "TableView", ")", "VisibleArea", "(", ")", "(", "firstCol", ",", "firstRow", ",", "colCount", ",", "rowCount", "int", ")", "{", "firstRow", "=", "l", ".", "topRow", "\n", "maxDy", ":=", "l", ".", "height", "-", "3", "\n", "if", "firstRow", "+", "maxDy", "<", "l", ".", "rowCount", "{", "rowCount", "=", "maxDy", "\n", "}", "else", "{", "rowCount", "=", "l", ".", "rowCount", "-", "l", ".", "topRow", "\n", "}", "\n\n", "total", ":=", "l", ".", "width", "-", "1", "\n", "if", "l", ".", "showRowNo", "{", "total", "-=", "l", ".", "counterWidth", "(", ")", "\n", "if", "l", ".", "showVLines", "{", "total", "--", "\n", "}", "\n", "}", "\n\n", "colNo", ":=", "l", ".", "topCol", "\n", "colCount", "=", "0", "\n", "for", "colNo", "<", "len", "(", "l", ".", "columns", ")", "&&", "<mask>", ">", "0", "{", "w", ":=", "l", ".", "columns", "[", "colNo", "]", ".", "Width", "\n", "total", "-=", "w", "\n", "colNo", "++", "\n", "colCount", "++", "\n", "}", "\n\n", "return", "l", ".", "topCol", ",", "l", ".", "topRow", ",", "colCount", ",", "rowCount", "\n", "}" ]
3,691
all-3692
[ "UserId", "is", "an", "adaption", "from", "https", ":", "//", "codereview", ".", "appspot", ".", "com", "/", "4589049", "." ]
[ "func", "UserId", "(", "name", "string", ")", "(", "int", ",", "error", ")", "{", "var", "pw", "C", ".", "struct_passwd", "\n", "var", "result", "*", "C", ".", "struct_passwd", "\n\n", "bufSize", ":=", "C", ".", "sysconf", "(", "C", ".", "_SC_GETPW_R_SIZE_MAX", ")", "\n", "if", "bufSize", "<", "0", "{", "bufSize", "=", "4096", "\n", "}", "\n\n", "buf", ":=", "C", ".", "malloc", "(", "C", ".", "size_t", "(", "bufSize", ")", ")", "\n", "if", "buf", "==", "nil", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "defer", "C", ".", "free", "(", "buf", ")", "\n\n", "cname", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cname", ")", ")", "\n\n", "again", ":", "rv", ",", "errno", ":=", "C", ".", "getpwnam_r", "(", "cname", ",", "&", "pw", ",", "(", "*", "C", ".", "char", ")", "(", "buf", ")", ",", "C", ".", "size_t", "(", "bufSize", ")", ",", "&", "result", ")", "\n", "if", "rv", "<", "0", "{", "// OOM killer will take care of us if we end up doing this too", "// often.", "if", "errno", "==", "syscall", ".", "ERANGE", "{", "bufSize", "*=", "2", "\n", "tmp", ":=", "C", ".", "realloc", "(", "buf", ",", "C", ".", "size_t", "(", "bufSize", ")", ")", "\n", "if", "tmp", "==", "nil", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "buf", "=", "tmp", "\n", "goto", "again", "\n", "}", "\n", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "syscall", ".", "Errno", "(", "rv", ")", ")", "\n", "}", "\n\n", "if", "result", "==", "nil", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "return", "int", "(", "C", ".", "int", "(", "<mask>", ".", "pw_uid", ")", ")", ",", "nil", "\n", "}" ]
3,692
all-3693
[ "Match", "is", "labeled", "with", "label" ]
[ "func", "(", "l", "LabelEvent", ")", "Match", "(", "eventName", ",", "label", "string", ")", "bool", "{", "return", "eventName", "==", "\"", "\"", "&&", "label", "==", "l", ".", "<mask>", "\n", "}" ]
3,693
all-3694
[ "/", "*", "Start", "starts", "the", "passed", "-", "in", "*", "exec", ".", "Cmd", "command", ".", "It", "wraps", "the", "command", "in", "a", "*", "gexec", ".", "Session", "." ]
[ "func", "Start", "(", "command", "*", "exec", ".", "Cmd", ",", "outWriter", "io", ".", "Writer", ",", "errWriter", "io", ".", "Writer", ")", "(", "*", "Session", ",", "error", ")", "{", "exited", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "<mask>", ":=", "&", "Session", "{", "Command", ":", "command", ",", "Out", ":", "gbytes", ".", "NewBuffer", "(", ")", ",", "Err", ":", "gbytes", ".", "NewBuffer", "(", ")", ",", "Exited", ":", "exited", ",", "lock", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "exitCode", ":", "-", "1", ",", "}", "\n\n", "var", "commandOut", ",", "commandErr", "io", ".", "Writer", "\n\n", "commandOut", ",", "commandErr", "=", "session", ".", "Out", ",", "session", ".", "Err", "\n\n", "if", "outWriter", "!=", "nil", "{", "commandOut", "=", "io", ".", "MultiWriter", "(", "commandOut", ",", "outWriter", ")", "\n", "}", "\n\n", "if", "errWriter", "!=", "nil", "{", "commandErr", "=", "io", ".", "MultiWriter", "(", "commandErr", ",", "errWriter", ")", "\n", "}", "\n\n", "command", ".", "Stdout", "=", "commandOut", "\n", "command", ".", "Stderr", "=", "commandErr", "\n\n", "err", ":=", "command", ".", "Start", "(", ")", "\n", "if", "err", "==", "nil", "{", "go", "session", ".", "monitorForExit", "(", "exited", ")", "\n", "trackedSessionsMutex", ".", "Lock", "(", ")", "\n", "defer", "trackedSessionsMutex", ".", "Unlock", "(", ")", "\n", "trackedSessions", "=", "append", "(", "trackedSessions", ",", "session", ")", "\n", "}", "\n\n", "return", "session", ",", "err", "\n", "}" ]
3,694
all-3695
[ "UnmarshalText", "implements", "encoding", ".", "TextUnmarshaler", ".", "It", "will", "unmarshal", "to", "a", "null", "Float", "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", "(", "f", "*", "<mask>", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "str", ":=", "string", "(", "text", ")", "\n", "if", "str", "==", "\"", "\"", "||", "str", "==", "\"", "\"", "{", "f", ".", "Valid", "=", "false", "\n", "return", "nil", "\n", "}", "\n", "var", "err", "error", "\n", "f", ".", "Float64", ",", "err", "=", "strconv", ".", "ParseFloat", "(", "string", "(", "text", ")", ",", "64", ")", "\n", "f", ".", "Valid", "=", "err", "==", "nil", "\n", "return", "err", "\n", "}" ]
3,695
all-3696
[ "AlertingRules", "returns", "the", "list", "of", "the", "manager", "s", "alerting", "rules", "." ]
[ "func", "(", "m", "*", "Manager", ")", "AlertingRules", "(", ")", "[", "]", "*", "AlertingRule", "{", "m", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "m", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "alerts", ":=", "[", "]", "*", "AlertingRule", "{", "}", "\n", "for", "_", ",", "rule", ":=", "range", "m", ".", "Rules", "(", ")", "{", "if", "alertingRule", ",", "ok", ":=", "<mask>", ".", "(", "*", "AlertingRule", ")", ";", "ok", "{", "alerts", "=", "append", "(", "alerts", ",", "alertingRule", ")", "\n", "}", "\n", "}", "\n", "return", "alerts", "\n", "}" ]
3,696
all-3697
[ "/", "*", "Set", "transaction", "category", "name", "e", ".", "g", ".", "Uri", "in", "WebTransaction", "/", "Uri", "/", "<txn_name", ">" ]
[ "func", "TransactionSetCategory", "(", "<mask>", "int64", ",", "category", "string", ")", "(", "int", ",", "error", ")", "{", "ccategory", ":=", "C", ".", "CString", "(", "category", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "ccategory", ")", ")", "\n", "return", "errNo", "(", "C", ".", "newrelic_transaction_set_category", "(", "C", ".", "long", "(", "id", ")", ",", "ccategory", ")", ")", "\n", "}" ]
3,697
all-3698
[ "Servers", "returns", "the", "servers", "that", "are", "currently", "part", "of", "the", "cluster", ".", "If", "this", "raft", "instance", "is", "not", "the", "leader", "an", "error", "is", "returned", "." ]
[ "func", "(", "i", "*", "raftInstance", ")", "Servers", "(", ")", "(", "[", "]", "raft", ".", "Server", ",", "error", ")", "{", "if", "i", ".", "raft", ".", "State", "(", ")", "!=", "raft", ".", "Leader", "{", "return", "nil", ",", "raft", ".", "ErrNotLeader", "\n", "}", "\n", "<mask>", ":=", "i", ".", "raft", ".", "GetConfiguration", "(", ")", "\n", "err", ":=", "future", ".", "Error", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "configuration", ":=", "future", ".", "Configuration", "(", ")", "\n", "return", "configuration", ".", "Servers", ",", "nil", "\n", "}" ]
3,698
all-3699
[ "Encode", "bits", "of", "64", "-", "bit", "word", "into", "a", "string", "." ]
[ "func", "(", "e", "*", "encoding", ")", "Encode", "(", "x", "uint64", ")", "string", "{", "b", ":=", "[", "12", "]", "<mask>", "{", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "12", ";", "i", "++", "{", "b", "[", "11", "-", "i", "]", "=", "e", ".", "encode", "[", "x", "&", "0x1f", "]", "\n", "x", ">>=", "5", "\n", "}", "\n", "return", "string", "(", "b", "[", ":", "]", ")", "\n", "}" ]
3,699
all-3700
[ "NewClient", "returns", "a", "worker", "client", "for", "the", "worker", "at", "the", "IP", "address", "passed", "in", "." ]
[ "func", "NewClient", "(", "address", "string", ")", "(", "Client", ",", "error", ")", "{", "port", ",", "err", ":=", "strconv", ".", "Atoi", "(", "os", ".", "Getenv", "(", "client", ".", "PPSWorkerPortEnv", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Client", "{", "}", ",", "err", "\n", "}", "\n", "<mask>", ",", "err", ":=", "grpc", ".", "Dial", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "address", ",", "port", ")", ",", "append", "(", "client", ".", "DefaultDialOptions", "(", ")", ",", "grpc", ".", "WithInsecure", "(", ")", ")", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Client", "{", "}", ",", "err", "\n", "}", "\n", "return", "newClient", "(", "conn", ")", ",", "nil", "\n", "}" ]