id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
24,900
all-24901
[ "Uint32", "returns", "the", "uint32", "value", "stored", "in", "r", ".", "r", "must", "have", "type", "uint32", "." ]
[ "func", "(", "r", "region", ")", "Uint32", "(", ")", "uint32", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindUint", "||", "r", ".", "typ", ".", "Size", "!=", "4", "{", "panic", "(", "\"", "\"", "+", "r", ".", "typ", ".", "<mask>", ")", "\n", "}", "\n", "return", "r", ".", "p", ".", "proc", ".", "ReadUint32", "(", "r", ".", "a", ")", "\n", "}" ]
24,901
all-24902
[ "==", "Set", "variables", "_Set", "sets", "the", "value", "named", "by", "the", "key", "in", "the", "given", "filename", "." ]
[ "func", "_Set", "(", "filename", ",", "key", ",", "value", "string", ")", "error", "{", "// Check if the key is already used.", "conf", ",", "err", ":=", "shconf", ".", "ParseFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "!=", "os", ".", "ErrNotExist", "{", "return", "err", "\n", "}", "\n", "println", "(", "\"", "\"", ")", "//TODO: remove", "\n", "}", "else", "{", "if", "_", ",", "err", "=", "conf", ".", "Get", "(", "key", ")", ";", "err", "!=", "shconf", ".", "ErrKey", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "return", "file", ".", "AppendString", "(", "<mask>", ",", "key", "+", "string", "(", "conf", ".", "Separator", "(", ")", ")", "+", "value", ")", "\n", "}" ]
24,902
all-24903
[ "returns", "the", "message", "price", "by", "country" ]
[ "func", "(", "cmps", "*", "CountryMessagingPriceService", ")", "Get", "(", "ctx", "context", ".", "<mask>", ",", "isoCountry", "string", ")", "(", "*", "MessagePrice", ",", "error", ")", "{", "messagePrice", ":=", "new", "(", "MessagePrice", ")", "\n", "err", ":=", "cmps", ".", "client", ".", "GetResource", "(", "ctx", ",", "messagingPathPart", "+", "\"", "\"", ",", "isoCountry", ",", "messagePrice", ")", "\n", "return", "messagePrice", ",", "err", "\n", "}" ]
24,903
all-24904
[ "HasOverride", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostActionMute", ")", "HasOverride", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "Override", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
24,904
all-24905
[ "CreatedByString", "return", "a", "short", "context", "about", "the", "origin", "of", "this", "goroutine", "signature", "." ]
[ "func", "(", "s", "*", "Signature", ")", "CreatedByString", "(", "fullPath", "bool", ")", "string", "{", "created", ":=", "s", ".", "CreatedBy", ".", "Func", ".", "PkgDotName", "(", ")", "\n", "if", "<mask>", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "created", "+=", "\"", "\"", "\n", "if", "fullPath", "{", "created", "+=", "s", ".", "CreatedBy", ".", "FullSrcLine", "(", ")", "\n", "}", "else", "{", "created", "+=", "s", ".", "CreatedBy", ".", "SrcLine", "(", ")", "\n", "}", "\n", "return", "created", "\n", "}" ]
24,905
all-24906
[ "calcKeys50", "calculates", "the", "keys", "used", "in", "RAR", "5", "archive", "processing", ".", "The", "returned", "slice", "of", "byte", "slices", "contains", "3", "keys", ".", "Key", "0", "is", "used", "for", "block", "or", "file", "decryption", ".", "Key", "1", "is", "optionally", "used", "for", "file", "checksum", "calculation", ".", "Key", "2", "is", "optionally", "used", "for", "password", "checking", "." ]
[ "func", "calcKeys50", "(", "pass", ",", "salt", "[", "]", "byte", ",", "kdfCount", "int", ")", "[", "]", "[", "]", "byte", "{", "if", "len", "(", "salt", ")", ">", "maxPbkdf2Salt", "{", "salt", "=", "salt", "[", ":", "maxPbkdf2Salt", "]", "\n", "}", "\n", "keys", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "3", ")", "\n", "if", "len", "(", "keys", ")", "==", "0", "{", "return", "keys", "\n", "}", "\n\n", "prf", ":=", "hmac", ".", "New", "(", "sha256", ".", "New", ",", "pass", ")", "\n", "prf", ".", "Write", "(", "salt", ")", "\n", "prf", ".", "Write", "(", "[", "]", "byte", "{", "0", ",", "0", ",", "0", ",", "1", "}", ")", "\n\n", "t", ":=", "prf", ".", "Sum", "(", "nil", ")", "\n", "u", ":=", "append", "(", "[", "]", "byte", "(", "nil", ")", ",", "t", "...", ")", "\n\n", "kdfCount", "--", "\n\n", "for", "i", ",", "iter", ":=", "range", "[", "]", "int", "{", "kdfCount", ",", "16", ",", "16", "}", "{", "for", "iter", ">", "0", "{", "prf", ".", "Reset", "(", ")", "\n", "prf", ".", "Write", "(", "u", ")", "\n", "u", "=", "prf", ".", "Sum", "(", "u", "[", ":", "0", "]", ")", "\n", "for", "j", ":=", "range", "u", "{", "t", "[", "j", "]", "^=", "u", "[", "j", "]", "\n", "}", "\n", "iter", "--", "\n", "}", "\n", "keys", "[", "i", "]", "=", "<mask>", "(", "[", "]", "byte", "(", "nil", ")", ",", "t", "...", ")", "\n", "}", "\n\n", "pwcheck", ":=", "keys", "[", "2", "]", "\n", "for", "i", ",", "v", ":=", "range", "pwcheck", "[", "pwCheckSize", ":", "]", "{", "pwcheck", "[", "i", "&", "(", "pwCheckSize", "-", "1", ")", "]", "^=", "v", "\n", "}", "\n", "keys", "[", "2", "]", "=", "pwcheck", "[", ":", "pwCheckSize", "]", "\n\n", "return", "keys", "\n", "}" ]
24,906
all-24907
[ "Flush", "the", "current", "batch", "." ]
[ "func", "(", "h", "*", "Handler", ")", "Flush", "(", ")", "{", "h", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "h", ".", "<mask>", "!=", "nil", "{", "go", "h", ".", "flush", "(", "h", ".", "batch", ")", "\n", "h", ".", "batch", "=", "nil", "\n", "}", "\n", "}" ]
24,907
all-24908
[ "Apply", "will", "compare", "the", "actual", "and", "expected", "firewall", "config", "if", "needed", "it", "will", "create", "the", "firewall", "." ]
[ "func", "(", "r", "*", "Firewall", ")", "Apply", "(", "actual", ",", "expected", "cloud", ".", "Resource", ",", "immutable", "*", "cluster", ".", "Cluster", ")", "(", "*", "cluster", ".", "Cluster", ",", "cloud", ".", "Resource", ",", "error", ")", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "expectedResource", ":=", "expected", ".", "(", "*", "Firewall", ")", "\n", "actualResource", ":=", "actual", ".", "(", "*", "Firewall", ")", "\n\n", "isEqual", ",", "err", ":=", "compare", ".", "IsEqual", "(", "actualResource", ",", "expectedResource", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "if", "isEqual", "{", "return", "immutable", ",", "expected", ",", "nil", "\n", "}", "\n\n", "firewallRequest", ":=", "godo", ".", "FirewallRequest", "{", "Name", ":", "expectedResource", ".", "Name", ",", "InboundRules", ":", "convertInRuleType", "(", "expectedResource", ".", "InboundRules", ")", ",", "OutboundRules", ":", "convertOutRuleType", "(", "expectedResource", ".", "OutboundRules", ")", ",", "DropletIDs", ":", "expectedResource", ".", "DropletIDs", ",", "Tags", ":", "expectedResource", ".", "Tags", ",", "}", "\n\n", "// Make sure Droplets are fully created before applying a firewall", "machineProviderConfigs", ":=", "immutable", ".", "MachineProviderConfigs", "(", ")", "\n", "for", "_", ",", "machineProviderConfig", ":=", "range", "machineProviderConfigs", "{", "for", "i", ":=", "0", ";", "i", "<=", "TagsGetAttempts", ";", "i", "++", "{", "active", ":=", "true", "\n", "droplets", ",", "_", ",", "err", ":=", "Sdk", ".", "Client", ".", "Droplets", ".", "ListByTag", "(", "context", ".", "TODO", "(", ")", ",", "machineProviderConfig", ".", "ServerPool", ".", "Name", ",", "&", "godo", ".", "ListOptions", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Debug", "(", "\"", "\"", ",", "err", ")", "\n", "time", ".", "Sleep", "(", "time", ".", "Duration", "(", "TagsGetTimeout", ")", "*", "time", ".", "Second", ")", "\n", "continue", "\n", "}", "\n", "if", "len", "(", "droplets", ")", "==", "0", "{", "continue", "\n", "}", "\n", "for", "_", ",", "d", ":=", "range", "droplets", "{", "if", "d", ".", "Status", "!=", "\"", "\"", "{", "active", "=", "false", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "!", "active", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "time", ".", "Sleep", "(", "time", ".", "Duration", "(", "TagsGetTimeout", ")", "*", "time", ".", "Second", ")", "\n", "continue", "\n", "}", "\n", "break", "\n", "}", "\n", "}", "\n\n", "firewall", ",", "_", ",", "err", ":=", "Sdk", ".", "Client", ".", "Firewalls", ".", "Create", "(", "<mask>", ".", "TODO", "(", ")", ",", "&", "firewallRequest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "logger", ".", "Success", "(", "\"", "\"", ",", "firewall", ".", "ID", ")", "\n", "newResource", ":=", "&", "Firewall", "{", "Shared", ":", "Shared", "{", "CloudID", ":", "firewall", ".", "ID", ",", "Name", ":", "r", ".", "Name", ",", "Tags", ":", "r", ".", "Tags", ",", "}", ",", "DropletIDs", ":", "r", ".", "DropletIDs", ",", "FirewallID", ":", "firewall", ".", "ID", ",", "InboundRules", ":", "r", ".", "InboundRules", ",", "OutboundRules", ":", "r", ".", "OutboundRules", ",", "Created", ":", "r", ".", "Created", ",", "}", "\n\n", "newCluster", ":=", "r", ".", "immutableRender", "(", "newResource", ",", "immutable", ")", "\n", "return", "newCluster", ",", "newResource", ",", "nil", "\n", "}" ]
24,908
all-24909
[ "ReplayManifestFile", "reads", "the", "manifest", "file", "and", "constructs", "two", "manifest", "objects", ".", "(", "We", "need", "one", "immutable", "copy", "and", "one", "mutable", "copy", "of", "the", "manifest", ".", "Easiest", "way", "is", "to", "construct", "two", "of", "them", ".", ")", "Also", "returns", "the", "last", "offset", "after", "a", "completely", "read", "manifest", "entry", "--", "the", "file", "must", "be", "truncated", "at", "that", "point", "before", "further", "appends", "are", "made", "(", "if", "there", "is", "a", "partial", "entry", "after", "that", ")", ".", "In", "normal", "conditions", "truncOffset", "is", "the", "file", "size", "." ]
[ "func", "ReplayManifestFile", "(", "fp", "*", "os", ".", "File", ")", "(", "<mask>", "Manifest", ",", "truncOffset", "int64", ",", "err", "error", ")", "{", "r", ":=", "countingReader", "{", "wrapped", ":", "bufio", ".", "NewReader", "(", "fp", ")", "}", "\n\n", "var", "magicBuf", "[", "8", "]", "byte", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "&", "r", ",", "magicBuf", "[", ":", "]", ")", ";", "err", "!=", "nil", "{", "return", "Manifest", "{", "}", ",", "0", ",", "errBadMagic", "\n", "}", "\n", "if", "!", "bytes", ".", "Equal", "(", "magicBuf", "[", "0", ":", "4", "]", ",", "magicText", "[", ":", "]", ")", "{", "return", "Manifest", "{", "}", ",", "0", ",", "errBadMagic", "\n", "}", "\n", "version", ":=", "binary", ".", "BigEndian", ".", "Uint32", "(", "magicBuf", "[", "4", ":", "8", "]", ")", "\n", "if", "version", "!=", "magicVersion", "{", "return", "Manifest", "{", "}", ",", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "version", ",", "magicVersion", ")", "\n", "}", "\n\n", "build", ":=", "createManifest", "(", ")", "\n", "var", "offset", "int64", "\n", "for", "{", "offset", "=", "r", ".", "count", "\n", "var", "lenCrcBuf", "[", "8", "]", "byte", "\n", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "&", "r", ",", "lenCrcBuf", "[", ":", "]", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "||", "err", "==", "io", ".", "ErrUnexpectedEOF", "{", "break", "\n", "}", "\n", "return", "Manifest", "{", "}", ",", "0", ",", "err", "\n", "}", "\n", "length", ":=", "binary", ".", "BigEndian", ".", "Uint32", "(", "lenCrcBuf", "[", "0", ":", "4", "]", ")", "\n", "var", "buf", "=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "&", "r", ",", "buf", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "||", "err", "==", "io", ".", "ErrUnexpectedEOF", "{", "break", "\n", "}", "\n", "return", "Manifest", "{", "}", ",", "0", ",", "err", "\n", "}", "\n", "if", "crc32", ".", "Checksum", "(", "buf", ",", "y", ".", "CastagnoliCrcTable", ")", "!=", "binary", ".", "BigEndian", ".", "Uint32", "(", "lenCrcBuf", "[", "4", ":", "8", "]", ")", "{", "break", "\n", "}", "\n\n", "var", "changeSet", "pb", ".", "ManifestChangeSet", "\n", "if", "err", ":=", "changeSet", ".", "Unmarshal", "(", "buf", ")", ";", "err", "!=", "nil", "{", "return", "Manifest", "{", "}", ",", "0", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "applyChangeSet", "(", "&", "build", ",", "&", "changeSet", ")", ";", "err", "!=", "nil", "{", "return", "Manifest", "{", "}", ",", "0", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "build", ",", "offset", ",", "err", "\n", "}" ]
24,909
all-24910
[ "WithMessageSigning", "enables", "or", "disables", "message", "signing", "(", "enabled", "by", "default", ")", "." ]
[ "func", "WithMessageSigning", "(", "<mask>", "bool", ")", "Option", "{", "return", "func", "(", "p", "*", "PubSub", ")", "error", "{", "if", "enabled", "{", "p", ".", "signKey", "=", "p", ".", "host", ".", "Peerstore", "(", ")", ".", "PrivKey", "(", "p", ".", "signID", ")", "\n", "if", "p", ".", "signKey", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "p", ".", "signID", ")", "\n", "}", "\n", "}", "else", "{", "p", ".", "signKey", "=", "nil", "\n", "p", ".", "signStrict", "=", "false", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "}" ]
24,910
all-24911
[ "HasCustomImageUrl", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardConditionalFormat", ")", "HasCustomImageUrl", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "CustomImageUrl", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,911
all-24912
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetType", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "<mask>", "\n", "}" ]
24,912
all-24913
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PrepareForLeakDetectionParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,913
all-24914
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkTextBuffer", "." ]
[ "func", "(", "v", "*", "TextBuffer", ")", "native", "(", ")", "*", "C", ".", "GtkTextBuffer", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkTextBuffer", "(", "p", ")", "\n", "}" ]
24,914
all-24915
[ "Return", "true", "if", "the", "input", "word", "is", "a", "Swedish", "stop", "word", "." ]
[ "func", "isStopWord", "(", "word", "string", ")", "bool", "{", "switch", "word", "{", "<mask>", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "d", ",", " ", "m", ",", " ", "v", ",", " ", "s", ",", " ", "f", " ", "\"", "å", "\"", "t", "l", "\"", "ä", "\"", "m", "e", "\"", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "m", ",", " ", "m", ",", " ", "e", ",", " ", "v", ",", " ", "k", ",", " ", "n", " ", "\"", "r", "\"", "u", "\"", "", "", "\"", ",", " ", "e", ",", " ", "u", ",", " ", "v", ",", " ", "d", ",", " ", "v", ",", " ", "v", ",", " ", "ö", " ", "\"", "n", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "h", ",", " ", "m", ",", " ", "a", ",", " ", "u", ",", " ", "n", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "d", ",", "", "\"", ",", " ", "u", ",", " ", "v", ",", " ", "h", ",", " ", "i", ",", " ", "m", ",", " ", "n", ",", " ", "b", ",", " ", "b", ",", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "d", ",", " ", "b", ",", " ", "m", ",", " ", "s", ",", "", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "v", " ", "\"", "l", " ", "\"", "e", " ", "\"", "n", " ", "\"", "e", "", "", "\"", ",", " ", "v", " ", "\"", "a", " ", "\"", "i", " ", "\"", "i", " ", "\"", "e", " ", "\"", "i", "", "", "\"", "\"", ",", "\"", ",", " ", "v", ",", " ", "d", ",", " ", "v", ",", " ", "v", " ", "\"", "å", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
24,915
all-24916
[ "resourceVSphereDatastoreClusterHasSDRSConfigChange", "checks", "all", "resource", "keys", "associated", "with", "storage", "DRS", "to", "see", "if", "there", "has", "been", "a", "change", "in", "the", "configuration", "of", "those", "keys", ".", "This", "helper", "is", "designed", "to", "detect", "no", "-", "ops", "in", "a", "SDRS", "configuration", "to", "see", "if", "we", "really", "need", "to", "send", "a", "configure", "API", "call", "to", "vSphere", "." ]
[ "func", "resourceVSphereDatastoreClusterHasSDRSConfigChange", "(", "d", "*", "schema", ".", "ResourceData", ")", "bool", "{", "for", "k", ":=", "range", "resourceVSphereDatastoreCluster", "(", ")", ".", "Schema", "{", "<mask>", "{", "case", "resourceVSphereDatastoreClusterHasSDRSConfigChangeExcluded", "(", "k", ")", ":", "continue", "\n", "case", "d", ".", "HasChange", "(", "k", ")", ":", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,916
all-24917
[ "Decode", "reads", "a", "PNG", "image", "from", "r", "and", "returns", "it", "as", "an", "image", ".", "Image", ".", "The", "type", "of", "Image", "returned", "depends", "on", "the", "PNG", "contents", "." ]
[ "func", "Decode", "(", "r", "io", ".", "Reader", ")", "(", "image", ".", "Image", ",", "error", ")", "{", "d", ":=", "&", "decoder", "{", "r", ":", "r", ",", "crc", ":", "crc32", ".", "NewIEEE", "(", ")", ",", "}", "\n", "if", "err", ":=", "d", ".", "checkHeader", "(", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "<mask>", ".", "EOF", "{", "err", "=", "io", ".", "ErrUnexpectedEOF", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "for", "d", ".", "stage", "!=", "dsSeenIEND", "{", "if", "err", ":=", "d", ".", "parseChunk", "(", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "err", "=", "io", ".", "ErrUnexpectedEOF", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "d", ".", "img", ",", "nil", "\n", "}" ]
24,917
all-24918
[ "LoadOCIConfig", "reads", "and", "parses", "the", "OCI", "ExternalDNS", "config", "file", "at", "the", "given", "path", "." ]
[ "func", "LoadOCIConfig", "(", "<mask>", "string", ")", "(", "*", "OCIConfig", ",", "error", ")", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "cfg", ":=", "OCIConfig", "{", "}", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "contents", ",", "&", "cfg", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "path", ")", "\n", "}", "\n", "return", "&", "cfg", ",", "nil", "\n", "}" ]
24,918
all-24919
[ "NewBase", "creates", "a", "new", "instance", "of", "Base", "with", "default", "values", "set", "." ]
[ "func", "NewBase", "(", "configs", "...", "baseConfigFunc", ")", "*", "Base", "{", "b", ":=", "&", "Base", "{", "clock", ":", "glock", ".", "NewRealClock", "(", ")", ",", "config", ":", "NewConfig", "(", ")", ",", "logLevel", ":", "LevelDebug", ",", "<mask>", ":", "0", ",", "BaseAttrs", ":", "NewAttrs", "(", ")", ",", "loggers", ":", "make", "(", "[", "]", "Logger", ",", "0", ")", ",", "hookPreQueue", ":", "make", "(", "[", "]", "HookPreQueue", ",", "0", ")", ",", "}", "\n\n", "for", "_", ",", "f", ":=", "range", "configs", "{", "f", "(", "b", ")", "\n", "}", "\n\n", "return", "b", "\n", "}" ]
24,919
all-24920
[ "Func", "declares", "a", "new", "Function", ".", "The", "second", "argument", "must", "be", "a", "function", "with", "a", "first", "argument", "of", "type", "context", ".", "Context", ".", "This", "function", "must", "be", "called", "at", "program", "initialization", "time", ".", "That", "means", "it", "must", "be", "called", "in", "a", "global", "variable", "declaration", "or", "from", "an", "init", "function", ".", "This", "restriction", "is", "necessary", "because", "the", "instance", "that", "delays", "a", "function", "call", "may", "not", "be", "the", "one", "that", "executes", "it", ".", "Only", "the", "code", "executed", "at", "program", "initialization", "time", "is", "guaranteed", "to", "have", "been", "run", "by", "an", "instance", "before", "it", "receives", "a", "request", "." ]
[ "func", "Func", "(", "key", "string", ",", "i", "interface", "{", "}", ")", "*", "Function", "{", "f", ":=", "&", "Function", "{", "fv", ":", "reflect", ".", "ValueOf", "(", "i", ")", "}", "\n\n", "// Derive unique, somewhat stable key for this func.", "_", ",", "file", ",", "_", ",", "_", ":=", "runtime", ".", "Caller", "(", "1", ")", "\n", "fk", ",", "err", ":=", "fileKey", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "// Not fatal, but log the error", "stdlog", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "f", ".", "key", "=", "fk", "+", "\"", "\"", "+", "key", "\n\n", "t", ":=", "f", ".", "fv", ".", "Type", "(", ")", "\n", "if", "t", ".", "Kind", "(", ")", "!=", "reflect", ".", "Func", "{", "f", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "f", "\n", "}", "\n", "if", "t", ".", "NumIn", "(", ")", "==", "0", "||", "!", "isContext", "(", "t", ".", "In", "(", "0", ")", ")", "{", "f", ".", "err", "=", "errFirstArg", "\n", "return", "f", "\n", "}", "\n\n", "// Register the function's arguments with the gob package.", "// This is required because they are marshaled inside a []interface{}.", "// gob.Register only expects to be called during initialization;", "// that's fine because this function expects the same.", "for", "i", ":=", "0", ";", "i", "<", "t", ".", "NumIn", "(", ")", ";", "i", "++", "{", "// Only concrete types may be registered. If the argument has", "// interface type, the client is resposible for registering the", "// concrete types it will hold.", "if", "t", ".", "In", "(", "i", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Interface", "{", "continue", "\n", "}", "\n", "gob", ".", "Register", "(", "reflect", ".", "Zero", "(", "t", ".", "In", "(", "i", ")", ")", ".", "Interface", "(", ")", ")", "\n", "}", "\n\n", "if", "old", ":=", "funcs", "[", "f", ".", "key", "]", ";", "old", "!=", "nil", "{", "old", ".", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ",", "file", ")", "\n", "}", "\n", "funcs", "[", "f", ".", "key", "]", "=", "f", "\n", "return", "f", "\n", "}" ]
24,920
all-24921
[ "GetShowHitsOk", "returns", "a", "tuple", "with", "the", "ShowHits", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetShowHitsOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "ShowHits", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "ShowHits", ",", "true", "\n", "}" ]
24,921
all-24922
[ "Close", "would", "close", "the", "iterator", ".", "It", "is", "important", "to", "call", "this", "when", "you", "re", "done", "with", "iteration", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Close", "(", ")", "{", "if", "it", ".", "closed", "{", "return", "\n", "}", "\n", "it", ".", "closed", "=", "true", "\n\n", "it", ".", "iitr", ".", "Close", "(", ")", "\n", "// It is important to wait for the fill goroutines to finish. Otherwise, we might leave zombie", "// goroutines behind, which are waiting to acquire file read locks after DB has been closed.", "waitFor", ":=", "func", "(", "l", "list", ")", "{", "<mask>", ":=", "l", ".", "pop", "(", ")", "\n", "for", "item", "!=", "nil", "{", "item", ".", "wg", ".", "Wait", "(", ")", "\n", "item", "=", "l", ".", "pop", "(", ")", "\n", "}", "\n", "}", "\n", "waitFor", "(", "it", ".", "waste", ")", "\n", "waitFor", "(", "it", ".", "data", ")", "\n\n", "// TODO: We could handle this error.", "_", "=", "it", ".", "txn", ".", "db", ".", "vlog", ".", "decrIteratorCount", "(", ")", "\n", "atomic", ".", "AddInt32", "(", "&", "it", ".", "txn", ".", "numIterators", ",", "-", "1", ")", "\n", "}" ]
24,922
all-24923
[ "StoragePoolDriver", "returns", "the", "driver", "of", "the", "pool", "with", "the", "given", "ID", "." ]
[ "func", "storagePoolDriverGet", "(", "tx", "*", "sql", ".", "Tx", ",", "id", "int64", ")", "(", "string", ",", "error", ")", "{", "stmt", ":=", "\"", "\"", "\n", "drivers", ",", "err", ":=", "query", ".", "SelectStrings", "(", "tx", ",", "stmt", ",", "id", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "switch", "len", "(", "drivers", ")", "{", "case", "0", ":", "return", "\"", "\"", ",", "ErrNoSuchObject", "\n", "case", "1", ":", "return", "drivers", "[", "0", "]", ",", "nil", "\n", "<mask>", ":", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}" ]
24,923
all-24924
[ "Del", "deletes", "argument", "with", "the", "given", "key", "from", "query", "args", "." ]
[ "func", "(", "a", "*", "Args", ")", "Del", "(", "key", "string", ")", "{", "a", ".", "args", "=", "delAllArgs", "(", "a", ".", "args", ",", "<mask>", ")", "\n", "}" ]
24,924
all-24925
[ "ParseUfloat", "parses", "unsigned", "float", "from", "buf", "." ]
[ "func", "ParseUfloat", "(", "buf", "[", "]", "byte", ")", "(", "float64", ",", "error", ")", "{", "if", "len", "(", "buf", ")", "==", "0", "{", "return", "-", "1", ",", "errEmptyFloat", "\n", "}", "\n", "b", ":=", "buf", "\n", "var", "v", "uint64", "\n", "var", "offset", "=", "1.0", "\n", "var", "pointFound", "bool", "\n", "for", "i", ",", "c", ":=", "range", "b", "{", "if", "c", "<", "'0'", "||", "c", ">", "'9'", "{", "if", "c", "==", "'.'", "{", "if", "pointFound", "{", "return", "-", "1", ",", "errDuplicateFloatPoint", "\n", "}", "\n", "pointFound", "=", "true", "\n", "continue", "\n", "}", "\n", "if", "c", "==", "'e'", "||", "c", "==", "'E'", "{", "if", "i", "+", "1", ">=", "len", "(", "b", ")", "{", "return", "-", "1", ",", "errUnexpectedFloatEnd", "\n", "}", "\n", "b", "=", "b", "[", "i", "+", "1", ":", "]", "\n", "minus", ":=", "-", "1", "\n", "switch", "b", "[", "0", "]", "{", "case", "'+'", ":", "b", "=", "b", "[", "1", ":", "]", "\n", "minus", "=", "1", "\n", "<mask>", "'-'", ":", "b", "=", "b", "[", "1", ":", "]", "\n", "default", ":", "minus", "=", "1", "\n", "}", "\n", "vv", ",", "err", ":=", "ParseUint", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errInvalidFloatExponent", "\n", "}", "\n", "return", "float64", "(", "v", ")", "*", "offset", "*", "math", ".", "Pow10", "(", "minus", "*", "int", "(", "vv", ")", ")", ",", "nil", "\n", "}", "\n", "return", "-", "1", ",", "errUnexpectedFloatChar", "\n", "}", "\n", "v", "=", "10", "*", "v", "+", "uint64", "(", "c", "-", "'0'", ")", "\n", "if", "pointFound", "{", "offset", "/=", "10", "\n", "}", "\n", "}", "\n", "return", "float64", "(", "v", ")", "*", "offset", ",", "nil", "\n", "}" ]
24,925
all-24926
[ "query", "the", "name", "of", "an", "active", "shader", "subroutine" ]
[ "func", "GetActiveSubroutineName", "(", "program", "uint32", ",", "shadertype", "uint32", ",", "index", "uint32", ",", "bufsize", "int32", ",", "<mask>", "*", "int32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowGetActiveSubroutineName", "(", "gpGetActiveSubroutineName", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLenum", ")", "(", "shadertype", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufsize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "}" ]
24,926
all-24927
[ "Construct", "an", "empty", "state", "object", "ready", "to", "receive", "updates", ".", "This", "is", "suitable", "to", "use", "at", "program", "start", ".", "Other", "peers", "will", "populate", "us", "with", "data", "." ]
[ "func", "newState", "(", "self", "mesh", ".", "PeerName", ")", "*", "<mask>", "{", "return", "&", "state", "{", "set", ":", "map", "[", "mesh", ".", "PeerName", "]", "int", "{", "}", ",", "self", ":", "self", ",", "}", "\n", "}" ]
24,927
all-24928
[ "ActivateItem", "is", "a", "wrapper", "around", "gtk_menu_shell_activate_item", "()", "." ]
[ "func", "(", "v", "*", "MenuShell", ")", "ActivateItem", "(", "child", "IMenuItem", ",", "forceDeactivate", "bool", ")", "{", "C", ".", "gtk_menu_shell_activate_item", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "gbool", "(", "forceDeactivate", ")", ")", "\n", "}" ]
24,928
all-24929
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "AppList", "." ]
[ "func", "(", "<mask>", "*", "AppList", ")", "DeepCopy", "(", ")", "*", "AppList", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "AppList", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
24,929
all-24930
[ "NewCounter", "creates", "new", "Counter", "instance", ".", "Options", "value", "can", "be", "nil", "." ]
[ "func", "NewCounter", "(", "options", "*", "CounterOptions", ")", "(", "c", "*", "Counter", ")", "{", "if", "options", "==", "nil", "{", "options", "=", "new", "(", "CounterOptions", ")", "\n", "}", "\n", "if", "options", ".", "Name", "==", "\"", "\"", "{", "options", ".", "Name", "=", "\"", "\"", "\n", "}", "\n", "if", "options", ".", "Help", "==", "\"", "\"", "{", "options", ".", "Help", "=", "\"", "\"", "\n", "}", "\n", "<mask>", ":=", "prometheus", ".", "NewCounterVec", "(", "prometheus", ".", "CounterOpts", "{", "Name", ":", "options", ".", "Name", ",", "Help", ":", "options", ".", "Help", ",", "}", ",", "[", "]", "string", "{", "\"", "\"", "}", ",", ")", "\n", "return", "&", "Counter", "{", "vector", ":", "vector", ",", "emergencyCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "alertCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "criticalCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "errorCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "warningCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "noticeCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "infoCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "debugCounter", ":", "vector", ".", "WithLabelValues", "(", "\"", "\"", ")", ",", "}", "\n", "}" ]
24,930
all-24931
[ "private", "handler", "implementation", "details" ]
[ "func", "(", "h", "*", "gerritInstanceHandler", ")", "queryAllChanges", "(", "lastUpdate", "time", ".", "Time", ",", "rateLimit", "int", ")", "[", "]", "gerrit", ".", "ChangeInfo", "{", "result", ":=", "[", "]", "gerrit", ".", "ChangeInfo", "{", "}", "\n", "for", "_", ",", "<mask>", ":=", "range", "h", ".", "projects", "{", "changes", ",", "err", ":=", "h", ".", "queryChangesForProject", "(", "project", ",", "lastUpdate", ",", "rateLimit", ")", "\n", "if", "err", "!=", "nil", "{", "// don't halt on error from one project, log & continue", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "project", ")", "\n", "continue", "\n", "}", "\n", "result", "=", "append", "(", "result", ",", "changes", "...", ")", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
24,931
all-24932
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TouchPoint", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
24,932
all-24933
[ "Get", "looks", "for", "key", "and", "returns", "corresponding", "Item", ".", "If", "key", "is", "not", "found", "ErrKeyNotFound", "is", "returned", "." ]
[ "func", "(", "txn", "*", "Txn", ")", "Get", "(", "key", "[", "]", "byte", ")", "(", "item", "*", "Item", ",", "rerr", "error", ")", "{", "if", "len", "(", "key", ")", "==", "0", "{", "return", "nil", ",", "ErrEmptyKey", "\n", "}", "else", "if", "txn", ".", "discarded", "{", "return", "nil", ",", "ErrDiscardedTxn", "\n", "}", "\n\n", "item", "=", "new", "(", "Item", ")", "\n", "if", "txn", ".", "update", "{", "if", "e", ",", "has", ":=", "txn", ".", "pendingWrites", "[", "string", "(", "key", ")", "]", ";", "has", "&&", "bytes", ".", "Equal", "(", "key", ",", "e", ".", "Key", ")", "{", "if", "isDeletedOrExpired", "(", "e", ".", "meta", ",", "e", ".", "ExpiresAt", ")", "{", "return", "nil", ",", "ErrKeyNotFound", "\n", "}", "\n", "// Fulfill from cache.", "item", ".", "meta", "=", "e", ".", "meta", "\n", "item", ".", "val", "=", "e", ".", "Value", "\n", "item", ".", "userMeta", "=", "e", ".", "UserMeta", "\n", "item", ".", "key", "=", "key", "\n", "item", ".", "status", "=", "prefetched", "\n", "item", ".", "version", "=", "txn", ".", "readTs", "\n", "item", ".", "expiresAt", "=", "e", ".", "ExpiresAt", "\n", "// We probably don't need to set db on item here.", "return", "item", ",", "nil", "\n", "}", "\n", "// Only track reads if this is update txn. No need to track read if txn serviced it", "// internally.", "txn", ".", "addReadKey", "(", "key", ")", "\n", "}", "\n\n", "seek", ":=", "y", ".", "KeyWithTs", "(", "key", ",", "txn", ".", "readTs", ")", "\n", "vs", ",", "err", ":=", "txn", ".", "db", ".", "get", "(", "seek", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "key", ")", "\n", "}", "\n", "if", "vs", ".", "Value", "==", "nil", "&&", "vs", ".", "Meta", "==", "0", "{", "return", "nil", ",", "ErrKeyNotFound", "\n", "}", "\n", "if", "isDeletedOrExpired", "(", "vs", ".", "Meta", ",", "vs", ".", "ExpiresAt", ")", "{", "return", "nil", ",", "ErrKeyNotFound", "\n", "}", "\n\n", "item", ".", "key", "=", "key", "\n", "item", ".", "version", "=", "vs", ".", "<mask>", "\n", "item", ".", "meta", "=", "vs", ".", "Meta", "\n", "item", ".", "userMeta", "=", "vs", ".", "UserMeta", "\n", "item", ".", "db", "=", "txn", ".", "db", "\n", "item", ".", "vptr", "=", "vs", ".", "Value", "// TODO: Do we need to copy this over?", "\n", "item", ".", "txn", "=", "txn", "\n", "item", ".", "expiresAt", "=", "vs", ".", "ExpiresAt", "\n", "return", "item", ",", "nil", "\n", "}" ]
24,933
all-24934
[ "SetUnit", "()", "is", "a", "wrapper", "around", "gtk_print_operation_set_unit", "()", "." ]
[ "func", "(", "po", "*", "PrintOperation", ")", "SetUnit", "(", "unit", "Unit", ")", "{", "C", ".", "gtk_print_operation_set_unit", "(", "<mask>", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "}" ]
24,934
all-24935
[ "findTarComponent", "returns", "a", "header", "and", "a", "reader", "matching", "path", "within", "inputFile", "or", "(", "nil", "nil", "nil", ")", "if", "not", "found", "." ]
[ "func", "findTarComponent", "(", "inputFile", "io", ".", "Reader", ",", "path", "string", ")", "(", "*", "tar", ".", "Reader", ",", "*", "tar", ".", "Header", ",", "error", ")", "{", "t", ":=", "<mask>", ".", "NewReader", "(", "inputFile", ")", "\n", "for", "{", "h", ",", "err", ":=", "t", ".", "Next", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "if", "h", ".", "Name", "==", "path", "{", "return", "t", ",", "h", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "nil", ",", "nil", "\n", "}" ]
24,935
all-24936
[ "String", "returns", "the", "value", "of", "the", "string", "stored", "in", "r", "." ]
[ "func", "(", "r", "region", ")", "String", "(", ")", "string", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindString", "{", "panic", "(", "\"", "\"", "+", "r", ".", "typ", ".", "Name", ")", "\n", "}", "\n", "p", ":=", "r", ".", "p", ".", "proc", ".", "ReadPtr", "(", "r", ".", "a", ")", "\n", "n", ":=", "r", ".", "p", ".", "proc", ".", "ReadUintptr", "(", "r", ".", "a", ".", "Add", "(", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", ")", ")", "\n", "b", ":=", "<mask>", "(", "[", "]", "byte", ",", "n", ")", "\n", "r", ".", "p", ".", "proc", ".", "ReadAt", "(", "b", ",", "p", ")", "\n", "return", "string", "(", "b", ")", "\n", "}" ]
24,936
all-24937
[ "Help", "describes", "the", "format", "of", "the", "configuration", "string", "for", "address", "discovery", "and", "the", "various", "provider", "specific", "options", "." ]
[ "func", "(", "d", "*", "Discover", ")", "Help", "(", ")", "string", "{", "d", ".", "once", ".", "Do", "(", "d", ".", "initProviders", ")", "\n\n", "h", ":=", "[", "]", "string", "{", "globalHelp", "}", "\n", "for", "_", ",", "name", ":=", "range", "d", ".", "Names", "(", ")", "{", "h", "=", "<mask>", "(", "h", ",", "d", ".", "Providers", "[", "name", "]", ".", "Help", "(", ")", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "h", ",", "\"", "\\n", "\"", ")", "\n", "}" ]
24,937
all-24938
[ "GetTitleSizeOk", "returns", "a", "tuple", "with", "the", "TitleSize", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScatterplotDefinition", ")", "GetTitleSizeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "s", "==", "nil", "||", "s", ".", "TitleSize", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "s", ".", "TitleSize", ",", "true", "\n", "}" ]
24,938
all-24939
[ "Intersect", "creates", "an", "Intersect", "query", ".", "Intersect", "performs", "a", "logical", "AND", "on", "the", "results", "of", "each", "ROW_CALL", "query", "passed", "to", "it", "." ]
[ "func", "(", "idx", "*", "Index", ")", "Intersect", "(", "rows", "...", "*", "PQLRowQuery", ")", "*", "PQLRowQuery", "{", "if", "len", "(", "<mask>", ")", "<", "1", "{", "return", "NewPQLRowQuery", "(", "\"", "\"", ",", "idx", ",", "NewError", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "idx", ".", "rowOperation", "(", "\"", "\"", ",", "rows", "...", ")", "\n", "}" ]
24,939
all-24940
[ "HashSecret", "will", "hash", "Secret", "and", "set", "SecretHash", "." ]
[ "func", "(", "a", "*", "<mask>", ")", "HashSecret", "(", ")", "error", "{", "// check length", "if", "len", "(", "a", ".", "Secret", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "// generate hash from password", "hash", ",", "err", ":=", "bcrypt", ".", "GenerateFromPassword", "(", "[", "]", "byte", "(", "a", ".", "Secret", ")", ",", "bcrypt", ".", "DefaultCost", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// save hash", "a", ".", "SecretHash", "=", "hash", "\n\n", "// clear password", "a", ".", "Secret", "=", "\"", "\"", "\n\n", "return", "nil", "\n", "}" ]
24,940
all-24941
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsDevice", ")", "GetName", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "Name", "\n", "}" ]
24,941
all-24942
[ "/", "*", "ProcessEvent", "processes", "all", "events", "come", "from", "the", "control", "parent", ".", "If", "a", "control", "processes", "an", "event", "it", "should", "return", "true", ".", "If", "the", "method", "returns", "false", "it", "means", "that", "the", "control", "do", "not", "want", "or", "cannot", "process", "the", "event", "and", "the", "caller", "sends", "the", "event", "to", "the", "control", "parent" ]
[ "func", "(", "b", "*", "Button", ")", "ProcessEvent", "(", "event", "Event", ")", "bool", "{", "if", "!", "b", ".", "Enabled", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "if", "event", ".", "Type", "==", "EventKey", "{", "if", "event", ".", "Key", "==", "term", ".", "KeySpace", "&&", "b", ".", "isPressed", "(", ")", "==", "0", "{", "b", ".", "setPressed", "(", "1", ")", "\n", "ev", ":=", "Event", "{", "Type", ":", "EventRedraw", "}", "\n\n", "go", "func", "(", ")", "{", "PutEvent", "(", "ev", ")", "\n", "time", ".", "Sleep", "(", "100", "*", "time", ".", "Millisecond", ")", "\n", "b", ".", "setPressed", "(", "0", ")", "\n", "PutEvent", "(", "ev", ")", "\n", "}", "(", ")", "\n\n", "if", "b", ".", "onClick", "!=", "nil", "{", "b", ".", "onClick", "(", "event", ")", "\n", "}", "\n", "return", "true", "\n", "}", "else", "if", "event", ".", "Key", "==", "term", ".", "KeyEsc", "&&", "b", ".", "isPressed", "(", ")", "!=", "0", "{", "b", ".", "setPressed", "(", "0", ")", "\n", "ReleaseEvents", "(", ")", "\n", "return", "true", "\n", "}", "\n", "}", "else", "if", "event", ".", "Type", "==", "EventMouse", "{", "if", "event", ".", "Key", "==", "term", ".", "MouseLeft", "{", "b", ".", "setPressed", "(", "1", ")", "\n", "GrabEvents", "(", "b", ")", "\n", "return", "true", "\n", "}", "else", "if", "event", ".", "Key", "==", "term", ".", "MouseRelease", "&&", "b", ".", "isPressed", "(", ")", "!=", "0", "{", "ReleaseEvents", "(", ")", "\n", "if", "event", ".", "X", ">=", "b", ".", "x", "&&", "event", ".", "Y", ">=", "b", ".", "y", "&&", "event", ".", "X", "<", "b", ".", "x", "+", "b", ".", "width", "&&", "event", ".", "Y", "<", "b", ".", "y", "+", "b", ".", "height", "{", "if", "b", ".", "onClick", "!=", "nil", "{", "b", ".", "onClick", "(", "event", ")", "\n", "}", "\n", "}", "\n", "b", ".", "setPressed", "(", "0", ")", "\n", "return", "<mask>", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,942
all-24943
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CollectGarbageParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,943
all-24944
[ "Do", "executes", "DOM", ".", "performSearch", "against", "the", "provided", "context", ".", "returns", ":", "searchID", "-", "Unique", "search", "session", "identifier", ".", "resultCount", "-", "Number", "of", "search", "results", "." ]
[ "func", "(", "p", "*", "PerformSearchParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "searchID", "string", ",", "resultCount", "int64", ",", "err", "error", ")", "{", "// execute", "var", "res", "PerformSearchReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandPerformSearch", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "0", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "SearchID", ",", "res", ".", "ResultCount", ",", "nil", "\n", "}" ]
24,944
all-24945
[ "the", "zones", "we", "are", "allowed", "to", "touch", ".", "Currently", "only", "exact", "matches", "are", "considered", "not", "all", "zones", "with", "the", "given", "suffix" ]
[ "func", "(", "d", "*", "dynProviderState", ")", "zones", "(", "client", "*", "dynect", ".", "<mask>", ")", "[", "]", "string", "{", "return", "d", ".", "ZoneIDFilter", ".", "zoneIDs", "\n", "}" ]
24,945
all-24946
[ "title", ":", "revoke", "access", "to", "app", "path", ":", "/", "apps", "/", "{", "app", "}", "/", "teams", "/", "{", "team", "}", "method", ":", "DELETE", "responses", ":", "200", ":", "Access", "revoked", "401", ":", "Unauthorized", "403", ":", "Forbidden", "404", ":", "App", "or", "team", "not", "found" ]
[ "func", "revokeAppAccess", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "appName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "teamName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "a", ",", "err", ":=", "getAppFromContext", "(", "appName", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermAppUpdateRevoke", ",", "contextsForApp", "(", "&", "a", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "appTarget", "(", "appName", ")", ",", "Kind", ":", "permission", ".", "PermAppUpdateRevoke", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermAppReadEvents", ",", "contextsForApp", "(", "&", "a", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "team", ",", "err", ":=", "servicemanager", ".", "Team", ".", "FindByName", "(", "teamName", ")", "\n", "if", "err", "!=", "nil", "||", "team", "==", "nil", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "if", "len", "(", "a", ".", "Teams", ")", "==", "1", "{", "msg", ":=", "\"", "\"", "\n", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusForbidden", ",", "<mask>", ":", "msg", "}", "\n", "}", "\n", "err", "=", "a", ".", "Revoke", "(", "team", ")", "\n", "switch", "err", "{", "case", "app", ".", "ErrNoAccess", ":", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "case", "app", ".", "ErrCannotOrphanApp", ":", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusForbidden", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "default", ":", "return", "err", "\n", "}", "\n", "}" ]
24,946
all-24947
[ "random", "select", "will", "return", "a", "random", "selection", "from", "an", "int", "slice" ]
[ "func", "randomSelect", "(", "a", "[", "]", "int", ")", "int", "{", "var", "tmpIndex", "int", "\n", "length", ":=", "len", "(", "a", ")", "\n", "randBytes", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n", "if", "_", ",", "err", ":=", "rand", ".", "Read", "(", "randBytes", ")", ";", "err", "==", "nil", "{", "tmpIndex", "=", "int", "(", "randBytes", "[", "0", "]", ")", "%", "<mask>", "\n", "}", "\n", "return", "a", "[", "tmpIndex", "]", "\n", "}" ]
24,947
all-24948
[ "GetCompletion", "()", "is", "a", "wrapper", "around", "gtk_entry_get_completion", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetCompletion", "(", ")", "(", "*", "EntryCompletion", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_entry_get_completion", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "e", ":=", "&", "EntryCompletion", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "return", "e", ",", "nil", "\n", "}" ]
24,948
all-24949
[ "setCommandFunc", "executes", "the", "set", "command", "." ]
[ "func", "setCommandFunc", "(", "c", "*", "cli", ".", "Context", ",", "ki", "client", ".", "KeysAPI", ")", "{", "if", "len", "(", "c", ".", "Args", "(", ")", ")", "==", "0", "{", "handleError", "(", "c", ",", "ExitBadArgs", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "key", ":=", "c", ".", "Args", "(", ")", "[", "0", "]", "\n", "<mask>", ",", "err", ":=", "argOrStdin", "(", "c", ".", "Args", "(", ")", ",", "os", ".", "Stdin", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "handleError", "(", "c", ",", "ExitBadArgs", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "ttl", ":=", "c", ".", "Int", "(", "\"", "\"", ")", "\n", "prevValue", ":=", "c", ".", "String", "(", "\"", "\"", ")", "\n", "prevIndex", ":=", "c", ".", "Int", "(", "\"", "\"", ")", "\n\n", "ctx", ",", "cancel", ":=", "contextWithTotalTimeout", "(", "c", ")", "\n", "resp", ",", "err", ":=", "ki", ".", "Set", "(", "ctx", ",", "key", ",", "value", ",", "&", "client", ".", "SetOptions", "{", "TTL", ":", "time", ".", "Duration", "(", "ttl", ")", "*", "time", ".", "Second", ",", "PrevIndex", ":", "uint64", "(", "prevIndex", ")", ",", "PrevValue", ":", "prevValue", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "handleError", "(", "c", ",", "ExitServerError", ",", "err", ")", "\n", "}", "\n\n", "printResponseKey", "(", "resp", ",", "c", ".", "GlobalString", "(", "\"", "\"", ")", ")", "\n", "}" ]
24,949
all-24950
[ "scroll", "scrolls", "the", "provided", "scroll", "region", "by", "param", "lines", ".", "The", "scroll", "region", "is", "in", "buffer", "coordinates", "." ]
[ "func", "(", "h", "*", "windowsAnsiEventHandler", ")", "scroll", "(", "param", "int", ",", "sr", "scrollRegion", ",", "info", "*", "CONSOLE_SCREEN_BUFFER_INFO", ")", "error", "{", "h", ".", "logf", "(", "\"", "\"", ",", "sr", ".", "top", ",", "sr", ".", "bottom", ")", "\n", "h", ".", "logf", "(", "\"", "\"", ",", "info", ".", "Window", ".", "Top", ",", "info", ".", "Window", ".", "Bottom", ")", "\n\n", "// Copy from and clip to the scroll region (full buffer width)", "scrollRect", ":=", "SMALL_RECT", "{", "Top", ":", "<mask>", ".", "top", ",", "Bottom", ":", "sr", ".", "bottom", ",", "Left", ":", "0", ",", "Right", ":", "info", ".", "Size", ".", "X", "-", "1", ",", "}", "\n\n", "// Origin to which area should be copied", "destOrigin", ":=", "COORD", "{", "X", ":", "0", ",", "Y", ":", "sr", ".", "top", "-", "int16", "(", "param", ")", ",", "}", "\n\n", "char", ":=", "CHAR_INFO", "{", "UnicodeChar", ":", "' '", ",", "Attributes", ":", "h", ".", "attributes", ",", "}", "\n\n", "if", "err", ":=", "ScrollConsoleScreenBuffer", "(", "h", ".", "fd", ",", "scrollRect", ",", "scrollRect", ",", "destOrigin", ",", "char", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,950
all-24951
[ "DoesHandle", "satisfies", "hookHandler", "." ]
[ "func", "(", "b", "BitbucketHook", ")", "DoesHandle", "(", "h", "http", ".", "Header", ")", "bool", "{", "<mask>", ":=", "h", ".", "Get", "(", "\"", "\"", ")", "\n\n", "// for Gitlab you can only use X-Gitlab-Event header to test if you could handle the request", "if", "event", "!=", "\"", "\"", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
24,951
all-24952
[ "copyTaskMetrics", "copies", "a", "slice", "of", "TaskMetric", "objects", "to", "another", "slice", ".", "This", "is", "needed", "as", "we", "reset", "the", "source", "slice", "after", "creating", "a", "new", "PublishMetricsRequest", "object", "." ]
[ "func", "copyTaskMetrics", "(", "from", "[", "]", "*", "ecstcs", ".", "TaskMetric", ")", "[", "]", "*", "ecstcs", ".", "TaskMetric", "{", "to", ":=", "make", "(", "[", "]", "*", "ecstcs", ".", "TaskMetric", ",", "len", "(", "from", ")", ")", "\n", "<mask>", "(", "to", ",", "from", ")", "\n", "return", "to", "\n", "}" ]
24,952
all-24953
[ "If", "you", "need", "to", "you", "can", "use", "this", "to", "construct", "the", "data", "map", "that", "will", "be", "cascaded", "down", "to", "related", "documents", ".", "Doing", "this", "is", "not", "recommended", "unless", "the", "cascaded", "fields", "are", "dynamic", "." ]
[ "func", "MapFromCascadeProperties", "(", "properties", "[", "]", "string", ",", "doc", "Document", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "data", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n\n", "for", "_", ",", "prop", ":=", "range", "properties", "{", "split", ":=", "strings", ".", "Split", "(", "prop", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "split", ")", "==", "1", "{", "data", "[", "prop", "]", ",", "_", "=", "dotaccess", ".", "Get", "(", "doc", ",", "prop", ")", "\n", "}", "else", "{", "actualProp", ":=", "split", "[", "len", "(", "split", ")", "-", "1", "]", "\n", "split", ":=", "append", "(", "[", "]", "string", "{", "}", ",", "split", "[", ":", "len", "(", "split", ")", "-", "1", "]", "...", ")", "\n", "curData", ":=", "data", "\n\n", "for", "_", ",", "s", ":=", "range", "split", "{", "if", "_", ",", "ok", ":=", "curData", "[", "s", "]", ";", "<mask>", "{", "if", "mapped", ",", "ok", ":=", "curData", "[", "s", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ";", "ok", "{", "curData", "=", "mapped", "\n", "}", "else", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "}", "else", "{", "curData", "[", "s", "]", "=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "mapped", ",", "ok", ":=", "curData", "[", "s", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", ";", "ok", "{", "curData", "=", "mapped", "\n", "}", "else", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "val", ",", "_", ":=", "dotaccess", ".", "Get", "(", "doc", ",", "prop", ")", "\n", "// if bsonId, ok := val.(bson.ObjectId); ok {", "// \tif !bsonId.Valid() {", "// \t\tcurData[actualProp] = \"\"", "// \t\tcontinue", "// \t}", "// }", "curData", "[", "actualProp", "]", "=", "val", "\n", "}", "\n", "}", "\n\n", "return", "data", "\n", "}" ]
24,953
all-24954
[ "Delete", "deletes", "an", "app", "." ]
[ "func", "Delete", "(", "app", "*", "App", ",", "evt", "*", "event", ".", "Event", ",", "requestID", "string", ")", "error", "{", "w", ":=", "evt", "\n", "isSwapped", ",", "swappedWith", ",", "err", ":=", "router", ".", "IsSwapped", "(", "app", ".", "GetName", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "isSwapped", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "swappedWith", ")", "\n", "}", "\n", "appName", ":=", "app", ".", "Name", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ",", "appName", ")", "\n", "var", "hasErrors", "bool", "\n", "defer", "func", "(", ")", "{", "var", "problems", "string", "\n", "if", "hasErrors", "{", "problems", "=", "\"", "\"", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ",", "problems", ")", "\n", "}", "(", ")", "\n", "logErr", ":=", "func", "(", "msg", "string", ",", "err", "error", ")", "{", "msg", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "msg", ",", "err", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ",", "msg", ")", "\n", "log", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "msg", ")", "\n", "hasErrors", "=", "true", "\n", "}", "\n", "prov", ",", "err", ":=", "app", ".", "getProvisioner", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "prov", ".", "Destroy", "(", "app", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "err", "=", "registry", ".", "RemoveAppImages", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "err", ")", "\n", "}", "\n", "if", "cleanProv", ",", "ok", ":=", "prov", ".", "(", "provision", ".", "CleanImageProvisioner", ")", ";", "ok", "{", "var", "imgs", "[", "]", "string", "\n", "imgs", ",", "err", "=", "image", ".", "ListAppImages", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "err", ")", "\n", "}", "\n", "var", "imgsBuild", "[", "]", "string", "\n", "imgsBuild", ",", "err", "=", "image", ".", "ListAppBuilderImages", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "img", ":=", "range", "append", "(", "imgs", ",", "imgsBuild", "...", ")", "{", "err", "=", "cleanProv", ".", "CleanImage", "(", "appName", ",", "img", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "err", "=", "image", ".", "DeleteAllAppImageNames", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "appName", ",", "err", ")", "\n", "}", "\n", "err", "=", "app", ".", "unbind", "(", "evt", ",", "requestID", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "routers", ":=", "app", ".", "GetRouters", "(", ")", "\n", "for", "_", ",", "appRouter", ":=", "range", "routers", "{", "var", "r", "router", ".", "Router", "\n", "r", ",", "err", "=", "router", ".", "Get", "(", "appRouter", ".", "Name", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "r", ".", "RemoveBackend", "(", "app", ".", "Name", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "err", "=", "router", ".", "Remove", "(", "app", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "err", "=", "app", ".", "unbindVolumes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "err", "=", "repository", ".", "Manager", "(", ")", ".", "RemoveRepository", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "token", ":=", "app", ".", "Env", "[", "\"", "\"", "]", ".", "Value", "\n", "err", "=", "AuthScheme", ".", "AppLogout", "(", "token", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "owner", ",", "err", ":=", "auth", ".", "GetUserByEmail", "(", "app", ".", "Owner", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "servicemanager", ".", "UserQuota", ".", "Inc", "(", "owner", ".", "Email", ",", "-", "1", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "logConn", ",", "err", ":=", "db", ".", "LogConn", "(", ")", "\n", "if", "err", "==", "nil", "{", "defer", "logConn", ".", "Close", "(", ")", "\n", "err", "=", "logConn", ".", "AppLogCollection", "(", "appName", ")", ".", "DropCollection", "(", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "conn", ",", "err", ":=", "db", ".", "Conn", "(", ")", "\n", "if", "err", "==", "nil", "{", "defer", "conn", ".", "Close", "(", ")", "\n", "err", "=", "conn", ".", "Apps", "(", ")", ".", "Remove", "(", "bson", ".", "M", "{", "\"", "\"", ":", "appName", "}", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "err", "=", "event", ".", "MarkAsRemoved", "(", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeApp", ",", "Value", ":", "appName", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logErr", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,954
all-24955
[ "MemberByName", "returns", "a", "Member", "with", "the", "given", "name", "if", "exists", ".", "If", "more", "than", "one", "member", "has", "the", "given", "name", "it", "will", "panic", "." ]
[ "func", "(", "c", "*", "RaftCluster", ")", "MemberByName", "(", "name", "string", ")", "*", "Member", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "var", "memb", "*", "Member", "\n", "for", "_", ",", "m", ":=", "range", "c", ".", "members", "{", "if", "m", ".", "Name", "==", "name", "{", "if", "memb", "!=", "nil", "{", "if", "c", ".", "lg", "!=", "nil", "{", "c", ".", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "<mask>", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "}", "\n", "memb", "=", "m", "\n", "}", "\n", "}", "\n", "return", "memb", ".", "Clone", "(", ")", "\n", "}" ]
24,955
all-24956
[ "releaseIPInIPAM", "releases", "the", "ip", "used", "by", "the", "task", "for", "awsvpc" ]
[ "func", "(", "mtask", "*", "managedTask", ")", "releaseIPInIPAM", "(", ")", "{", "if", "mtask", ".", "ENI", "==", "nil", "{", "return", "\n", "}", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "mtask", ".", "Arn", ")", "\n\n", "cfg", ",", "err", ":=", "mtask", ".", "BuildCNIConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "mtask", ".", "Arn", ",", "err", ")", "\n", "return", "\n", "}", "\n", "err", "=", "mtask", ".", "cniClient", ".", "ReleaseIPResource", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "mtask", ".", "Arn", ",", "<mask>", ")", "\n", "return", "\n", "}", "\n", "}" ]
24,956
all-24957
[ "updateTaskKnownStatus", "updates", "the", "given", "task", "s", "status", "based", "on", "its", "container", "s", "status", ".", "It", "updates", "to", "the", "minimum", "of", "all", "containers", "no", "matter", "what", "It", "returns", "a", "TaskStatus", "indicating", "what", "change", "occurred", "or", "TaskStatusNone", "if", "there", "was", "no", "change", "Invariant", ":", "task", "known", "status", "is", "the", "minimum", "of", "container", "known", "status" ]
[ "func", "(", "task", "*", "Task", ")", "updateTaskKnownStatus", "(", ")", "(", "newStatus", "apitaskstatus", ".", "TaskStatus", ")", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "String", "(", ")", ")", "\n", "// Set to a large 'impossible' status that can't be the min", "containerEarliestKnownStatus", ":=", "apicontainerstatus", ".", "ContainerZombie", "\n", "var", "earliestKnownStatusContainer", "*", "apicontainer", ".", "Container", "\n", "essentialContainerStopped", ":=", "false", "\n", "for", "_", ",", "container", ":=", "range", "<mask>", ".", "Containers", "{", "containerKnownStatus", ":=", "container", ".", "GetKnownStatus", "(", ")", "\n", "if", "containerKnownStatus", "==", "apicontainerstatus", ".", "ContainerStopped", "&&", "container", ".", "Essential", "{", "essentialContainerStopped", "=", "true", "\n", "}", "\n", "if", "containerKnownStatus", "<", "containerEarliestKnownStatus", "{", "containerEarliestKnownStatus", "=", "containerKnownStatus", "\n", "earliestKnownStatusContainer", "=", "container", "\n", "}", "\n", "}", "\n", "if", "earliestKnownStatusContainer", "==", "nil", "{", "seelog", ".", "Criticalf", "(", "\"", "\"", ",", "containerEarliestKnownStatus", ".", "String", "(", ")", ",", "task", ")", "\n", "return", "apitaskstatus", ".", "TaskStatusNone", "\n", "}", "\n", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "earliestKnownStatusContainer", ".", "String", "(", ")", ",", "task", ".", "String", "(", ")", ")", "\n", "// If the essential container is stopped while other containers may be running", "// don't update the task status until the other containers are stopped.", "if", "earliestKnownStatusContainer", ".", "IsKnownSteadyState", "(", ")", "&&", "essentialContainerStopped", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "task", ".", "String", "(", ")", ")", "\n", "return", "apitaskstatus", ".", "TaskStatusNone", "\n", "}", "\n", "// We can't rely on earliest container known status alone for determining if the", "// task state needs to be updated as containers can have different steady states", "// defined. Instead we should get the task status for all containers' known", "// statuses and compute the min of this", "earliestKnownTaskStatus", ":=", "task", ".", "getEarliestKnownTaskStatusForContainers", "(", ")", "\n", "if", "task", ".", "GetKnownStatus", "(", ")", "<", "earliestKnownTaskStatus", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "earliestKnownTaskStatus", ".", "String", "(", ")", ",", "task", ".", "String", "(", ")", ")", "\n", "task", ".", "SetKnownStatus", "(", "earliestKnownTaskStatus", ")", "\n", "return", "task", ".", "GetKnownStatus", "(", ")", "\n", "}", "\n", "return", "apitaskstatus", ".", "TaskStatusNone", "\n", "}" ]
24,957
all-24958
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "AddRuleReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss63", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
24,958
all-24959
[ "GetIP", "returns", "the", "ip" ]
[ "func", "(", "d", "*", "BaseDriver", ")", "GetIP", "(", ")", "(", "string", ",", "error", ")", "{", "if", "d", ".", "IPAddress", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "d", ".", "IPAddress", ",", "nil", "\n", "}" ]
24,959
all-24960
[ "GetTimings", "is", "a", "wrapper", "around", "gdk_frame_clock_get_timings", "()", "." ]
[ "func", "(", "v", "*", "FrameClock", ")", "GetTimings", "(", "frameCounter", "int64", ")", "(", "*", "FrameTimings", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gdk_frame_clock_get_timings", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint64", "(", "frameCounter", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapFrameTimings", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ",", "nil", "\n", "}" ]
24,960
all-24961
[ "NewContext", "returns", "a", "Context", "that", "can", "be", "used", "to", "make", "Thrift", "calls", "." ]
[ "func", "NewContext", "(", "timeout", "time", ".", "Duration", ")", "(", "Context", ",", "<mask>", ".", "CancelFunc", ")", "{", "ctx", ",", "cancel", ":=", "tchannel", ".", "NewContext", "(", "timeout", ")", "\n", "return", "Wrap", "(", "ctx", ")", ",", "cancel", "\n", "}" ]
24,961
all-24962
[ "MustDontHave", "retrieves", "the", "DontHave", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "StellarMessage", ")", "MustDontHave", "(", ")", "DontHave", "{", "val", ",", "ok", ":=", "u", ".", "GetDontHave", "(", ")", "\n\n", "if", "!", "<mask>", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
24,962
all-24963
[ "GetActivateOnSingleClick", "gtk_flow_box_get_activate_on_single_click", "()" ]
[ "func", "(", "fb", "*", "FlowBox", ")", "GetActivateOnSingleClick", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_flow_box_get_activate_on_single_click", "(", "fb", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
24,963
all-24964
[ "ListFile", "returns", "info", "about", "all", "files", "in", "a", "Commit", "under", "path", "." ]
[ "func", "(", "c", "APIClient", ")", "ListFile", "(", "repoName", "string", ",", "commitID", "string", ",", "<mask>", "string", ")", "(", "[", "]", "*", "pfs", ".", "FileInfo", ",", "error", ")", "{", "var", "result", "[", "]", "*", "pfs", ".", "FileInfo", "\n", "if", "err", ":=", "c", ".", "ListFileF", "(", "repoName", ",", "commitID", ",", "path", ",", "0", ",", "func", "(", "fi", "*", "pfs", ".", "FileInfo", ")", "error", "{", "result", "=", "append", "(", "result", ",", "fi", ")", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
24,964
all-24965
[ "Convert", "converts", "build", "metadata", "stored", "in", "gcp", "into", "the", "corresponding", "ResultStore", "Invocation", "Target", "and", "Test", "." ]
[ "func", "convert", "(", "project", ",", "details", "string", ",", "url", "gcs", ".", "Path", ",", "result", "downloadResult", ")", "(", "resultstore", ".", "Invocation", ",", "resultstore", ".", "Target", ",", "resultstore", ".", "Test", ")", "{", "started", ":=", "result", ".", "started", "\n", "finished", ":=", "result", ".", "finished", "\n", "artifacts", ":=", "<mask>", ".", "artifactURLs", "\n\n", "basePath", ":=", "trailingSlash", "(", "url", ".", "String", "(", ")", ")", "\n", "artifactsPath", ":=", "basePath", "+", "\"", "\"", "\n", "buildLog", ":=", "basePath", "+", "\"", "\"", "\n", "bucket", ":=", "url", ".", "Bucket", "(", ")", "\n", "inv", ":=", "resultstore", ".", "Invocation", "{", "Project", ":", "project", ",", "Details", ":", "details", ",", "Files", ":", "[", "]", "resultstore", ".", "File", "{", "{", "ID", ":", "resultstore", ".", "InvocationLog", ",", "ContentType", ":", "\"", "\"", ",", "URL", ":", "buildLog", ",", "// ensure build-log.txt appears as the invocation log", "}", ",", "}", ",", "}", "\n\n", "// Files need a unique identifier, trim the common prefix and provide this.", "uniqPath", ":=", "func", "(", "s", "string", ")", "string", "{", "return", "strings", ".", "TrimPrefix", "(", "s", ",", "basePath", ")", "}", "\n\n", "for", "i", ",", "a", ":=", "range", "artifacts", "{", "artifacts", "[", "i", "]", "=", "\"", "\"", "+", "bucket", "+", "\"", "\"", "+", "a", "\n", "}", "\n\n", "for", "_", ",", "a", ":=", "range", "artifacts", "{", "// add started.json, etc to the invocation artifact list.", "if", "strings", ".", "HasPrefix", "(", "a", ",", "artifactsPath", ")", "{", "continue", "// things under artifacts/ are owned by the test", "\n", "}", "\n", "if", "a", "==", "buildLog", "{", "continue", "// Handle this in InvocationLog", "\n", "}", "\n", "inv", ".", "Files", "=", "append", "(", "inv", ".", "Files", ",", "resultstore", ".", "File", "{", "ID", ":", "uniqPath", "(", "a", ")", ",", "ContentType", ":", "\"", "\"", ",", "URL", ":", "a", ",", "}", ")", "\n", "}", "\n", "if", "started", ".", "Timestamp", ">", "0", "{", "inv", ".", "Start", "=", "time", ".", "Unix", "(", "started", ".", "Timestamp", ",", "0", ")", "\n", "if", "finished", ".", "Timestamp", "!=", "nil", "{", "inv", ".", "Duration", "=", "time", ".", "Duration", "(", "*", "finished", ".", "Timestamp", "-", "started", ".", "Timestamp", ")", "*", "time", ".", "Second", "\n", "}", "\n", "}", "\n\n", "const", "day", "=", "24", "*", "60", "*", "60", "\n", "switch", "{", "case", "finished", ".", "Timestamp", "==", "nil", "&&", "started", ".", "Timestamp", "<", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", "+", "day", ":", "inv", ".", "Status", "=", "resultstore", ".", "Running", "\n", "inv", ".", "Description", "=", "\"", "\"", "\n", "case", "finished", ".", "Passed", "!=", "nil", "&&", "*", "finished", ".", "Passed", ":", "inv", ".", "Status", "=", "resultstore", ".", "Passed", "\n", "inv", ".", "Description", "=", "\"", "\"", "\n", "case", "finished", ".", "Timestamp", "==", "nil", ":", "inv", ".", "Status", "=", "resultstore", ".", "Failed", "\n", "inv", ".", "Description", "=", "\"", "\"", "\n", "default", ":", "inv", ".", "Status", "=", "resultstore", ".", "Failed", "\n", "inv", ".", "Description", "=", "\"", "\"", "\n", "}", "\n\n", "test", ":=", "resultstore", ".", "Test", "{", "Action", ":", "resultstore", ".", "Action", "{", "Node", ":", "started", ".", "Node", ",", "}", ",", "Suite", ":", "resultstore", ".", "Suite", "{", "Name", ":", "\"", "\"", ",", "Files", ":", "[", "]", "resultstore", ".", "File", "{", "{", "ID", ":", "resultstore", ".", "TargetLog", ",", "ContentType", ":", "\"", "\"", ",", "URL", ":", "buildLog", ",", "// ensure build-log.txt appears as the target log.", "}", ",", "}", ",", "}", ",", "}", "\n\n", "for", "_", ",", "suiteMeta", ":=", "range", "result", ".", "suiteMetas", "{", "child", ":=", "convertSuiteMeta", "(", "suiteMeta", ")", "\n", "test", ".", "Suite", ".", "Suites", "=", "append", "(", "test", ".", "Suite", ".", "Suites", ",", "child", ")", "\n", "test", ".", "Suite", ".", "Files", "=", "append", "(", "test", ".", "Suite", ".", "Files", ",", "child", ".", "Files", "...", ")", "\n", "}", "\n", "for", "_", ",", "a", ":=", "range", "artifacts", "{", "if", "!", "strings", ".", "HasPrefix", "(", "a", ",", "artifactsPath", ")", "{", "continue", "// Non-artifacts (started.json, etc) are owned by the invocation", "\n", "}", "\n", "if", "a", "==", "buildLog", "{", "continue", "// Already in the list.", "\n", "}", "\n", "// TODO(fejta): use set.Strings instead", "var", "found", "bool", "\n", "for", "_", ",", "sm", ":=", "range", "result", ".", "suiteMetas", "{", "if", "sm", ".", "Path", "==", "a", "{", "found", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "found", "{", "continue", "\n", "}", "\n", "test", ".", "Suite", ".", "Files", "=", "append", "(", "test", ".", "Suite", ".", "Files", ",", "resultstore", ".", "File", "{", "ID", ":", "uniqPath", "(", "a", ")", ",", "ContentType", ":", "\"", "\"", ",", "URL", ":", "a", ",", "}", ")", "\n", "}", "\n\n", "test", ".", "Suite", ".", "Start", "=", "inv", ".", "Start", "\n", "test", ".", "Action", ".", "Start", "=", "inv", ".", "Start", "\n", "test", ".", "Suite", ".", "Duration", "=", "inv", ".", "Duration", "\n", "test", ".", "Action", ".", "Duration", "=", "inv", ".", "Duration", "\n", "test", ".", "Status", "=", "inv", ".", "Status", "\n", "test", ".", "Description", "=", "inv", ".", "Description", "\n\n", "target", ":=", "resultstore", ".", "Target", "{", "Start", ":", "inv", ".", "Start", ",", "Duration", ":", "inv", ".", "Duration", ",", "Status", ":", "inv", ".", "Status", ",", "Description", ":", "inv", ".", "Description", ",", "}", "\n\n", "return", "inv", ",", "target", ",", "test", "\n", "}" ]
24,965
all-24966
[ "TokenMigrator", "is", "a", "middleware", "that", "detects", "access", "tokens", "passed", "via", "query", "parameters", "and", "migrates", "them", "to", "a", "Bearer", "Token", "header", ".", "Additionally", "it", "may", "remove", "the", "migrated", "query", "parameter", "from", "the", "request", ".", "Note", ":", "The", "TokenMigrator", "should", "be", "added", "before", "any", "logger", "in", "the", "middleware", "chain", "to", "successfully", "protect", "the", "access", "token", "from", "being", "exposed", "." ]
[ "func", "TokenMigrator", "(", "remove", "bool", ")", "func", "(", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// fetch access token", "accessToken", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n\n", "// handle access token if present", "if", "accessToken", "!=", "\"", "\"", "{", "// set token if not already set", "if", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "==", "\"", "\"", "{", "r", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", "+", "accessToken", ")", "\n", "}", "\n\n", "// remove parameter if requested", "if", "remove", "{", "q", ":=", "r", ".", "URL", ".", "Query", "(", ")", "\n", "q", ".", "Del", "(", "\"", "\"", ")", "\n", "r", ".", "URL", ".", "RawQuery", "=", "q", ".", "Encode", "(", ")", "\n", "}", "\n", "}", "\n\n", "// call next handler", "next", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n", "}", "\n", "}" ]
24,966
all-24967
[ "Text", "returns", "the", "most", "recents", "tokens", "generated", "by", "a", "call", "to", "Scan", "as", "a", "newly", "allocated", "string", "holding", "its", "bytes", "." ]
[ "func", "(", "s", "*", "Scanner", ")", "Text", "(", ")", "(", "key", ",", "<mask>", "string", ")", "{", "return", "string", "(", "s", ".", "key", ")", ",", "string", "(", "s", ".", "value", ")", "\n", "}" ]
24,967
all-24968
[ "ImageSourceGetCachedFingerprint", "tries", "to", "find", "a", "source", "entry", "of", "a", "locally", "cached", "image", "that", "matches", "the", "given", "remote", "details", "(", "server", "protocol", "and", "alias", ")", ".", "Return", "the", "fingerprint", "linked", "to", "the", "matching", "entry", "if", "any", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageSourceGetCachedFingerprint", "(", "server", "string", ",", "protocol", "string", ",", "alias", "string", ")", "(", "string", ",", "error", ")", "{", "protocolInt", ":=", "-", "1", "\n", "for", "protoInt", ",", "protoString", ":=", "range", "ImageSourceProtocol", "{", "if", "protoString", "==", "protocol", "{", "protocolInt", "=", "protoInt", "\n", "}", "\n", "}", "\n\n", "if", "protocolInt", "==", "-", "1", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "protocol", ")", "\n", "}", "\n\n", "q", ":=", "`SELECT images.fingerprint\n\t\t\tFROM images_source\n\t\t\tINNER JOIN images\n\t\t\tON images_source.image_id=images.id\n\t\t\tWHERE server=? AND protocol=? AND alias=? AND auto_update=1\n\t\t\tORDER BY creation_date DESC`", "\n\n", "fingerprint", ":=", "\"", "\"", "\n\n", "arg1", ":=", "[", "]", "interface", "{", "}", "{", "<mask>", ",", "protocolInt", ",", "alias", "}", "\n", "arg2", ":=", "[", "]", "interface", "{", "}", "{", "&", "fingerprint", "}", "\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "q", ",", "arg1", ",", "arg2", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "\"", "\"", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "fingerprint", ",", "nil", "\n", "}" ]
24,968
all-24969
[ "title", ":", "role", "info", "path", ":", "/", "roles", "/", "{", "name", "}", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized", "404", ":", "Role", "not", "found" ]
[ "func", "roleInfo", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "(", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdateAssign", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdateDissociate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleCreate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleDelete", ")", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "roleName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "role", ",", "err", ":=", "permission", ".", "FindRole", "(", "roleName", ")", "\n", "if", "err", "==", "permTypes", ".", "ErrRoleNotFound", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "role", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "<mask>", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", "\n", "return", "err", "\n", "}" ]
24,969
all-24970
[ "SquashRules", "copies", "information", "from", "src", "into", "dst", "without", "discarding", "information", "in", "dst", ".", "SquashRules", "detects", "duplicate", "elements", "in", "lists", "and", "dictionaries", "but", "it", "doesn", "t", "sort", "elements", "after", "squashing", ".", "If", "squashing", "fails", "because", "the", "expression", "is", "not", "understood", "an", "error", "is", "returned", "and", "neither", "rule", "is", "modified", "." ]
[ "func", "SquashRules", "(", "src", ",", "dst", "*", "Rule", ",", "filename", "string", ")", "error", "{", "if", "dst", ".", "ShouldKeep", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "for", "key", ",", "srcAttr", ":=", "range", "src", ".", "attrs", "{", "srcValue", ":=", "srcAttr", ".", "RHS", "\n", "if", "dstAttr", ",", "ok", ":=", "dst", ".", "attrs", "[", "key", "]", ";", "!", "ok", "{", "dst", ".", "SetAttr", "(", "key", ",", "srcValue", ")", "\n", "}", "else", "if", "!", "ShouldKeep", "(", "dstAttr", ")", "{", "dstValue", ":=", "dstAttr", ".", "RHS", "\n", "if", "squashedValue", ",", "err", ":=", "squashExprs", "(", "srcValue", ",", "dstValue", ")", ";", "err", "!=", "nil", "{", "start", ",", "end", ":=", "dstValue", ".", "Span", "(", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "filename", ",", "start", ".", "Line", ",", "start", ".", "LineRune", ",", "end", ".", "Line", ",", "end", ".", "LineRune", ")", "\n", "}", "else", "{", "dst", ".", "SetAttr", "(", "key", ",", "squashedValue", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "Before", "=", "append", "(", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "Before", ",", "src", ".", "expr", ".", "<mask>", "(", ")", ".", "Before", "...", ")", "\n", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "Suffix", "=", "append", "(", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "Suffix", ",", "src", ".", "expr", ".", "Comment", "(", ")", ".", "Suffix", "...", ")", "\n", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "After", "=", "append", "(", "dst", ".", "expr", ".", "Comment", "(", ")", ".", "After", ",", "src", ".", "expr", ".", "Comment", "(", ")", ".", "After", "...", ")", "\n", "return", "nil", "\n", "}" ]
24,970
all-24971
[ "resourceVSphereComputeClusterApplyDelete", "process", "the", "removal", "of", "a", "cluster", "." ]
[ "func", "resourceVSphereComputeClusterApplyDelete", "(", "d", "structure", ".", "ResourceIDStringer", ",", "cluster", "*", "<mask>", ".", "ClusterComputeResource", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ")", "\n", "if", "err", ":=", "clustercomputeresource", ".", "Delete", "(", "cluster", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,971
all-24972
[ "===", "min_over_time", "(", "Matrix", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcMinOverTime", "(", "vals", "[", "]", "<mask>", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "aggrOverTime", "(", "vals", ",", "enh", ",", "func", "(", "values", "[", "]", "Point", ")", "float64", "{", "min", ":=", "values", "[", "0", "]", ".", "V", "\n", "for", "_", ",", "v", ":=", "range", "values", "{", "if", "v", ".", "V", "<", "min", "||", "math", ".", "IsNaN", "(", "min", ")", "{", "min", "=", "v", ".", "V", "\n", "}", "\n", "}", "\n", "return", "min", "\n", "}", ")", "\n", "}" ]
24,972
all-24973
[ "SetIconSensitive", "()", "is", "a", "wrapper", "around", "gtk_entry_set_icon_sensitive", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetIconSensitive", "(", "iconPos", "EntryIconPosition", ",", "sensitive", "bool", ")", "{", "C", ".", "gtk_entry_set_icon_sensitive", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GtkEntryIconPosition", "(", "iconPos", ")", ",", "gbool", "(", "sensitive", ")", ")", "\n", "}" ]
24,973
all-24974
[ "OpenCluster", "creates", "a", "new", "Cluster", "object", "for", "interacting", "with", "the", "dqlite", "database", ".", "-", "name", ":", "Basename", "of", "the", "database", "file", "holding", "the", "data", ".", "Typically", "db", ".", "bin", ".", "-", "dialer", ":", "Function", "used", "to", "connect", "to", "the", "dqlite", "backend", "via", "gRPC", "SQL", ".", "-", "address", ":", "Network", "address", "of", "this", "node", "(", "or", "empty", "string", ")", ".", "-", "dir", ":", "Base", "LXD", "database", "directory", "(", "e", ".", "g", ".", "/", "var", "/", "lib", "/", "lxd", "/", "database", ")", "The", "address", "and", "api", "parameters", "will", "be", "used", "to", "determine", "if", "the", "cluster", "database", "matches", "our", "version", "and", "possibly", "trigger", "a", "schema", "update", ".", "If", "the", "schema", "update", "can", "t", "be", "performed", "right", "now", "because", "some", "nodes", "are", "still", "behind", "an", "Upgrading", "error", "is", "returned", "." ]
[ "func", "OpenCluster", "(", "name", "string", ",", "store", "dqlite", ".", "ServerStore", ",", "address", ",", "dir", "string", ",", "timeout", "time", ".", "Duration", ",", "options", "...", "dqlite", ".", "DriverOption", ")", "(", "*", "Cluster", ",", "error", ")", "{", "db", ",", "err", ":=", "cluster", ".", "Open", "(", "name", ",", "store", ",", "options", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Test that the cluster database is operational. We wait up to the", "// given timeout , in case there's no quorum of nodes online yet.", "timer", ":=", "time", ".", "After", "(", "timeout", ")", "\n", "for", "i", ":=", "0", ";", ";", "i", "++", "{", "// Log initial attempts at debug level, but use warn", "// level after the 5'th attempt (about 10 seconds).", "// After the 15'th attempt (about 30 seconds), log", "// only one attempt every 5.", "logPriority", ":=", "1", "// 0 is discard, 1 is Debug, 2 is Warn", "\n", "if", "i", ">", "5", "{", "logPriority", "=", "2", "\n", "if", "i", ">", "15", "&&", "!", "(", "(", "i", "%", "5", ")", "==", "0", ")", "{", "logPriority", "=", "0", "\n", "}", "\n", "}", "\n\n", "err", "=", "<mask>", ".", "Ping", "(", ")", "\n", "if", "err", "==", "nil", "{", "break", "\n", "}", "\n\n", "cause", ":=", "errors", ".", "Cause", "(", "err", ")", "\n", "if", "cause", "!=", "dqlite", ".", "ErrNoAvailableLeader", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "switch", "logPriority", "{", "case", "1", ":", "logger", ".", "Debugf", "(", "\"", "\"", ",", "i", ",", "err", ")", "\n", "case", "2", ":", "logger", ".", "Warnf", "(", "\"", "\"", ",", "i", ",", "err", ")", "\n", "}", "\n\n", "time", ".", "Sleep", "(", "2", "*", "time", ".", "Second", ")", "\n", "select", "{", "case", "<-", "timer", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "default", ":", "}", "\n", "}", "\n\n", "nodesVersionsMatch", ",", "err", ":=", "cluster", ".", "EnsureSchema", "(", "db", ",", "address", ",", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "db", ".", "SetMaxOpenConns", "(", "1", ")", "\n", "db", ".", "SetMaxIdleConns", "(", "1", ")", "\n\n", "if", "!", "nodesVersionsMatch", "{", "cluster", ":=", "&", "Cluster", "{", "db", ":", "db", ",", "stmts", ":", "map", "[", "int", "]", "*", "sql", ".", "Stmt", "{", "}", ",", "}", "\n\n", "return", "cluster", ",", "ErrSomeNodesAreBehind", "\n", "}", "\n\n", "stmts", ",", "err", ":=", "cluster", ".", "PrepareStmts", "(", "db", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "cluster", ":=", "&", "Cluster", "{", "db", ":", "db", ",", "stmts", ":", "stmts", ",", "}", "\n\n", "// Figure out the ID of this node.", "err", "=", "cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "nodes", ",", "err", ":=", "tx", ".", "Nodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "nodes", ")", "==", "1", "&&", "nodes", "[", "0", "]", ".", "Address", "==", "\"", "\"", "{", "// We're not clustered", "cluster", ".", "NodeID", "(", "1", ")", "\n", "return", "nil", "\n", "}", "\n", "for", "_", ",", "node", ":=", "range", "nodes", "{", "if", "node", ".", "Address", "==", "address", "{", "cluster", ".", "nodeID", "=", "node", ".", "ID", "\n", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "address", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "cluster", ",", "err", "\n", "}" ]
24,974
all-24975
[ "RetType", "returns", "the", "go", "return", "type", "of", "the", "method", "." ]
[ "func", "(", "m", "*", "Method", ")", "RetType", "(", ")", "string", "{", "if", "!", "m", ".", "HasReturn", "(", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "<mask>", ".", "goType", "(", "m", ".", "Method", ".", "ReturnType", ")", ",", "\"", "\"", ")", "\n", "}" ]
24,975
all-24976
[ "Write", "serializes", "the", "command", "to", "the", "given", "buffered", "output", "satisfies", "the", "Command", "interface", "." ]
[ "func", "(", "c", "Nop", ")", "Write", "(", "w", "*", "bufio", ".", "Writer", ")", "(", "err", "error", ")", "{", "if", "_", ",", "err", "=", "w", ".", "WriteString", "(", "\"", "\\n", "\"", ")", ";", "err", "!=", "nil", "{", "err", "=", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "return", "\n", "}" ]
24,976
all-24977
[ "ExeDirJoin", "composes", "a", "file", "name", "relative", "to", "a", "running", "executable", "." ]
[ "func", "ExeDirJoin", "(", "elem", "...", "string", ")", "string", "{", "exe", ",", "err", ":=", "<mask>", ".", "Executable", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "elem", "=", "append", "(", "[", "]", "string", "{", "filepath", ".", "Dir", "(", "exe", ")", "}", ",", "elem", "...", ")", "\n", "return", "filepath", ".", "Join", "(", "elem", "...", ")", "\n", "}" ]
24,977
all-24978
[ "append", "digits", "to", "string" ]
[ "func", "(", "g", "Garbler", ")", "addNums", "(", "p", "string", ",", "numDigits", "int", ")", "string", "{", "if", "numDigits", "<=", "0", "{", "return", "p", "\n", "}", "\n", "ret", ":=", "p", "\n", "remaining", ":=", "numDigits", "\n", "for", "remaining", ">", "10", "{", "ret", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pow", "(", "10", ",", "9", ")", "+", "randInt", "(", "pow", "(", "10", ",", "10", ")", "-", "pow", "(", "10", ",", "9", ")", ")", ")", "\n", "remaining", "-=", "10", "\n", "}", "\n", "ret", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pow", "(", "10", ",", "remaining", "-", "1", ")", "+", "randInt", "(", "pow", "(", "10", ",", "remaining", ")", "-", "pow", "(", "10", ",", "remaining", "-", "1", ")", ")", ")", "\n\n", "return", "<mask>", "\n", "}" ]
24,978
all-24979
[ "DecodeOAuth2Code", "inverse", "of", "EncodeOAuth2Code" ]
[ "func", "DecodeOAuth2Code", "(", "code", ",", "sharedKey", "string", ")", "(", "response", "<mask>", ",", "err", "error", ")", "{", "object", ",", "err", ":=", "jose", ".", "ParseSigned", "(", "code", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "output", ",", "err", ":=", "object", ".", "Verify", "(", "[", "]", "byte", "(", "sharedKey", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "base64Text", ":=", "make", "(", "[", "]", "byte", ",", "base64", ".", "StdEncoding", ".", "DecodedLen", "(", "len", "(", "output", ")", ")", ")", "\n", "l", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "Decode", "(", "base64Text", ",", "output", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "response", "=", "Response", "{", "}", "\n", "err", "=", "json", ".", "Unmarshal", "(", "base64Text", "[", ":", "l", "]", ",", "&", "response", ")", "\n", "return", "\n", "}" ]
24,979
all-24980
[ "Do", "executes", "Runtime", ".", "discardConsoleEntries", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "DiscardConsoleEntriesParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandDiscardConsoleEntries", ",", "nil", ",", "nil", ")", "\n", "}" ]
24,980
all-24981
[ "Handle", "registers", "a", "handler", "that", "will", "be", "called", "for", "every", "logging", "event", ".", "The", "function", "receives", "a", "message", "which", "is", "a", "structured", "representation", "of", "the", "log", "message", "text", ".", "This", "function", "is", "useful", "for", "registering", "handlers", "that", "send", "log", "information", "to", "external", "sources", "." ]
[ "func", "(", "w", "*", "Writer", ")", "Handle", "(", "h", "Handler", ")", "{", "w", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "if", "h", "!=", "nil", "{", "w", ".", "handlers", "=", "<mask>", "(", "w", ".", "handlers", ",", "h", ")", "\n", "}", "\n", "}" ]
24,981
all-24982
[ "Try", "converts", "a", "handler", "to", "a", "standard", "http", ".", "Handler", "storing", "any", "error", "in", "the", "request", "s", "context", "." ]
[ "func", "Try", "(", "h", "Handler", ")", "http", ".", "Handler", "{", "return", "<mask>", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "err", ":=", "h", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "Store", "(", "r", ",", "err", ")", "\n", "}", ")", "\n", "}" ]
24,982
all-24983
[ "GoStr", "takes", "a", "null", "-", "terminated", "string", "returned", "by", "OpenGL", "and", "constructs", "a", "corresponding", "Go", "string", "." ]
[ "func", "GoStr", "(", "cstr", "*", "uint8", ")", "string", "{", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", ")", "\n", "}" ]
24,983
all-24984
[ "paramsByLocation", "is", "a", "helper", "method", "that", "returns", "the", "names", "of", "the", "parameters", "at", "the", "given", "location", "(", "path", "query", "string", "or", "payload", ")", "." ]
[ "func", "(", "a", "*", "Action", ")", "paramsByLocation", "(", "loc", "Location", ")", "[", "]", "string", "{", "var", "res", "[", "]", "string", "\n", "for", "_", ",", "p", ":=", "range", "a", ".", "APIParams", "{", "if", "p", ".", "Location", "==", "loc", "{", "res", "=", "append", "(", "res", ",", "p", ".", "Name", ")", "\n", "}", "\n", "}", "\n", "sort", ".", "Strings", "(", "<mask>", ")", "\n", "return", "res", "\n", "}" ]
24,984
all-24985
[ "returns", "user", "-", "readable", "cause", "of", "failed", "comparison" ]
[ "func", "getCompareFailCause", "(", "n", "*", "node", ",", "which", "int", ",", "prevValue", "string", ",", "prevIndex", "uint64", ")", "string", "{", "<mask>", "which", "{", "case", "CompareIndexNotMatch", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prevIndex", ",", "n", ".", "ModifiedIndex", ")", "\n", "case", "CompareValueNotMatch", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prevValue", ",", "n", ".", "Value", ")", "\n", "default", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prevValue", ",", "n", ".", "Value", ",", "prevIndex", ",", "n", ".", "ModifiedIndex", ")", "\n", "}", "\n", "}" ]
24,985
all-24986
[ "/", "*", "from", "zfs", "diff", "s", "escape", "function", ":", "Prints", "a", "file", "name", "out", "a", "character", "at", "a", "time", ".", "If", "the", "character", "is", "not", "in", "the", "range", "of", "what", "we", "consider", "printable", "ASCII", "display", "it", "as", "an", "escaped", "3", "-", "digit", "octal", "value", ".", "ASCII", "values", "less", "than", "a", "space", "are", "all", "control", "characters", "and", "we", "declare", "the", "upper", "end", "as", "the", "DELete", "character", ".", "This", "also", "is", "the", "last", "7", "-", "bit", "ASCII", "character", ".", "We", "choose", "to", "treat", "all", "8", "-", "bit", "ASCII", "as", "not", "printable", "for", "this", "application", "." ]
[ "func", "unescapeFilepath", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "path", ")", ")", "\n", "llen", ":=", "len", "(", "path", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "llen", ";", "{", "if", "<mask>", "[", "i", "]", "==", "'\\\\'", "{", "if", "llen", "<", "i", "+", "4", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "octalCode", ":=", "path", "[", "(", "i", "+", "1", ")", ":", "(", "i", "+", "4", ")", "]", "\n", "val", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "octalCode", ",", "8", ",", "8", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "buf", "=", "append", "(", "buf", ",", "byte", "(", "val", ")", ")", "\n", "i", "+=", "4", "\n", "}", "else", "{", "buf", "=", "append", "(", "buf", ",", "path", "[", "i", "]", ")", "\n", "i", "++", "\n", "}", "\n", "}", "\n", "return", "string", "(", "buf", ")", ",", "nil", "\n", "}" ]
24,986
all-24987
[ "AppendEntries", "is", "used", "to", "pipeline", "a", "new", "append", "entries", "request", "." ]
[ "func", "(", "n", "*", "netPipeline", ")", "AppendEntries", "(", "args", "*", "AppendEntriesRequest", ",", "resp", "*", "AppendEntriesResponse", ")", "(", "AppendFuture", ",", "error", ")", "{", "// Create a new future", "future", ":=", "&", "appendFuture", "{", "start", ":", "time", ".", "Now", "(", ")", ",", "args", ":", "args", ",", "resp", ":", "resp", ",", "}", "\n", "future", ".", "init", "(", ")", "\n\n", "// Add a send timeout", "if", "timeout", ":=", "n", ".", "trans", ".", "timeout", ";", "timeout", ">", "0", "{", "n", ".", "<mask>", ".", "conn", ".", "SetWriteDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "timeout", ")", ")", "\n", "}", "\n\n", "// Send the RPC", "if", "err", ":=", "sendRPC", "(", "n", ".", "conn", ",", "rpcAppendEntries", ",", "future", ".", "args", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Hand-off for decoding, this can also cause back-pressure", "// to prevent too many inflight requests", "select", "{", "case", "n", ".", "inprogressCh", "<-", "future", ":", "return", "future", ",", "nil", "\n", "case", "<-", "n", ".", "shutdownCh", ":", "return", "nil", ",", "ErrPipelineShutdown", "\n", "}", "\n", "}" ]
24,987
all-24988
[ "Average", "accumulating", "counter", ".", "Expect", "adding", "and", "removing", "CountPoints", "." ]
[ "func", "newAverageAccumulatingCounter", "(", "<mask>", "Point", ")", "accumulatingCounter", "{", "return", "&", "averageAccumulatingCounter", "{", "newSingleValueAccumulatingCounter", "(", "point", ")", ".", "(", "*", "singleValueAccumulatingCounter", ")", ",", "point", ".", "(", "*", "CountPoint", ")", ".", "Count", ".", "(", "float64", ")", ",", "}", "\n", "}" ]
24,988
all-24989
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetDOMStorageItemsReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
24,989
all-24990
[ "SetEncoder", "can", "be", "used", "to", "set", "the", "implementation", "of", "a", "compression", "algorithm", ".", "The", "encoding", "should", "be", "a", "standardised", "identifier", ".", "See", ":", "https", ":", "//", "developer", ".", "mozilla", ".", "org", "/", "en", "-", "US", "/", "docs", "/", "Web", "/", "HTTP", "/", "Headers", "/", "Accept", "-", "Encoding", "For", "example", "add", "the", "Brotli", "algortithm", ":", "import", "brotli_enc", "gopkg", ".", "in", "/", "kothar", "/", "brotli", "-", "go", ".", "v0", "/", "enc", "middleware", ".", "SetEncoder", "(", "br", "func", "(", "w", "http", ".", "ResponseWriter", "level", "int", ")", "io", ".", "Writer", "{", "params", ":", "=", "brotli_enc", ".", "NewBrotliParams", "()", "params", ".", "SetQuality", "(", "level", ")", "return", "brotli_enc", ".", "NewBrotliWriter", "(", "params", "w", ")", "}", ")", "DEPRECATED" ]
[ "func", "SetEncoder", "(", "encoding", "<mask>", ",", "fn", "EncoderFunc", ")", "{", "if", "defaultCompressor", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "defaultCompressor", ".", "SetEncoder", "(", "encoding", ",", "fn", ")", "\n", "}" ]
24,990
all-24991
[ "UpdateRuleSet", "updates", "passed", "rule", "set", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateRuleSet", "(", "cfg", "*", "RuleSet", ")", "(", "*", "RuleSet", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "rulesetCID", ":=", "string", "(", "cfg", ".", "CID", ")", "\n\n", "<mask>", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "RuleSetCIDRegex", ",", "rulesetCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rulesetCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Put", "(", "rulesetCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ruleset", ":=", "&", "RuleSet", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "ruleset", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "ruleset", ",", "nil", "\n", "}" ]
24,991
all-24992
[ "FSSize", "gets", "the", "size", "of", "the", "hashtree" ]
[ "func", "(", "h", "*", "dbHashTree", ")", "FSSize", "(", ")", "int64", "{", "rootNode", ",", "err", ":=", "h", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", "0", "\n", "}", "\n", "return", "rootNode", ".", "SubtreeSize", "\n", "}" ]
24,992
all-24993
[ "ContainerConfigRemove", "removes", "the", "given", "key", "from", "the", "config", "of", "the", "container", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerConfigRemove", "(", "<mask>", "int", ",", "key", "string", ")", "error", "{", "err", ":=", "exec", "(", "c", ".", "db", ",", "\"", "\"", ",", "key", ",", "id", ")", "\n", "return", "err", "\n", "}" ]
24,993
all-24994
[ "/", "*" ]
[ "func", "(", "s", "*", "SkuM1Small", ")", "PollForTasks", "(", ")", "{", "if", "<mask>", ",", "err", ":=", "s", ".", "TaskManager", ".", "FindAndStallTaskForCaller", "(", "SkuName", ")", ";", "err", "==", "nil", "{", "fmt", ".", "Println", "(", "task", ")", "\n", "}", "\n", "return", "\n", "}" ]
24,994
all-24995
[ "forwardPeerFrame", "forwards", "a", "frame", "from", "a", "peer", "to", "the", "message", "exchange", "where", "it", "can", "be", "pulled", "by", "whatever", "application", "thread", "is", "handling", "the", "exchange" ]
[ "func", "(", "mex", "*", "messageExchange", ")", "forwardPeerFrame", "(", "frame", "*", "Frame", ")", "error", "{", "// We want a very specific priority here:", "// 1. Timeouts/cancellation (mex.ctx errors)", "// 2. Whether recvCh has buffer space (non-blocking select over mex.recvCh)", "// 3. Other mex errors (mex.errCh)", "// Which is why we check the context error only (instead of mex.checkError).", "// In the mex.errCh case, we do a non-blocking write to recvCh to prioritize it.", "if", "err", ":=", "mex", ".", "ctx", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "GetContextError", "(", "err", ")", "\n", "}", "\n\n", "<mask>", "{", "case", "mex", ".", "recvCh", "<-", "frame", ":", "return", "nil", "\n", "case", "<-", "mex", ".", "ctx", ".", "Done", "(", ")", ":", "// Note: One slow reader processing a large request could stall the connection.", "// If we see this, we need to increase the recvCh buffer size.", "return", "GetContextError", "(", "mex", ".", "ctx", ".", "Err", "(", ")", ")", "\n", "case", "<-", "mex", ".", "errCh", ".", "c", ":", "// Select will randomly choose a case, but we want to prioritize", "// sending a frame over the errCh. Try a non-blocking write.", "select", "{", "case", "mex", ".", "recvCh", "<-", "frame", ":", "return", "nil", "\n", "default", ":", "}", "\n", "return", "mex", ".", "errCh", ".", "err", "\n", "}", "\n", "}" ]
24,995
all-24996
[ "Stop", "all", "tasks", "in", "the", "group", ".", "This", "works", "by", "sending", "a", "cancellation", "signal", "to", "all", "tasks", "of", "the", "group", "and", "waiting", "for", "them", "to", "terminate", ".", "If", "a", "task", "is", "idle", "(", "i", ".", "e", ".", "not", "executing", "its", "task", "function", ")", "it", "will", "terminate", "immediately", ".", "If", "a", "task", "is", "busy", "executing", "its", "task", "function", "the", "cancellation", "signal", "will", "propagate", "through", "the", "context", "passed", "to", "it", "and", "the", "task", "will", "block", "waiting", "for", "the", "function", "to", "terminate", ".", "In", "case", "the", "given", "timeout", "expires", "before", "all", "tasks", "complete", "this", "method", "exits", "immediately", "and", "returns", "an", "error", "otherwise", "it", "returns", "nil", "." ]
[ "func", "(", "g", "*", "Group", ")", "Stop", "(", "timeout", "time", ".", "Duration", ")", "error", "{", "if", "g", ".", "cancel", "==", "nil", "{", "// We were not even started", "return", "nil", "\n", "}", "\n", "g", ".", "cancel", "(", ")", "\n\n", "graceful", ":=", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "g", ".", "wg", ".", "Wait", "(", ")", "\n", "close", "(", "graceful", ")", "\n", "}", "(", ")", "\n\n", "// Wait for graceful termination, but abort if the context expires.", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "timeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "running", ":=", "[", "]", "string", "{", "}", "\n", "for", "i", ",", "value", ":=", "range", "g", ".", "running", "{", "if", "value", "{", "running", "=", "append", "(", "running", ",", "strconv", ".", "Itoa", "(", "i", ")", ")", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "running", ",", "\"", "\"", ")", ")", "\n", "case", "<-", "graceful", ":", "return", "nil", "\n\n", "}", "\n", "}" ]
24,996
all-24997
[ "OnSignalGo", "calls", "the", "given", "ProcessFunc", "every", "time", "the", "signal", "fires", ".", "This", "is", "not", "rate", "limited", "multiple", "calls", "could", "be", "in", "-", "flight", "at", "the", "same", "time", ".", "sig", ":", "=", "make", "(", "chan", "struct", "{}", ")", "p", ":", "=", "periodicproc", ".", "OnSignalGo", "(", "sig", "func", "(", "proc", "goprocess", ".", "Process", ")", "{", "fmt", ".", "Println", "(", "fire!", ")", "<", "-", "time", ".", "After", "(", "time", ".", "Second", ")", "//", "wont", "block", "execution", "}", ")", "sig<", "-", "struct", "{}", "sig<", "-", "struct", "{}", "sig<", "-", "struct", "{}", "//", "Output", ":", "//", "fire!", "//", "fire!", "//", "fire!" ]
[ "func", "OnSignalGo", "(", "sig", "<-", "chan", "struct", "{", "}", ",", "procfunc", "gp", ".", "ProcessFunc", ")", "gp", ".", "Process", "{", "return", "gp", ".", "Go", "(", "func", "(", "proc", "gp", ".", "<mask>", ")", "{", "for", "{", "select", "{", "case", "<-", "sig", ":", "proc", ".", "Go", "(", "procfunc", ")", "\n", "case", "<-", "proc", ".", "Closing", "(", ")", ":", "// we're told to close", "return", "\n", "}", "\n", "}", "\n", "}", ")", "\n", "}" ]
24,997
all-24998
[ "Run", "makes", "a", "new", "cobra", "run", "function", "that", "wraps", "the", "given", "function", "." ]
[ "func", "Run", "(", "run", "func", "(", "args", "[", "]", "string", ")", "error", ")", "func", "(", "*", "cobra", ".", "Command", ",", "[", "]", "string", ")", "{", "return", "func", "(", "_", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "err", ":=", "run", "(", "args", ")", ";", "err", "!=", "nil", "{", "ErrorAndExit", "(", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
24,998
all-24999
[ "HasBytes", "returns", "true", "if", "the", "given", "key", "exists", "in", "Args", "." ]
[ "func", "(", "a", "*", "Args", ")", "HasBytes", "(", "<mask>", "[", "]", "byte", ")", "bool", "{", "return", "hasArg", "(", "a", ".", "args", ",", "b2s", "(", "key", ")", ")", "\n", "}" ]
24,999
all-25000
[ "GetData", "is", "a", "wrapper", "around", "gtk_selection_data_get_data_with_length", ".", "It", "returns", "a", "slice", "of", "the", "correct", "size", "with", "the", "selection", "s", "data", "." ]
[ "func", "(", "v", "*", "SelectionData", ")", "GetData", "(", ")", "(", "data", "[", "]", "byte", ")", "{", "<mask>", "length", "C", ".", "gint", "\n", "c", ":=", "C", ".", "gtk_selection_data_get_data_with_length", "(", "v", ".", "native", "(", ")", ",", "&", "length", ")", "\n", "sliceHeader", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "data", ")", ")", "\n", "sliceHeader", ".", "Data", "=", "uintptr", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "sliceHeader", ".", "Len", "=", "int", "(", "length", ")", "\n", "sliceHeader", ".", "Cap", "=", "int", "(", "length", ")", "\n", "return", "\n", "}" ]