id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
3,300
all-3301
[ "Match", "searches", "for", "a", "rule", "that", "can", "be", "merged", "with", "x", "in", "rules", ".", "A", "rule", "is", "considered", "a", "match", "if", "its", "kind", "is", "equal", "to", "x", "s", "kind", "AND", "either", "its", "name", "is", "equal", "OR", "at", "least", "one", "of", "the", "attributes", "in", "matchAttrs", "is", "equal", ".", "If", "there", "are", "no", "matches", "nil", "and", "nil", "are", "returned", ".", "If", "a", "rule", "has", "the", "same", "name", "but", "a", "different", "kind", "nill", "and", "an", "error", "are", "returned", ".", "If", "there", "is", "exactly", "one", "match", "the", "rule", "and", "nil", "are", "returned", ".", "If", "there", "are", "multiple", "matches", "match", "will", "attempt", "to", "disambiguate", "based", "on", "the", "quality", "of", "the", "match", "(", "name", "match", "is", "best", "then", "attribute", "match", "in", "the", "order", "that", "attributes", "are", "listed", ")", ".", "If", "disambiguation", "is", "successful", "the", "rule", "and", "nil", "are", "returned", ".", "Otherwise", "nil", "and", "an", "error", "are", "returned", "." ]
[ "func", "Match", "(", "rules", "[", "]", "*", "rule", ".", "Rule", ",", "x", "*", "rule", ".", "Rule", ",", "info", "rule", ".", "KindInfo", ")", "(", "*", "rule", ".", "Rule", ",", "error", ")", "{", "xname", ":=", "x", ".", "Name", "(", ")", "\n", "xkind", ":=", "x", ".", "Kind", "(", ")", "\n", "var", "nameMatches", "[", "]", "*", "rule", ".", "Rule", "\n", "<mask>", "kindMatches", "[", "]", "*", "rule", ".", "Rule", "\n", "for", "_", ",", "y", ":=", "range", "rules", "{", "if", "xname", "==", "y", ".", "Name", "(", ")", "{", "nameMatches", "=", "append", "(", "nameMatches", ",", "y", ")", "\n", "}", "\n", "if", "xkind", "==", "y", ".", "Kind", "(", ")", "{", "kindMatches", "=", "append", "(", "kindMatches", ",", "y", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "nameMatches", ")", "==", "1", "{", "y", ":=", "nameMatches", "[", "0", "]", "\n", "if", "xkind", "!=", "y", ".", "Kind", "(", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "xkind", ",", "xname", ",", "y", ".", "Kind", "(", ")", ")", "\n", "}", "\n", "return", "y", ",", "nil", "\n", "}", "\n", "if", "len", "(", "nameMatches", ")", ">", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "xkind", ",", "xname", ")", "\n", "}", "\n\n", "for", "_", ",", "key", ":=", "range", "info", ".", "MatchAttrs", "{", "var", "attrMatches", "[", "]", "*", "rule", ".", "Rule", "\n", "xvalue", ":=", "x", ".", "AttrString", "(", "key", ")", "\n", "if", "xvalue", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "for", "_", ",", "y", ":=", "range", "kindMatches", "{", "if", "xvalue", "==", "y", ".", "AttrString", "(", "key", ")", "{", "attrMatches", "=", "append", "(", "attrMatches", ",", "y", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "attrMatches", ")", "==", "1", "{", "return", "attrMatches", "[", "0", "]", ",", "nil", "\n", "}", "else", "if", "len", "(", "attrMatches", ")", ">", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "xkind", ",", "xname", ",", "key", ",", "xvalue", ")", "\n", "}", "\n", "}", "\n\n", "if", "info", ".", "MatchAny", "{", "if", "len", "(", "kindMatches", ")", "==", "1", "{", "return", "kindMatches", "[", "0", "]", ",", "nil", "\n", "}", "else", "if", "len", "(", "kindMatches", ")", ">", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "xkind", ",", "xname", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", ",", "nil", "\n", "}" ]
3,301
all-3302
[ "readUint32", "reads", "a", "RAR", "V3", "encoded", "uint32" ]
[ "func", "(", "r", "*", "rarBitReader", ")", "readUint32", "(", ")", "(", "uint32", ",", "error", ")", "{", "n", ",", "err", ":=", "r", ".", "readBits", "(", "2", ")", "\n", "if", "<mask>", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "if", "n", "!=", "1", "{", "n", ",", "err", "=", "r", ".", "readBits", "(", "4", "<<", "uint", "(", "n", ")", ")", "\n", "return", "uint32", "(", "n", ")", ",", "err", "\n", "}", "\n", "n", ",", "err", "=", "r", ".", "readBits", "(", "4", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "if", "n", "==", "0", "{", "n", ",", "err", "=", "r", ".", "readBits", "(", "8", ")", "\n", "n", "|=", "-", "1", "<<", "8", "\n", "return", "uint32", "(", "n", ")", ",", "err", "\n", "}", "\n", "nlow", ",", "err", ":=", "r", ".", "readBits", "(", "4", ")", "\n", "n", "=", "n", "<<", "4", "|", "nlow", "\n", "return", "uint32", "(", "n", ")", ",", "err", "\n", "}" ]
3,302
all-3303
[ "HasStatus", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GroupData", ")", "HasStatus", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
3,303
all-3304
[ "GetEd25519", "retrieves", "the", "Ed25519", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "NodeId", ")", "GetEd25519", "(", ")", "(", "result", "Uint256", ",", "<mask>", "bool", ")", "{", "return", "PublicKey", "(", "u", ")", ".", "GetEd25519", "(", ")", "\n", "}" ]
3,304
all-3305
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "MonotonicTime", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
3,305
all-3306
[ "readKey", "reads", "a", "private", "rsa", "key", "from", "path", ".", "The", "key", "is", "expected", "to", "be", "in", "PEM", "format", "." ]
[ "func", "readKey", "(", "path", "string", ")", "(", "crypto", ".", "Signer", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "d", ",", "_", ":=", "pem", ".", "Decode", "(", "b", ")", "\n", "if", "d", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "switch", "d", ".", "Type", "{", "case", "rsaPrivateKey", ":", "return", "x509", ".", "ParsePKCS1PrivateKey", "(", "d", ".", "Bytes", ")", "\n", "case", "ecPrivateKey", ":", "return", "x509", ".", "ParseECPrivateKey", "(", "d", ".", "Bytes", ")", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "d", ".", "Type", ")", "\n", "}", "\n", "}" ]
3,306
all-3307
[ "Step", "5", "Undouble", "non", "-", "vowel", "endings" ]
[ "func", "step5", "(", "word", "*", "snowballword", ".", "SnowballWord", ")", "bool", "{", "suffix", ",", "_", ":=", "word", ".", "FirstSuffix", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "suffix", "!=", "\"", "\"", "{", "word", ".", "RemoveLastNRunes", "(", "1", ")", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
3,307
all-3308
[ "ataWrite", "performs", "an", "ATA", "28", "-", "bit", "or", "48", "-", "bit", "write", "request", "on", "rs", "using", "the", "argument", "values", "in", "r", "." ]
[ "func", "ataWrite", "(", "r", "*", "ATAArg", ",", "rs", "io", ".", "ReadSeeker", ")", "(", "*", "ATAArg", ",", "error", ")", "{", "// Only ATA writes allowed here", "if", "r", ".", "CmdStatus", "!=", "ATACmdStatusWrite28Bit", "&&", "r", ".", "CmdStatus", "!=", "ATACmdStatusWrite48Bit", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// Write must be flagged as a write", "if", "!", "r", ".", "FlagWrite", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// Verify that request data and sector count match up", "if", "sectors", ":=", "len", "(", "r", ".", "Data", ")", "/", "sectorSize", ";", "sectors", "!=", "int", "(", "r", ".", "SectorCount", ")", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// Determine if io.ReadSeeker is also an io.Writer, and if a write is", "// requested", "rws", ",", "ok", ":=", "rs", ".", "(", "io", ".", "ReadWriteSeeker", ")", "\n", "if", "!", "ok", "{", "// A write was requested, but the io.ReadSeeker is not an io.Writer", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "// TODO(mdlayher): implement asynchronous writes", "// Convert LBA to byte offset and seek to correct location", "offset", ":=", "calculateLBA", "(", "r", ".", "LBA", ",", "r", ".", "FlagLBA48Extended", ")", "*", "sectorSize", "\n", "if", "_", ",", "err", ":=", "rs", ".", "Seek", "(", "<mask>", ",", "os", ".", "SEEK_SET", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Write data to stream", "n", ",", "err", ":=", "rws", ".", "Write", "(", "r", ".", "Data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Verify full sectors written to disk using sector count", "if", "sectors", ":=", "n", "/", "sectorSize", ";", "sectors", "!=", "int", "(", "r", ".", "SectorCount", ")", "{", "return", "nil", ",", "errATAAbort", "\n", "}", "\n\n", "return", "&", "ATAArg", "{", "CmdStatus", ":", "ATACmdStatusReadyStatus", ",", "}", ",", "nil", "\n", "}" ]
3,308
all-3309
[ "Checkout", "does", "git", "checkout", "." ]
[ "func", "(", "lg", "*", "LocalGit", ")", "Checkout", "(", "org", ",", "repo", ",", "commitlike", "string", ")", "error", "{", "rdir", ":=", "filepath", ".", "Join", "(", "lg", ".", "Dir", ",", "org", ",", "repo", ")", "\n", "<mask>", "runCmd", "(", "lg", ".", "Git", ",", "rdir", ",", "\"", "\"", ",", "commitlike", ")", "\n", "}" ]
3,309
all-3310
[ "simultaneously", "specify", "storage", "for", "all", "levels", "of", "a", "one", "-", "dimensional", "texture" ]
[ "func", "TextureStorage1D", "(", "texture", "uint32", ",", "levels", "int32", ",", "internalformat", "uint32", ",", "<mask>", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpTextureStorage1D", ",", "4", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "levels", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "width", ")", ",", "0", ",", "0", ")", "\n", "}" ]
3,310
all-3311
[ "Merge", "the", "gossiped", "data", "represented", "by", "buf", "into", "our", "state", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "OnGossipUnicast", "(", "src", "mesh", ".", "PeerName", ",", "buf", "[", "]", "byte", ")", "error", "{", "var", "set", "map", "[", "mesh", ".", "PeerName", "]", "int", "\n", "if", "err", ":=", "gob", ".", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "buf", ")", ")", ".", "Decode", "(", "&", "set", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "complete", ":=", "p", ".", "st", ".", "mergeComplete", "(", "set", ")", "\n", "p", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "src", ",", "set", ",", "complete", ")", "\n", "return", "nil", "\n", "}" ]
3,311
all-3312
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequestStyle", ")", "GetType", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Type", "\n", "}" ]
3,312
all-3313
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ValueType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "<mask>", "ValueType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "ValueTypeBoolean", ":", "*", "t", "=", "ValueTypeBoolean", "\n", "case", "ValueTypeTristate", ":", "*", "t", "=", "ValueTypeTristate", "\n", "case", "ValueTypeBooleanOrUndefined", ":", "*", "t", "=", "ValueTypeBooleanOrUndefined", "\n", "case", "ValueTypeIdref", ":", "*", "t", "=", "ValueTypeIdref", "\n", "case", "ValueTypeIdrefList", ":", "*", "t", "=", "ValueTypeIdrefList", "\n", "case", "ValueTypeInteger", ":", "*", "t", "=", "ValueTypeInteger", "\n", "case", "ValueTypeNode", ":", "*", "t", "=", "ValueTypeNode", "\n", "case", "ValueTypeNodeList", ":", "*", "t", "=", "ValueTypeNodeList", "\n", "case", "ValueTypeNumber", ":", "*", "t", "=", "ValueTypeNumber", "\n", "case", "ValueTypeString", ":", "*", "t", "=", "ValueTypeString", "\n", "case", "ValueTypeComputedString", ":", "*", "t", "=", "ValueTypeComputedString", "\n", "case", "ValueTypeToken", ":", "*", "t", "=", "ValueTypeToken", "\n", "case", "ValueTypeTokenList", ":", "*", "t", "=", "ValueTypeTokenList", "\n", "case", "ValueTypeDomRelation", ":", "*", "t", "=", "ValueTypeDomRelation", "\n", "case", "ValueTypeRole", ":", "*", "t", "=", "ValueTypeRole", "\n", "case", "ValueTypeInternalRole", ":", "*", "t", "=", "ValueTypeInternalRole", "\n", "case", "ValueTypeValueUndefined", ":", "*", "t", "=", "ValueTypeValueUndefined", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
3,313
all-3314
[ "New", "creates", "a", "new", "functions", "client" ]
[ "func", "New", "(", "transport", "runtime", ".", "ClientTransport", ",", "formats", "strfmt", ".", "Registry", ")", "*", "Functions", "{", "cli", ":=", "new", "(", "Functions", ")", "\n", "cli", ".", "Transport", "=", "transport", "\n\n", "cli", ".", "Apps", "=", "apps", ".", "New", "(", "transport", ",", "formats", ")", "\n\n", "cli", ".", "Routes", "=", "routes", ".", "New", "(", "transport", ",", "formats", ")", "\n\n", "cli", ".", "Tasks", "=", "tasks", ".", "New", "(", "transport", ",", "formats", ")", "\n\n", "cli", ".", "<mask>", "=", "version", ".", "New", "(", "transport", ",", "formats", ")", "\n\n", "return", "cli", "\n", "}" ]
3,314
all-3315
[ "set", "front", "and", "/", "or", "back", "function", "and", "reference", "value", "for", "stencil", "testing" ]
[ "func", "StencilFuncSeparate", "(", "face", "uint32", ",", "xfunc", "uint32", ",", "<mask>", "int32", ",", "mask", "uint32", ")", "{", "C", ".", "glowStencilFuncSeparate", "(", "gpStencilFuncSeparate", ",", "(", "C", ".", "GLenum", ")", "(", "face", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xfunc", ")", ",", "(", "C", ".", "GLint", ")", "(", "ref", ")", ",", "(", "C", ".", "GLuint", ")", "(", "mask", ")", ")", "\n", "}" ]
3,315
all-3316
[ "New", "returns", "a", "new", "instance", "of", "App", "and", "adds", "some", "sane", "and", "useful", "defaults", "." ]
[ "func", "New", "(", "opts", "Options", ")", "*", "App", "{", "LoadPlugins", "(", ")", "\n", "envy", ".", "Load", "(", ")", "\n", "opts", "=", "optionsWithDefaults", "(", "opts", ")", "\n\n", "a", ":=", "&", "App", "{", "Options", ":", "opts", ",", "ErrorHandlers", ":", "ErrorHandlers", "{", "404", ":", "defaultErrorHandler", ",", "500", ":", "defaultErrorHandler", ",", "}", ",", "router", ":", "mux", ".", "NewRouter", "(", ")", ",", "moot", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "routes", ":", "RouteList", "{", "}", ",", "children", ":", "[", "]", "*", "App", "{", "}", ",", "}", "\n\n", "dem", ":=", "a", ".", "defaultErrorMiddleware", "\n", "a", ".", "Middleware", "=", "newMiddlewareStack", "(", "dem", ")", "\n\n", "notFoundHandler", ":=", "func", "(", "errorf", "string", ",", "<mask>", "int", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "c", ":=", "a", ".", "newContext", "(", "RouteInfo", "{", "}", ",", "res", ",", "req", ")", "\n", "err", ":=", "fmt", ".", "Errorf", "(", "errorf", ",", "req", ".", "Method", ",", "req", ".", "URL", ".", "Path", ")", "\n", "a", ".", "ErrorHandlers", ".", "Get", "(", "code", ")", "(", "code", ",", "err", ",", "c", ")", "\n", "}", "\n", "}", "\n\n", "a", ".", "router", ".", "NotFoundHandler", "=", "notFoundHandler", "(", "\"", "\"", ",", "404", ")", "\n", "a", ".", "router", ".", "MethodNotAllowedHandler", "=", "notFoundHandler", "(", "\"", "\"", ",", "405", ")", "\n\n", "if", "a", ".", "MethodOverride", "==", "nil", "{", "a", ".", "MethodOverride", "=", "MethodOverride", "\n", "}", "\n", "a", ".", "Use", "(", "a", ".", "PanicHandler", ")", "\n", "a", ".", "Use", "(", "RequestLogger", ")", "\n", "a", ".", "Use", "(", "sessionSaver", ")", "\n\n", "return", "a", "\n", "}" ]
3,316
all-3317
[ "GetTabReorderable", "()", "is", "a", "wrapper", "around", "gtk_notebook_get_tab_reorderable", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "GetTabReorderable", "(", "child", "IWidget", ")", "bool", "{", "c", ":=", "C", ".", "gtk_notebook_get_tab_reorderable", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
3,317
all-3318
[ "expandVmwareDistributedVirtualSwitchTrunkVlanSpec", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "VmwareDistributedVirtualSwitchTrunkVlanSpec", "." ]
[ "func", "expandVmwareDistributedVirtualSwitchTrunkVlanSpec", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "VmwareDistributedVirtualSwitchTrunkVlanSpec", "{", "var", "ranges", "[", "]", "types", ".", "NumericRange", "\n", "data", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "*", "schema", ".", "Set", ")", ".", "<mask>", "(", ")", "\n", "for", "_", ",", "v", ":=", "range", "data", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "v", ")", "\n", "r", ":=", "v", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "min", ":=", "r", "[", "\"", "\"", "]", ".", "(", "int", ")", "\n", "max", ":=", "r", "[", "\"", "\"", "]", ".", "(", "int", ")", "\n", "rng", ":=", "types", ".", "NumericRange", "{", "Start", ":", "int32", "(", "min", ")", ",", "End", ":", "int32", "(", "max", ")", ",", "}", "\n", "ranges", "=", "append", "(", "ranges", ",", "rng", ")", "\n", "}", "\n\n", "if", "len", "(", "ranges", ")", "<", "1", "{", "return", "nil", "\n", "}", "\n\n", "obj", ":=", "&", "types", ".", "VmwareDistributedVirtualSwitchTrunkVlanSpec", "{", "VlanId", ":", "ranges", ",", "}", "\n", "return", "obj", "\n", "}" ]
3,318
all-3319
[ "--", "Trigger", "Trigger", "creates", "a", "new", "PagerDuty", "incident", "using", "the", "default", "client", "with", "the", "given", "description", ".", "The", "returned", "incident", "key", "can", "be", "used", "to", "resolve", "the", "incident", ".", "It", "can", "also", "be", "used", "by", "the", "TriggerIncidentKey", "*", "functions", "to", "trigger", "an", "incident", "only", "if", "that", "specific", "incident", "has", "been", "resolved", "." ]
[ "func", "Trigger", "(", "<mask>", "string", ")", "(", "incidentKey", "string", ",", "err", "error", ")", "{", "return", "trigger", "(", "description", ",", "\"", "\"", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "}", ")", "\n", "}" ]
3,319
all-3320
[ "ResolvePathToFullyExplicit", "returns", "the", "input", "path", "converted", "to", "an", "absolute", "no", "-", "symlinks", "cleaned", "up", "path", ".", "To", "do", "so", "all", "elements", "of", "the", "input", "path", "must", "exist", ";", "as", "a", "special", "case", "the", "final", "component", "may", "be", "a", "non", "-", "existent", "name", "(", "but", "not", "a", "symlink", "pointing", "to", "a", "non", "-", "existent", "name", ")", "This", "is", "intended", "as", "a", "a", "helper", "for", "implementations", "of", "types", ".", "ImageReference", ".", "PolicyConfigurationIdentity", "etc", "." ]
[ "func", "ResolvePathToFullyExplicit", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "switch", "_", ",", "err", ":=", "os", ".", "Lstat", "(", "path", ")", ";", "{", "case", "err", "==", "nil", ":", "return", "resolveExistingPathToFullyExplicit", "(", "path", ")", "\n", "case", "os", ".", "IsNotExist", "(", "err", ")", ":", "parent", ",", "file", ":=", "filepath", ".", "Split", "(", "path", ")", "\n", "resolvedParent", ",", "err", ":=", "resolveExistingPathToFullyExplicit", "(", "parent", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "<mask>", "==", "\"", "\"", "||", "file", "==", "\"", "\"", "{", "// Coverage: This can happen, but very rarely: if we have successfully resolved the parent, both \".\" and \"..\" in it should have been resolved as well.", "// This can still happen if there is a filesystem race condition, causing the Lstat() above to fail but the later resolution to succeed.", "// We do not care to promise anything if such filesystem race conditions can happen, but we definitely don't want to return \".\"/\"..\" components", "// in the resulting path, and especially not at the end.", "return", "\"", "\"", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "resolvedPath", ":=", "filepath", ".", "Join", "(", "resolvedParent", ",", "file", ")", "\n", "// As a sanity check, ensure that there are no \".\" or \"..\" components.", "cleanedResolvedPath", ":=", "filepath", ".", "Clean", "(", "resolvedPath", ")", "\n", "if", "cleanedResolvedPath", "!=", "resolvedPath", "{", "// Coverage: This should never happen.", "return", "\"", "\"", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "path", ",", "resolvedPath", ",", "cleanedResolvedPath", ")", "\n", "}", "\n", "return", "resolvedPath", ",", "nil", "\n", "default", ":", "// err != nil, unrecognized", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}" ]
3,320
all-3321
[ "grow", "the", "inflight", "buffer", "by", "doubling", "up", "to", "inflights", ".", "size", ".", "We", "grow", "on", "demand", "instead", "of", "preallocating", "to", "inflights", ".", "size", "to", "handle", "systems", "which", "have", "thousands", "of", "Raft", "groups", "per", "process", "." ]
[ "func", "(", "in", "*", "inflights", ")", "growBuf", "(", ")", "{", "newSize", ":=", "len", "(", "<mask>", ".", "buffer", ")", "*", "2", "\n", "if", "newSize", "==", "0", "{", "newSize", "=", "1", "\n", "}", "else", "if", "newSize", ">", "in", ".", "size", "{", "newSize", "=", "in", ".", "size", "\n", "}", "\n", "newBuffer", ":=", "make", "(", "[", "]", "uint64", ",", "newSize", ")", "\n", "copy", "(", "newBuffer", ",", "in", ".", "buffer", ")", "\n", "in", ".", "buffer", "=", "newBuffer", "\n", "}" ]
3,321
all-3322
[ "export", "FileSequence_Index" ]
[ "func", "FileSequence_Index", "(", "id", "FileSeqId", ",", "frame", "int", ")", "*", "C", ".", "<mask>", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "// caller must free string", "if", "!", "ok", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "C", ".", "CString", "(", "fs", ".", "Index", "(", "frame", ")", ")", "\n", "}" ]
3,322
all-3323
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "ErrorReason", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "<mask>", "(", "string", "(", "t", ")", ")", "\n", "}" ]
3,323
all-3324
[ "WriteTo", "writes", "query", "string", "to", "w", ".", "WriteTo", "implements", "io", ".", "WriterTo", "interface", "." ]
[ "func", "(", "a", "*", "Args", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "n", ",", "err", ":=", "w", ".", "Write", "(", "a", ".", "QueryString", "(", ")", ")", "\n", "return", "int64", "(", "n", ")", ",", "err", "\n", "}" ]
3,324
all-3325
[ "replace", "ResponseWriter", "with", "a", "monitorable", "one", "return", "logger" ]
[ "func", "(", "m", "*", "monitorableWriter", ")", "Log", "(", ")", "{", "duration", ":=", "time", ".", "Now", "(", ")", ".", "Sub", "(", "m", ".", "t0", ")", "\n", "if", "m", ".", "Code", "==", "0", "{", "m", ".", "Code", "=", "200", "\n", "}", "\n", "if", "m", ".", "opts", ".", "Filter", "!=", "nil", "&&", "!", "m", ".", "opts", ".", "Filter", "(", "m", ".", "r", ",", "m", ".", "Code", ",", "duration", ",", "m", ".", "Size", ")", "{", "return", "//skip", "\n", "}", "\n", "cc", ":=", "m", ".", "colorCode", "(", ")", "\n", "size", ":=", "\"", "\"", "\n", "if", "m", ".", "Size", ">", "0", "{", "size", "=", "sizestr", ".", "ToString", "(", "m", ".", "Size", ")", "\n", "}", "\n", "buff", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "m", ".", "opts", ".", "formatTmpl", ".", "Execute", "(", "&", "buff", ",", "&", "struct", "{", "*", "Colors", "\n", "Timestamp", ",", "Method", ",", "Path", ",", "CodeColor", "string", "\n", "Code", "int", "\n", "Duration", ",", "Size", ",", "IP", "string", "\n", "}", "{", "m", ".", "opts", ".", "Colors", ",", "m", ".", "t0", ".", "Format", "(", "m", ".", "opts", ".", "TimeFormat", ")", ",", "m", ".", "method", ",", "m", ".", "path", ",", "cc", ",", "m", ".", "Code", ",", "fmtDuration", "(", "duration", ")", ",", "size", ",", "m", ".", "<mask>", ",", "}", ")", "\n", "//fmt is threadsafe :)", "fmt", ".", "Fprint", "(", "m", ".", "opts", ".", "Writer", ",", "buff", ".", "String", "(", ")", ")", "\n", "}" ]
3,325
all-3326
[ "The", "gogo", "protobuf", "NewDelimitedReader", "is", "buffered", "which", "may", "eat", "up", "stream", "data", ".", "So", "we", "need", "to", "implement", "a", "compatible", "delimited", "reader", "that", "reads", "unbuffered", ".", "There", "is", "a", "slowdown", "from", "unbuffered", "reading", ":", "when", "reading", "the", "message", "it", "can", "take", "multiple", "single", "byte", "Reads", "to", "read", "the", "length", "and", "another", "Read", "to", "read", "the", "message", "payload", ".", "However", "this", "is", "not", "critical", "performance", "degradation", "as", "-", "the", "reader", "is", "utilized", "to", "read", "one", "(", "dialer", "stop", ")", "or", "two", "messages", "(", "hop", ")", "during", "the", "handshake", "so", "it", "s", "a", "drop", "in", "the", "water", "for", "the", "connection", "lifetime", ".", "-", "messages", "are", "small", "(", "max", "4k", ")", "and", "the", "length", "fits", "in", "a", "couple", "of", "bytes", "so", "overall", "we", "have", "at", "most", "three", "reads", "per", "message", "." ]
[ "func", "newDelimitedReader", "(", "r", "<mask>", ".", "Reader", ",", "maxSize", "int", ")", "*", "delimitedReader", "{", "return", "&", "delimitedReader", "{", "r", ":", "r", ",", "buf", ":", "pool", ".", "Get", "(", "maxSize", ")", "}", "\n", "}" ]
3,326
all-3327
[ "NewApprovers", "create", "a", "new", "Approvers", "with", "no", "approval", "." ]
[ "func", "NewApprovers", "(", "owners", "Owners", ")", "Approvers", "{", "return", "Approvers", "{", "owners", ":", "owners", ",", "approvers", ":", "<mask>", "[", "string", "]", "Approval", "{", "}", ",", "assignees", ":", "sets", ".", "NewString", "(", ")", ",", "ManuallyApproved", ":", "func", "(", ")", "bool", "{", "return", "false", "\n", "}", ",", "}", "\n", "}" ]
3,327
all-3328
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "QueryObjectsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
3,328
all-3329
[ "Main", "draws", "Hello", "World", "and", "returns", "the", "filename", ".", "This", "should", "only", "be", "used", "during", "testing", "." ]
[ "func", "Main", "(", "gc", "draw2d", ".", "GraphicContext", ",", "ext", "string", ")", "(", "string", ",", "<mask>", ")", "{", "// Draw hello world", "Draw", "(", "gc", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "gc", ".", "GetDPI", "(", ")", ")", ")", "\n\n", "// Return the output filename", "return", "samples", ".", "Output", "(", "\"", "\"", ",", "ext", ")", ",", "nil", "\n", "}" ]
3,329
all-3330
[ "rescind", "releases", "a", "lease", "from", "this", "client", "." ]
[ "func", "(", "lkv", "*", "leasingKV", ")", "rescind", "(", "ctx", "<mask>", ".", "Context", ",", "key", "string", ",", "rev", "int64", ")", "{", "if", "lkv", ".", "leases", ".", "Evict", "(", "key", ")", ">", "rev", "{", "return", "\n", "}", "\n", "cmp", ":=", "v3", ".", "Compare", "(", "v3", ".", "CreateRevision", "(", "lkv", ".", "pfx", "+", "key", ")", ",", "\"", "\"", ",", "rev", ")", "\n", "op", ":=", "v3", ".", "OpDelete", "(", "lkv", ".", "pfx", "+", "key", ")", "\n", "for", "ctx", ".", "Err", "(", ")", "==", "nil", "{", "if", "_", ",", "err", ":=", "lkv", ".", "kv", ".", "Txn", "(", "ctx", ")", ".", "If", "(", "cmp", ")", ".", "Then", "(", "op", ")", ".", "Commit", "(", ")", ";", "err", "==", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "}" ]
3,330
all-3331
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetBoxModelParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom51", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
3,331
all-3332
[ "AddSSHKey", "adds", "a", "new", "SSH", "key", "to", "the", "project" ]
[ "func", "(", "c", "*", "Client", ")", "AddSSHKey", "(", "account", ",", "repo", ",", "hostname", ",", "privateKey", "string", ")", "error", "{", "key", ":=", "&", "struct", "{", "Hostname", "string", "`json:\"hostname\"`", "\n", "PrivateKey", "string", "`json:\"private_key\"`", "\n", "}", "{", "hostname", ",", "privateKey", "}", "\n", "return", "c", ".", "<mask>", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "account", ",", "repo", ")", ",", "nil", ",", "nil", ",", "key", ")", "\n", "}" ]
3,332
all-3333
[ "bind", "a", "named", "sampler", "to", "a", "texturing", "target" ]
[ "func", "BindSampler", "(", "<mask>", "uint32", ",", "sampler", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpBindSampler", ",", "2", ",", "uintptr", "(", "unit", ")", ",", "uintptr", "(", "sampler", ")", ",", "0", ")", "\n", "}" ]
3,333
all-3334
[ "===", "clamp_min", "(", "Vector", "ValueTypeVector", "min", "Scalar", ")", "Vector", "===" ]
[ "func", "funcClampMin", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "<mask>", "{", "vec", ":=", "vals", "[", "0", "]", ".", "(", "Vector", ")", "\n", "min", ":=", "vals", "[", "1", "]", ".", "(", "Vector", ")", "[", "0", "]", ".", "Point", ".", "V", "\n", "for", "_", ",", "el", ":=", "range", "vec", "{", "enh", ".", "out", "=", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Metric", ":", "enh", ".", "dropMetricName", "(", "el", ".", "Metric", ")", ",", "Point", ":", "Point", "{", "V", ":", "math", ".", "Max", "(", "min", ",", "el", ".", "V", ")", "}", ",", "}", ")", "\n", "}", "\n", "return", "enh", ".", "out", "\n", "}" ]
3,334
all-3335
[ "ReadAll", "ReadAll" ]
[ "func", "(", "<mask>", "*", "MemoryStore", ")", "ReadAll", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "dataKeys", ":=", "ms", ".", "dataStore", ".", "Keys", "(", ")", "\n", "dataLen", ":=", "len", "(", "dataKeys", ")", "\n", "result", ":=", "make", "(", "[", "]", "string", ",", "dataLen", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "dataLen", ";", "i", "++", "{", "result", "[", "i", "]", "=", "dataKeys", "[", "i", "]", ".", "(", "string", ")", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
3,335
all-3336
[ "HasHandle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsUser", ")", "HasHandle", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Handle", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
3,336
all-3337
[ "newReference", "returns", "a", "dockerReference", "for", "a", "named", "reference", "." ]
[ "func", "newReference", "(", "ref", "reference", ".", "Named", ")", "(", "dockerReference", ",", "error", ")", "{", "if", "reference", ".", "IsNameOnly", "(", "ref", ")", "{", "return", "dockerReference", "{", "}", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "reference", ".", "FamiliarString", "(", "ref", ")", ")", "\n", "}", "\n", "// A github.com/distribution/reference value can have a tag and a digest at the same time!", "// The docker/distribution API does not really support that (we can’t ask for an image with a specific", "// tag and digest), so fail. This MAY be accepted in the future.", "// (Even if it were supported, the semantics of policy namespaces are unclear - should we drop", "// the tag or the digest first?)", "_", ",", "isTagged", ":=", "ref", ".", "(", "reference", ".", "NamedTagged", ")", "\n", "_", ",", "isDigested", ":=", "<mask>", ".", "(", "reference", ".", "Canonical", ")", "\n", "if", "isTagged", "&&", "isDigested", "{", "return", "dockerReference", "{", "}", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "dockerReference", "{", "ref", ":", "ref", ",", "}", ",", "nil", "\n", "}" ]
3,337
all-3338
[ "GetContentArea", "()", "is", "a", "wrapper", "around", "gtk_dialog_get_content_area", "()", "." ]
[ "func", "(", "v", "*", "Dialog", ")", "GetContentArea", "(", ")", "(", "*", "Box", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_dialog_get_content_area", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "b", ":=", "&", "Box", "{", "<mask>", "{", "Widget", "{", "glib", ".", "InitiallyUnowned", "{", "obj", "}", "}", "}", "}", "\n", "return", "b", ",", "nil", "\n", "}" ]
3,338
all-3339
[ "FetchMetrics", "retrieves", "all", "metrics", "available", "to", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchMetrics", "(", ")", "(", "*", "[", "]", "Metric", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "MetricPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "metrics", "[", "]", "Metric", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "metrics", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "metrics", ",", "nil", "\n", "}" ]
3,339
all-3340
[ "PushMetrics", "is", "meant", "to", "run", "in", "a", "goroutine", "and", "continuously", "push", "metrics", "to", "the", "provided", "endpoint", "." ]
[ "func", "PushMetrics", "(", "component", ",", "endpoint", "string", ",", "interval", "time", ".", "Duration", ")", "{", "sig", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "sig", ",", "os", ".", "Interrupt", ",", "syscall", ".", "SIGTERM", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "time", ".", "Tick", "(", "interval", ")", ":", "if", "err", ":=", "push", ".", "FromGatherer", "(", "component", ",", "push", ".", "HostnameGroupingKey", "(", ")", ",", "endpoint", ",", "prometheus", ".", "DefaultGatherer", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "<mask>", ")", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "case", "<-", "sig", ":", "logrus", ".", "WithField", "(", "\"", "\"", ",", "component", ")", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
3,340
all-3341
[ "Load", "attempts", "to", "load", "config", "from", "the", "path", ".", "It", "returns", "an", "error", "if", "either", "the", "file", "can", "t", "be", "read", "or", "the", "configuration", "is", "invalid", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "Load", "(", "path", "string", ")", "error", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "np", ":=", "&", "Configuration", "{", "}", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "b", ",", "np", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "np", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "pa", ".", "<mask>", "(", "np", ")", "\n", "return", "nil", "\n", "}" ]
3,341
all-3342
[ "GetString", "returns", "a", "string", "value", "for", "a", "specific", "column", "." ]
[ "func", "(", "r", "Record", ")", "GetString", "(", "column", "string", ")", "(", "string", ",", "error", ")", "{", "v", ",", "err", ":=", "r", ".", "getKey", "(", "reflect", ".", "<mask>", ",", "column", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "v", ".", "(", "string", ")", ",", "nil", "\n", "}" ]
3,342
all-3343
[ "Handle", "implements", "Handler", "." ]
[ "func", "(", "h", "*", "HandlerWithErrorConfigurer", ")", "Handle", "(", "ctx", "context", ".", "Context", ",", "conn", "*", "Conn", ",", "req", "*", "Request", ")", "{", "result", ",", "err", ":=", "h", ".", "handleFunc", "(", "ctx", ",", "conn", ",", "req", ")", "\n", "if", "req", ".", "Notif", "{", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "req", ".", "Method", ",", "err", ")", "\n", "}", "\n", "return", "\n", "}", "\n\n", "resp", ":=", "&", "Response", "{", "ID", ":", "req", ".", "ID", "}", "\n", "if", "err", "==", "nil", "{", "err", "=", "resp", ".", "SetResult", "(", "result", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "if", "e", ",", "ok", ":=", "err", ".", "(", "*", "Error", ")", ";", "<mask>", "{", "resp", ".", "Error", "=", "e", "\n", "}", "else", "{", "resp", ".", "Error", "=", "&", "Error", "{", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "}", "\n\n", "if", "!", "req", ".", "Notif", "{", "if", "err", ":=", "conn", ".", "SendResponse", "(", "ctx", ",", "resp", ")", ";", "err", "!=", "nil", "{", "if", "err", "!=", "ErrClosed", "||", "!", "h", ".", "suppressErrClosed", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resp", ".", "ID", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
3,343
all-3344
[ "OperationRemove", "removes", "the", "operation", "with", "the", "given", "UUID", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "OperationRemove", "(", "uuid", "string", ")", "error", "{", "result", ",", "err", ":=", "c", ".", "<mask>", ".", "Exec", "(", "\"", "\"", ",", "uuid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "n", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "n", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,344
all-3345
[ "NotNil", "checks", "a", "value", "is", "non", "-", "nil", "." ]
[ "func", "NotNil", "(", "tb", "testing", ".", "TB", ",", "object", "interface", "{", "}", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "success", ":=", "true", "\n\n", "if", "object", "==", "nil", "{", "success", "=", "false", "\n", "}", "else", "{", "value", ":=", "reflect", ".", "ValueOf", "(", "<mask>", ")", "\n", "kind", ":=", "value", ".", "Kind", "(", ")", "\n", "if", "kind", ">=", "reflect", ".", "Chan", "&&", "kind", "<=", "reflect", ".", "Slice", "&&", "value", ".", "IsNil", "(", ")", "{", "success", "=", "false", "\n", "}", "\n", "}", "\n\n", "if", "!", "success", "{", "fatal", "(", "tb", ",", "msgAndArgs", ",", "\"", "\"", ")", "\n", "}", "\n", "}" ]
3,345
all-3346
[ "SetBuffer", "is", "a", "wrapper", "around", "gtk_text_view_set_buffer", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "SetBuffer", "(", "<mask>", "*", "TextBuffer", ")", "{", "C", ".", "gtk_text_view_set_buffer", "(", "v", ".", "native", "(", ")", ",", "buffer", ".", "native", "(", ")", ")", "\n", "}" ]
3,346
all-3347
[ "CallV2", "makes", "a", "call", "and", "does", "not", "attempt", "any", "retries", "." ]
[ "func", "CallV2", "(", "ctx", "context", ".", "Context", ",", "sc", "*", "tchannel", ".", "SubChannel", ",", "cArgs", "CArgs", ")", "(", "*", "CRes", ",", "error", ")", "{", "call", ",", "err", ":=", "sc", ".", "BeginCall", "(", "ctx", ",", "cArgs", ".", "Method", ",", "cArgs", ".", "CallOptions", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "arg2", ",", "arg3", ",", "res", ",", "err", ":=", "WriteArgs", "(", "<mask>", ",", "cArgs", ".", "Arg2", ",", "cArgs", ".", "Arg3", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "CRes", "{", "Arg2", ":", "arg2", ",", "Arg3", ":", "arg3", ",", "AppError", ":", "res", ".", "ApplicationError", "(", ")", ",", "}", ",", "nil", "\n", "}" ]
3,347
all-3348
[ "Encode", "serializes", "the", "JSON", "marshalable", "obj", "data", "as", "a", "JWT", "." ]
[ "func", "(", "es", "*", "EccSigner", ")", "Encode", "(", "obj", "interface", "{", "}", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "return", "es", ".", "alg", ".", "Encode", "(", "es", ",", "obj", ")", "\n", "}" ]
3,348
all-3349
[ "MinioSecret", "creates", "an", "amazon", "secret", "with", "the", "following", "parameters", ":", "bucket", "-", "S3", "bucket", "name", "id", "-", "S3", "access", "key", "id", "secret", "-", "S3", "secret", "access", "key", "endpoint", "-", "S3", "compatible", "endpoint", "secure", "-", "set", "to", "true", "for", "a", "secure", "connection", ".", "isS3V2", "-", "Set", "to", "true", "if", "client", "follows", "S3V2" ]
[ "func", "MinioSecret", "(", "bucket", "string", ",", "<mask>", "string", ",", "secret", "string", ",", "endpoint", "string", ",", "secure", ",", "isS3V2", "bool", ")", "map", "[", "string", "]", "[", "]", "byte", "{", "secureV", ":=", "\"", "\"", "\n", "if", "secure", "{", "secureV", "=", "\"", "\"", "\n", "}", "\n", "s3V2", ":=", "\"", "\"", "\n", "if", "isS3V2", "{", "s3V2", "=", "\"", "\"", "\n", "}", "\n", "return", "map", "[", "string", "]", "[", "]", "byte", "{", "\"", "\"", ":", "[", "]", "byte", "(", "bucket", ")", ",", "\"", "\"", ":", "[", "]", "byte", "(", "id", ")", ",", "\"", "\"", ":", "[", "]", "byte", "(", "secret", ")", ",", "\"", "\"", ":", "[", "]", "byte", "(", "endpoint", ")", ",", "\"", "\"", ":", "[", "]", "byte", "(", "secureV", ")", ",", "\"", "\"", ":", "[", "]", "byte", "(", "s3V2", ")", ",", "}", "\n", "}" ]
3,349
all-3350
[ "Raw", "returns", "the", "bytes", "of", "the", "key" ]
[ "func", "(", "k", "*", "Secp256k1PublicKey", ")", "Raw", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "return", "(", "*", "btcec", ".", "PublicKey", ")", "(", "k", ")", ".", "SerializeCompressed", "(", ")", ",", "nil", "\n", "}" ]
3,350
all-3351
[ "VolumeInspect", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "VolumeInspect", "(", "arg0", "context", ".", "Context", ",", "arg1", "string", ")", "(", "types", ".", "Volume", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "<mask>", ".", "Volume", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
3,351
all-3352
[ "Endpoint", "returns", "a", "handler", "for", "the", "common", "token", "and", "authorize", "endpoint", "." ]
[ "func", "(", "a", "*", "Authenticator", ")", "Endpoint", "(", "prefix", "string", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// create tracer", "tracer", ":=", "fire", ".", "NewTracerFromRequest", "(", "r", ",", "\"", "\"", ")", "\n", "tracer", ".", "Tag", "(", "\"", "\"", ",", "prefix", ")", "\n", "defer", "tracer", ".", "Finish", "(", "true", ")", "\n\n", "// continue any previous aborts", "defer", "stack", ".", "Resume", "(", "func", "(", "err", "error", ")", "{", "// directly write oauth2 errors", "if", "oauth2Error", ",", "ok", ":=", "err", ".", "(", "*", "oauth2", ".", "Error", ")", ";", "ok", "{", "_", "=", "oauth2", ".", "WriteError", "(", "w", ",", "oauth2Error", ")", "\n", "return", "\n", "}", "\n\n", "// set critical error on last span", "tracer", ".", "Tag", "(", "\"", "\"", ",", "true", ")", "\n", "tracer", ".", "Log", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "tracer", ".", "Log", "(", "\"", "\"", ",", "stack", ".", "Trace", "(", ")", ")", "\n\n", "// otherwise report critical errors", "if", "a", ".", "Reporter", "!=", "nil", "{", "a", ".", "Reporter", "(", "err", ")", "\n", "}", "\n\n", "// ignore errors caused by writing critical errors", "_", "=", "oauth2", ".", "WriteError", "(", "w", ",", "oauth2", ".", "ServerError", "(", "\"", "\"", ")", ")", "\n", "}", ")", "\n\n", "// trim and split path", "s", ":=", "strings", ".", "Split", "(", "strings", ".", "Trim", "(", "strings", ".", "TrimPrefix", "(", "r", ".", "URL", ".", "Path", ",", "<mask>", ")", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "if", "len", "(", "s", ")", "!=", "1", "||", "(", "s", "[", "0", "]", "!=", "\"", "\"", "&&", "s", "[", "0", "]", "!=", "\"", "\"", "&&", "s", "[", "0", "]", "!=", "\"", "\"", ")", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNotFound", ")", "\n", "return", "\n", "}", "\n\n", "// copy store", "store", ":=", "a", ".", "store", ".", "Copy", "(", ")", "\n", "defer", "store", ".", "Close", "(", ")", "\n\n", "// create", "state", ":=", "&", "state", "{", "request", ":", "r", ",", "writer", ":", "w", ",", "store", ":", "store", ",", "tracer", ":", "tracer", ",", "}", "\n\n", "// call endpoints", "switch", "s", "[", "0", "]", "{", "case", "\"", "\"", ":", "a", ".", "authorizationEndpoint", "(", "state", ")", "\n", "case", "\"", "\"", ":", "a", ".", "tokenEndpoint", "(", "state", ")", "\n", "case", "\"", "\"", ":", "a", ".", "revocationEndpoint", "(", "state", ")", "\n", "}", "\n", "}", ")", "\n", "}" ]
3,352
all-3353
[ "GetProject", "returns", "the", "project", "quota", "ID", "for", "the", "given", "path" ]
[ "func", "GetProject", "(", "path", "string", ")", "(", "uint32", ",", "error", ")", "{", "// Call ioctl through CGo", "cPath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cPath", ")", ")", "\n\n", "id", ":=", "C", ".", "quota_get_path", "(", "cPath", ")", "\n", "if", "id", "<", "0", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "uint32", "(", "id", ")", ",", "nil", "\n", "}" ]
3,353
all-3354
[ "SetContainerMetadata", "sets", "the", "content", "of", "the", "container", "metadata", "file", "." ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "SetContainerMetadata", "(", "name", "string", ",", "metadata", "api", ".", "ImageMetadata", ",", "ETag", "string", ")", "error", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", "\n", "_", ",", "_", ",", "err", ":=", "r", ".", "query", "(", "\"", "\"", ",", "<mask>", ",", "metadata", ",", "ETag", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
3,354
all-3355
[ "primaryExpr", "parses", "a", "primary", "expression", ".", "<metric_name", ">", "|", "<function_call", ">", "|", "<Vector_aggregation", ">", "|", "<literal", ">" ]
[ "func", "(", "p", "*", "parser", ")", "primaryExpr", "(", ")", "Expr", "{", "switch", "t", ":=", "p", ".", "next", "(", ")", ";", "{", "case", "t", ".", "typ", "==", "ItemNumber", ":", "f", ":=", "p", ".", "<mask>", "(", "t", ".", "val", ")", "\n", "return", "&", "NumberLiteral", "{", "f", "}", "\n\n", "case", "t", ".", "typ", "==", "ItemString", ":", "return", "&", "StringLiteral", "{", "p", ".", "unquoteString", "(", "t", ".", "val", ")", "}", "\n\n", "case", "t", ".", "typ", "==", "ItemLeftBrace", ":", "// Metric selector without metric name.", "p", ".", "backup", "(", ")", "\n", "return", "p", ".", "VectorSelector", "(", "\"", "\"", ")", "\n\n", "case", "t", ".", "typ", "==", "ItemIdentifier", ":", "// Check for function call.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemLeftParen", "{", "return", "p", ".", "call", "(", "t", ".", "val", ")", "\n", "}", "\n", "fallthrough", "// Else metric selector.", "\n\n", "case", "t", ".", "typ", "==", "ItemMetricIdentifier", ":", "return", "p", ".", "VectorSelector", "(", "t", ".", "val", ")", "\n\n", "case", "t", ".", "typ", ".", "isAggregator", "(", ")", ":", "p", ".", "backup", "(", ")", "\n", "return", "p", ".", "aggrExpr", "(", ")", "\n\n", "default", ":", "p", ".", "errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,355
all-3356
[ "InternalServerError", "configurates", "handler", "which", "is", "called", "when", "route", "handler", "returns", "error", ".", "If", "it", "is", "not", "set", "default", "handler", "is", "used", ".", "Be", "sure", "to", "set", "500", "response", "code", "in", "your", "handler", "." ]
[ "func", "(", "r", "*", "Router", ")", "InternalServerError", "(", "handlers", "...", "Handler", ")", "{", "handlers", "=", "validateAndWrapHandlers", "(", "handlers", ")", "\n", "r", ".", "internalServerError", "=", "func", "(", "c", "*", "<mask>", ",", "err", "error", ")", "{", "c", ".", "index", "=", "0", "\n", "c", ".", "handlers", "=", "handlers", "\n", "c", ".", "Map", "(", "err", ")", "\n", "c", ".", "run", "(", ")", "\n", "}", "\n", "}" ]
3,356
all-3357
[ "GetAccounts", "returns", "accounts", "." ]
[ "func", "(", "h", "*", "Handler", ")", "GetAccounts", "(", "tkn", "string", ")", "(", "[", "]", "data", ".", "Account", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "accounts", ",", "err", ":=", "h", ".", "selectAllFrom", "(", "logger", ",", "data", ".", "AccountTable", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "result", ":=", "make", "(", "[", "]", "data", ".", "Account", ",", "len", "(", "accounts", ")", ")", "\n\n", "for", "k", ",", "v", ":=", "<mask>", "accounts", "{", "result", "[", "k", "]", "=", "*", "v", ".", "(", "*", "data", ".", "Account", ")", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
3,357
all-3358
[ "Log", "calls", "UI", ".", "Log", "to", "write", ".", "LogFGColor", "and", "LogBGColor", "are", "used", "for", "color", "." ]
[ "func", "(", "ui", "*", "ColorUI", ")", "<mask>", "(", "message", "string", ")", "{", "ct", ".", "ChangeColor", "(", "ui", ".", "LogFGColor", ".", "Code", ",", "ui", ".", "LogFGColor", ".", "Bright", ",", "ui", ".", "LogBGColor", ".", "Code", ",", "ui", ".", "LogBGColor", ".", "Bright", ")", "\n", "ui", ".", "UI", ".", "Log", "(", "message", ")", "\n", "ct", ".", "ResetColor", "(", ")", "\n", "}" ]
3,358
all-3359
[ "GetBuyPrice", "gets", "the", "current", "BTC", "buy", "price" ]
[ "func", "(", "c", "<mask>", ")", "GetBuyPrice", "(", "qty", "int", ")", "(", "*", "pricesHolder", ",", "error", ")", "{", "return", "c", ".", "getPrice", "(", "\"", "\"", ",", "qty", ")", "\n", "}" ]
3,359
all-3360
[ "NewImage", "creates", "a", "new", "instance", "of", "Image", "." ]
[ "func", "NewImage", "(", "d", "*", "Docker", ",", "name", "string", ")", "*", "<mask>", "{", "return", "&", "Image", "{", "docker", ":", "d", ",", "name", ":", "name", ",", "}", "\n", "}" ]
3,360
all-3361
[ "New", "returns", "a", "fresh", "instance", "of", "Render" ]
[ "func", "New", "(", ")", "Render", "{", "return", "Render", "{", "Templates", ":", "make", "(", "map", "[", "string", "]", "*", "template", ".", "Template", ")", ",", "Files", ":", "make", "(", "<mask>", "[", "string", "]", "[", "]", "string", ")", ",", "TemplatesDir", ":", "TemplatesDir", ",", "Layout", ":", "Layout", ",", "Ext", ":", "Ext", ",", "Debug", ":", "Debug", ",", "}", "\n", "}" ]
3,361
all-3362
[ "Contains", "returns", "true", "if", "the", "given", "value", "is", "a", "valid", "value", "within", "the", "value", "range", "." ]
[ "func", "(", "r", "*", "InclusiveRange", ")", "Contains", "(", "value", "int", ")", "bool", "{", "// If we attempt to find the closest value, given", "// the start of the range and the step, we can check", "// if it is still the same number. If it hasn't changed,", "// then it is in the range.", "closest", ":=", "r", ".", "closestInRange", "(", "<mask>", ",", "r", ".", "start", ",", "r", ".", "End", "(", ")", ",", "r", ".", "step", ")", "\n", "return", "closest", "==", "value", "\n", "}" ]
3,362
all-3363
[ "GetMediaType", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_media_type", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetMediaType", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_print_settings_get_media_type", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", "\n", "}" ]
3,363
all-3364
[ "FromIDHeader", "decodes", "a", "Content", "-", "ID", "or", "Message", "-", "ID", "header", "value", "(", "RFC", "2392", ")", "into", "a", "utf", "-", "8", "string", ".", "Example", ":", "<foo%3fbar", "+", "baz", ">", "becomes", "foo?bar", "baz", "." ]
[ "func", "FromIDHeader", "(", "v", "string", ")", "string", "{", "if", "v", "==", "\"", "\"", "{", "return", "v", "\n", "}", "\n", "v", "=", "strings", ".", "TrimLeft", "(", "v", ",", "\"", "\"", ")", "\n", "v", "=", "strings", ".", "TrimRight", "(", "v", ",", "\"", "\"", ")", "\n", "r", ",", "err", ":=", "<mask>", ".", "QueryUnescape", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "v", "\n", "}", "\n", "return", "r", "\n", "}" ]
3,364
all-3365
[ "NewStaticFilesHandler", "serves", "a", "file", "under", "specified", "filesystem", "if", "it", "can", "be", "opened", "otherwise", "it", "serves", "HTTP", "from", "a", "specified", "handler", "." ]
[ "func", "NewStaticFilesHandler", "(", "h", "http", ".", "Handler", ",", "<mask>", "string", ",", "fs", "http", ".", "FileSystem", ")", "http", ".", "Handler", "{", "fileserver", ":=", "http", ".", "StripPrefix", "(", "prefix", ",", "http", ".", "FileServer", "(", "fs", ")", ")", "\n", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "filename", ":=", "strings", ".", "TrimPrefix", "(", "r", ".", "URL", ".", "Path", ",", "prefix", ")", "\n", "_", ",", "err", ":=", "fs", ".", "Open", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "return", "\n", "}", "\n", "fileserver", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n", "}" ]
3,365
all-3366
[ "establish", "data", "storage", "format", "and", "dimensions", "of", "a", "renderbuffer", "object", "s", "image" ]
[ "func", "NamedRenderbufferStorage", "(", "renderbuffer", "uint32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ")", "{", "C", ".", "glowNamedRenderbufferStorage", "(", "gpNamedRenderbufferStorage", ",", "(", "C", ".", "GLuint", ")", "(", "renderbuffer", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ")", "\n", "}" ]
3,366
all-3367
[ "Consul", "returns", "the", "Consul", "client", "for", "this", "set", "." ]
[ "func", "(", "c", "*", "ClientSet", ")", "Consul", "(", ")", "*", "consulapi", ".", "<mask>", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "consul", ".", "client", "\n", "}" ]
3,367
all-3368
[ "Do", "executes", "CSS", ".", "createStyleSheet", "against", "the", "provided", "context", ".", "returns", ":", "styleSheetID", "-", "Identifier", "of", "the", "created", "via", "-", "inspector", "stylesheet", "." ]
[ "func", "(", "p", "*", "CreateStyleSheetParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "styleSheetID", "StyleSheetID", ",", "err", "error", ")", "{", "// execute", "var", "res", "CreateStyleSheetReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCreateStyleSheet", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "StyleSheetID", ",", "nil", "\n", "}" ]
3,368
all-3369
[ "LoadConfig", "loads", "options", "from", "serialized", "config" ]
[ "func", "(", "o", "*", "Options", ")", "LoadConfig", "(", "config", "string", ")", "error", "{", "return", "json", ".", "Unmarshal", "(", "[", "]", "<mask>", "(", "config", ")", ",", "o", ")", "\n", "}" ]
3,369
all-3370
[ "/", "*", "Format", "returns", "the", "file", "sequence", "as", "a", "formatted", "string", "according", "to", "the", "given", "template", "." ]
[ "func", "(", "s", "*", "FileSequence", ")", "Format", "(", "tpl", "string", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "<mask>", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "s", ".", "Dirname", ",", "\"", "\"", ":", "s", ".", "Basename", ",", "\"", "\"", ":", "s", ".", "Ext", ",", "\"", "\"", ":", "s", ".", "Start", ",", "\"", "\"", ":", "s", ".", "End", ",", "\"", "\"", ":", "s", ".", "Len", ",", "\"", "\"", ":", "s", ".", "Padding", ",", "\"", "\"", ":", "s", ".", "ZFill", ",", "\"", "\"", ":", "s", ".", "FrameRange", ",", "\"", "\"", ":", "s", ".", "InvertedFrameRange", ",", "}", "\n\n", "t", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "c", ")", ".", "Parse", "(", "tpl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "var", "buf", "bytes", ".", "Buffer", "\n", "err", "=", "t", ".", "Execute", "(", "&", "buf", ",", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "buf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
3,370
all-3371
[ "PushEventHandlers", "returns", "a", "map", "of", "plugin", "names", "to", "handlers", "for", "the", "repo", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "PushEventHandlers", "(", "owner", ",", "repo", "string", ")", "map", "[", "string", "]", "PushEventHandler", "{", "pa", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "pa", ".", "mut", ".", "Unlock", "(", ")", "\n\n", "hs", ":=", "<mask>", "[", "string", "]", "PushEventHandler", "{", "}", "\n", "for", "_", ",", "p", ":=", "range", "pa", ".", "getPlugins", "(", "owner", ",", "repo", ")", "{", "if", "h", ",", "ok", ":=", "pushEventHandlers", "[", "p", "]", ";", "ok", "{", "hs", "[", "p", "]", "=", "h", "\n", "}", "\n", "}", "\n\n", "return", "hs", "\n", "}" ]
3,371
all-3372
[ "Use", "attaches", "middleware", "to", "a", "route" ]
[ "func", "(", "r", "*", "Router", ")", "Use", "(", "middleware", "...", "interface", "{", "}", ")", "{", "r", ".", "dispatcher", ".", "Middleware", "(", "r", ".", "<mask>", ",", "r", ".", "buildMiddlewares", "(", "middleware", ")", "...", ")", "\n", "}" ]
3,372
all-3373
[ "newNetPipeline", "is", "used", "to", "construct", "a", "netPipeline", "from", "a", "given", "transport", "and", "connection", "." ]
[ "func", "newNetPipeline", "(", "trans", "*", "NetworkTransport", ",", "<mask>", "*", "netConn", ")", "*", "netPipeline", "{", "n", ":=", "&", "netPipeline", "{", "conn", ":", "conn", ",", "trans", ":", "trans", ",", "doneCh", ":", "make", "(", "chan", "AppendFuture", ",", "rpcMaxPipeline", ")", ",", "inprogressCh", ":", "make", "(", "chan", "*", "appendFuture", ",", "rpcMaxPipeline", ")", ",", "shutdownCh", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "go", "n", ".", "decodeResponses", "(", ")", "\n", "return", "n", "\n", "}" ]
3,373
all-3374
[ "integer", "types" ]
[ "func", "convertNvInteger", "(", "v", "interface", "{", "}", ",", "min", ",", "max", "int64", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "v", ",", "nil", "\n", "}", "\n\n", "rv", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "switch", "rv", ".", "Kind", "(", ")", "{", "// bool is represented in HDB as tinyint", "case", "reflect", ".", "Bool", ":", "return", "rv", ".", "Bool", "(", ")", ",", "nil", "\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "i64", ":=", "rv", ".", "Int", "(", ")", "\n", "if", "i64", ">", "max", "||", "i64", "<", "min", "{", "return", "nil", ",", "ErrIntegerOutOfRange", "\n", "}", "\n", "return", "i64", ",", "nil", "\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ":", "u64", ":=", "rv", ".", "Uint", "(", ")", "\n", "if", "u64", ">", "uint64", "(", "max", ")", "{", "return", "nil", ",", "ErrIntegerOutOfRange", "\n", "}", "\n", "return", "int64", "(", "u64", ")", ",", "nil", "\n", "case", "reflect", ".", "Ptr", ":", "// indirect pointers", "if", "rv", ".", "IsNil", "(", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "convertNvInteger", "(", "rv", ".", "Elem", "(", ")", ".", "Interface", "(", ")", ",", "min", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}" ]
3,374
all-3375
[ "shouldContinuePaging", "returns", "true", "if", "fetching", "more", "results", "(", "that", "have", "earlier", "timestamps", "than", "the", "provided", "results", ")", "could", "possibly", "return", "results", "in", "the", "range", ".", "shouldContinuePaging", "assumes", "results", "is", "sorted", "so", "the", "first", "result", "in", "the", "slice", "has", "the", "latest", "timestamp", "and", "the", "last", "result", "in", "the", "slice", "has", "the", "earliest", "timestamp", ".", "shouldContinuePaging", "panics", "if", "results", "is", "empty", "." ]
[ "func", "shouldContinuePaging", "(", "start", "time", ".", "Time", ",", "results", "[", "]", "<mask>", ".", "Time", ")", "bool", "{", "// the last result in results is the earliest. if the earliest result is", "// before the start, fetching more resources may return more results.", "if", "len", "(", "results", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "last", ":=", "results", "[", "len", "(", "results", ")", "-", "1", "]", "\n", "return", "last", ".", "After", "(", "start", ")", "\n", "}" ]
3,375
all-3376
[ "ResponseStatus", "returns", "the", "HTTP", "response", "status", ".", "Remember", "that", "the", "status", "is", "only", "set", "by", "the", "server", "after", "WriteHeader", "has", "been", "called", "." ]
[ "func", "ResponseStatus", "(", "w", "<mask>", ".", "ResponseWriter", ")", "int", "{", "return", "int", "(", "httpResponseStruct", "(", "reflect", ".", "ValueOf", "(", "w", ")", ")", ".", "FieldByName", "(", "\"", "\"", ")", ".", "Int", "(", ")", ")", "\n", "}" ]
3,376
all-3377
[ "GorillaPathPrefix", "----------------------------------------------------------" ]
[ "func", "NewGorillaPathPrefix", "(", "<mask>", "string", ")", "(", "*", "GorillaPathPrefix", ",", "error", ")", "{", "regexpPattern", ",", "err", ":=", "gorillaPattern", "(", "pattern", ",", "false", ",", "true", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ",", "err", ":=", "CompileRegexp", "(", "regexpPattern", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "GorillaPathPrefix", "{", "*", "r", "}", ",", "nil", "\n", "}" ]
3,377
all-3378
[ "Insert", "inserts", "a", "RangerEntry", "into", "prefix", "trie", "." ]
[ "func", "(", "p", "*", "prefixTrie", ")", "Insert", "(", "entry", "RangerEntry", ")", "error", "{", "<mask>", ":=", "entry", ".", "Network", "(", ")", "\n", "return", "p", ".", "insert", "(", "rnet", ".", "NewNetwork", "(", "network", ")", ",", "entry", ")", "\n", "}" ]
3,378
all-3379
[ "Since", "returns", "the", "time", "different", "from", "Now", "and", "the", "given", "time", "t" ]
[ "func", "Since", "(", "t", "<mask>", ".", "Time", ")", "time", ".", "Duration", "{", "return", "_time", ".", "Now", "(", ")", ".", "Sub", "(", "t", ")", "\n", "}" ]
3,379
all-3380
[ "ResolveContainer", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockContainerMetadataResolver", ")", "ResolveContainer", "(", "arg0", "string", ")", "(", "*", "container", ".", "DockerContainer", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "container", ".", "DockerContainer", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
3,380
all-3381
[ "randomTimeout", "returns", "a", "value", "that", "is", "between", "the", "minVal", "and", "2x", "minVal", "." ]
[ "func", "randomTimeout", "(", "minVal", "time", ".", "Duration", ")", "<-", "chan", "time", ".", "Time", "{", "if", "minVal", "==", "0", "{", "return", "nil", "\n", "}", "\n", "<mask>", ":=", "(", "time", ".", "Duration", "(", "rand", ".", "Int63", "(", ")", ")", "%", "minVal", ")", "\n", "return", "time", ".", "After", "(", "minVal", "+", "extra", ")", "\n", "}" ]
3,381
all-3382
[ "peek", "returns", "but", "does", "not", "consume", "the", "next", "rune", "in", "the", "input", "." ]
[ "func", "(", "l", "*", "lexer", ")", "peek", "(", ")", "rune", "{", "r", ":=", "l", ".", "<mask>", "(", ")", "\n", "l", ".", "backup", "(", ")", "\n", "return", "r", "\n", "}" ]
3,382
all-3383
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetShowViewportSizeOnResizeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
3,383
all-3384
[ "Clean", "removes", "the", "metadata", "files", "of", "all", "containers", "associated", "with", "a", "task" ]
[ "func", "(", "manager", "*", "metadataManager", ")", "Clean", "(", "taskARN", "string", ")", "error", "{", "metadataPath", ",", "err", ":=", "getTaskMetadataDir", "(", "taskARN", ",", "manager", ".", "dataDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "taskARN", ",", "err", ")", "\n", "}", "\n", "return", "<mask>", ".", "osWrap", ".", "RemoveAll", "(", "metadataPath", ")", "\n", "}" ]
3,384
all-3385
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardListItem", ")", "HasType", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
3,385
all-3386
[ "Close", "is", "used", "to", "indicate", "a", "successful", "end", "." ]
[ "func", "(", "s", "*", "FileSnapshotSink", ")", "Close", "(", ")", "error", "{", "// Make sure close is idempotent", "if", "s", ".", "closed", "{", "return", "nil", "\n", "}", "\n", "s", ".", "closed", "=", "<mask>", "\n\n", "// Close the open handles", "if", "err", ":=", "s", ".", "finalize", "(", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "if", "delErr", ":=", "os", ".", "RemoveAll", "(", "s", ".", "dir", ")", ";", "delErr", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "s", ".", "dir", ",", "delErr", ")", "\n", "return", "delErr", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "// Write out the meta data", "if", "err", ":=", "s", ".", "writeMeta", "(", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "// Move the directory into place", "newPath", ":=", "strings", ".", "TrimSuffix", "(", "s", ".", "dir", ",", "tmpSuffix", ")", "\n", "if", "err", ":=", "os", ".", "Rename", "(", "s", ".", "dir", ",", "newPath", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "if", "runtime", ".", "GOOS", "!=", "\"", "\"", "{", "//skipping fsync for directory entry edits on Windows, only needed for *nix style file systems", "parentFH", ",", "err", ":=", "os", ".", "Open", "(", "s", ".", "parentDir", ")", "\n", "defer", "parentFH", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "s", ".", "parentDir", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "if", "err", "=", "parentFH", ".", "Sync", "(", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "s", ".", "parentDir", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "}", "\n\n", "// Reap any old snapshots", "if", "err", ":=", "s", ".", "store", ".", "ReapSnapshots", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
3,386
all-3387
[ "GetProcessQueryOk", "returns", "a", "tuple", "with", "the", "ProcessQuery", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HeatmapRequest", ")", "GetProcessQueryOk", "(", ")", "(", "WidgetProcessQuery", ",", "bool", ")", "{", "if", "h", "==", "nil", "||", "h", ".", "ProcessQuery", "==", "nil", "{", "return", "WidgetProcessQuery", "{", "}", ",", "<mask>", "\n", "}", "\n", "return", "*", "h", ".", "ProcessQuery", ",", "true", "\n", "}" ]
3,387
all-3388
[ "ListRepositories", "extracts", "metadata", "about", "repositories", "declared", "in", "a", "file", "." ]
[ "func", "ListRepositories", "(", "workspace", "*", "rule", ".", "File", ")", "(", "repos", "[", "]", "Repo", ",", "repoNamesByFile", "<mask>", "[", "*", "rule", ".", "File", "]", "[", "]", "string", ",", "err", "error", ")", "{", "repoNamesByFile", "=", "make", "(", "map", "[", "*", "rule", ".", "File", "]", "[", "]", "string", ")", "\n", "repos", ",", "repoNamesByFile", "[", "workspace", "]", "=", "getRepos", "(", "workspace", ".", "Rules", ")", "\n", "for", "_", ",", "d", ":=", "range", "workspace", ".", "Directives", "{", "switch", "d", ".", "Key", "{", "case", "\"", "\"", ":", "f", ",", "defName", ",", "err", ":=", "parseRepositoryMacroDirective", "(", "d", ".", "Value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "f", "=", "filepath", ".", "Join", "(", "filepath", ".", "Dir", "(", "workspace", ".", "Path", ")", ",", "filepath", ".", "Clean", "(", "f", ")", ")", "\n", "macroFile", ",", "err", ":=", "rule", ".", "LoadMacroFile", "(", "f", ",", "\"", "\"", ",", "defName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "currRepos", ",", "names", ":=", "getRepos", "(", "macroFile", ".", "Rules", ")", "\n", "repoNamesByFile", "[", "macroFile", "]", "=", "names", "\n", "repos", "=", "append", "(", "repos", ",", "currRepos", "...", ")", "\n", "}", "\n", "}", "\n\n", "return", "repos", ",", "repoNamesByFile", ",", "nil", "\n", "}" ]
3,388
all-3389
[ "Close", "shuts", "down", "the", "nitro", "instance" ]
[ "func", "(", "m", "*", "Nitro", ")", "Close", "(", ")", "{", "// Wait until all snapshot iterators have finished", "for", "s", ":=", "m", ".", "snapshots", ".", "GetStats", "(", ")", ";", "int", "(", "s", ".", "NodeCount", ")", "!=", "0", ";", "s", "=", "m", ".", "snapshots", ".", "GetStats", "(", ")", "{", "time", ".", "Sleep", "(", "time", ".", "Millisecond", ")", "\n", "}", "\n\n", "m", ".", "hasShutdown", "=", "true", "\n\n", "// Acquire gc chan ownership", "// This will make sure that no other goroutine will write to gcchan", "for", "!", "atomic", ".", "CompareAndSwapInt32", "(", "&", "m", ".", "isGCRunning", ",", "0", ",", "1", ")", "{", "time", ".", "Sleep", "(", "time", ".", "Millisecond", ")", "\n", "}", "\n", "close", "(", "m", ".", "gcchan", ")", "\n\n", "buf", ":=", "dbInstances", ".", "MakeBuf", "(", ")", "\n", "defer", "dbInstances", ".", "FreeBuf", "(", "buf", ")", "\n", "dbInstances", ".", "Delete", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "CompareNitro", ",", "buf", ",", "&", "dbInstances", ".", "Stats", ")", "\n\n", "if", "m", ".", "useMemoryMgmt", "{", "buf", ":=", "m", ".", "snapshots", ".", "MakeBuf", "(", ")", "\n", "defer", "m", ".", "snapshots", ".", "FreeBuf", "(", "buf", ")", "\n\n", "m", ".", "shutdownWg1", ".", "Wait", "(", ")", "\n", "close", "(", "m", ".", "freechan", ")", "\n", "m", ".", "shutdownWg2", ".", "Wait", "(", ")", "\n\n", "// Manually free up all nodes", "iter", ":=", "m", ".", "store", ".", "NewIterator", "(", "m", ".", "iterCmp", ",", "buf", ")", "\n", "defer", "iter", ".", "Close", "(", ")", "\n", "<mask>", "lastNode", "*", "skiplist", ".", "Node", "\n\n", "iter", ".", "SeekFirst", "(", ")", "\n", "if", "iter", ".", "Valid", "(", ")", "{", "lastNode", "=", "iter", ".", "GetNode", "(", ")", "\n", "iter", ".", "Next", "(", ")", "\n", "}", "\n\n", "for", "lastNode", "!=", "nil", "{", "m", ".", "freeItem", "(", "(", "*", "Item", ")", "(", "lastNode", ".", "Item", "(", ")", ")", ")", "\n", "m", ".", "store", ".", "FreeNode", "(", "lastNode", ",", "&", "m", ".", "store", ".", "Stats", ")", "\n", "lastNode", "=", "nil", "\n\n", "if", "iter", ".", "Valid", "(", ")", "{", "lastNode", "=", "iter", ".", "GetNode", "(", ")", "\n", "iter", ".", "Next", "(", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
3,389
all-3390
[ "NewConsole", "creates", "new", "console", "for", "process", "and", "returns", "it" ]
[ "func", "(", "p", "*", "Process", ")", "NewConsole", "(", "rootuid", "int", ")", "(", "Console", ",", "error", ")", "{", "console", ",", "err", ":=", "newConsole", "(", "rootuid", ",", "rootuid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "p", ".", "consolePath", "=", "console", ".", "<mask>", "(", ")", "\n", "return", "console", ",", "nil", "\n", "}" ]
3,390
all-3391
[ "GetId", "returns", "the", "Id", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetId", "(", ")", "int", "{", "if", "d", "==", "nil", "||", "d", ".", "<mask>", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "d", ".", "Id", "\n", "}" ]
3,391
all-3392
[ "Tolist", "returns", "all", "the", "recipients", "of", "the", "email" ]
[ "func", "(", "m", "*", "Message", ")", "Tolist", "(", ")", "[", "]", "string", "{", "tolist", ":=", "m", ".", "To", "\n\n", "for", "_", ",", "cc", ":=", "<mask>", "m", ".", "Cc", "{", "tolist", "=", "append", "(", "tolist", ",", "cc", ")", "\n", "}", "\n\n", "for", "_", ",", "bcc", ":=", "range", "m", ".", "Bcc", "{", "tolist", "=", "append", "(", "tolist", ",", "bcc", ")", "\n", "}", "\n\n", "return", "tolist", "\n", "}" ]
3,392
all-3393
[ "BTCAddrBytesFromPubKeyBytes", "returns", "a", "hex", "Bitcoin", "mainnet", "address", "and", "its", "checksum", "." ]
[ "func", "BTCAddrBytesFromPubKeyBytes", "(", "pubKeyBytes", "[", "]", "byte", ")", "(", "addrBytes", "[", "]", "byte", ",", "checksum", "[", "]", "byte", ")", "{", "versionPrefix", ":=", "btcPrefixPubKeyHash", "// TODO Make const or configurable", "\n", "h160", ":=", "CalcHash160", "(", "pubKeyBytes", ")", "\n", "_h160", ":=", "<mask>", "(", "[", "]", "byte", "{", "versionPrefix", "}", ",", "h160", "...", ")", "\n", "checksum", "=", "CalcHash256", "(", "_h160", ")", "[", ":", "4", "]", "\n", "return", "h160", ",", "checksum", "\n", "}" ]
3,393
all-3394
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "cairo_pattern_t", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "native", "(", ")", "*", "C", ".", "cairo_pattern_t", "{", "if", "v", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "v", ".", "pattern", "\n", "}" ]
3,394
all-3395
[ "flag", "edges", "as", "either", "boundary", "or", "nonboundary" ]
[ "func", "EdgeFlag", "(", "<mask>", "bool", ")", "{", "C", ".", "glowEdgeFlag", "(", "gpEdgeFlag", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "flag", ")", ")", ")", "\n", "}" ]
3,395
all-3396
[ "ScanAST", "creates", "a", "File", "wrapped", "around", "the", "given", "syntax", "tree", ".", "This", "tree", "will", "be", "modified", "by", "editing", "methods", "." ]
[ "func", "ScanAST", "(", "pkg", "string", ",", "bzlFile", "*", "bzl", ".", "File", ")", "*", "<mask>", "{", "return", "ScanASTBody", "(", "pkg", ",", "\"", "\"", ",", "bzlFile", ")", "\n", "}" ]
3,396
all-3397
[ "ParseTs", "parses", "the", "timestamp", "from", "the", "key", "bytes", "." ]
[ "func", "ParseTs", "(", "key", "[", "]", "byte", ")", "uint64", "{", "if", "len", "(", "<mask>", ")", "<=", "8", "{", "return", "0", "\n", "}", "\n", "return", "math", ".", "MaxUint64", "-", "binary", ".", "BigEndian", ".", "Uint64", "(", "key", "[", "len", "(", "key", ")", "-", "8", ":", "]", ")", "\n", "}" ]
3,397
all-3398
[ "rayCasting", "returns", "a", "slice", "of", "line", "originating", "from", "point", "cx", "cy", "and", "intersecting", "with", "objects" ]
[ "func", "rayCasting", "(", "cx", ",", "cy", "float64", ",", "objects", "[", "]", "object", ")", "[", "]", "line", "{", "const", "rayLength", "=", "1000", "// something large enough to reach all objects", "\n\n", "var", "rays", "[", "]", "line", "\n", "for", "_", ",", "obj", ":=", "range", "objects", "{", "// Cast two rays per point", "for", "_", ",", "p", ":=", "range", "obj", ".", "points", "(", ")", "{", "l", ":=", "line", "{", "cx", ",", "cy", ",", "p", "[", "0", "]", ",", "p", "[", "1", "]", "}", "\n", "angle", ":=", "l", ".", "angle", "(", ")", "\n\n", "for", "_", ",", "offset", ":=", "range", "[", "]", "float64", "{", "-", "0.005", ",", "0.005", "}", "{", "points", ":=", "[", "]", "[", "2", "]", "float64", "{", "}", "\n", "ray", ":=", "newRay", "(", "cx", ",", "cy", ",", "rayLength", ",", "angle", "+", "offset", ")", "\n\n", "// Unpack all objects", "for", "_", ",", "o", ":=", "range", "objects", "{", "for", "_", ",", "wall", ":=", "range", "o", ".", "walls", "{", "if", "px", ",", "py", ",", "ok", ":=", "intersection", "(", "ray", ",", "wall", ")", ";", "ok", "{", "points", "=", "append", "(", "points", ",", "[", "2", "]", "float64", "{", "px", ",", "py", "}", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Find the point closest to start of ray", "min", ":=", "math", ".", "Inf", "(", "1", ")", "\n", "minI", ":=", "-", "1", "\n", "for", "i", ",", "p", ":=", "range", "points", "{", "d2", ":=", "(", "cx", "-", "p", "[", "0", "]", ")", "*", "(", "cx", "-", "p", "[", "0", "]", ")", "+", "(", "cy", "-", "p", "[", "1", "]", ")", "*", "(", "cy", "-", "p", "[", "1", "]", ")", "\n", "if", "d2", "<", "min", "{", "min", "=", "d2", "\n", "minI", "=", "i", "\n", "}", "\n", "}", "\n", "rays", "=", "append", "(", "rays", ",", "line", "{", "cx", ",", "cy", ",", "points", "[", "minI", "]", "[", "0", "]", ",", "points", "[", "minI", "]", "[", "1", "]", "}", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Sort rays based on angle, otherwise light triangles will not come out right", "<mask>", ".", "Slice", "(", "rays", ",", "func", "(", "i", "int", ",", "j", "int", ")", "bool", "{", "return", "rays", "[", "i", "]", ".", "angle", "(", ")", "<", "rays", "[", "j", "]", ".", "angle", "(", ")", "\n", "}", ")", "\n", "return", "rays", "\n", "}" ]
3,398
all-3399
[ "v1HandlersSetup", "adds", "all", "handlers", "except", "CredentialsHandler", "in", "v1", "package", "to", "the", "server", "mux", "." ]
[ "func", "v1HandlersSetup", "(", "serverMux", "*", "<mask>", ".", "ServeMux", ",", "containerInstanceArn", "*", "string", ",", "taskEngine", "handlersutils", ".", "DockerStateResolver", ",", "cfg", "*", "config", ".", "Config", ")", "{", "serverMux", ".", "HandleFunc", "(", "v1", ".", "AgentMetadataPath", ",", "v1", ".", "AgentMetadataHandler", "(", "containerInstanceArn", ",", "cfg", ")", ")", "\n", "serverMux", ".", "HandleFunc", "(", "v1", ".", "TaskContainerMetadataPath", ",", "v1", ".", "TaskContainerMetadataHandler", "(", "taskEngine", ")", ")", "\n", "serverMux", ".", "HandleFunc", "(", "v1", ".", "LicensePath", ",", "v1", ".", "LicenseHandler", ")", "\n", "}" ]
3,399
all-3400
[ "DeleteMapping", "removes", "the", "port", "mapping", "." ]
[ "func", "(", "n", "*", "discovery", ")", "DeleteMapping", "(", "protocol", "string", ",", "extPort", ",", "intPort", "int", ")", "error", "{", "if", "err", ":=", "n", ".", "wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "n", ".", "<mask>", ".", "DeleteMapping", "(", "protocol", ",", "extPort", ",", "intPort", ")", "\n", "}" ]