id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
6,300
all-6301
[ "SavedRestSessionOrNew", "either", "loads", "a", "saved", "REST", "session", "from", "disk", "or", "creates", "a", "new", "one", "." ]
[ "func", "(", "c", "*", "Config", ")", "SavedRestSessionOrNew", "(", "u", "*", "url", ".", "URL", ")", "(", "*", "tags", ".", "RestClient", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "defaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "client", ",", "valid", ",", "err", ":=", "c", ".", "LoadRestClient", "(", "ctx", ",", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "!", "valid", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "c", ".", "VSphereServer", ")", "\n", "if", "err", ":=", "client", ".", "Login", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "<mask>", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "client", ",", "nil", "\n", "}" ]
6,301
all-6302
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ReleaseObjectGroupParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,302
all-6303
[ "UnmarshalText", "validates", "the", "text", "is", "a", "valid", "string" ]
[ "func", "(", "l", "*", "RepoPermissionLevel", ")", "UnmarshalText", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "v", ":=", "RepoPermissionLevel", "(", "text", ")", "\n", "if", "_", ",", "ok", ":=", "repoPermissionLevels", "[", "v", "]", ";", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ",", "repoPermissionLevels", ")", "\n", "}", "\n", "*", "l", "=", "v", "\n", "return", "nil", "\n", "}" ]
6,303
all-6304
[ "Close", "closes", "the", "underlying", "connection", "." ]
[ "func", "(", "cs", "*", "clientServer", ")", "Close", "(", ")", "error", "{", "if", "cs", ".", "publishTicker", "!=", "nil", "{", "cs", ".", "publishTicker", ".", "Stop", "(", ")", "\n", "}", "\n", "if", "cs", ".", "publishHealthTicker", "!=", "nil", "{", "cs", ".", "publishHealthTicker", ".", "Stop", "(", ")", "\n", "}", "\n\n", "cs", ".", "cancel", "(", ")", "\n", "return", "<mask>", ".", "Disconnect", "(", ")", "\n", "}" ]
6,304
all-6305
[ "Execute", "-", "enables", "/", "disables", "service", "access" ]
[ "func", "(", "c", "*", "ServiceAccessCommand", ")", "Execute", "(", "[", "]", "string", ")", "error", "{", "var", "cfMgmt", "*", "CFMgmt", "\n", "<mask>", "err", "error", "\n", "if", "cfMgmt", ",", "err", "=", "InitializePeekManagers", "(", "c", ".", "BaseCFConfigCommand", ",", "c", ".", "Peek", ")", ";", "err", "==", "nil", "{", "err", "=", "cfMgmt", ".", "ServiceAccessManager", ".", "Apply", "(", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
6,305
all-6306
[ "Bucket", "retrieves", "a", "nested", "bucket", "by", "name", ".", "Returns", "nil", "if", "the", "bucket", "does", "not", "exist", ".", "The", "bucket", "instance", "is", "only", "valid", "for", "the", "lifetime", "of", "the", "transaction", ".", "folders", "can", "be", "empty", "in", "which", "case", "the", "b", "itself", "is", "sent", "to", "f", "." ]
[ "func", "(", "b", "Bucket", ")", "OpenBucket", "(", "folders", "[", "]", "[", "]", "byte", ",", "f", "func", "(", "Bucket", ")", "error", ")", "error", "{", "bb", ":=", "b", ".", "Bucket", "\n", "for", "_", ",", "fld", ":=", "<mask>", "folders", "{", "bb", "=", "bb", ".", "Bucket", "(", "fld", ")", "\n", "if", "bb", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "errorsp", ".", "WithStacks", "(", "f", "(", "Bucket", "{", "bb", "}", ")", ")", "\n", "}" ]
6,306
all-6307
[ "Routes", "calculates", "the", "routing", "table", "from", "this", "peer", "to", "all", "peers", "reachable", "from", "it", "returning", "a", "next", "hop", "map", "of", "PeerNameX", "-", ">", "PeerNameY", "which", "says", "in", "order", "to", "send", "a", "message", "to", "X", "the", "peer", "should", "send", "the", "message", "to", "its", "neighbour", "Y", ".", "Because", "currently", "we", "do", "not", "have", "weightings", "on", "the", "connections", "between", "peers", "there", "is", "no", "need", "to", "use", "a", "minimum", "spanning", "tree", "algorithm", ".", "Instead", "we", "employ", "the", "simpler", "and", "cheaper", "breadth", "-", "first", "widening", ".", "The", "computation", "is", "deterministic", "which", "ensures", "that", "when", "it", "is", "performed", "on", "the", "same", "data", "by", "different", "peers", "they", "get", "the", "same", "result", ".", "This", "is", "important", "since", "otherwise", "we", "risk", "message", "loss", "or", "routing", "cycles", ".", "When", "the", "establishedAndSymmetric", "flag", "is", "set", "only", "connections", "that", "are", "marked", "as", "established", "and", "are", "symmetric", "(", "i", ".", "e", ".", "where", "both", "sides", "indicate", "they", "have", "a", "connection", "to", "the", "other", ")", "are", "considered", ".", "When", "a", "non", "-", "nil", "stopAt", "peer", "is", "supplied", "the", "widening", "stops", "when", "it", "reaches", "that", "peer", ".", "The", "boolean", "return", "indicates", "whether", "that", "has", "happened", ".", "NB", ":", "This", "function", "should", "generally", "be", "invoked", "while", "holding", "a", "read", "lock", "on", "Peers", "and", "LocalPeer", "." ]
[ "func", "(", "<mask>", "*", "Peer", ")", "routes", "(", "stopAt", "*", "Peer", ",", "establishedAndSymmetric", "bool", ")", "(", "bool", ",", "map", "[", "PeerName", "]", "PeerName", ")", "{", "routes", ":=", "make", "(", "unicastRoutes", ")", "\n", "routes", "[", "peer", ".", "Name", "]", "=", "UnknownPeerName", "\n", "nextWorklist", ":=", "[", "]", "*", "Peer", "{", "peer", "}", "\n", "for", "len", "(", "nextWorklist", ")", ">", "0", "{", "worklist", ":=", "nextWorklist", "\n", "sort", ".", "Sort", "(", "listOfPeers", "(", "worklist", ")", ")", "\n", "nextWorklist", "=", "[", "]", "*", "Peer", "{", "}", "\n", "for", "_", ",", "curPeer", ":=", "range", "worklist", "{", "if", "curPeer", "==", "stopAt", "{", "return", "true", ",", "routes", "\n", "}", "\n", "curPeer", ".", "forEachConnectedPeer", "(", "establishedAndSymmetric", ",", "routes", ",", "func", "(", "remotePeer", "*", "Peer", ")", "{", "nextWorklist", "=", "append", "(", "nextWorklist", ",", "remotePeer", ")", "\n", "remoteName", ":=", "remotePeer", ".", "Name", "\n", "// We now know how to get to remoteName: the same", "// way we get to curPeer. Except, if curPeer is", "// the starting peer in which case we know we can", "// reach remoteName directly.", "if", "curPeer", "==", "peer", "{", "routes", "[", "remoteName", "]", "=", "remoteName", "\n", "}", "else", "{", "routes", "[", "remoteName", "]", "=", "routes", "[", "curPeer", ".", "Name", "]", "\n", "}", "\n", "}", ")", "\n", "}", "\n", "}", "\n", "return", "false", ",", "routes", "\n", "}" ]
6,307
all-6308
[ "GetPrecisionOk", "returns", "a", "tuple", "with", "the", "Precision", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertValueDefinition", ")", "GetPrecisionOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "Precision", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "Precision", ",", "<mask>", "\n", "}" ]
6,308
all-6309
[ "LuaToGo", "converts", "the", "Lua", "value", "at", "index", "idx", "to", "the", "Go", "value", ".", "The", "Go", "value", "must", "be", "a", "non", "-", "nil", "pointer", ".", "Conversions", "to", "strings", "and", "numbers", "are", "straightforward", ".", "Lua", "nil", "is", "converted", "to", "the", "zero", "value", "of", "the", "specified", "Go", "value", ".", "If", "the", "Lua", "value", "is", "non", "-", "nil", "pointers", "are", "dereferenced", "(", "multiple", "times", "if", "required", ")", "and", "the", "pointed", "value", "is", "the", "one", "that", "is", "set", ".", "If", "nil", "then", "the", "Go", "pointer", "is", "set", "to", "nil", ".", "To", "set", "a", "pointer", "s", "value", "to", "its", "zero", "value", "use", "luar", ".", "null", ".", "The", "Go", "value", "can", "be", "an", "interface", "in", "which", "case", "the", "type", "is", "inferred", ".", "When", "converting", "a", "table", "to", "an", "interface", "the", "Go", "value", "is", "a", "[]", "interface", "{}", "slice", "if", "all", "its", "elements", "are", "indexed", "consecutively", "from", "1", "or", "a", "map", "[", "string", "]", "interface", "{}", "otherwise", ".", "Existing", "entries", "in", "maps", "and", "structs", "are", "kept", ".", "Arrays", "and", "slices", "are", "reset", ".", "Nil", "maps", "and", "slices", "are", "automatically", "allocated", ".", "Proxies", "are", "unwrapped", "to", "the", "Go", "value", "if", "convertible", ".", "If", "both", "the", "proxy", "and", "the", "Go", "value", "are", "pointers", "then", "the", "Go", "pointer", "will", "be", "set", "to", "the", "proxy", "pointer", ".", "Userdata", "that", "is", "not", "a", "proxy", "will", "be", "converted", "to", "a", "LuaObject", "if", "the", "Go", "value", "is", "an", "interface", "or", "a", "LuaObject", "." ]
[ "func", "LuaToGo", "(", "L", "*", "lua", ".", "State", ",", "idx", "int", ",", "a", "interface", "{", "}", ")", "error", "{", "// LuaToGo should not pop the Lua stack to be consistent with L.ToString(), etc.", "// It is also easier in practice when we want to keep working with the value on stack.", "v", ":=", "reflect", ".", "ValueOf", "(", "a", ")", "\n", "// TODO: Test interfaces with methods.", "// TODO: Allow unreferenced map? encoding/json does not do it.", "if", "v", ".", "Kind", "(", ")", "!=", "reflect", ".", "Ptr", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "v", ".", "IsNil", "(", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "v", "=", "v", ".", "Elem", "(", ")", "\n", "// If the Lua value is 'nil' and the Go value is a pointer, nullify the pointer.", "if", "v", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "&&", "L", ".", "IsNil", "(", "idx", ")", "{", "v", ".", "Set", "(", "reflect", ".", "Zero", "(", "v", ".", "Type", "(", ")", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "return", "luaToGo", "(", "L", ",", "idx", ",", "v", ",", "<mask>", "[", "uintptr", "]", "reflect", ".", "Value", "{", "}", ")", "\n", "}" ]
6,309
all-6310
[ "UpdateLabel", "provides", "a", "wrapper", "around", "the", "UpdateLabel", "data", "objects" ]
[ "func", "UpdateLabel", "(", "ctx", "context", ".", "Context", ",", "m", "*", "license", ".", "<mask>", ",", "licenseKey", "string", ",", "key", "string", ",", "val", "string", ")", "error", "{", "req", ":=", "types", ".", "UpdateLicenseLabel", "{", "This", ":", "m", ".", "Reference", "(", ")", ",", "LicenseKey", ":", "licenseKey", ",", "LabelKey", ":", "key", ",", "LabelValue", ":", "val", ",", "}", "\n\n", "_", ",", "err", ":=", "methods", ".", "UpdateLicenseLabel", "(", "ctx", ",", "m", ".", "Client", "(", ")", ",", "&", "req", ")", "\n", "return", "err", "\n", "}" ]
6,310
all-6311
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "OperationResultCode", ")", "<mask>", "(", ")", "string", "{", "name", ",", "_", ":=", "operationResultCodeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
6,311
all-6312
[ "ListPrefix", "returns", "keys", "(", "and", "values", ")", "that", "begin", "with", "prefix", "f", "will", "be", "called", "with", "each", "key", "val", "will", "contain", "the", "value", "for", "the", "key", ".", "You", "can", "break", "out", "of", "iteration", "by", "returning", "errutil", ".", "ErrBreak", "." ]
[ "func", "(", "c", "*", "readonlyCollection", ")", "ListPrefix", "(", "prefix", "string", ",", "val", "proto", ".", "Message", ",", "opts", "*", "Options", ",", "f", "func", "(", "string", ")", "error", ")", "error", "{", "queryPrefix", ":=", "c", ".", "prefix", "\n", "if", "<mask>", "!=", "\"", "\"", "{", "// If we always call join, we'll get rid of the trailing slash we need", "// on the root c.prefix", "queryPrefix", "=", "filepath", ".", "Join", "(", "c", ".", "prefix", ",", "prefix", ")", "\n", "}", "\n", "return", "c", ".", "list", "(", "queryPrefix", ",", "&", "c", ".", "limit", ",", "opts", ",", "func", "(", "kv", "*", "mvccpb", ".", "KeyValue", ")", "error", "{", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "kv", ".", "Value", ",", "val", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "f", "(", "strings", ".", "TrimPrefix", "(", "string", "(", "kv", ".", "Key", ")", ",", "queryPrefix", ")", ")", "\n", "}", ")", "\n", "}" ]
6,312
all-6313
[ "Match", "checks", "whether", "a", "domain", "can", "be", "found", "in", "the", "DomainFilter", "." ]
[ "func", "(", "df", "DomainFilter", ")", "Match", "(", "domain", "string", ")", "bool", "{", "// return always true, if not filter is specified", "if", "len", "(", "df", ".", "filters", ")", "==", "0", "{", "return", "true", "\n", "}", "\n\n", "for", "_", ",", "filter", ":=", "range", "df", ".", "filters", "{", "strippedDomain", ":=", "strings", ".", "TrimSuffix", "(", "domain", ",", "\"", "\"", ")", "\n\n", "if", "filter", "==", "\"", "\"", "{", "return", "true", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "filter", ",", "\"", "\"", ")", "&&", "strings", ".", "HasSuffix", "(", "strippedDomain", ",", "filter", ")", "{", "return", "true", "\n", "}", "else", "if", "strings", ".", "Count", "(", "strippedDomain", ",", "\"", "\"", ")", "==", "strings", ".", "Count", "(", "filter", ",", "\"", "\"", ")", "{", "if", "strippedDomain", "==", "<mask>", "{", "return", "true", "\n", "}", "\n", "}", "else", "if", "strings", ".", "HasSuffix", "(", "strippedDomain", ",", "\"", "\"", "+", "filter", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,313
all-6314
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetOuterHTMLParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom37", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,314
all-6315
[ "cond", "emits", "to", "fn", "code", "to", "evaluate", "boolean", "condition", "e", "and", "jump", "to", "t", "or", "f", "depending", "on", "its", "value", "performing", "various", "simplifications", ".", "Postcondition", ":", "fn", ".", "currentBlock", "is", "nil", "." ]
[ "func", "(", "b", "*", "builder", ")", "cond", "(", "fn", "*", "Function", ",", "e", "ast", ".", "Expr", ",", "t", ",", "f", "*", "BasicBlock", ")", "{", "switch", "e", ":=", "e", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "ParenExpr", ":", "b", ".", "cond", "(", "fn", ",", "e", ".", "X", ",", "t", ",", "f", ")", "\n", "return", "\n\n", "case", "*", "ast", ".", "BinaryExpr", ":", "<mask>", "e", ".", "Op", "{", "case", "token", ".", "LAND", ":", "ltrue", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "b", ".", "cond", "(", "fn", ",", "e", ".", "X", ",", "ltrue", ",", "f", ")", "\n", "fn", ".", "currentBlock", "=", "ltrue", "\n", "b", ".", "cond", "(", "fn", ",", "e", ".", "Y", ",", "t", ",", "f", ")", "\n", "return", "\n\n", "case", "token", ".", "LOR", ":", "lfalse", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "b", ".", "cond", "(", "fn", ",", "e", ".", "X", ",", "t", ",", "lfalse", ")", "\n", "fn", ".", "currentBlock", "=", "lfalse", "\n", "b", ".", "cond", "(", "fn", ",", "e", ".", "Y", ",", "t", ",", "f", ")", "\n", "return", "\n", "}", "\n\n", "case", "*", "ast", ".", "UnaryExpr", ":", "if", "e", ".", "Op", "==", "token", ".", "NOT", "{", "b", ".", "cond", "(", "fn", ",", "e", ".", "X", ",", "f", ",", "t", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "// A traditional compiler would simplify \"if false\" (etc) here", "// but we do not, for better fidelity to the source code.", "//", "// The value of a constant condition may be platform-specific,", "// and may cause blocks that are reachable in some configuration", "// to be hidden from subsequent analyses such as bug-finding tools.", "emitIf", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "e", ")", ",", "t", ",", "f", ")", "\n", "}" ]
6,315
all-6316
[ "Release", "deletes", "the", "barrier", "key", "to", "unblock", "all", "waiting", "processes", "." ]
[ "func", "(", "b", "*", "Barrier", ")", "Release", "(", ")", "error", "{", "_", ",", "err", ":=", "b", ".", "<mask>", ".", "Delete", "(", "b", ".", "ctx", ",", "b", ".", "key", ")", "\n", "return", "err", "\n", "}" ]
6,316
all-6317
[ "Do", "executes", "Profiler", ".", "stopTypeProfile", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StopTypeProfileParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStopTypeProfile", ",", "nil", ",", "nil", ")", "\n", "}" ]
6,317
all-6318
[ "Do", "executes", "DOM", ".", "requestChildNodes", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "RequestChildNodesParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRequestChildNodes", ",", "p", ",", "nil", ")", "\n", "}" ]
6,318
all-6319
[ "FindItems", "finds", "VIX", "objects", ".", "For", "example", "when", "used", "to", "find", "all", "running", "virtual", "machines", "Host", ".", "FindItems", "()", "returns", "a", "series", "of", "virtual", "machine", "file", "path", "names", "." ]
[ "func", "(", "h", "*", "Host", ")", "FindItems", "(", "options", "SearchType", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "<mask>", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "jobHandle", "=", "C", ".", "VixHost_FindItems", "(", "h", ".", "handle", ",", "C", ".", "VixFindItemType", "(", "options", ")", ",", "//searchType", "C", ".", "VIX_INVALID_HANDLE", ",", "//searchCriteria", "-", "1", ",", "//timeout", "(", "*", "C", ".", "VixEventProc", ")", "(", "C", ".", "find_items_callback", ")", ",", "//callbackProc", "unsafe", ".", "Pointer", "(", "h", ")", ")", "//clientData", "\n\n", "defer", "func", "(", ")", "{", "h", ".", "items", "=", "[", "]", "string", "{", "}", "\n", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n", "}", "(", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "nil", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "h", ".", "items", ",", "nil", "\n", "}" ]
6,319
all-6320
[ "ListLocations", "returns", "location", "collection", "data" ]
[ "func", "(", "c", "*", "Client", ")", "ListLocations", "(", ")", "(", "*", "Locations", ",", "error", ")", "{", "<mask>", ":=", "locationColPath", "(", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Locations", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
6,320
all-6321
[ "clean", "canonicalizes", "path", "for", "internal", "use", ":", "leading", "slash", "and", "no", "trailing", "slash", ".", "Also", "clean", "the", "result", "with", "internalDefault", "." ]
[ "func", "clean", "(", "p", "string", ")", "string", "{", "if", "!", "strings", ".", "HasPrefix", "(", "p", ",", "\"", "\"", ")", "{", "p", "=", "\"", "\"", "+", "p", "\n", "}", "\n", "return", "internalDefault", "(", "<mask>", ".", "Clean", "(", "p", ")", ")", "\n", "}" ]
6,321
all-6322
[ "NewTaskStateChangeEvent", "creates", "a", "new", "task", "state", "change", "event" ]
[ "func", "NewTaskStateChangeEvent", "(", "task", "*", "apitask", ".", "Task", ",", "reason", "string", ")", "(", "TaskStateChange", ",", "error", ")", "{", "var", "event", "TaskStateChange", "\n", "taskKnownStatus", ":=", "task", ".", "GetKnownStatus", "(", ")", "\n", "if", "!", "taskKnownStatus", ".", "BackendRecognized", "(", ")", "{", "return", "event", ",", "<mask>", ".", "Errorf", "(", "\"", "\"", ",", "taskKnownStatus", ")", "\n", "}", "\n", "if", "task", ".", "GetSentStatus", "(", ")", ">=", "taskKnownStatus", "{", "return", "event", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "taskKnownStatus", ".", "String", "(", ")", ")", "\n", "}", "\n\n", "event", "=", "TaskStateChange", "{", "TaskARN", ":", "task", ".", "Arn", ",", "Status", ":", "taskKnownStatus", ",", "Reason", ":", "reason", ",", "Task", ":", "task", ",", "}", "\n\n", "event", ".", "SetTaskTimestamps", "(", ")", "\n\n", "return", "event", ",", "nil", "\n", "}" ]
6,322
all-6323
[ "UpdateIntegrationPD", "updates", "the", "PagerDuty", "Integration", ".", "This", "will", "replace", "the", "existing", "values", "with", "the", "new", "values", "." ]
[ "func", "(", "client", "*", "<mask>", ")", "UpdateIntegrationPD", "(", "pdIntegration", "*", "IntegrationPDRequest", ")", "error", "{", "return", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "pdIntegration", ",", "nil", ")", "\n", "}" ]
6,323
all-6324
[ "Returns", "an", "slice", "of", "Typed", "helpers", "or", "a", "nil", "slice" ]
[ "func", "(", "t", "Typed", ")", "Objects", "(", "key", "string", ")", "[", "]", "Typed", "{", "value", ",", "_", ":=", "t", ".", "ObjectsIf", "(", "<mask>", ")", "\n", "return", "value", "\n", "}" ]
6,324
all-6325
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "ProwJobStatus", "." ]
[ "func", "(", "in", "*", "ProwJobStatus", ")", "DeepCopy", "(", ")", "*", "ProwJobStatus", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "ProwJobStatus", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
6,325
all-6326
[ "title", ":", "template", "destroy", "path", ":", "/", "iaas", "/", "templates", "/", "{", "template_name", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "templateDestroy", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "token", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "templateName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "t", ",", "err", ":=", "iaas", ".", "FindTemplate", "(", "templateName", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "mgo", ".", "ErrNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "iaasCtx", ":=", "permission", ".", "Context", "(", "permTypes", ".", "CtxIaaS", ",", "t", ".", "IaaSName", ")", "\n", "allowed", ":=", "permission", ".", "Check", "(", "token", ",", "permission", ".", "PermMachineTemplateDelete", ",", "iaasCtx", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeIaas", ",", "Value", ":", "t", ".", "IaaSName", "}", ",", "Kind", ":", "permission", ".", "PermMachineTemplateDelete", ",", "Owner", ":", "token", ",", "CustomData", ":", "<mask>", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermMachineReadEvents", ",", "iaasCtx", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "return", "iaas", ".", "DestroyTemplate", "(", "templateName", ")", "\n", "}" ]
6,326
all-6327
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "AttachToBrowserTargetReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget30", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
6,327
all-6328
[ "Do", "executes", "Page", ".", "navigate", "against", "the", "provided", "context", ".", "returns", ":", "frameID", "-", "Frame", "id", "that", "has", "navigated", "(", "or", "failed", "to", "navigate", ")", "loaderID", "-", "Loader", "identifier", ".", "errorText", "-", "User", "friendly", "error", "message", "present", "if", "and", "only", "if", "navigation", "has", "failed", "." ]
[ "func", "(", "p", "*", "NavigateParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "frameID", "cdp", ".", "FrameID", ",", "loaderID", "cdp", ".", "LoaderID", ",", "errorText", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "NavigateReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandNavigate", ",", "p", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "FrameID", ",", "res", ".", "LoaderID", ",", "res", ".", "ErrorText", ",", "nil", "\n", "}" ]
6,328
all-6329
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "FontSizes", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage48", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,329
all-6330
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkAccelMap", "." ]
[ "func", "(", "v", "*", "AccelMap", ")", "native", "(", ")", "*", "C", ".", "GtkAccelMap", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkAccelMap", "(", "p", ")", "\n", "}" ]
6,330
all-6331
[ "currentAlerts", "returns", "all", "instances", "of", "alerts", "for", "this", "rule", ".", "This", "may", "include", "inactive", "alerts", "that", "were", "previously", "firing", "." ]
[ "func", "(", "r", "*", "AlertingRule", ")", "currentAlerts", "(", ")", "[", "]", "*", "Alert", "{", "r", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "alerts", ":=", "make", "(", "[", "]", "*", "Alert", ",", "0", ",", "len", "(", "r", ".", "active", ")", ")", "\n\n", "for", "_", ",", "a", ":=", "range", "r", ".", "<mask>", "{", "anew", ":=", "*", "a", "\n", "alerts", "=", "append", "(", "alerts", ",", "&", "anew", ")", "\n", "}", "\n", "return", "alerts", "\n", "}" ]
6,331
all-6332
[ "GetTypeOk", "returns", "a", "tuple", "with", "the", "Type", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "n", "*", "NoteDefinition", ")", "GetTypeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "n", "==", "nil", "||", "n", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "n", ".", "Type", ",", "true", "\n", "}" ]
6,332
all-6333
[ "stmt", "lowers", "statement", "s", "to", "SSA", "form", "emitting", "code", "to", "fn", "." ]
[ "func", "(", "b", "*", "builder", ")", "stmt", "(", "fn", "*", "Function", ",", "_s", "ast", ".", "Stmt", ")", "{", "// The label of the current statement. If non-nil, its _goto", "// target is always set; its _break and _continue are set only", "// within the body of switch/typeswitch/select/for/range.", "// It is effectively an additional default-nil parameter of stmt().", "var", "label", "*", "lblock", "\n", "start", ":", "switch", "s", ":=", "_s", ".", "(", "type", ")", "{", "case", "*", "ast", ".", "EmptyStmt", ":", "// ignore. (Usually removed by gofmt.)", "case", "*", "ast", ".", "DeclStmt", ":", "// Con, Var or Typ", "d", ":=", "s", ".", "Decl", ".", "(", "*", "ast", ".", "GenDecl", ")", "\n", "if", "d", ".", "Tok", "==", "token", ".", "VAR", "{", "for", "_", ",", "spec", ":=", "range", "d", ".", "Specs", "{", "if", "vs", ",", "ok", ":=", "spec", ".", "(", "*", "ast", ".", "ValueSpec", ")", ";", "ok", "{", "b", ".", "localValueSpec", "(", "fn", ",", "vs", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "case", "*", "ast", ".", "LabeledStmt", ":", "label", "=", "fn", ".", "labelledBlock", "(", "s", ".", "Label", ")", "\n", "emitJump", "(", "fn", ",", "label", ".", "_goto", ")", "\n", "fn", ".", "currentBlock", "=", "label", ".", "_goto", "\n", "_s", "=", "s", ".", "Stmt", "\n", "goto", "start", "// effectively: tailcall stmt(fn, s.Stmt, label)", "\n\n", "case", "*", "ast", ".", "ExprStmt", ":", "b", ".", "expr", "(", "fn", ",", "s", ".", "X", ")", "\n\n", "case", "*", "ast", ".", "SendStmt", ":", "fn", ".", "emit", "(", "&", "Send", "{", "Chan", ":", "b", ".", "expr", "(", "fn", ",", "s", ".", "Chan", ")", ",", "X", ":", "emitConv", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "s", ".", "<mask>", ")", ",", "fn", ".", "Pkg", ".", "typeOf", "(", "s", ".", "Chan", ")", ".", "Underlying", "(", ")", ".", "(", "*", "types", ".", "Chan", ")", ".", "Elem", "(", ")", ")", ",", "pos", ":", "s", ".", "Arrow", ",", "}", ")", "\n\n", "case", "*", "ast", ".", "IncDecStmt", ":", "op", ":=", "token", ".", "ADD", "\n", "if", "s", ".", "Tok", "==", "token", ".", "DEC", "{", "op", "=", "token", ".", "SUB", "\n", "}", "\n", "loc", ":=", "b", ".", "addr", "(", "fn", ",", "s", ".", "X", ",", "false", ")", "\n", "b", ".", "assignOp", "(", "fn", ",", "loc", ",", "NewConst", "(", "exact", ".", "MakeInt64", "(", "1", ")", ",", "loc", ".", "typ", "(", ")", ")", ",", "op", ",", "s", ".", "Pos", "(", ")", ")", "\n\n", "case", "*", "ast", ".", "AssignStmt", ":", "switch", "s", ".", "Tok", "{", "case", "token", ".", "ASSIGN", ",", "token", ".", "DEFINE", ":", "b", ".", "assignStmt", "(", "fn", ",", "s", ".", "Lhs", ",", "s", ".", "Rhs", ",", "s", ".", "Tok", "==", "token", ".", "DEFINE", ")", "\n\n", "default", ":", "// +=, etc.", "op", ":=", "s", ".", "Tok", "+", "token", ".", "ADD", "-", "token", ".", "ADD_ASSIGN", "\n", "b", ".", "assignOp", "(", "fn", ",", "b", ".", "addr", "(", "fn", ",", "s", ".", "Lhs", "[", "0", "]", ",", "false", ")", ",", "b", ".", "expr", "(", "fn", ",", "s", ".", "Rhs", "[", "0", "]", ")", ",", "op", ",", "s", ".", "Pos", "(", ")", ")", "\n", "}", "\n\n", "case", "*", "ast", ".", "GoStmt", ":", "// The \"intrinsics\" new/make/len/cap are forbidden here.", "// panic is treated like an ordinary function call.", "v", ":=", "Go", "{", "pos", ":", "s", ".", "Go", "}", "\n", "b", ".", "setCall", "(", "fn", ",", "s", ".", "Call", ",", "&", "v", ".", "Call", ")", "\n", "fn", ".", "emit", "(", "&", "v", ")", "\n\n", "case", "*", "ast", ".", "DeferStmt", ":", "// The \"intrinsics\" new/make/len/cap are forbidden here.", "// panic is treated like an ordinary function call.", "v", ":=", "Defer", "{", "pos", ":", "s", ".", "Defer", "}", "\n", "b", ".", "setCall", "(", "fn", ",", "s", ".", "Call", ",", "&", "v", ".", "Call", ")", "\n", "fn", ".", "emit", "(", "&", "v", ")", "\n\n", "// A deferred call can cause recovery from panic,", "// and control resumes at the Recover block.", "createRecoverBlock", "(", "fn", ")", "\n\n", "case", "*", "ast", ".", "ReturnStmt", ":", "var", "results", "[", "]", "Value", "\n", "if", "len", "(", "s", ".", "Results", ")", "==", "1", "&&", "fn", ".", "Signature", ".", "Results", "(", ")", ".", "Len", "(", ")", ">", "1", "{", "// Return of one expression in a multi-valued function.", "tuple", ":=", "b", ".", "exprN", "(", "fn", ",", "s", ".", "Results", "[", "0", "]", ")", "\n", "ttuple", ":=", "tuple", ".", "Type", "(", ")", ".", "(", "*", "types", ".", "Tuple", ")", "\n", "for", "i", ",", "n", ":=", "0", ",", "ttuple", ".", "Len", "(", ")", ";", "i", "<", "n", ";", "i", "++", "{", "results", "=", "append", "(", "results", ",", "emitConv", "(", "fn", ",", "emitExtract", "(", "fn", ",", "tuple", ",", "i", ")", ",", "fn", ".", "Signature", ".", "Results", "(", ")", ".", "At", "(", "i", ")", ".", "Type", "(", ")", ")", ")", "\n", "}", "\n", "}", "else", "{", "// 1:1 return, or no-arg return in non-void function.", "for", "i", ",", "r", ":=", "range", "s", ".", "Results", "{", "v", ":=", "emitConv", "(", "fn", ",", "b", ".", "expr", "(", "fn", ",", "r", ")", ",", "fn", ".", "Signature", ".", "Results", "(", ")", ".", "At", "(", "i", ")", ".", "Type", "(", ")", ")", "\n", "results", "=", "append", "(", "results", ",", "v", ")", "\n", "}", "\n", "}", "\n", "if", "fn", ".", "namedResults", "!=", "nil", "{", "// Function has named result parameters (NRPs).", "// Perform parallel assignment of return operands to NRPs.", "for", "i", ",", "r", ":=", "range", "results", "{", "emitStore", "(", "fn", ",", "fn", ".", "namedResults", "[", "i", "]", ",", "r", ",", "s", ".", "Return", ")", "\n", "}", "\n", "}", "\n", "// Run function calls deferred in this", "// function when explicitly returning from it.", "fn", ".", "emit", "(", "new", "(", "RunDefers", ")", ")", "\n", "if", "fn", ".", "namedResults", "!=", "nil", "{", "// Reload NRPs to form the result tuple.", "results", "=", "results", "[", ":", "0", "]", "\n", "for", "_", ",", "r", ":=", "range", "fn", ".", "namedResults", "{", "results", "=", "append", "(", "results", ",", "emitLoad", "(", "fn", ",", "r", ")", ")", "\n", "}", "\n", "}", "\n", "fn", ".", "emit", "(", "&", "Return", "{", "Results", ":", "results", ",", "pos", ":", "s", ".", "Return", "}", ")", "\n", "fn", ".", "currentBlock", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n\n", "case", "*", "ast", ".", "BranchStmt", ":", "var", "block", "*", "BasicBlock", "\n", "switch", "s", ".", "Tok", "{", "case", "token", ".", "BREAK", ":", "if", "s", ".", "Label", "!=", "nil", "{", "block", "=", "fn", ".", "labelledBlock", "(", "s", ".", "Label", ")", ".", "_break", "\n", "}", "else", "{", "for", "t", ":=", "fn", ".", "targets", ";", "t", "!=", "nil", "&&", "block", "==", "nil", ";", "t", "=", "t", ".", "tail", "{", "block", "=", "t", ".", "_break", "\n", "}", "\n", "}", "\n\n", "case", "token", ".", "CONTINUE", ":", "if", "s", ".", "Label", "!=", "nil", "{", "block", "=", "fn", ".", "labelledBlock", "(", "s", ".", "Label", ")", ".", "_continue", "\n", "}", "else", "{", "for", "t", ":=", "fn", ".", "targets", ";", "t", "!=", "nil", "&&", "block", "==", "nil", ";", "t", "=", "t", ".", "tail", "{", "block", "=", "t", ".", "_continue", "\n", "}", "\n", "}", "\n\n", "case", "token", ".", "FALLTHROUGH", ":", "for", "t", ":=", "fn", ".", "targets", ";", "t", "!=", "nil", "&&", "block", "==", "nil", ";", "t", "=", "t", ".", "tail", "{", "block", "=", "t", ".", "_fallthrough", "\n", "}", "\n\n", "case", "token", ".", "GOTO", ":", "block", "=", "fn", ".", "labelledBlock", "(", "s", ".", "Label", ")", ".", "_goto", "\n", "}", "\n", "emitJump", "(", "fn", ",", "block", ")", "\n", "fn", ".", "currentBlock", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n\n", "case", "*", "ast", ".", "BlockStmt", ":", "b", ".", "stmtList", "(", "fn", ",", "s", ".", "List", ")", "\n\n", "case", "*", "ast", ".", "IfStmt", ":", "if", "s", ".", "Init", "!=", "nil", "{", "b", ".", "stmt", "(", "fn", ",", "s", ".", "Init", ")", "\n", "}", "\n", "then", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "done", ":=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "els", ":=", "done", "\n", "if", "s", ".", "Else", "!=", "nil", "{", "els", "=", "fn", ".", "newBasicBlock", "(", "\"", "\"", ")", "\n", "}", "\n", "b", ".", "cond", "(", "fn", ",", "s", ".", "Cond", ",", "then", ",", "els", ")", "\n", "fn", ".", "currentBlock", "=", "then", "\n", "b", ".", "stmt", "(", "fn", ",", "s", ".", "Body", ")", "\n", "emitJump", "(", "fn", ",", "done", ")", "\n\n", "if", "s", ".", "Else", "!=", "nil", "{", "fn", ".", "currentBlock", "=", "els", "\n", "b", ".", "stmt", "(", "fn", ",", "s", ".", "Else", ")", "\n", "emitJump", "(", "fn", ",", "done", ")", "\n", "}", "\n\n", "fn", ".", "currentBlock", "=", "done", "\n\n", "case", "*", "ast", ".", "SwitchStmt", ":", "b", ".", "switchStmt", "(", "fn", ",", "s", ",", "label", ")", "\n\n", "case", "*", "ast", ".", "TypeSwitchStmt", ":", "b", ".", "typeSwitchStmt", "(", "fn", ",", "s", ",", "label", ")", "\n\n", "case", "*", "ast", ".", "SelectStmt", ":", "b", ".", "selectStmt", "(", "fn", ",", "s", ",", "label", ")", "\n\n", "case", "*", "ast", ".", "ForStmt", ":", "b", ".", "forStmt", "(", "fn", ",", "s", ",", "label", ")", "\n\n", "case", "*", "ast", ".", "RangeStmt", ":", "b", ".", "rangeStmt", "(", "fn", ",", "s", ",", "label", ")", "\n\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ")", ")", "\n", "}", "\n", "}" ]
6,333
all-6334
[ "******", "matrix", "iterator", ":", "used", "for", "n", "-", "ary", "operations", "on", "dense", "arrays", "********", "P290", "/", "*", "Returns", "width", "and", "height", "of", "array", "in", "elements" ]
[ "func", "GetSizeWidth", "(", "img", "*", "IplImage", ")", "int", "{", "size", ":=", "C", ".", "cvGetSize", "(", "unsafe", ".", "Pointer", "(", "img", ")", ")", "\n", "w", ":=", "int", "(", "size", ".", "<mask>", ")", "\n", "return", "w", "\n", "}" ]
6,334
all-6335
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventLastSeenObjectID", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,335
all-6336
[ "DupSecOpt", "takes", "an", "SELinux", "process", "label", "and", "returns", "security", "options", "that", "can", "will", "set", "the", "SELinux", "Type", "and", "Level", "for", "future", "container", "processes" ]
[ "func", "DupSecOpt", "(", "src", "string", ")", "[", "]", "string", "{", "if", "src", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "con", ":=", "NewContext", "(", "src", ")", "\n", "if", "con", "[", "\"", "\"", "]", "==", "\"", "\"", "||", "con", "[", "\"", "\"", "]", "==", "\"", "\"", "||", "con", "[", "\"", "\"", "]", "==", "\"", "\"", "||", "con", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "<mask>", "nil", "\n", "}", "\n", "return", "[", "]", "string", "{", "\"", "\"", "+", "con", "[", "\"", "\"", "]", ",", "\"", "\"", "+", "con", "[", "\"", "\"", "]", ",", "\"", "\"", "+", "con", "[", "\"", "\"", "]", ",", "\"", "\"", "+", "con", "[", "\"", "\"", "]", "}", "\n", "}" ]
6,336
all-6337
[ "Visible", "returns", "true", "if", "all", "of", "the", "elements", "that", "the", "selection", "refers", "to", "are", "visible", "." ]
[ "func", "(", "s", "*", "Selection", ")", "Visible", "(", ")", "(", "bool", ",", "error", ")", "{", "return", "s", ".", "hasState", "(", "<mask>", ".", "Element", ".", "IsDisplayed", ",", "\"", "\"", ")", "\n", "}" ]
6,337
all-6338
[ "Subscribers", "returns", "a", "list", "of", "subscriber", "of", "a", "mailing", "list", "." ]
[ "func", "(", "ml", "*", "MailingList", ")", "Subscribers", "(", ")", "(", "[", "]", "*", "Subscriber", ",", "error", ")", "{", "var", "res", "readSubscribersResponse", "\n", "err", ":=", "ml", ".", "Domain", ".", "cgp", ".", "request", "(", "readSubscribers", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ml", ".", "Name", ",", "ml", ".", "Domain", ".", "Name", ")", "}", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "*", "Subscriber", "{", "}", ",", "err", "\n", "}", "\n", "ds", ":=", "res", ".", "SubValues", "[", "1", "]", ".", "SubValues", "\n", "subs", ":=", "make", "(", "[", "]", "*", "Subscriber", ",", "len", "(", "ds", ")", ")", "\n", "for", "i", ",", "d", ":=", "<mask>", "ds", "{", "m", ":=", "d", ".", "toMap", "(", ")", "\n", "subs", "[", "i", "]", "=", "ml", ".", "Subscriber", "(", "m", "[", "\"", "\"", "]", ",", "m", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "return", "subs", ",", "nil", "\n", "}" ]
6,338
all-6339
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetStyleSheetTextReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss35", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
6,339
all-6340
[ "Returns", "paste", "link", "string", "and", "nil", "if", "everything", "is", "ok" ]
[ "func", "(", "api", "*", "API", ")", "SendPaste", "(", "paste", "Paste", ")", "(", "string", ",", "error", ")", "{", "if", "paste", ".", "UserKey", "==", "\"", "\"", "&&", "paste", ".", "Privacy", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "PrivacyModError", "\n", "}", "\n", "values", ":=", "url", ".", "Values", "{", "}", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "api", ".", "APIKey", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "paste", ".", "UserKey", ")", "\n", "values", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "paste", ".", "Text", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "paste", ".", "Name", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "paste", ".", "Privacy", ")", "\n", "values", ".", "Set", "(", "\"", "\"", ",", "paste", ".", "ExpireDate", ")", "\n", "response", ",", "err", ":=", "http", ".", "PostForm", "(", "\"", "\"", ",", "values", ")", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "response", ".", "StatusCode", "!=", "200", "{", "return", "\"", "\"", ",", "PastePostingError", "\n", "}", "\n", "buf", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "_", ",", "err", "=", "buf", ".", "ReadFrom", "(", "response", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
6,340
all-6341
[ "Stop", "closes", "all", "idle", "connections", "for", "any", "attached", "clients", "." ]
[ "func", "(", "c", "*", "ClientSet", ")", "Stop", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "if", "c", ".", "consul", "!=", "nil", "{", "c", ".", "consul", ".", "transport", ".", "CloseIdleConnections", "(", ")", "\n", "}", "\n\n", "if", "c", ".", "vault", "!=", "nil", "{", "c", ".", "vault", ".", "httpClient", ".", "Transport", ".", "(", "*", "<mask>", ".", "Transport", ")", ".", "CloseIdleConnections", "(", ")", "\n", "}", "\n", "}" ]
6,341
all-6342
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChangeDefinition", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "TitleAlign", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,342
all-6343
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "MixedContentType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "MixedContentType", "(", "in", ".", "<mask>", "(", ")", ")", "{", "case", "MixedContentTypeBlockable", ":", "*", "t", "=", "MixedContentTypeBlockable", "\n", "case", "MixedContentTypeOptionallyBlockable", ":", "*", "t", "=", "MixedContentTypeOptionallyBlockable", "\n", "case", "MixedContentTypeNone", ":", "*", "t", "=", "MixedContentTypeNone", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
6,343
all-6344
[ "executeLF", "executes", "a", "LF", "without", "a", "CR", "." ]
[ "func", "(", "h", "*", "windowsAnsiEventHandler", ")", "executeLF", "(", ")", "error", "{", "handled", ",", "err", ":=", "h", ".", "simulateLF", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "handled", "{", "// Windows LF will reset the cursor column position. Write the LF", "// and restore the cursor position.", "pos", ",", "_", ",", "err", ":=", "h", ".", "getCurrentInfo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "h", ".", "buffer", ".", "WriteByte", "(", "ansiterm", ".", "ANSI_LINE_FEED", ")", "\n", "if", "pos", ".", "X", "!=", "0", "{", "if", "err", ":=", "h", ".", "Flush", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "h", ".", "logf", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "SetConsoleCursorPosition", "(", "h", ".", "fd", ",", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,344
all-6345
[ "New", "creates", "a", "new", "instance", "of", "Server", "." ]
[ "func", "New", "(", "handler", "http", ".", "Handler", ",", "opts", "...", "Option", ")", "(", "s", "*", "Server", ")", "{", "o", ":=", "&", "Options", "{", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "opt", "(", "o", ")", "\n", "}", "\n", "s", "=", "&", "Server", "{", "<mask>", ":", "&", "h2quic", ".", "Server", "{", "Server", ":", "&", "http", ".", "Server", "{", "Handler", ":", "handler", ",", "TLSConfig", ":", "o", ".", "tlsConfig", ",", "}", ",", "}", ",", "}", "\n", "return", "\n", "}" ]
6,345
all-6346
[ "Delete", "the", "Application", "with", "the", "given", "sid", ".", "If", "the", "Application", "has", "already", "been", "deleted", "or", "does", "not", "exist", "Delete", "returns", "nil", ".", "If", "another", "error", "or", "a", "timeout", "occurs", "the", "error", "is", "returned", "." ]
[ "func", "(", "r", "*", "ApplicationService", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "sid", "string", ")", "error", "{", "return", "r", ".", "<mask>", ".", "DeleteResource", "(", "ctx", ",", "applicationPathPart", ",", "sid", ")", "\n", "}" ]
6,346
all-6347
[ "ToMap", "converts", "a", "UserData", "to", "UserDataMap" ]
[ "func", "(", "ud", "*", "UserData", ")", "ToMap", "(", ")", "UserDataMap", "{", "m", ":=", "UserDataMap", "{", "}", "\n", "ud", ".", "Range", "(", "func", "(", "<mask>", ",", "value", "interface", "{", "}", ")", "bool", "{", "m", "[", "key", ".", "(", "string", ")", "]", "=", "value", ".", "(", "string", ")", "\n", "return", "true", "\n", "}", ")", "\n", "return", "m", "\n", "}" ]
6,347
all-6348
[ "NewCluster", "returns", "an", "unlaunched", "cluster", "of", "the", "given", "size", "which", "has", "been", "set", "to", "use", "static", "bootstrap", "." ]
[ "func", "NewCluster", "(", "t", "testing", ".", "TB", ",", "size", "int", ")", "*", "cluster", "{", "return", "newCluster", "(", "t", ",", "&", "ClusterConfig", "{", "Size", ":", "<mask>", "}", ")", "\n", "}" ]
6,348
all-6349
[ "Append", "appends", "an", "op", "code", "to", "the", "current", "list", "of", "op", "codes", "." ]
[ "func", "(", "b", "*", "ByteCode", ")", "Append", "(", "op", "Op", ")", "{", "b", ".", "OpList", "=", "<mask>", "(", "b", ".", "OpList", ",", "op", ")", "\n", "}" ]
6,349
all-6350
[ "NewWatchServer", "returns", "a", "new", "watch", "server", "." ]
[ "func", "NewWatchServer", "(", "s", "*", "etcdserver", ".", "EtcdServer", ")", "pb", ".", "WatchServer", "{", "return", "&", "watchServer", "{", "lg", ":", "s", ".", "Cfg", ".", "Logger", ",", "clusterID", ":", "int64", "(", "s", ".", "Cluster", "(", ")", ".", "ID", "(", ")", ")", ",", "memberID", ":", "int64", "(", "s", ".", "<mask>", "(", ")", ")", ",", "maxRequestBytes", ":", "int", "(", "s", ".", "Cfg", ".", "MaxRequestBytes", "+", "grpcOverheadBytes", ")", ",", "sg", ":", "s", ",", "watchable", ":", "s", ".", "Watchable", "(", ")", ",", "ag", ":", "s", ",", "}", "\n", "}" ]
6,350
all-6351
[ "AddChildInWindow", "is", "a", "wrapper", "around", "gtk_text_view_add_child_in_window", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "AddChildInWindow", "(", "<mask>", "IWidget", ",", "tp", "TextWindowType", ",", "xpos", ",", "ypos", "int", ")", "{", "C", ".", "gtk_text_view_add_child_in_window", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ",", "C", ".", "GtkTextWindowType", "(", "tp", ")", ",", "C", ".", "gint", "(", "xpos", ")", ",", "C", ".", "gint", "(", "ypos", ")", ")", "\n", "}" ]
6,351
all-6352
[ "LoadFromData", "is", "a", "wrapper", "around", "gtk_css_provider_load_from_data", "()", "." ]
[ "func", "(", "v", "*", "CssProvider", ")", "LoadFromData", "(", "data", "string", ")", "error", "{", "cdata", ":=", "C", ".", "CString", "(", "data", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cdata", ")", ")", "\n", "var", "gerr", "*", "C", ".", "GError", "\n", "if", "C", ".", "gtk_css_provider_load_from_data", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "unsafe", ".", "Pointer", "(", "cdata", ")", ")", ",", "C", ".", "gssize", "(", "len", "(", "<mask>", ")", ")", ",", "&", "gerr", ")", "==", "0", "{", "defer", "C", ".", "g_error_free", "(", "gerr", ")", "\n", "return", "errors", ".", "New", "(", "goString", "(", "gerr", ".", "message", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,352
all-6353
[ "ChGPasswd", "updates", "group", "passwd", ".", "The", "passwd", "must", "be", "supplied", "in", "clear", "-", "text", "." ]
[ "func", "ChGPasswd", "(", "group", "string", ",", "<mask>", "[", "]", "byte", ")", "error", "{", "gshadow", ",", "err", ":=", "LookupGShadow", "(", "group", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "gshadow", ".", "Passwd", "(", "key", ")", "\n\n", "return", "edit", "(", "group", ",", "gshadow", ")", "\n", "}" ]
6,353
all-6354
[ "NewData", "returns", "a", "new", "memory", "based", "data", "buffer" ]
[ "func", "NewData", "(", ")", "(", "*", "Data", ",", "<mask>", ")", "{", "d", ":=", "newData", "(", ")", "\n", "return", "d", ",", "handleError", "(", "C", ".", "gpgme_data_new", "(", "&", "d", ".", "dh", ")", ")", "\n", "}" ]
6,354
all-6355
[ "ThemeNames", "returns", "the", "list", "of", "short", "theme", "names", "(", "file", "names", ")" ]
[ "func", "ThemeNames", "(", ")", "[", "]", "string", "{", "var", "str", "[", "]", "string", "\n", "str", "=", "append", "(", "str", ",", "defaultTheme", ")", "\n\n", "path", ":=", "themeManager", ".", "themePath", "\n", "if", "path", "==", "\"", "\"", "{", "path", "=", "\"", "\"", "+", "string", "(", "os", ".", "PathSeparator", ")", "\n", "}", "\n", "files", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "themeManager", ".", "themePath", ")", "\n", "}", "\n\n", "for", "_", ",", "f", ":=", "range", "files", "{", "name", ":=", "f", ".", "Name", "(", ")", "\n", "if", "!", "f", ".", "IsDir", "(", ")", "&&", "strings", ".", "HasSuffix", "(", "name", ",", "themeSuffix", ")", "{", "str", "=", "append", "(", "str", ",", "strings", ".", "TrimSuffix", "(", "name", ",", "themeSuffix", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "str", "\n", "}" ]
6,355
all-6356
[ "writeHeaders", "is", "a", "helper", "function", "that", "writes", "the", "given", "HTTP", "headers", "to", "the", "given", "buffer", "as", "human", "readable", "strings", ".", "If", "DumpFormat", "is", "not", "Verbose", "then", "writeHeaders", "filters", "out", "headers", "whose", "names", "are", "keys", "of", "HiddenHeaders", "." ]
[ "func", "(", "d", "*", "dumpClient", ")", "writeHeaders", "(", "buffer", "*", "bytes", ".", "Buffer", ",", "headers", "http", ".", "Header", ")", "{", "filterHeaders", "(", "d", ".", "dumpFormat", "(", ")", ",", "d", ".", "hiddenHeaders", "(", ")", ",", "<mask>", ",", "func", "(", "name", "string", ",", "value", "[", "]", "string", ")", "{", "buffer", ".", "WriteString", "(", "name", ")", "\n", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "buffer", ".", "WriteString", "(", "strings", ".", "Join", "(", "value", ",", "\"", "\"", ")", ")", "\n", "buffer", ".", "WriteString", "(", "\"", "\\n", "\"", ")", "\n", "}", ")", "\n", "}" ]
6,356
all-6357
[ "title", ":", "node", "container", "update", "path", ":", "/", "docker", "/", "nodecontainers", "/", "{", "name", "}", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "200", ":", "Ok", "400", ":", "Invald", "data", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "nodeContainerUpdate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "var", "config", "nodecontainer", ".", "NodeContainerConfig", "\n", "err", "=", "ParseInput", "(", "r", ",", "&", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "poolName", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "var", "ctxs", "[", "]", "permTypes", ".", "PermissionContext", "\n", "if", "poolName", "!=", "\"", "\"", "{", "ctxs", "=", "append", "(", "ctxs", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "poolName", ")", ")", "\n", "}", "\n", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodecontainerUpdate", ",", "ctxs", "...", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "<mask>", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeNodeContainer", ",", "Value", ":", "config", ".", "Name", "}", ",", "Kind", ":", "permission", ".", "PermNodecontainerUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "ctxs", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "config", ".", "Name", "=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "err", "=", "nodecontainer", ".", "UpdateContainer", "(", "poolName", ",", "&", "config", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "nodecontainer", ".", "ErrNodeContainerNotFound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "err", ".", "(", "nodecontainer", ".", "ValidationErr", ")", ";", "ok", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,357
all-6358
[ "Getdowntime", "retrieves", "an", "downtime", "by", "identifier", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetDowntime", "(", "id", "int", ")", "(", "*", "Downtime", ",", "error", ")", "{", "var", "out", "Downtime", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ")", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "<mask>", ",", "nil", "\n", "}" ]
6,358
all-6359
[ "BuildNS", "resolves", "all", "the", "namespace", "nodes", "of", "the", "element", "and", "returns", "them" ]
[ "func", "BuildNS", "(", "t", "Elem", ")", "(", "ret", "[", "]", "NS", ")", "{", "vals", ":=", "make", "(", "map", "[", "xml", ".", "Name", "]", "string", ")", "\n\n", "if", "nselem", ",", "ok", ":=", "t", ".", "(", "NSElem", ")", ";", "ok", "{", "buildNS", "(", "nselem", ",", "vals", ")", "\n\n", "ret", "=", "make", "(", "[", "]", "NS", ",", "0", ",", "len", "(", "vals", ")", ")", "\n", "i", ":=", "1", "\n\n", "for", "k", ",", "v", ":=", "range", "vals", "{", "if", "!", "(", "k", ".", "Local", "==", "\"", "\"", "&&", "k", ".", "Space", "==", "\"", "\"", "&&", "v", "==", "\"", "\"", ")", "{", "ret", "=", "append", "(", "ret", ",", "NS", "{", "Attr", ":", "xml", ".", "Attr", "{", "Name", ":", "k", ",", "Value", ":", "v", "}", ",", "Parent", ":", "t", ",", "NodeType", ":", "NtNs", ",", "}", ")", "\n", "i", "++", "\n", "}", "\n", "}", "\n\n", "sort", ".", "Sort", "(", "nsValueSort", "(", "<mask>", ")", ")", "\n", "for", "i", ":=", "range", "ret", "{", "ret", "[", "i", "]", ".", "NodePos", "=", "NodePos", "(", "t", ".", "Pos", "(", ")", "+", "i", "+", "1", ")", "\n", "}", "\n", "}", "\n\n", "return", "ret", "\n", "}" ]
6,359
all-6360
[ "RunGroup", "runs", "a", "parse", ".", "Group", ".", "Consider", "RunFile", "instead", "." ]
[ "func", "(", "r", "*", "<mask>", ")", "RunGroup", "(", "groups", "...", "*", "parse", ".", "Group", ")", "{", "for", "_", ",", "group", ":=", "range", "groups", "{", "r", ".", "runGroup", "(", "group", ")", "\n", "}", "\n", "}" ]
6,360
all-6361
[ "GetTimestampOk", "returns", "a", "tuple", "with", "the", "Timestamp", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "Check", ")", "GetTimestampOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Timestamp", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "Timestamp", ",", "true", "\n", "}" ]
6,361
all-6362
[ "paeth", "implements", "the", "Paeth", "filter", "function", "as", "per", "the", "PNG", "specification", "." ]
[ "func", "paeth", "(", "a", ",", "b", ",", "c", "uint8", ")", "uint8", "{", "// This is an optimized version of the sample code in the PNG spec.", "// For example, the sample code starts with:", "//\tp := int(a) + int(b) - int(c)", "//\tpa := abs(p - int(a))", "// but the optimized form uses fewer arithmetic operations:", "//\tpa := int(b) - int(c)", "//\tpa = abs(pa)", "pc", ":=", "int", "(", "c", ")", "\n", "pa", ":=", "int", "(", "b", ")", "-", "pc", "\n", "pb", ":=", "int", "(", "a", ")", "-", "pc", "\n", "pc", "=", "abs", "(", "pa", "+", "pb", ")", "\n", "pa", "=", "abs", "(", "pa", ")", "\n", "pb", "=", "abs", "(", "pb", ")", "\n", "if", "pa", "<=", "pb", "&&", "pa", "<=", "pc", "{", "return", "a", "\n", "}", "else", "if", "pb", "<=", "<mask>", "{", "return", "b", "\n", "}", "\n", "return", "c", "\n", "}" ]
6,362
all-6363
[ "VerifyBytes", "creates", "a", "signature", "for", "buf", "comparing", "it", "against", "the", "raw", "sig", ".", "If", "the", "sig", "is", "invalid", "then", "ErrInvalidSignature", "is", "returned", "." ]
[ "func", "(", "<mask>", "*", "EccSigner", ")", "VerifyBytes", "(", "buf", ",", "sig", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n\n", "// check es.pub", "if", "es", ".", "pub", "==", "nil", "{", "return", "ErrInvalidPublicKey", "\n", "}", "\n\n", "// hash", "h", ":=", "es", ".", "hash", ".", "New", "(", ")", "\n", "_", ",", "err", "=", "h", ".", "Write", "(", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// check decoded length", "if", "len", "(", "sig", ")", "!=", "2", "*", "es", ".", "keyLen", "{", "return", "ErrInvalidSignature", "\n", "}", "\n\n", "r", ":=", "big", ".", "NewInt", "(", "0", ")", ".", "SetBytes", "(", "sig", "[", ":", "es", ".", "keyLen", "]", ")", "\n", "s", ":=", "big", ".", "NewInt", "(", "0", ")", ".", "SetBytes", "(", "sig", "[", "es", ".", "keyLen", ":", "]", ")", "\n\n", "// verify", "if", "!", "ecdsa", ".", "Verify", "(", "es", ".", "pub", ",", "h", ".", "Sum", "(", "nil", ")", ",", "r", ",", "s", ")", "{", "return", "ErrInvalidSignature", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,363
all-6364
[ "WithFields", "adds", "multiple", "fields", "to", "the", "logger" ]
[ "func", "(", "n", "*", "Namespaced", ")", "WithFields", "(", "fields", "<mask>", ".", "Fields", ")", "log", ".", "Interface", "{", "return", "&", "Namespaced", "{", "Interface", ":", "n", ".", "Interface", ".", "WithFields", "(", "fields", ")", ",", "namespaces", ":", "n", ".", "namespaces", ",", "namespace", ":", "n", ".", "namespace", ",", "}", "\n", "}" ]
6,364
all-6365
[ "ThrottleBacklog", "is", "a", "middleware", "that", "limits", "number", "of", "currently", "processed", "requests", "at", "a", "time", "and", "provides", "a", "backlog", "for", "holding", "a", "finite", "number", "of", "pending", "requests", "." ]
[ "func", "ThrottleBacklog", "(", "limit", "int", ",", "backlogLimit", "int", ",", "backlogTimeout", "time", ".", "Duration", ")", "func", "(", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "if", "limit", "<", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "backlogLimit", "<", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "t", ":=", "throttler", "{", "tokens", ":", "make", "(", "chan", "token", ",", "limit", ")", ",", "backlogTokens", ":", "make", "(", "chan", "<mask>", ",", "limit", "+", "backlogLimit", ")", ",", "backlogTimeout", ":", "backlogTimeout", ",", "}", "\n\n", "// Filling tokens.", "for", "i", ":=", "0", ";", "i", "<", "limit", "+", "backlogLimit", ";", "i", "++", "{", "if", "i", "<", "limit", "{", "t", ".", "tokens", "<-", "token", "{", "}", "\n", "}", "\n", "t", ".", "backlogTokens", "<-", "token", "{", "}", "\n", "}", "\n\n", "fn", ":=", "func", "(", "h", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "t", ".", "h", "=", "h", "\n", "return", "&", "t", "\n", "}", "\n\n", "return", "fn", "\n", "}" ]
6,365
all-6366
[ "GetBalance", "returns", "current", "balance", "in", "BTC" ]
[ "func", "(", "c", "<mask>", ")", "GetBalance", "(", ")", "(", "float64", ",", "error", ")", "{", "balance", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "if", "err", ":=", "c", ".", "Get", "(", "\"", "\"", ",", "nil", ",", "&", "balance", ")", ";", "err", "!=", "nil", "{", "return", "0.0", ",", "err", "\n", "}", "\n", "balanceFloat", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "balance", "[", "\"", "\"", "]", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "return", "balanceFloat", ",", "nil", "\n", "}" ]
6,366
all-6367
[ "ValidateScope", "validates", "a", "policy", "configuration", "scope", "for", "an", "OCI", "transport", "." ]
[ "func", "ValidateScope", "(", "scope", "string", ")", "error", "{", "var", "err", "error", "\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "err", "=", "validateScopeWindows", "(", "scope", ")", "\n", "}", "else", "{", "err", "=", "validateScopeNonWindows", "(", "scope", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "cleaned", ":=", "filepath", ".", "Clean", "(", "<mask>", ")", "\n", "if", "cleaned", "!=", "scope", "{", "return", "errors", ".", "Errorf", "(", "`Invalid scope %s: Uses non-canonical path format, perhaps try with path %s`", ",", "scope", ",", "cleaned", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
6,367
all-6368
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "BucketEntryType" ]
[ "func", "(", "e", "BucketEntryType", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "ok", ":=", "bucketEntryTypeMap", "[", "v", "]", "\n", "return", "<mask>", "\n", "}" ]
6,368
all-6369
[ "Buy", "an", "amount", "of", "BTC", "and", "bypass", "rate", "limits", "by", "setting", "agreeBtcAmountVaries", "to", "true" ]
[ "func", "(", "c", "Client", ")", "Buy", "(", "amount", "float64", ",", "agreeBtcAmountVaries", "bool", ")", "(", "*", "transfer", ",", "error", ")", "{", "params", ":=", "map", "[", "string", "]", "<mask>", "{", "}", "{", "\"", "\"", ":", "amount", ",", "\"", "\"", ":", "agreeBtcAmountVaries", ",", "}", "\n", "holder", ":=", "transferHolder", "{", "}", "\n", "if", "err", ":=", "c", ".", "Post", "(", "\"", "\"", ",", "params", ",", "&", "holder", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "checkApiErrors", "(", "holder", ".", "response", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "holder", ".", "Transfer", ",", "nil", "\n", "}" ]
6,369
all-6370
[ "HasDisplayType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetMarker", ")", "HasDisplayType", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "DisplayType", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
6,370
all-6371
[ "StringWithinTransport", "returns", "a", "string", "representation", "of", "the", "reference", "which", "MUST", "be", "such", "that", "reference", ".", "Transport", "()", ".", "ParseReference", "(", "reference", ".", "StringWithinTransport", "()", ")", "returns", "an", "equivalent", "reference", "." ]
[ "func", "(", "ref", "ociArchiveReference", ")", "StringWithinTransport", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "file", ",", "ref", ".", "image", ")", "\n", "}" ]
6,371
all-6372
[ "startUdevWatcher", "starts", "the", "udev", "monitor", "and", "the", "watcher", "for", "receiving", "notifications", "from", "the", "monitor" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "startUdevWatcher", "(", "state", "dockerstate", ".", "TaskEngineState", ",", "stateChangeEvents", "chan", "<-", "statechange", ".", "Event", ")", "error", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "udevMonitor", ",", "err", ":=", "udevwrapper", ".", "New", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "// Create Watcher", "eniWatcher", ":=", "watcher", ".", "New", "(", "agent", ".", "ctx", ",", "agent", ".", "<mask>", ",", "udevMonitor", ",", "state", ",", "stateChangeEvents", ")", "\n", "if", "err", ":=", "eniWatcher", ".", "Init", "(", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "go", "eniWatcher", ".", "Start", "(", ")", "\n", "return", "nil", "\n", "}" ]
6,372
all-6373
[ "NewImageFromImage", "creates", "a", "new", "image", "with", "the", "given", "image", "(", "source", ")", ".", "If", "source", "s", "width", "or", "height", "is", "less", "than", "1", "or", "more", "than", "device", "-", "dependent", "maximum", "size", "NewImageFromImage", "panics", ".", "filter", "argument", "is", "just", "for", "backward", "compatibility", ".", "If", "you", "are", "not", "sure", "specify", "FilterDefault", ".", "Error", "returned", "by", "NewImageFromImage", "is", "always", "nil", "as", "of", "1", ".", "5", ".", "0", "-", "alpha", "." ]
[ "func", "NewImageFromImage", "(", "source", "image", ".", "Image", ",", "filter", "Filter", ")", "(", "*", "Image", ",", "error", ")", "{", "size", ":=", "source", ".", "Bounds", "(", ")", ".", "Size", "(", ")", "\n\n", "width", ",", "height", ":=", "size", ".", "X", ",", "size", ".", "Y", "\n\n", "s", ":=", "shareable", ".", "NewImage", "(", "<mask>", ",", "height", ")", "\n", "i", ":=", "&", "Image", "{", "mipmap", ":", "newMipmap", "(", "s", ")", ",", "filter", ":", "filter", ",", "}", "\n", "i", ".", "addr", "=", "i", "\n\n", "_", "=", "i", ".", "ReplacePixels", "(", "graphics", ".", "CopyImage", "(", "source", ")", ")", "\n", "return", "i", ",", "nil", "\n", "}" ]
6,373
all-6374
[ "GetLineCap", "is", "a", "wrapper", "around", "cairo_get_line_cap", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetLineCap", "(", ")", "LineCap", "{", "c", ":=", "C", ".", "cairo_get_line_cap", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "LineCap", "(", "c", ")", "\n", "}" ]
6,374
all-6375
[ "MarshalEasyJSON", "writes", "the", "HexColor", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "h", "HexColor", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "<mask>", ")", "{", "w", ".", "String", "(", "string", "(", "h", ")", ")", "\n", "}" ]
6,375
all-6376
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventWorkerVersionUpdated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,376
all-6377
[ "AddEntity", "adds", "the", "entity", "to", "all", "systems", "that", "have", "been", "added", "via", "AddSystemInterface", ".", "If", "the", "system", "was", "added", "via", "AddSystem", "the", "entity", "will", "not", "be", "added", "to", "it", "." ]
[ "func", "(", "w", "*", "World", ")", "AddEntity", "(", "e", "Identifier", ")", "{", "if", "w", ".", "sysIn", "==", "nil", "{", "w", ".", "sysIn", "=", "make", "(", "map", "[", "reflect", ".", "Type", "]", "reflect", ".", "Type", ")", "\n", "}", "\n", "if", "w", ".", "sysEx", "==", "nil", "{", "w", ".", "sysEx", "=", "make", "(", "map", "[", "reflect", ".", "<mask>", "]", "reflect", ".", "Type", ")", "\n", "}", "\n", "for", "_", ",", "system", ":=", "range", "w", ".", "systems", "{", "sys", ",", "ok", ":=", "system", ".", "(", "SystemAddByInterfacer", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "if", "ex", ",", "not", ":=", "w", ".", "sysEx", "[", "reflect", ".", "TypeOf", "(", "sys", ")", "]", ";", "not", "{", "if", "reflect", ".", "TypeOf", "(", "e", ")", ".", "Implements", "(", "ex", ")", "{", "continue", "\n", "}", "\n", "}", "\n", "if", "in", ",", "ok", ":=", "w", ".", "sysIn", "[", "reflect", ".", "TypeOf", "(", "sys", ")", "]", ";", "ok", "{", "if", "reflect", ".", "TypeOf", "(", "e", ")", ".", "Implements", "(", "in", ")", "{", "sys", ".", "AddByInterface", "(", "e", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
6,377
all-6378
[ "Validate", "inspects", "the", "fields", "of", "the", "type", "to", "determine", "if", "they", "are", "valid", "." ]
[ "func", "(", "s", "*", "RunTaskInput", ")", "Validate", "(", ")", "error", "{", "invalidParams", ":=", "<mask>", ".", "ErrInvalidParams", "{", "Context", ":", "\"", "\"", "}", "\n", "if", "s", ".", "TaskDefinition", "==", "nil", "{", "invalidParams", ".", "Add", "(", "request", ".", "NewErrParamRequired", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "if", "s", ".", "NetworkConfiguration", "!=", "nil", "{", "if", "err", ":=", "s", ".", "NetworkConfiguration", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "invalidParams", ".", "AddNested", "(", "\"", "\"", ",", "err", ".", "(", "request", ".", "ErrInvalidParams", ")", ")", "\n", "}", "\n", "}", "\n\n", "if", "invalidParams", ".", "Len", "(", ")", ">", "0", "{", "return", "invalidParams", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,378
all-6379
[ "Arguments", "adds", "the", "arguments", "to", "the", "args", "." ]
[ "func", "(", "r", "*", "RequestBuilder", ")", "Arguments", "(", "args", "...", "string", ")", "*", "RequestBuilder", "{", "r", ".", "args", "=", "<mask>", "(", "r", ".", "args", ",", "args", "...", ")", "\n", "return", "r", "\n", "}" ]
6,379
all-6380
[ "NewMockDockerMetadataClient", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockDockerMetadataClient", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockDockerMetadataClient", "{", "mock", ":=", "&", "MockDockerMetadataClient", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockDockerMetadataClientMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
6,380
all-6381
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopViolationsReportParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLog1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
6,381
all-6382
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestMemoryDumpReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
6,382
all-6383
[ "ensureParent", "makes", "sure", "that", "the", "parent", "directory", "of", "current", "is", "created", "and", "populated", "with", "the", "proper", "cpus", "and", "mems", "files", "copied", "from", "it", "s", "parent", "." ]
[ "func", "(", "s", "*", "CpusetGroup", ")", "ensureParent", "(", "current", ",", "<mask>", "string", ")", "error", "{", "parent", ":=", "filepath", ".", "Dir", "(", "current", ")", "\n", "if", "filepath", ".", "Clean", "(", "parent", ")", "==", "root", "{", "return", "nil", "\n", "}", "\n", "if", "err", ":=", "s", ".", "ensureParent", "(", "parent", ",", "root", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "current", ",", "0755", ")", ";", "err", "!=", "nil", "&&", "!", "os", ".", "IsExist", "(", "err", ")", "{", "return", "err", "\n", "}", "\n", "return", "s", ".", "copyIfNeeded", "(", "current", ",", "parent", ")", "\n", "}" ]
6,383
all-6384
[ "appendReplacementCandiates", "creates", "prioritize", ".", "CandidateWithTime", "values", "for", "digest", "in", "scopeBucket", "and", "returns", "the", "result", "of", "appending", "them", "to", "candidates", "." ]
[ "func", "(", "bdc", "*", "cache", ")", "appendReplacementCandidates", "(", "candidates", "[", "]", "prioritize", ".", "CandidateWithTime", ",", "scopeBucket", "*", "bolt", ".", "Bucket", ",", "digest", "digest", ".", "Digest", ")", "[", "]", "prioritize", ".", "CandidateWithTime", "{", "b", ":=", "scopeBucket", ".", "Bucket", "(", "[", "]", "byte", "(", "digest", ".", "String", "(", ")", ")", ")", "\n", "if", "b", "==", "nil", "{", "return", "candidates", "\n", "}", "\n", "_", "=", "b", ".", "ForEach", "(", "func", "(", "k", ",", "v", "[", "]", "<mask>", ")", "error", "{", "t", ":=", "time", ".", "Time", "{", "}", "\n", "if", "err", ":=", "t", ".", "UnmarshalBinary", "(", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "candidates", "=", "append", "(", "candidates", ",", "prioritize", ".", "CandidateWithTime", "{", "Candidate", ":", "types", ".", "BICReplacementCandidate", "{", "Digest", ":", "digest", ",", "Location", ":", "types", ".", "BICLocationReference", "{", "Opaque", ":", "string", "(", "k", ")", "}", ",", "}", ",", "LastSeen", ":", "t", ",", "}", ")", "\n", "return", "nil", "\n", "}", ")", "// FIXME? Log error (but throttle the log volume on repeated accesses)?", "\n", "return", "candidates", "\n", "}" ]
6,384
all-6385
[ "Make", "a", "vmdk", "disk", "image", "with", "the", "given", "size", "(", "in", "MB", ")", "." ]
[ "func", "vdiskmanager", "(", "dest", "string", ",", "size", "int", ")", "error", "{", "cmd", ":=", "exec", ".", "Command", "(", "vdiskmanbin", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "size", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "dest", ")", "\n", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "!=", "\"", "\"", "{", "cmd", ".", "Stdout", "=", "<mask>", ".", "Stdout", "\n", "cmd", ".", "Stderr", "=", "os", ".", "Stderr", "\n", "}", "\n\n", "if", "stdout", ":=", "cmd", ".", "Run", "(", ")", ";", "stdout", "!=", "nil", "{", "if", "ee", ",", "ok", ":=", "stdout", ".", "(", "*", "exec", ".", "Error", ")", ";", "ok", "&&", "ee", "==", "exec", ".", "ErrNotFound", "{", "return", "ErrVMRUNNotFound", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
6,385
all-6386
[ "CreateSubnet", "creates", "or", "updates", "a", "subnet", "if", "it", "does", "not", "already", "exist", "." ]
[ "func", "(", "a", "AzureClient", ")", "CreateSubnet", "(", "ctx", "*", "DeploymentContext", ",", "resourceGroup", ",", "virtualNetwork", ",", "name", ",", "subnetPrefix", "string", ")", "error", "{", "subnet", ",", "err", ":=", "a", ".", "GetSubnet", "(", "resourceGroup", ",", "virtualNetwork", ",", "<mask>", ")", "\n", "if", "err", "==", "nil", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "ctx", ".", "SubnetID", "=", "to", ".", "String", "(", "subnet", ".", "ID", ")", "\n", "return", "err", "\n", "}", "\n\n", "// If the subnet is not found, create it", "if", "err", ".", "(", "autorest", ".", "DetailedError", ")", ".", "StatusCode", "==", "404", "{", "log", ".", "Info", "(", "\"", "\"", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "name", ",", "\"", "\"", ":", "virtualNetwork", ",", "\"", "\"", ":", "subnetPrefix", "}", ")", "\n", "_", ",", "err", "=", "a", ".", "subnetsClient", "(", ")", ".", "CreateOrUpdate", "(", "resourceGroup", ",", "virtualNetwork", ",", "name", ",", "network", ".", "Subnet", "{", "Properties", ":", "&", "network", ".", "SubnetPropertiesFormat", "{", "AddressPrefix", ":", "to", ".", "StringPtr", "(", "subnetPrefix", ")", ",", "}", ",", "}", ",", "nil", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "subnet", ",", "err", "=", "a", ".", "subnetsClient", "(", ")", ".", "Get", "(", "resourceGroup", ",", "virtualNetwork", ",", "name", ",", "\"", "\"", ")", "\n", "ctx", ".", "SubnetID", "=", "to", ".", "String", "(", "subnet", ".", "ID", ")", "\n", "return", "err", "\n", "}", "\n\n", "log", ".", "Warn", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n\n", "}" ]
6,386
all-6387
[ "ensure", "retreives", "a", "value", "associated", "with", "the", "given", "key", "from", "the", "cache", ".", "If", "the", "key", "does", "not", "exist", "in", "the", "cache", "the", "load", "function", "will", "be", "called", "and", "its", "result", "will", "be", "associated", "with", "the", "key", ".", "The", "load", "function", "will", "not", "be", "called", "more", "than", "once", "for", "any", "key", "." ]
[ "func", "(", "m", "*", "remoteCacheMap", ")", "ensure", "(", "key", "string", ",", "load", "func", "(", ")", "(", "interface", "{", "}", ",", "error", ")", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "e", ",", "ok", ":=", "m", ".", "cache", "[", "key", "]", "\n", "if", "!", "ok", "{", "e", "=", "&", "remoteCacheEntry", "{", "ready", ":", "make", "(", "chan", "struct", "{", "}", ")", "}", "\n", "m", ".", "cache", "[", "key", "]", "=", "e", "\n", "m", ".", "mu", ".", "Unlock", "(", ")", "\n", "e", ".", "value", ",", "e", ".", "err", "=", "load", "(", ")", "\n", "close", "(", "e", ".", "ready", ")", "\n", "}", "else", "{", "m", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "e", ".", "<mask>", "!=", "nil", "{", "<-", "e", ".", "ready", "\n", "}", "\n", "}", "\n", "return", "e", ".", "value", ",", "e", ".", "err", "\n", "}" ]
6,387
all-6388
[ "WriteRequest", "writes", "a", "http", ".", "Request", "to", "the", "given", "writers", "." ]
[ "func", "WriteRequest", "(", "call", "tchannel", ".", "ArgWritable", ",", "req", "*", "http", ".", "Request", ")", "error", "{", "// TODO(prashant): Allow creating write buffers that let you grow the buffer underneath.", "wb", ":=", "typed", ".", "NewWriteBufferWithSize", "(", "10000", ")", "\n", "wb", ".", "WriteLen8String", "(", "req", ".", "Method", ")", "\n", "writeVarintString", "(", "wb", ",", "req", ".", "<mask>", ".", "String", "(", ")", ")", "\n", "writeHeaders", "(", "wb", ",", "req", ".", "Header", ")", "\n\n", "arg2Writer", ",", "err", ":=", "call", ".", "Arg2Writer", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "err", ":=", "wb", ".", "FlushTo", "(", "arg2Writer", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "arg2Writer", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "arg3Writer", ",", "err", ":=", "call", ".", "Arg3Writer", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "req", ".", "Body", "!=", "nil", "{", "if", "_", ",", "err", "=", "io", ".", "Copy", "(", "arg3Writer", ",", "req", ".", "Body", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "arg3Writer", ".", "Close", "(", ")", "\n", "}" ]
6,388
all-6389
[ "NewClientFromURLAndSecret", "constructs", "a", "client", "by", "parsing", "URL", "and", "then", "constructing", "the", "correct", "client", "for", "that", "URL", "using", "secrets", "." ]
[ "func", "NewClientFromURLAndSecret", "(", "url", "*", "ObjectStoreURL", ",", "reversed", "...", "bool", ")", "(", "c", "Client", ",", "err", "error", ")", "{", "switch", "url", ".", "Store", "{", "case", "\"", "\"", ":", "c", ",", "err", "=", "NewAmazonClientFromSecret", "(", "url", ".", "Bucket", ",", "reversed", "...", ")", "\n", "<mask>", "\"", "\"", ":", "fallthrough", "\n", "case", "\"", "\"", ":", "c", ",", "err", "=", "NewGoogleClientFromSecret", "(", "url", ".", "Bucket", ")", "\n", "case", "\"", "\"", ":", "fallthrough", "\n", "case", "\"", "\"", ":", "// In Azure, the first part of the path is the container name.", "c", ",", "err", "=", "NewMicrosoftClientFromSecret", "(", "url", ".", "Bucket", ")", "\n", "case", "\"", "\"", ":", "c", ",", "err", "=", "NewLocalClient", "(", "\"", "\"", "+", "url", ".", "Bucket", ")", "\n", "}", "\n", "switch", "{", "case", "err", "!=", "nil", ":", "return", "nil", ",", "err", "\n", "case", "c", "!=", "nil", ":", "return", "TracingObjClient", "(", "url", ".", "Store", ",", "c", ")", ",", "nil", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "url", ".", "Bucket", ")", "\n", "}", "\n", "}" ]
6,389
all-6390
[ "GetTokenData", "implements", "the", "flame", ".", "GenericToken", "interface", "." ]
[ "func", "(", "t", "*", "Token", ")", "GetTokenData", "(", ")", "(", "TokenType", ",", "[", "]", "string", ",", "<mask>", ".", "Time", ",", "bson", ".", "ObjectId", ",", "*", "bson", ".", "ObjectId", ")", "{", "return", "t", ".", "Type", ",", "t", ".", "Scope", ",", "t", ".", "ExpiresAt", ",", "t", ".", "Application", ",", "t", ".", "User", "\n", "}" ]
6,390
all-6391
[ "StoragePoolVolumeRename", "renames", "the", "storage", "volume", "attached", "to", "a", "given", "storage", "pool", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolVolumeRename", "(", "<mask>", ",", "oldVolumeName", "string", ",", "newVolumeName", "string", ",", "volumeType", "int", ",", "poolID", "int64", ")", "error", "{", "volumeID", ",", "_", ",", "err", ":=", "c", ".", "StoragePoolNodeVolumeGetTypeByProject", "(", "project", ",", "oldVolumeName", ",", "volumeType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "err", ":=", "storagePoolVolumeReplicateIfCeph", "(", "tx", ".", "tx", ",", "volumeID", ",", "project", ",", "oldVolumeName", ",", "volumeType", ",", "poolID", ",", "func", "(", "volumeID", "int64", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "tx", ".", "Exec", "(", "\"", "\"", ",", "newVolumeName", ",", "volumeID", ",", "volumeType", ")", "\n", "return", "err", "\n", "}", ")", "\n", "return", "err", "\n", "}", ")", "\n\n", "return", "err", "\n", "}" ]
6,391
all-6392
[ "splitQuoted", "splits", "the", "string", "s", "around", "each", "instance", "of", "one", "or", "more", "consecutive", "white", "space", "characters", "while", "taking", "into", "account", "quotes", "and", "escaping", "and", "returns", "an", "array", "of", "substrings", "of", "s", "or", "an", "empty", "list", "if", "s", "contains", "only", "white", "space", ".", "Single", "quotes", "and", "double", "quotes", "are", "recognized", "to", "prevent", "splitting", "within", "the", "quoted", "region", "and", "are", "removed", "from", "the", "resulting", "substrings", ".", "If", "a", "quote", "in", "s", "isn", "t", "closed", "err", "will", "be", "set", "and", "r", "will", "have", "the", "unclosed", "argument", "as", "the", "last", "element", ".", "The", "backslash", "is", "used", "for", "escaping", ".", "For", "example", "the", "following", "string", ":", "a", "b", ":", "c", "d", "e", "f", "g", "\\", "Would", "be", "parsed", "as", ":", "[]", "string", "{", "a", "b", ":", "c", "d", "ef", "g", "}", "Copied", "from", "go", "/", "build", ".", "splitQuoted" ]
[ "func", "splitQuoted", "(", "s", "string", ")", "(", "r", "[", "]", "string", ",", "err", "error", ")", "{", "var", "args", "[", "]", "string", "\n", "arg", ":=", "make", "(", "[", "]", "rune", ",", "len", "(", "s", ")", ")", "\n", "escaped", ":=", "false", "\n", "quoted", ":=", "false", "\n", "quote", ":=", "'\\x00'", "\n", "i", ":=", "0", "\n", "for", "_", ",", "rune", ":=", "range", "s", "{", "switch", "{", "<mask>", "escaped", ":", "escaped", "=", "false", "\n", "case", "rune", "==", "'\\\\'", ":", "escaped", "=", "true", "\n", "continue", "\n", "case", "quote", "!=", "'\\x00'", ":", "if", "rune", "==", "quote", "{", "quote", "=", "'\\x00'", "\n", "continue", "\n", "}", "\n", "case", "rune", "==", "'\"'", "||", "rune", "==", "'\\''", ":", "quoted", "=", "true", "\n", "quote", "=", "rune", "\n", "continue", "\n", "case", "unicode", ".", "IsSpace", "(", "rune", ")", ":", "if", "quoted", "||", "i", ">", "0", "{", "quoted", "=", "false", "\n", "args", "=", "append", "(", "args", ",", "string", "(", "arg", "[", ":", "i", "]", ")", ")", "\n", "i", "=", "0", "\n", "}", "\n", "continue", "\n", "}", "\n", "arg", "[", "i", "]", "=", "rune", "\n", "i", "++", "\n", "}", "\n", "if", "quoted", "||", "i", ">", "0", "{", "args", "=", "append", "(", "args", ",", "string", "(", "arg", "[", ":", "i", "]", ")", ")", "\n", "}", "\n", "if", "quote", "!=", "0", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "else", "if", "escaped", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "args", ",", "err", "\n", "}" ]
6,392
all-6393
[ "RecoverPubKey", "recover", "public", "key", "from", "signature", "values", "." ]
[ "func", "RecoverPubKey", "(", "signer", "types", ".", "Signer", ",", "tx", "*", "types", ".", "Transaction", ")", "(", "*", "ecdsa", ".", "PublicKey", ",", "error", ")", "{", "V", ",", "R", ",", "S", ":=", "tx", ".", "RawSignatureValues", "(", ")", "\n", "hash", ":=", "signer", ".", "Hash", "(", "tx", ")", "\n", "r", ",", "s", ":=", "R", ".", "Bytes", "(", ")", ",", "S", ".", "Bytes", "(", ")", "\n", "sig", ":=", "make", "(", "[", "]", "byte", ",", "65", ")", "\n", "copy", "(", "sig", "[", "32", "-", "len", "(", "r", ")", ":", "32", "]", ",", "r", ")", "\n", "copy", "(", "sig", "[", "64", "-", "len", "(", "s", ")", ":", "64", "]", ",", "s", ")", "\n", "sig", "[", "64", "]", "=", "byte", "(", "V", ".", "Uint64", "(", ")", "-", "27", ")", "\n", "// recover the public key from the signature", "pub", ",", "err", ":=", "crypto", ".", "Ecrecover", "(", "<mask>", "[", ":", "]", ",", "sig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "crypto", ".", "UnmarshalPubkey", "(", "pub", ")", "\n", "}" ]
6,393
all-6394
[ "specify", "a", "two", "-", "dimensional", "texture", "subimage" ]
[ "func", "TextureSubImage2D", "(", "texture", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "width", "int32", ",", "height", "int32", ",", "format", "uint32", ",", "xtype", "uint32", ",", "pixels", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowTextureSubImage2D", "(", "gpTextureSubImage2D", ",", "(", "C", ".", "GLuint", ")", "(", "texture", ")", ",", "(", "C", ".", "GLint", ")", "(", "level", ")", ",", "(", "C", ".", "GLint", ")", "(", "xoffset", ")", ",", "(", "C", ".", "GLint", ")", "(", "yoffset", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "format", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "pixels", ")", "\n", "}" ]
6,394
all-6395
[ "Get", "gets", "the", "value", "stored", "by", "specified", "token", "." ]
[ "func", "(", "s", "*", "SessionCache", ")", "Get", "(", "token", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "v", ",", "err", ":=", "s", ".", "<mask>", ".", "Get", "(", "token", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "s", ".", "getInvalidTokenError", "(", "token", ")", "\n", "}", "\n", "return", "v", ",", "err", "\n", "}" ]
6,395
all-6396
[ "IsExtInCert", "is", "equivalent", "to", "GetExtFromCert", "()", "!", "=", "nil", "." ]
[ "func", "IsExtInCert", "(", "cert", "*", "x509", ".", "Certificate", ",", "oid", "asn1", ".", "ObjectIdentifier", ")", "bool", "{", "if", "<mask>", "!=", "nil", "&&", "GetExtFromCert", "(", "cert", ",", "oid", ")", "!=", "nil", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
6,396
all-6397
[ "HandleFunc", "registers", "a", "handler", "function", "for", "a", "given", "pattern", "." ]
[ "func", "(", "s", "*", "Server", ")", "HandleFunc", "(", "pattern", "string", ",", "handler", "HandlerFunc", ")", "{", "s", ".", "Mux", "(", ")", ".", "HandleFunc", "(", "pattern", ",", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "handler", "(", "w", ",", "r", ",", "&", "<mask>", "{", "}", ")", "\n", "}", ")", "\n", "}" ]
6,397
all-6398
[ "flushable", "returns", "a", "boolean", "value", "indicating", "whether", "there", "is", "a", "flushable", "line", "in", "the", "field", "." ]
[ "func", "(", "f", "*", "<mask>", ")", "flushable", "(", ")", "bool", "{", "for", "j", ":=", "fieldBlockNumY", "-", "1", ";", "0", "<=", "j", ";", "j", "--", "{", "if", "f", ".", "flushableLine", "(", "j", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
6,398
all-6399
[ "GetTitleSize", "returns", "the", "TitleSize", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "GetTitleSize", "(", ")", "<mask>", "{", "if", "t", "==", "nil", "||", "t", ".", "TitleSize", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "TitleSize", "\n", "}" ]
6,399
all-6400
[ "isNetworkStatsError", "returns", "if", "the", "error", "indicates", "that", "files", "in", "/", "sys", "/", "class", "/", "net", "could", "not", "be", "opened", "." ]
[ "func", "isNetworkStatsError", "(", "err", "error", ")", "bool", "{", "matched", ",", "mErr", ":=", "regexp", ".", "MatchString", "(", "networkStatsErrorPattern", ",", "err", ".", "<mask>", "(", ")", ")", "\n", "if", "mErr", "!=", "nil", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "mErr", ")", "\n", "return", "false", "\n", "}", "\n\n", "return", "matched", "\n", "}" ]