id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
21,700
all-21701
[ "MustEncode", "is", "like", "Encode", "but", "panics", "on", "error" ]
[ "func", "MustEncode", "(", "<mask>", "VersionByte", ",", "src", "[", "]", "byte", ")", "string", "{", "e", ",", "err", ":=", "Encode", "(", "version", ",", "src", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "e", "\n", "}" ]
21,701
all-21702
[ "listEntriesType", "filters", "and", "prints", "entries", "based", "on", "the", "entry", "-", "type", "flag" ]
[ "func", "listEntriesType", "(", "entrytype", "string", ",", "streamdecoder", "string", ",", "ents", "[", "]", "raftpb", ".", "Entry", ")", "{", "entryFilters", ":=", "evaluateEntrytypeFlag", "(", "entrytype", ")", "\n", "printerMap", ":=", "map", "[", "string", "]", "EntryPrinter", "{", "\"", "\"", ":", "printInternalRaftRequest", ",", "\"", "\"", ":", "printRequest", ",", "\"", "\"", ":", "printConfChange", ",", "\"", "\"", ":", "printUnknownNormal", "}", "\n", "var", "stderr", "bytes", ".", "Buffer", "\n", "args", ":=", "strings", ".", "Split", "(", "streamdecoder", ",", "\"", "\"", ")", "\n", "cmd", ":=", "exec", ".", "Command", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "...", ")", "\n", "stdin", ",", "err", ":=", "cmd", ".", "StdinPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Panic", "(", "err", ")", "\n", "}", "\n", "stdout", ",", "err", ":=", "cmd", ".", "StdoutPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Panic", "(", "err", ")", "\n", "}", "\n", "cmd", ".", "Stderr", "=", "&", "stderr", "\n", "if", "streamdecoder", "!=", "\"", "\"", "{", "err", "=", "cmd", ".", "Start", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Panic", "(", "err", ")", "\n", "}", "\n", "}", "\n\n", "cnt", ":=", "0", "\n\n", "for", "_", ",", "e", ":=", "range", "ents", "{", "passed", ":=", "false", "\n", "currtype", ":=", "\"", "\"", "\n", "for", "_", ",", "filter", ":=", "range", "entryFilters", "{", "passed", ",", "currtype", "=", "filter", "(", "e", ")", "\n", "if", "passed", "{", "cnt", "++", "\n", "<mask>", "\n", "}", "\n", "}", "\n", "if", "passed", "{", "printer", ":=", "printerMap", "[", "currtype", "]", "\n", "printer", "(", "e", ")", "\n", "if", "streamdecoder", "==", "\"", "\"", "{", "fmt", ".", "Println", "(", ")", "\n", "continue", "\n", "}", "\n\n", "// if decoder is set, pass the e.Data to stdin and read the stdout from decoder", "io", ".", "WriteString", "(", "stdin", ",", "hex", ".", "EncodeToString", "(", "e", ".", "Data", ")", ")", "\n", "io", ".", "WriteString", "(", "stdin", ",", "\"", "\\n", "\"", ")", "\n", "outputReader", ":=", "bufio", ".", "NewReader", "(", "stdout", ")", "\n", "decoderoutput", ",", "currerr", ":=", "outputReader", ".", "ReadString", "(", "'\\n'", ")", "\n", "if", "currerr", "!=", "nil", "{", "fmt", ".", "Println", "(", "currerr", ")", "\n", "return", "\n", "}", "\n\n", "decoder_status", ",", "decoded_data", ":=", "parseDecoderOutput", "(", "decoderoutput", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\t", "\\t", "\"", ",", "decoder_status", ",", "decoded_data", ")", "\n", "}", "\n", "}", "\n\n", "stdin", ".", "Close", "(", ")", "\n", "err", "=", "cmd", ".", "Wait", "(", ")", "\n", "if", "streamdecoder", "!=", "\"", "\"", "{", "if", "err", "!=", "nil", "{", "log", ".", "Panic", "(", "err", ")", "\n", "}", "\n", "if", "stderr", ".", "String", "(", ")", "!=", "\"", "\"", "{", "os", ".", "Stderr", ".", "WriteString", "(", "\"", "\"", "+", "stderr", ".", "String", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "entrytype", ",", "cnt", ")", "\n", "}" ]
21,702
all-21703
[ "Find", "finds", "nodes", "based", "on", "the", "pathexpr", ".", "PathExpr" ]
[ "func", "Find", "(", "x", "tree", ".", "Node", ",", "p", "pathexpr", ".", "PathExpr", ")", "[", "]", "tree", ".", "Node", "{", "ret", ":=", "[", "]", "tree", ".", "Node", "{", "}", "\n\n", "if", "p", ".", "Axis", "==", "\"", "\"", "{", "findChild", "(", "x", ",", "&", "p", ",", "&", "ret", ")", "\n", "return", "ret", "\n", "}", "\n\n", "f", ":=", "findMap", "[", "p", ".", "Axis", "]", "\n", "f", "(", "x", ",", "&", "p", ",", "&", "<mask>", ")", "\n\n", "return", "ret", "\n", "}" ]
21,703
all-21704
[ "AddTaskIPAddress", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "AddTaskIPAddress", "(", "arg0", ",", "arg1", "<mask>", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
21,704
all-21705
[ "CheckApplies", "returns", "true", "if", "the", "certificate", "contains", "any", "names", "that", "end", "in", "one", "of", "the", "two", "designated", "zones", "for", "reverse", "DNS", ":", "in", "-", "addr", ".", "arpa", "or", "ip6", ".", "arpa", "." ]
[ "func", "(", "l", "*", "arpaReservedIP", ")", "CheckApplies", "(", "c", "*", "x509", ".", "Certificate", ")", "bool", "{", "names", ":=", "append", "(", "[", "]", "string", "{", "c", ".", "Subject", ".", "CommonName", "}", ",", "c", ".", "DNSNames", "...", ")", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "<mask>", "=", "strings", ".", "ToLower", "(", "name", ")", "\n", "if", "strings", ".", "HasSuffix", "(", "name", ",", "rdnsIPv4Suffix", ")", "||", "strings", ".", "HasSuffix", "(", "name", ",", "rdnsIPv6Suffix", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
21,705
all-21706
[ "insertLink", "attempts", "to", "set", "metadata", ".", "links", ".", "resultstore", ".", "url", "to", "viewURL", ".", "returns", "true", "if", "started", "metadata", "was", "updated", "." ]
[ "func", "insertLink", "(", "started", "*", "gcs", ".", "Started", ",", "viewURL", "string", ")", "(", "bool", ",", "error", ")", "{", "if", "started", ".", "Metadata", "==", "nil", "{", "started", ".", "Metadata", "=", "metadata", ".", "Metadata", "{", "}", "\n", "}", "\n", "meta", ":=", "started", ".", "Metadata", "\n", "var", "changed", "bool", "\n", "top", ",", "present", ":=", "meta", ".", "String", "(", "resultstoreKey", ")", "\n", "if", "!", "present", "||", "top", "==", "nil", "||", "*", "top", "!=", "viewURL", "{", "changed", "=", "true", "\n", "meta", "[", "resultstoreKey", "]", "=", "viewURL", "\n", "}", "\n", "links", ",", "present", ":=", "meta", ".", "Meta", "(", "linksKey", ")", "\n", "if", "present", "&&", "links", "==", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "meta", "[", "linksKey", "]", ")", "\n", "}", "\n", "if", "links", "==", "nil", "{", "links", "=", "&", "metadata", ".", "Metadata", "{", "}", "\n", "changed", "=", "true", "\n", "}", "\n", "resultstoreMeta", ",", "present", ":=", "links", ".", "Meta", "(", "resultstoreKey", ")", "\n", "if", "present", "&&", "resultstoreMeta", "==", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "(", "*", "links", ")", "[", "resultstoreKey", "]", ")", "\n", "}", "\n", "if", "resultstoreMeta", "==", "nil", "{", "resultstoreMeta", "=", "&", "metadata", ".", "Metadata", "{", "}", "\n", "changed", "=", "true", "\n", "}", "\n", "val", ",", "present", ":=", "resultstoreMeta", ".", "String", "(", "urlKey", ")", "\n", "if", "present", "&&", "val", "==", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "(", "*", "resultstoreMeta", ")", "[", "urlKey", "]", ")", "\n", "}", "\n", "if", "!", "<mask>", "&&", "val", "!=", "nil", "&&", "*", "val", "==", "viewURL", "{", "return", "false", ",", "nil", "\n", "}", "\n\n", "(", "*", "resultstoreMeta", ")", "[", "urlKey", "]", "=", "viewURL", "\n", "(", "*", "links", ")", "[", "resultstoreKey", "]", "=", "*", "resultstoreMeta", "\n", "meta", "[", "linksKey", "]", "=", "*", "links", "\n", "return", "true", ",", "nil", "\n", "}" ]
21,706
all-21707
[ "NewMetricsHandler", "returns", "a", "healthcheck", "Handler", "that", "also", "exposes", "metrics", "into", "the", "provided", "Prometheus", "registry", "." ]
[ "func", "NewMetricsHandler", "(", "registry", "prometheus", ".", "Registerer", ",", "namespace", "string", ")", "<mask>", "{", "return", "&", "metricsHandler", "{", "handler", ":", "NewHandler", "(", ")", ",", "registry", ":", "registry", ",", "namespace", ":", "namespace", ",", "}", "\n", "}" ]
21,707
all-21708
[ "AllImageStates", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "AllImageStates", "(", ")", "[", "]", "*", "image", ".", "ImageState", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "*", "<mask>", ".", "ImageState", ")", "\n", "return", "ret0", "\n", "}" ]
21,708
all-21709
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkRecentManager", "." ]
[ "func", "(", "v", "*", "RecentManager", ")", "native", "(", ")", "*", "C", ".", "GtkRecentManager", "{", "if", "v", "==", "nil", "||", "v", ".", "<mask>", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkRecentManager", "(", "p", ")", "\n", "}" ]
21,709
all-21710
[ "ClientAfterChannelTopUp", "updates", "deposit", "of", "a", "channel", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientAfterChannelTopUp", "(", "job", "*", "data", ".", "<mask>", ")", "error", "{", "return", "w", ".", "afterChannelTopUp", "(", "job", ",", "data", ".", "JobClientAfterChannelTopUp", ")", "\n", "}" ]
21,710
all-21711
[ "----------------------------------------", "Signed" ]
[ "func", "DecodeInt8", "(", "bz", "[", "]", "byte", ")", "(", "i", "int8", ",", "n", "int", ",", "err", "error", ")", "{", "var", "i64", "=", "int64", "(", "0", ")", "\n", "i64", ",", "n", ",", "err", "=", "DecodeVarint", "(", "bz", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "i64", "<", "int64", "(", "math", ".", "MinInt8", ")", "||", "i64", ">", "int64", "(", "math", ".", "MaxInt8", ")", "{", "err", "=", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "i", "=", "int8", "(", "i64", ")", "\n", "return", "\n", "}" ]
21,711
all-21712
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "DNSEndpoint", "." ]
[ "func", "(", "in", "*", "DNSEndpoint", ")", "DeepCopy", "(", ")", "*", "DNSEndpoint", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "DNSEndpoint", ")", "\n", "in", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
21,712
all-21713
[ "shrinkEntriesArray", "discards", "the", "underlying", "array", "used", "by", "the", "entries", "slice", "if", "most", "of", "it", "isn", "t", "being", "used", ".", "This", "avoids", "holding", "references", "to", "a", "bunch", "of", "potentially", "large", "entries", "that", "aren", "t", "needed", "anymore", ".", "Simply", "clearing", "the", "entries", "wouldn", "t", "be", "safe", "because", "clients", "might", "still", "be", "using", "them", "." ]
[ "func", "(", "u", "*", "unstable", ")", "shrinkEntriesArray", "(", ")", "{", "// We replace the array if we're using less than half of the space in", "// it. This number is fairly arbitrary, chosen as an attempt to balance", "// memory usage vs number of allocations. It could probably be improved", "// with some focused tuning.", "const", "lenMultiple", "=", "2", "\n", "if", "len", "(", "u", ".", "entries", ")", "==", "0", "{", "u", ".", "entries", "=", "nil", "\n", "}", "else", "if", "len", "(", "u", ".", "entries", ")", "*", "lenMultiple", "<", "cap", "(", "u", ".", "entries", ")", "{", "newEntries", ":=", "make", "(", "[", "]", "pb", ".", "<mask>", ",", "len", "(", "u", ".", "entries", ")", ")", "\n", "copy", "(", "newEntries", ",", "u", ".", "entries", ")", "\n", "u", ".", "entries", "=", "newEntries", "\n", "}", "\n", "}" ]
21,713
all-21714
[ "Seek", "brings", "us", "to", "element", ">", "=", "key", "if", "reversed", "is", "false", ".", "Otherwise", "<", "=", "key", "." ]
[ "func", "(", "s", "*", "ConcatIterator", ")", "Seek", "(", "key", "[", "]", "byte", ")", "{", "var", "idx", "int", "\n", "if", "!", "s", ".", "reversed", "{", "idx", "=", "<mask>", ".", "Search", "(", "len", "(", "s", ".", "tables", ")", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "y", ".", "CompareKeys", "(", "s", ".", "tables", "[", "i", "]", ".", "Biggest", "(", ")", ",", "key", ")", ">=", "0", "\n", "}", ")", "\n", "}", "else", "{", "n", ":=", "len", "(", "s", ".", "tables", ")", "\n", "idx", "=", "n", "-", "1", "-", "sort", ".", "Search", "(", "n", ",", "func", "(", "i", "int", ")", "bool", "{", "return", "y", ".", "CompareKeys", "(", "s", ".", "tables", "[", "n", "-", "1", "-", "i", "]", ".", "Smallest", "(", ")", ",", "key", ")", "<=", "0", "\n", "}", ")", "\n", "}", "\n", "if", "idx", ">=", "len", "(", "s", ".", "tables", ")", "||", "idx", "<", "0", "{", "s", ".", "setIdx", "(", "-", "1", ")", "\n", "return", "\n", "}", "\n", "// For reversed=false, we know s.tables[i-1].Biggest() < key. Thus, the", "// previous table cannot possibly contain key.", "s", ".", "setIdx", "(", "idx", ")", "\n", "s", ".", "cur", ".", "Seek", "(", "key", ")", "\n", "}" ]
21,714
all-21715
[ "KeepAlive", "signals", "that", "the", "connection", "is", "still", "in", "use", ".", "It", "may", "be", "called", "to", "prevent", "the", "socket", "being", "closed", "due", "to", "inactivity", "." ]
[ "func", "(", "cn", "*", "Conn", ")", "KeepAlive", "(", ")", "error", "{", "req", ":=", "&", "pb", ".", "GetSocketNameRequest", "{", "SocketDescriptor", ":", "&", "cn", ".", "desc", ",", "}", "\n", "res", ":=", "&", "<mask>", ".", "GetSocketNameReply", "{", "}", "\n", "return", "internal", ".", "Call", "(", "cn", ".", "ctx", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "}" ]
21,715
all-21716
[ "Source", "returns", "the", "backing", "file", "and", "offset", "for", "the", "mapping", "or", "0", "if", "none", "." ]
[ "func", "(", "m", "*", "Mapping", ")", "Source", "(", ")", "(", "string", ",", "int64", ")", "{", "if", "m", ".", "f", "==", "nil", "{", "return", "\"", "\"", ",", "0", "\n", "}", "\n", "return", "m", ".", "f", ".", "<mask>", "(", ")", ",", "m", ".", "off", "\n", "}" ]
21,716
all-21717
[ "setVPCSubnet", "sets", "the", "vpc", "and", "subnet", "ids", "for", "the", "agent", "by", "querying", "the", "instance", "metadata", "service" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "setVPCSubnet", "(", ")", "(", "error", ",", "bool", ")", "{", "mac", ",", "err", ":=", "agent", ".", "ec2MetadataClient", ".", "PrimaryENIMAC", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ",", "<mask>", "\n", "}", "\n\n", "vpcID", ",", "err", ":=", "agent", ".", "ec2MetadataClient", ".", "VPCID", "(", "mac", ")", "\n", "if", "err", "!=", "nil", "{", "if", "isInstanceLaunchedInVPC", "(", "err", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ",", "true", "\n", "}", "\n", "return", "instanceNotLaunchedInVPCError", ",", "false", "\n", "}", "\n\n", "subnetID", ",", "err", ":=", "agent", ".", "ec2MetadataClient", ".", "SubnetID", "(", "mac", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ",", "false", "\n", "}", "\n", "agent", ".", "vpc", "=", "vpcID", "\n", "agent", ".", "subnet", "=", "subnetID", "\n", "agent", ".", "mac", "=", "mac", "\n", "return", "nil", ",", "false", "\n", "}" ]
21,717
all-21718
[ "HandlerDisconnect", "is", "a", "wrapper", "around", "g_signal_handler_disconnect", "()", "." ]
[ "func", "(", "v", "*", "Object", ")", "HandlerDisconnect", "(", "handle", "SignalHandle", ")", "{", "C", ".", "g_signal_handler_disconnect", "(", "C", ".", "gpointer", "(", "v", ".", "GObject", ")", ",", "C", ".", "gulong", "(", "handle", ")", ")", "\n", "C", ".", "g_closure_invalidate", "(", "signals", "[", "<mask>", "]", ")", "\n", "delete", "(", "closures", ".", "m", ",", "signals", "[", "handle", "]", ")", "\n", "delete", "(", "signals", ",", "handle", ")", "\n", "}" ]
21,718
all-21719
[ "Finalize", "ensures", "there", "no", "nil", "pointers", "." ]
[ "func", "(", "c", "*", "WaitConfig", ")", "Finalize", "(", ")", "{", "if", "c", ".", "Enabled", "==", "nil", "{", "c", ".", "Enabled", "=", "Bool", "(", "TimeDurationPresent", "(", "c", ".", "Min", ")", ")", "\n", "}", "\n\n", "if", "c", ".", "Min", "==", "nil", "{", "c", ".", "Min", "=", "TimeDuration", "(", "0", "*", "<mask>", ".", "Second", ")", "\n", "}", "\n\n", "if", "c", ".", "Max", "==", "nil", "{", "c", ".", "Max", "=", "TimeDuration", "(", "4", "*", "*", "c", ".", "Min", ")", "\n", "}", "\n", "}" ]
21,719
all-21720
[ "InsertText", "is", "a", "wrapper", "around", "gtk_editable_insert_text", "()", ".", "The", "returned", "int", "is", "the", "position", "after", "the", "inserted", "text", "." ]
[ "func", "(", "v", "*", "Editable", ")", "InsertText", "(", "newText", "string", ",", "position", "int", ")", "int", "{", "cstr", ":=", "C", ".", "CString", "(", "newText", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "pos", ":=", "new", "(", "C", ".", "gint", ")", "\n", "*", "pos", "=", "C", ".", "gint", "(", "position", ")", "\n", "C", ".", "gtk_editable_insert_text", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gint", "(", "len", "(", "newText", ")", ")", ",", "pos", ")", "\n", "return", "int", "(", "*", "pos", ")", "\n", "}" ]
21,720
all-21721
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "PseudoType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "PseudoType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "PseudoTypeFirstLine", ":", "*", "t", "=", "PseudoTypeFirstLine", "\n", "case", "PseudoTypeFirstLetter", ":", "*", "t", "=", "PseudoTypeFirstLetter", "\n", "case", "PseudoTypeBefore", ":", "*", "t", "=", "PseudoTypeBefore", "\n", "case", "PseudoTypeAfter", ":", "*", "t", "=", "PseudoTypeAfter", "\n", "case", "PseudoTypeBackdrop", ":", "*", "t", "=", "PseudoTypeBackdrop", "\n", "case", "PseudoTypeSelection", ":", "*", "t", "=", "PseudoTypeSelection", "\n", "case", "PseudoTypeFirstLineInherited", ":", "*", "t", "=", "PseudoTypeFirstLineInherited", "\n", "case", "PseudoTypeScrollbar", ":", "*", "t", "=", "PseudoTypeScrollbar", "\n", "case", "PseudoTypeScrollbarThumb", ":", "*", "t", "=", "PseudoTypeScrollbarThumb", "\n", "<mask>", "PseudoTypeScrollbarButton", ":", "*", "t", "=", "PseudoTypeScrollbarButton", "\n", "case", "PseudoTypeScrollbarTrack", ":", "*", "t", "=", "PseudoTypeScrollbarTrack", "\n", "case", "PseudoTypeScrollbarTrackPiece", ":", "*", "t", "=", "PseudoTypeScrollbarTrackPiece", "\n", "case", "PseudoTypeScrollbarCorner", ":", "*", "t", "=", "PseudoTypeScrollbarCorner", "\n", "case", "PseudoTypeResizer", ":", "*", "t", "=", "PseudoTypeResizer", "\n", "case", "PseudoTypeInputListButton", ":", "*", "t", "=", "PseudoTypeInputListButton", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
21,721
all-21722
[ "Reader", "implements", "the", "corresponding", "method", "in", "the", "Client", "interface" ]
[ "func", "(", "o", "*", "tracingObjClient", ")", "Reader", "(", "ctx", "context", ".", "<mask>", ",", "name", "string", ",", "offset", "uint64", ",", "size", "uint64", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "span", ",", "ctx", ":=", "tracing", ".", "AddSpanToAnyExisting", "(", "ctx", ",", "o", ".", "provider", "+", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "offset", ")", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "size", ")", ")", "\n", "defer", "tracing", ".", "FinishAnySpan", "(", "span", ")", "\n", "return", "o", ".", "Client", ".", "Reader", "(", "ctx", ",", "name", ",", "offset", ",", "size", ")", "\n", "}" ]
21,722
all-21723
[ "Claimer", "is", "responsible", "for", "transforming", "a", "standard", "claims", "object", "into", "a", "custom", "one", "." ]
[ "func", "Claimer", "(", "c", "func", "(", "claims", "*", "jwt", ".", "StandardClaims", ")", "jwt", ".", "Claims", ")", "TokenOpt", "{", "return", "TokenOpt", "{", "func", "(", "o", "*", "<mask>", ")", "{", "o", ".", "claimer", "=", "c", "\n", "}", "}", "\n", "}" ]
21,723
all-21724
[ "BodyWriteTo", "writes", "response", "body", "to", "w", "." ]
[ "func", "(", "resp", "*", "Response", ")", "BodyWriteTo", "(", "w", "<mask>", ".", "Writer", ")", "error", "{", "if", "resp", ".", "bodyStream", "!=", "nil", "{", "_", ",", "err", ":=", "copyZeroAlloc", "(", "w", ",", "resp", ".", "bodyStream", ")", "\n", "resp", ".", "closeBodyStream", "(", ")", "\n", "return", "err", "\n", "}", "\n", "_", ",", "err", ":=", "w", ".", "Write", "(", "resp", ".", "bodyBytes", "(", ")", ")", "\n", "return", "err", "\n", "}" ]
21,724
all-21725
[ "UpdateIntegrationSlack", "updates", "the", "Slack", "Integration", ".", "This", "will", "replace", "the", "existing", "values", "with", "the", "new", "values", "." ]
[ "func", "(", "<mask>", "*", "Client", ")", "UpdateIntegrationSlack", "(", "slackIntegration", "*", "IntegrationSlackRequest", ")", "error", "{", "return", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "slackIntegration", ",", "nil", ")", "\n", "}" ]
21,725
all-21726
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform1fv", "(", "location", "int32", ",", "<mask>", "int32", ",", "value", "*", "float32", ")", "{", "C", ".", "glowUniform1fv", "(", "gpUniform1fv", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
21,726
all-21727
[ "updateEmbeddedDockerReference", "handles", "the", "Docker", "reference", "embedded", "in", "Docker", "schema1", "manifests", "." ]
[ "func", "(", "ic", "*", "imageCopier", ")", "updateEmbeddedDockerReference", "(", ")", "error", "{", "if", "ic", ".", "c", ".", "dest", ".", "IgnoresEmbeddedDockerReference", "(", ")", "{", "return", "nil", "// Destination would prefer us not to update the embedded reference.", "\n", "}", "\n", "destRef", ":=", "ic", ".", "c", ".", "dest", ".", "Reference", "(", ")", ".", "DockerReference", "(", ")", "\n", "if", "destRef", "==", "nil", "{", "return", "nil", "// Destination does not care about Docker references", "\n", "}", "\n", "if", "!", "ic", ".", "src", ".", "EmbeddedDockerReferenceConflicts", "(", "destRef", ")", "{", "return", "nil", "// No reference embedded in the manifest, or it matches destRef already.", "\n", "}", "\n\n", "if", "!", "<mask>", ".", "canModifyManifest", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "transports", ".", "ImageName", "(", "ic", ".", "c", ".", "dest", ".", "Reference", "(", ")", ")", ",", "destRef", ".", "String", "(", ")", ")", "\n", "}", "\n", "ic", ".", "manifestUpdates", ".", "EmbeddedDockerReference", "=", "destRef", "\n", "return", "nil", "\n", "}" ]
21,727
all-21728
[ "CreateProwJob", "creates", "a", "prowjob", "in", "the", "client", "s", "specified", "namespace", ".", "Analogous", "to", "kubectl", "create", "prowjob", "--", "namespace", "=", "client", ".", "namespace" ]
[ "func", "(", "c", "*", "Client", ")", "CreateProwJob", "(", "j", "prowapi", ".", "ProwJob", ")", "(", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "var", "representation", "string", "\n", "if", "out", ",", "err", ":=", "json", ".", "Marshal", "(", "j", ")", ";", "err", "==", "nil", "{", "representation", "=", "string", "(", "out", "[", ":", "]", ")", "\n", "}", "else", "{", "representation", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "j", ")", "\n", "}", "\n", "c", ".", "log", "(", "\"", "\"", ",", "representation", ")", "\n", "var", "retJob", "prowapi", ".", "ProwJob", "\n", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "<mask>", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "namespace", ")", ",", "requestBody", ":", "&", "j", ",", "}", ",", "&", "retJob", ")", "\n", "return", "retJob", ",", "err", "\n", "}" ]
21,728
all-21729
[ "return", "a", "binary", "representation", "of", "a", "program", "object", "s", "compiled", "and", "linked", "executable", "source" ]
[ "func", "GetProgramBinary", "(", "program", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "binaryFormat", "*", "uint32", ",", "<mask>", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetProgramBinary", ",", "5", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "bufSize", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "binaryFormat", ")", ")", ",", "uintptr", "(", "binary", ")", ",", "0", ")", "\n", "}" ]
21,729
all-21730
[ "Name", "sets", "name", "of", "route", "." ]
[ "func", "(", "r", "*", "Route", ")", "Name", "(", "name", "string", ")", "{", "if", "len", "(", "name", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "else", "if", "r", ".", "router", ".", "namedRoutes", "[", "<mask>", "]", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "name", ")", "\n", "}", "\n", "r", ".", "router", ".", "namedRoutes", "[", "name", "]", "=", "r", ".", "leaf", "\n", "}" ]
21,730
all-21731
[ "StringMD5Hex", "returns", "the", "hex", "encoded", "MD5", "hash", "of", "data" ]
[ "func", "StringMD5Hex", "(", "data", "string", ")", "string", "{", "hash", ":=", "md5", ".", "New", "(", ")", "\n", "<mask>", ".", "Write", "(", "[", "]", "byte", "(", "data", ")", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hash", ".", "Sum", "(", "nil", ")", ")", "\n", "}" ]
21,731
all-21732
[ "createSession", "is", "used", "to", "create", "and", "maintain", "a", "session", "to", "Consul" ]
[ "func", "(", "d", "*", "DedupManager", ")", "createSession", "(", "client", "*", "consulapi", ".", "Client", ")", "{", "START", ":", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "session", ":=", "client", ".", "Session", "(", ")", "\n", "sessionCh", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "ttl", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "float64", "(", "*", "d", ".", "config", ".", "TTL", ")", "/", "float64", "(", "time", ".", "Second", ")", ")", "\n", "se", ":=", "&", "consulapi", ".", "SessionEntry", "{", "Name", ":", "\"", "\"", ",", "Behavior", ":", "\"", "\"", ",", "TTL", ":", "ttl", ",", "}", "\n", "id", ",", "_", ",", "err", ":=", "session", ".", "Create", "(", "se", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "goto", "WAIT", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "<mask>", ")", "\n\n", "// Attempt to lock each template", "for", "_", ",", "t", ":=", "range", "d", ".", "templates", "{", "d", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "d", ".", "attemptLock", "(", "client", ",", "id", ",", "sessionCh", ",", "t", ")", "\n", "}", "\n\n", "// Renew our session periodically", "if", "err", ":=", "session", ".", "RenewPeriodic", "(", "\"", "\"", ",", "id", ",", "nil", ",", "d", ".", "stopCh", ")", ";", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "close", "(", "sessionCh", ")", "\n", "d", ".", "wg", ".", "Wait", "(", ")", "\n\n", "WAIT", ":", "select", "{", "case", "<-", "time", ".", "After", "(", "sessionCreateRetry", ")", ":", "goto", "START", "\n", "case", "<-", "d", ".", "stopCh", ":", "return", "\n", "}", "\n", "}" ]
21,732
all-21733
[ "retryCmd", "will", "retry", "the", "command", "a", "few", "times", "with", "backoff", ".", "Use", "this", "for", "any", "commands", "that", "will", "be", "talking", "to", "GitHub", "such", "as", "clones", "or", "fetches", "." ]
[ "func", "retryCmd", "(", "l", "*", "logrus", ".", "Entry", ",", "dir", ",", "cmd", "string", ",", "arg", "...", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "b", "[", "]", "byte", "\n", "var", "err", "error", "\n", "sleepyTime", ":=", "time", ".", "Second", "\n", "for", "i", ":=", "0", ";", "i", "<", "3", ";", "i", "++", "{", "c", ":=", "exec", ".", "Command", "(", "cmd", ",", "arg", "...", ")", "\n", "c", ".", "Dir", "=", "dir", "\n", "b", ",", "err", "=", "c", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "nil", "{", "l", ".", "Warningf", "(", "\"", "\"", ",", "cmd", ",", "arg", ",", "err", ",", "string", "(", "b", ")", ")", "\n", "<mask>", ".", "Sleep", "(", "sleepyTime", ")", "\n", "sleepyTime", "*=", "2", "\n", "continue", "\n", "}", "\n", "break", "\n", "}", "\n", "return", "b", ",", "err", "\n", "}" ]
21,733
all-21734
[ "DeleteServer", "deletes", "the", "server", "where", "id", "=", "srvid", "and", "returns", "Resp", "struct" ]
[ "func", "(", "c", "*", "Client", ")", "DeleteServer", "(", "dcid", ",", "srvid", "string", ")", "(", "*", "http", ".", "<mask>", ",", "error", ")", "{", "ret", ":=", "&", "http", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Delete", "(", "serverPath", "(", "dcid", ",", "srvid", ")", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
21,734
all-21735
[ "Before", "will", "retrieve", "all", "old", "rows", "that", "were", "created", "before", "the", "row", "with", "id", "was", "created", "[", "1", "2", "3", "4", "]", "before", "2", "will", "return", "[", "3", "4", "]", "r", ".", "db", "(", "worksmart", ")", ".", "table", "(", "store", ")", ".", "orderBy", "(", "{", "index", ":", "r", ".", "desc", "(", "id", ")", "}", ")", ".", "filter", "(", "r", ".", "row", "(", "schemas", ")", ".", "eq", "(", "osiloke_tsaboin_silverbird", ")", ".", "and", "(", "r", ".", "row", "(", "id", ")", ".", "lt", "(", "55b54e93f112a16514000057", ")))", ".", "pluck", "(", "schemas", "id", "tid", "timestamp", "created_at", ")", ".", "limit", "(", "100", ")" ]
[ "func", "(", "s", "RethinkStore", ")", "Before", "(", "id", "string", ",", "count", "int", ",", "skip", "int", ",", "store", "string", ")", "(", "rows", "ObjectRows", ",", "err", "error", ")", "{", "result", ",", "err", ":=", "r", ".", "DB", "(", "s", ".", "Database", ")", ".", "Table", "(", "store", ")", ".", "Filter", "(", "r", ".", "Row", ".", "Field", "(", "\"", "\"", ")", ".", "Lt", "(", "id", ")", ")", ".", "Limit", "(", "count", ")", ".", "Skip", "(", "skip", ")", ".", "Run", "(", "s", ".", "Session", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defer", "result", ".", "Close", "(", ")", "\n", "//\tresult.All(dst)", "<mask>", "=", "RethinkRows", "{", "result", "}", "\n", "return", "\n", "}" ]
21,735
all-21736
[ "SetStartupID", "is", "a", "wrapper", "around", "gtk_window_set_startup_id", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetStartupID", "(", "sid", "string", ")", "{", "cstr", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "sid", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_window_set_startup_id", "(", "v", ".", "native", "(", ")", ",", "cstr", ")", "\n", "}" ]
21,736
all-21737
[ "SetScriptTimeout", "sets", "the", "script", "timeout", "(", "in", "ms", ")" ]
[ "func", "(", "p", "*", "Page", ")", "SetScriptTimeout", "(", "timeout", "int", ")", "error", "{", "return", "p", ".", "<mask>", ".", "SetScriptTimeout", "(", "timeout", ")", "\n", "}" ]
21,737
all-21738
[ "ParseCommand", "actually", "runs", "a", "command", "." ]
[ "func", "(", "a", "*", "API", ")", "ParseCommand", "(", "cmd", ",", "hrefPrefix", "string", ",", "values", "ActionCommands", ")", "(", "*", "ParsedCommand", ",", "error", ")", "{", "// 0. Show help if requested", "val", ",", "ok", ":=", "values", "[", "cmd", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cmd", ")", "\n", "}", "\n", "if", "val", ".", "ShowHelp", "!=", "\"", "\"", "{", "a", ".", "ShowHelp", "(", "cmd", ",", "hrefPrefix", ",", "values", ")", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// 1. Initialize / find href as well as resource and action command definitions", "target", ",", "params", ",", "err", ":=", "a", ".", "ParseCommandAndFlags", "(", "cmd", ",", "hrefPrefix", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "resource", ",", "action", ",", "path", ":=", "target", ".", "Resource", ",", "target", ".", "Action", ",", "target", ".", "Path", "\n\n", "// 2. Coerce and validate given flag values, use array for payload as order is meaningful", "// when building the data structure (e.g. in the case of array of hashes)", "var", "queryParams", ",", "payloadParams", "[", "]", "APIParams", "\n", "<mask>", "seen", "[", "]", "string", "\n", "for", "_", ",", "p", ":=", "range", "params", "{", "param", ",", "value", ",", "err", ":=", "a", ".", "findParamAndValue", "(", "action", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "param", "==", "nil", "{", "name", ":=", "strings", ".", "SplitN", "(", "p", ",", "\"", "\"", ",", "2", ")", "[", "0", "]", "\n", "if", "len", "(", "action", ".", "CommandFlags", ")", ">", "0", "{", "supported", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "action", ".", "CommandFlags", ")", ")", "\n", "for", "i", ",", "p", ":=", "range", "action", ".", "CommandFlags", "{", "supported", "[", "i", "]", "=", "p", ".", "Name", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resource", ".", "Name", ",", "action", ".", "Name", ",", "name", ",", "strings", ".", "Join", "(", "supported", ",", "\"", "\"", ")", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resource", ".", "Name", ",", "action", ".", "Name", ",", "name", ",", "resource", ".", "Name", ",", "action", ".", "Name", ")", "\n", "}", "\n", "name", ":=", "param", ".", "Name", "\n", "seen", "=", "append", "(", "seen", ",", "name", ")", "\n", "if", "err", ":=", "validateFlagValue", "(", "value", ",", "param", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "coerced", ":=", "&", "queryParams", "\n", "if", "param", ".", "Location", "==", "metadata", ".", "PayloadParam", "{", "coerced", "=", "&", "payloadParams", "\n", "}", "\n", "switch", "param", ".", "Type", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "value", "}", ")", "\n", "case", "\"", "\"", ",", "\"", "\"", ":", "val", ",", "err", ":=", "strconv", ".", "Atoi", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "value", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "val", "}", ")", "\n", "case", "\"", "\"", ",", "\"", "\"", ":", "val", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "value", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "val", "}", ")", "\n", "case", "\"", "\"", ":", "// Try to parse the input as int64 and if it was successful, treat is as a Unix", "// time otherwise parse as RFC3339.", "if", "val", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "value", ",", "10", ",", "64", ")", ";", "err", "==", "nil", "{", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "time", ".", "Unix", "(", "val", ",", "0", ")", "}", ")", "\n", "}", "else", "{", "val", ",", "err", ":=", "time", ".", "Parse", "(", "time", ".", "RFC3339", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ",", "name", ",", "err", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "val", "}", ")", "\n", "}", "\n", "case", "\"", "\"", ":", "velems", ":=", "strings", ".", "SplitN", "(", "value", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "velems", ")", "!=", "2", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "value", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "velems", "[", "0", "]", ")", ":", "velems", "[", "1", "]", "}", ")", "\n", "case", "\"", "\"", ":", "file", ",", "err", ":=", "os", ".", "Open", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ",", "name", ",", "err", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "&", "SourceUpload", "{", "Reader", ":", "file", "}", "}", ")", "\n", "case", "\"", "\"", ":", "file", ",", "err", ":=", "os", ".", "Open", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "value", ",", "name", ",", "err", ")", "\n", "}", "\n", "*", "coerced", "=", "append", "(", "*", "coerced", ",", "APIParams", "{", "name", ":", "&", "FileUpload", "{", "Name", ":", "name", ",", "Filename", ":", "value", ",", "Reader", ":", "file", "}", "}", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "p", ":=", "range", "action", ".", "CommandFlags", "{", "var", "ok", "bool", "\n", "for", "_", ",", "s", ":=", "range", "seen", "{", "if", "s", "==", "p", ".", "Name", "{", "ok", "=", "true", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "p", ".", "Mandatory", "&&", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "p", ".", "Name", ")", "\n", "}", "\n", "}", "\n\n", "// Reconstruct data structure from flat values", "qParams", ",", "err", ":=", "buildQuery", "(", "queryParams", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "pParams", ",", "err", ":=", "buildPayload", "(", "payloadParams", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "ParsedCommand", "{", "path", ".", "HTTPMethod", ",", "path", ".", "Path", ",", "qParams", ",", "pParams", "}", ",", "nil", "\n", "}" ]
21,738
all-21739
[ "HasTickEvery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsOptions", ")", "HasTickEvery", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "TickEvery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
21,739
all-21740
[ "retrieve", "information", "about", "a", "bound", "renderbuffer", "object" ]
[ "func", "GetRenderbufferParameteriv", "(", "<mask>", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpGetRenderbufferParameteriv", ",", "3", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
21,740
all-21741
[ "StructuredLogger", "is", "a", "simple", "but", "powerful", "implementation", "of", "a", "custom", "structured", "logger", "backed", "on", "logrus", ".", "I", "encourage", "users", "to", "copy", "it", "adapt", "it", "and", "make", "it", "their", "own", ".", "Also", "take", "a", "look", "at", "https", ":", "//", "github", ".", "com", "/", "pressly", "/", "lg", "for", "a", "dedicated", "pkg", "based", "on", "this", "work", "designed", "for", "context", "-", "based", "http", "routers", "." ]
[ "func", "NewStructuredLogger", "(", "logger", "*", "logrus", ".", "Logger", ")", "func", "(", "next", "http", ".", "Handler", ")", "<mask>", ".", "Handler", "{", "return", "middleware", ".", "RequestLogger", "(", "&", "StructuredLogger", "{", "logger", "}", ")", "\n", "}" ]
21,741
all-21742
[ "Records", "returns", "all", "DNS", "records", "found", "in", "CoreDNS", "etcd", "backend", ".", "Depending", "on", "the", "record", "fields", "it", "may", "be", "mapped", "to", "one", "or", "two", "records", "of", "type", "A", "CNAME", "TXT", "A", "+", "TXT", "CNAME", "+", "TXT" ]
[ "func", "(", "p", "coreDNSProvider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "var", "result", "[", "]", "*", "endpoint", ".", "Endpoint", "\n", "services", ",", "err", ":=", "p", ".", "client", ".", "GetServices", "(", "coreDNSPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "_", ",", "service", ":=", "range", "services", "{", "domains", ":=", "strings", ".", "Split", "(", "strings", ".", "TrimPrefix", "(", "service", ".", "Key", ",", "coreDNSPrefix", ")", ",", "\"", "\"", ")", "\n", "reverse", "(", "domains", ")", "\n", "dnsName", ":=", "strings", ".", "Join", "(", "domains", "[", "service", ".", "TargetStrip", ":", "]", ",", "\"", "\"", ")", "\n", "if", "!", "p", ".", "domainFilter", ".", "Match", "(", "dnsName", ")", "{", "continue", "\n", "}", "\n", "prefix", ":=", "strings", ".", "Join", "(", "domains", "[", ":", "service", ".", "TargetStrip", "]", ",", "\"", "\"", ")", "\n", "if", "service", ".", "Host", "!=", "\"", "\"", "{", "ep", ":=", "endpoint", ".", "NewEndpointWithTTL", "(", "dnsName", ",", "guessRecordType", "(", "service", ".", "Host", ")", ",", "endpoint", ".", "TTL", "(", "service", ".", "TTL", ")", ",", "service", ".", "Host", ",", ")", "\n", "ep", ".", "Labels", "[", "\"", "\"", "]", "=", "service", ".", "Text", "\n", "ep", ".", "Labels", "[", "randomPrefixLabel", "]", "=", "prefix", "\n", "result", "=", "append", "(", "result", ",", "ep", ")", "\n", "}", "\n", "if", "service", ".", "<mask>", "!=", "\"", "\"", "{", "ep", ":=", "endpoint", ".", "NewEndpoint", "(", "dnsName", ",", "endpoint", ".", "RecordTypeTXT", ",", "service", ".", "Text", ",", ")", "\n", "ep", ".", "Labels", "[", "randomPrefixLabel", "]", "=", "prefix", "\n", "result", "=", "append", "(", "result", ",", "ep", ")", "\n", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
21,742
all-21743
[ "AccelGroupsFromObject", "is", "a", "wrapper", "around", "gtk_accel_groups_from_object", "()", "." ]
[ "func", "AccelGroupsFromObject", "(", "obj", "*", "glib", ".", "Object", ")", "*", "glib", ".", "SList", "{", "<mask>", ":=", "C", ".", "gtk_accel_groups_from_object", "(", "(", "*", "C", ".", "GObject", ")", "(", "unsafe", ".", "Pointer", "(", "obj", ".", "Native", "(", ")", ")", ")", ")", "\n", "if", "res", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "(", "*", "glib", ".", "SList", ")", "(", "unsafe", ".", "Pointer", "(", "res", ")", ")", "\n", "}" ]
21,743
all-21744
[ "called", "from", "queue" ]
[ "func", "(", "sw", "*", "secondWindow", ")", "Init", "(", "w", "*", "ttk", ".", "Window", ")", "{", "sw", ".", "l", "=", "w", ".", "AddLabel", "(", "2", ",", "2", ",", "\"", "\"", ")", "\n", "sw", ".", "l", ".", "SetAttributes", "(", "ttk", ".", "Attributes", "{", "Fg", ":", "termbox", ".", "ColorRed", ",", "Bg", ":", "termbox", ".", "ColorCyan", ",", "}", ")", "\n\n", "// edit box", "<mask>", "s", "string", "=", "\"", "\"", "\n", "sw", ".", "e", "=", "w", ".", "AddEdit", "(", "2", ",", "14", ",", "-", "2", ",", "&", "s", ")", "\n", "ttk", ".", "Flush", "(", ")", "\n", "}" ]
21,744
all-21745
[ "IsProgressNotify", "returns", "true", "if", "the", "WatchResponse", "is", "progress", "notification", "." ]
[ "func", "(", "wr", "*", "WatchResponse", ")", "IsProgressNotify", "(", ")", "bool", "{", "return", "len", "(", "wr", ".", "Events", ")", "==", "0", "&&", "!", "wr", ".", "Canceled", "&&", "!", "wr", ".", "Created", "&&", "wr", ".", "CompactRevision", "==", "0", "&&", "wr", ".", "<mask>", ".", "Revision", "!=", "0", "\n", "}" ]
21,745
all-21746
[ "scan", "enumerates", "events", "from", "the", "index", "history", "and", "stops", "at", "the", "first", "point", "where", "the", "key", "matches", "." ]
[ "func", "(", "eh", "*", "EventHistory", ")", "scan", "(", "key", "string", ",", "recursive", "bool", ",", "index", "uint64", ")", "(", "*", "Event", ",", "*", "v2error", ".", "Error", ")", "{", "eh", ".", "rwl", ".", "RLock", "(", ")", "\n", "defer", "eh", ".", "rwl", ".", "RUnlock", "(", ")", "\n\n", "// index should be after the event history's StartIndex", "if", "index", "<", "eh", ".", "StartIndex", "{", "return", "nil", ",", "v2error", ".", "NewError", "(", "v2error", ".", "EcodeEventIndexCleared", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "eh", ".", "StartIndex", ",", "index", ")", ",", "0", ")", "\n", "}", "\n\n", "// the index should come before the size of the queue minus the duplicate count", "if", "index", ">", "eh", ".", "LastIndex", "{", "// future index", "return", "nil", ",", "nil", "\n", "}", "\n\n", "offset", ":=", "index", "-", "eh", ".", "StartIndex", "\n", "i", ":=", "(", "eh", ".", "Queue", ".", "Front", "+", "int", "(", "offset", ")", ")", "%", "eh", ".", "Queue", ".", "Capacity", "\n\n", "for", "{", "e", ":=", "eh", ".", "Queue", ".", "Events", "[", "i", "]", "\n\n", "if", "!", "e", ".", "Refresh", "{", "ok", ":=", "e", ".", "Node", ".", "Key", "==", "<mask>", "\n\n", "if", "recursive", "{", "// add tailing slash", "nkey", ":=", "path", ".", "Clean", "(", "key", ")", "\n", "if", "nkey", "[", "len", "(", "nkey", ")", "-", "1", "]", "!=", "'/'", "{", "nkey", "=", "nkey", "+", "\"", "\"", "\n", "}", "\n\n", "ok", "=", "ok", "||", "strings", ".", "HasPrefix", "(", "e", ".", "Node", ".", "Key", ",", "nkey", ")", "\n", "}", "\n\n", "if", "(", "e", ".", "Action", "==", "Delete", "||", "e", ".", "Action", "==", "Expire", ")", "&&", "e", ".", "PrevNode", "!=", "nil", "&&", "e", ".", "PrevNode", ".", "Dir", "{", "ok", "=", "ok", "||", "strings", ".", "HasPrefix", "(", "key", ",", "e", ".", "PrevNode", ".", "Key", ")", "\n", "}", "\n\n", "if", "ok", "{", "return", "e", ",", "nil", "\n", "}", "\n", "}", "\n\n", "i", "=", "(", "i", "+", "1", ")", "%", "eh", ".", "Queue", ".", "Capacity", "\n\n", "if", "i", "==", "eh", ".", "Queue", ".", "Back", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "}", "\n", "}" ]
21,746
all-21747
[ "AddIPAddr", "adds", "an", "IP", "address", "to", "Pinger", ".", "ip", "arg", "should", "be", "a", "net", ".", "IPAddr", "pointer", "." ]
[ "func", "(", "p", "*", "Pinger", ")", "AddIPAddr", "(", "ip", "*", "net", ".", "IPAddr", ")", "{", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "p", ".", "addrs", "[", "ip", ".", "String", "(", ")", "]", "=", "<mask>", "\n", "if", "isIPv4", "(", "ip", ".", "IP", ")", "{", "p", ".", "hasIPv4", "=", "true", "\n", "}", "else", "if", "isIPv6", "(", "ip", ".", "IP", ")", "{", "p", ".", "hasIPv6", "=", "true", "\n", "}", "\n", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
21,747
all-21748
[ "NewDiscovery", "returns", "a", "new", "Marathon", "Discovery", "." ]
[ "func", "NewDiscovery", "(", "conf", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "(", "*", "Discovery", ",", "error", ")", "{", "rt", ",", "err", ":=", "config_util", ".", "NewRoundTripperFromConfig", "(", "conf", ".", "HTTPClientConfig", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "conf", ".", "AuthToken", ")", ">", "0", "{", "rt", ",", "err", "=", "newAuthTokenRoundTripper", "(", "conf", ".", "AuthToken", ",", "rt", ")", "\n", "}", "else", "if", "len", "(", "conf", ".", "AuthTokenFile", ")", ">", "0", "{", "rt", ",", "err", "=", "newAuthTokenFileRoundTripper", "(", "conf", ".", "AuthTokenFile", ",", "rt", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "d", ":=", "&", "Discovery", "{", "client", ":", "&", "http", ".", "Client", "{", "Transport", ":", "rt", "}", ",", "servers", ":", "conf", ".", "Servers", ",", "appsClient", ":", "fetchApps", ",", "}", "\n", "d", ".", "Discovery", "=", "refresh", ".", "NewDiscovery", "(", "logger", ",", "\"", "\"", ",", "<mask>", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "d", ".", "refresh", ",", ")", "\n", "return", "d", ",", "nil", "\n", "}" ]
21,748
all-21749
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetCategoriesParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTracing7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,749
all-21750
[ "Arg", "appends", "a", "new", "argument", "to", "the", "command", "." ]
[ "func", "(", "c", "*", "Command", ")", "Arg", "(", "v", "interface", "{", "}", ")", "*", "Command", "{", "c", ".", "args", "=", "<mask>", "(", "c", ".", "args", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ")", ")", "\n", "return", "c", "\n", "}" ]
21,750
all-21751
[ "deadlineLoop", "reaps", "any", "keep", "alive", "channels", "that", "have", "not", "received", "a", "response", "within", "the", "lease", "TTL" ]
[ "func", "(", "l", "*", "lessor", ")", "deadlineLoop", "(", ")", "{", "for", "{", "select", "{", "case", "<-", "time", ".", "After", "(", "time", ".", "Second", ")", ":", "case", "<-", "l", ".", "donec", ":", "return", "\n", "}", "\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "for", "id", ",", "ka", ":=", "range", "l", ".", "keepAlives", "{", "if", "ka", ".", "deadline", ".", "Before", "(", "now", ")", "{", "// waited too long for response; lease may be expired", "ka", ".", "close", "(", ")", "\n", "<mask>", "(", "l", ".", "keepAlives", ",", "id", ")", "\n", "}", "\n", "}", "\n", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "}", "\n", "}" ]
21,751
all-21752
[ "Receive", "receives", "frames", "intended", "for", "this", "connection", ".", "It", "returns", "whether", "the", "frame", "was", "sent", "and", "a", "reason", "for", "failure", "if", "it", "failed", "." ]
[ "func", "(", "r", "*", "Relayer", ")", "Receive", "(", "f", "*", "Frame", ",", "fType", "frameType", ")", "(", "sent", "bool", ",", "failureReason", "string", ")", "{", "id", ":=", "f", ".", "Header", ".", "ID", "\n\n", "// If we receive a response frame, we expect to find that ID in our outbound.", "// If we receive a request frame, we expect to find that ID in our inbound.", "items", ":=", "r", ".", "receiverItems", "(", "fType", ")", "\n\n", "<mask>", ",", "ok", ":=", "items", ".", "Get", "(", "id", ")", "\n", "if", "!", "ok", "{", "r", ".", "logger", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "id", "}", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "false", ",", "_relayErrorNotFound", "\n", "}", "\n\n", "finished", ":=", "finishesCall", "(", "f", ")", "\n", "if", "item", ".", "tomb", "{", "// Call timed out, ignore this frame. (We've already handled stats.)", "// TODO: metrics for late-arriving frames.", "return", "true", ",", "\"", "\"", "\n", "}", "\n\n", "// call res frames don't include the OK bit, so we can't wait until the last", "// frame of a relayed RPC to determine if the call succeeded.", "if", "fType", "==", "responseFrame", "{", "// If we've gotten a response frame, we're the originating relayer and", "// should handle stats.", "if", "succeeded", ",", "failMsg", ":=", "determinesCallSuccess", "(", "f", ")", ";", "succeeded", "{", "item", ".", "call", ".", "Succeeded", "(", ")", "\n", "}", "else", "if", "len", "(", "failMsg", ")", ">", "0", "{", "item", ".", "call", ".", "Failed", "(", "failMsg", ")", "\n", "}", "\n", "}", "\n", "select", "{", "case", "r", ".", "conn", ".", "sendCh", "<-", "f", ":", "default", ":", "// Buffer is full, so drop this frame and cancel the call.", "r", ".", "logger", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "id", "}", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n\n", "items", ":=", "r", ".", "receiverItems", "(", "fType", ")", "\n\n", "err", ":=", "_relayErrorDestConnSlow", "\n", "// If we're dealing with a response frame, then the client is slow.", "if", "fType", "==", "responseFrame", "{", "err", "=", "_relayErrorSourceConnSlow", "\n", "}", "\n\n", "r", ".", "failRelayItem", "(", "items", ",", "id", ",", "err", ")", "\n", "return", "false", ",", "err", "\n", "}", "\n\n", "if", "finished", "{", "r", ".", "finishRelayItem", "(", "items", ",", "id", ")", "\n", "}", "\n\n", "return", "true", ",", "\"", "\"", "\n", "}" ]
21,752
all-21753
[ "SetBodyRaw", "sets", "response", "body", "but", "without", "copying", "it", ".", "From", "this", "point", "onward", "the", "body", "argument", "must", "not", "be", "changed", "." ]
[ "func", "(", "resp", "*", "Response", ")", "SetBodyRaw", "(", "<mask>", "[", "]", "byte", ")", "{", "resp", ".", "ResetBody", "(", ")", "\n", "resp", ".", "bodyRaw", "=", "body", "\n", "}" ]
21,753
all-21754
[ "invalidate", "the", "content", "of", "a", "region", "of", "some", "or", "all", "of", "a", "framebuffer", "s", "attachments" ]
[ "func", "InvalidateNamedFramebufferSubData", "(", "framebuffer", "uint32", ",", "numAttachments", "int32", ",", "attachments", "*", "uint32", ",", "x", "int32", ",", "y", "int32", ",", "<mask>", "int32", ",", "height", "int32", ")", "{", "C", ".", "glowInvalidateNamedFramebufferSubData", "(", "gpInvalidateNamedFramebufferSubData", ",", "(", "C", ".", "GLuint", ")", "(", "framebuffer", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "numAttachments", ")", ",", "(", "*", "C", ".", "GLenum", ")", "(", "unsafe", ".", "Pointer", "(", "attachments", ")", ")", ",", "(", "C", ".", "GLint", ")", "(", "x", ")", ",", "(", "C", ".", "GLint", ")", "(", "y", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "height", ")", ")", "\n", "}" ]
21,754
all-21755
[ "SetXAlign", "is", "a", "wrapper", "around", "gtk_label_set_xalign", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetXAlign", "(", "n", "float64", ")", "{", "C", ".", "gtk_label_set_xalign", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gfloat", "(", "n", ")", ")", "\n", "}" ]
21,755
all-21756
[ "NewRcodezeroChange", "returns", "a", "RcodeZero", "specific", "rrset", "change", "object", "." ]
[ "func", "(", "p", "*", "RcodeZeroProvider", ")", "NewRcodezeroChange", "(", "action", "string", ",", "endpoint", "*", "endpoint", ".", "Endpoint", ")", "*", "rc0", ".", "RRSetChange", "{", "change", ":=", "&", "rc0", ".", "RRSetChange", "{", "Type", ":", "endpoint", ".", "RecordType", ",", "ChangeType", ":", "action", ",", "Name", ":", "endpoint", ".", "DNSName", ",", "Records", ":", "[", "]", "*", "rc0", ".", "Record", "{", "{", "Disabled", ":", "false", ",", "Content", ":", "endpoint", ".", "Targets", "[", "0", "]", ",", "}", "}", ",", "}", "\n\n", "if", "p", ".", "TXTEncrypt", "&&", "(", "p", ".", "<mask>", "!=", "nil", ")", "&&", "strings", ".", "EqualFold", "(", "endpoint", ".", "RecordType", ",", "\"", "\"", ")", "{", "p", ".", "Client", ".", "RRSet", ".", "EncryptTXT", "(", "p", ".", "Key", ",", "change", ")", "\n", "}", "\n\n", "return", "change", "\n", "}" ]
21,756
all-21757
[ "Get", "lxc", "container", "state", "with", "1", "second", "timeout", "If", "we", "don", "t", "get", "a", "reply", "assume", "the", "lxc", "monitor", "is", "hung" ]
[ "func", "(", "c", "*", "containerLXC", ")", "getLxcState", "(", ")", "(", "lxc", ".", "State", ",", "error", ")", "{", "if", "c", ".", "IsSnapshot", "(", ")", "{", "return", "lxc", ".", "StateMap", "[", "\"", "\"", "]", ",", "nil", "\n", "}", "\n\n", "// Load the go-lxc struct", "err", ":=", "c", ".", "initLXC", "(", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "lxc", ".", "StateMap", "[", "\"", "\"", "]", ",", "err", "\n", "}", "\n\n", "monitor", ":=", "<mask>", "(", "chan", "lxc", ".", "State", ",", "1", ")", "\n\n", "go", "func", "(", "c", "*", "lxc", ".", "Container", ")", "{", "monitor", "<-", "c", ".", "State", "(", ")", "\n", "}", "(", "c", ".", "c", ")", "\n\n", "select", "{", "case", "state", ":=", "<-", "monitor", ":", "return", "state", ",", "nil", "\n", "case", "<-", "time", ".", "After", "(", "5", "*", "time", ".", "Second", ")", ":", "return", "lxc", ".", "StateMap", "[", "\"", "\"", "]", ",", "LxcMonitorStateError", "\n", "}", "\n", "}" ]
21,757
all-21758
[ "PushFrame", "pushes", "a", "new", "frame", "to", "the", "frame", "stack" ]
[ "func", "(", "st", "*", "State", ")", "PushFrame", "(", ")", "*", "frame", ".", "Frame", "{", "f", ":=", "<mask>", ".", "New", "(", "st", ".", "framestack", ")", "\n", "st", ".", "frames", ".", "Push", "(", "f", ")", "\n", "f", ".", "SetMark", "(", "st", ".", "frames", ".", "Size", "(", ")", ")", "\n", "return", "f", "\n", "}" ]
21,758
all-21759
[ "VisitAllCookie", "calls", "f", "for", "each", "response", "cookie", ".", "Cookie", "name", "is", "passed", "in", "key", "and", "the", "whole", "Set", "-", "Cookie", "header", "value", "is", "passed", "in", "value", "on", "each", "f", "invocation", ".", "Value", "may", "be", "parsed", "with", "Cookie", ".", "ParseBytes", "()", ".", "f", "must", "not", "retain", "references", "to", "key", "and", "/", "or", "value", "after", "returning", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "VisitAllCookie", "(", "f", "func", "(", "<mask>", ",", "value", "[", "]", "byte", ")", ")", "{", "visitArgs", "(", "h", ".", "cookies", ",", "f", ")", "\n", "}" ]
21,759
all-21760
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetDeviceMetricsOverrideParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation12", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
21,760
all-21761
[ "effectiveSr", "gets", "the", "current", "effective", "scroll", "region", "in", "buffer", "coordinates" ]
[ "func", "(", "h", "*", "windowsAnsiEventHandler", ")", "effectiveSr", "(", "window", "SMALL_RECT", ")", "scrollRegion", "{", "top", ":=", "addInRange", "(", "window", ".", "Top", ",", "h", ".", "sr", ".", "top", ",", "window", ".", "Top", ",", "window", ".", "Bottom", ")", "\n", "bottom", ":=", "addInRange", "(", "window", ".", "Top", ",", "h", ".", "sr", ".", "bottom", ",", "window", ".", "Top", ",", "window", ".", "Bottom", ")", "\n", "if", "top", ">=", "bottom", "{", "top", "=", "window", ".", "Top", "\n", "bottom", "=", "window", ".", "Bottom", "\n", "}", "\n", "return", "scrollRegion", "{", "top", ":", "<mask>", ",", "bottom", ":", "bottom", "}", "\n", "}" ]
21,761
all-21762
[ "Hash", "returns", "the", "hash", "of", "this", "builder", "s", "transaction", "." ]
[ "func", "(", "b", "*", "TransactionBuilder", ")", "Hash", "(", ")", "(", "[", "32", "]", "byte", ",", "error", ")", "{", "var", "txBytes", "bytes", ".", "Buffer", "\n\n", "_", ",", "err", ":=", "fmt", ".", "Fprintf", "(", "&", "txBytes", ",", "\"", "\"", ",", "b", ".", "NetworkID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "32", "]", "byte", "{", "}", ",", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "xdr", ".", "Marshal", "(", "&", "txBytes", ",", "xdr", ".", "EnvelopeTypeEnvelopeTypeTx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "32", "]", "byte", "{", "}", ",", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "xdr", ".", "Marshal", "(", "&", "txBytes", ",", "b", ".", "TX", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "32", "]", "byte", "{", "}", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "Hash", "(", "txBytes", ".", "Bytes", "(", ")", ")", ",", "nil", "\n", "}" ]
21,762
all-21763
[ "RegisterVM", "adds", "a", "virtual", "machine", "to", "the", "host", "s", "inventory", ".", "Parameters", ":", "vmxFile", ":", "The", "path", "name", "of", "the", ".", "vmx", "file", "on", "the", "host", ".", "Remarks", ":", "*", "This", "function", "registers", "the", "virtual", "machine", "identified", "by", "vmxFile", "which", "is", "a", "storage", "path", "to", "the", "configuration", "file", "(", ".", "vmx", ")", "for", "that", "virtual", "machine", ".", "You", "can", "register", "a", "virtual", "machine", "regardless", "of", "its", "power", "state", ".", "*", "The", "format", "of", "the", "path", "name", "depends", "on", "the", "host", "operating", "system", ".", "If", "the", "path", "name", "includes", "backslash", "characters", "you", "need", "to", "precede", "each", "one", "with", "an", "escape", "character", ".", "Path", "to", "storage", "[", "standard", "]", "or", "[", "storage1", "]", "may", "vary", ".", "*", "For", "VMware", "Server", "1", ".", "x", "supply", "the", "full", "path", "name", "instead", "of", "storage", "path", "and", "specify", "provider", "VMWARE_SERVER", "to", "connect", ".", "*", "This", "function", "has", "no", "effect", "on", "Workstation", "or", "Player", "which", "lack", "a", "virtual", "machine", "inventory", ".", "*", "It", "is", "not", "a", "Vix", "error", "to", "register", "an", "already", "-", "registered", "virtual", "machine", "although", "the", "VMware", "Server", "UI", "shows", "an", "error", "icon", "in", "the", "Task", "pane", ".", "Trying", "to", "register", "a", "non", "-", "existent", "virtual", "machine", "results", "in", "error", "2000", "VIX_E_NOT_FOUND", ".", "Since", "VMware", "Server", "1", ".", "0" ]
[ "func", "(", "h", "*", "Host", ")", "RegisterVM", "(", "vmxFile", "string", ")", "error", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "cVmxFile", ":=", "C", ".", "CString", "(", "vmxFile", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cVmxFile", ")", ")", "\n\n", "jobHandle", "=", "C", ".", "VixHost_RegisterVM", "(", "h", ".", "handle", ",", "cVmxFile", ",", "nil", ",", "// callbackProc", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "Error", "{", "<mask>", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
21,763
all-21764
[ "GetState", "is", "a", "wrapper", "around", "g_action_get_state" ]
[ "func", "(", "v", "*", "<mask>", ")", "GetState", "(", ")", "*", "Variant", "{", "c", ":=", "C", ".", "g_action_get_state", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "newVariant", "(", "(", "*", "C", ".", "GVariant", ")", "(", "c", ")", ")", "\n", "}" ]
21,764
all-21765
[ "expandExtraConfig", "reads", "in", "all", "the", "extra_config", "key", "/", "value", "pairs", "and", "returns", "the", "appropriate", "OptionValue", "slice", ".", "We", "track", "changes", "to", "keys", "to", "determine", "if", "any", "have", "been", "removed", "from", "configuration", "-", "if", "they", "have", "we", "add", "them", "with", "a", "nil", "value", "to", "ensure", "they", "are", "removed", "from", "extraConfig", "on", "the", "update", "." ]
[ "func", "expandExtraConfig", "(", "d", "*", "schema", ".", "ResourceData", ")", "[", "]", "types", ".", "BaseOptionValue", "{", "if", "d", ".", "HasChange", "(", "\"", "\"", ")", "{", "// While there's a possibility that modification of some settings in", "// extraConfig may not require a restart, there's no real way for us to", "// know, hence we just default to requiring a reboot here.", "d", ".", "Set", "(", "\"", "\"", ",", "true", ")", "\n", "}", "else", "{", "// There's no change here, so we might as well just return a nil set, which", "// is a no-op for modification of extraConfig.", "return", "nil", "\n", "}", "\n", "var", "opts", "[", "]", "types", ".", "BaseOptionValue", "\n\n", "// Nil out removed values", "old", ",", "new", ":=", "d", ".", "GetChange", "(", "\"", "\"", ")", "\n", "for", "k1", ":=", "range", "old", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "var", "found", "bool", "\n", "for", "k2", ":=", "range", "new", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "if", "k1", "==", "k2", "{", "found", "=", "true", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "ov", ":=", "&", "types", ".", "OptionValue", "{", "Key", ":", "k1", ",", "Value", ":", "\"", "\"", ",", "}", "\n", "opts", "=", "append", "(", "opts", ",", "ov", ")", "\n", "}", "\n", "}", "\n\n", "// Look for new values, in addition to changed values.", "for", "k1", ",", "v1", ":=", "range", "new", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "var", "found", "bool", "\n", "for", "k2", ",", "v2", ":=", "range", "old", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "if", "k1", "==", "k2", "{", "found", "=", "true", "\n", "if", "v1", "!=", "v2", "{", "// Value has changed, add it to the changeset", "ov", ":=", "&", "types", ".", "OptionValue", "{", "<mask>", ":", "k1", ",", "Value", ":", "types", ".", "AnyType", "(", "v1", ")", ",", "}", "\n", "opts", "=", "append", "(", "opts", ",", "ov", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "!", "found", "{", "// Brand new value", "ov", ":=", "&", "types", ".", "OptionValue", "{", "Key", ":", "k1", ",", "Value", ":", "types", ".", "AnyType", "(", "v1", ")", ",", "}", "\n", "opts", "=", "append", "(", "opts", ",", "ov", ")", "\n", "}", "\n", "}", "\n\n", "// Done!", "return", "opts", "\n", "}" ]
21,765
all-21766
[ "SetText", "()", "is", "a", "wrapper", "around", "gtk_clipboard_set_text", "()", "." ]
[ "func", "(", "v", "*", "Clipboard", ")", "SetText", "(", "text", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "text", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_clipboard_set_text", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gint", "(", "len", "(", "text", ")", ")", ")", "\n", "}" ]
21,766
all-21767
[ "String", "returns", "the", "string", "representation", "of", "a", "PerfDatum", "suitable", "for", "check", "output", "." ]
[ "func", "(", "p", "PerfDatum", ")", "String", "(", ")", "string", "{", "val", ":=", "fmtPerfFloat", "(", "p", ".", "value", ")", "\n", "value", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "label", ",", "val", ",", "p", ".", "unit", ")", "\n", "value", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fmtThreshold", "(", "p", ".", "warn", ")", ",", "fmtThreshold", "(", "p", ".", "crit", ")", ")", "\n", "value", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fmtThreshold", "(", "p", ".", "<mask>", ")", ",", "fmtThreshold", "(", "p", ".", "max", ")", ")", "\n", "return", "value", "\n", "}" ]
21,767
all-21768
[ "Get", "returns", "a", "single", "Queue", "or", "an", "error", "." ]
[ "func", "(", "c", "*", "QueueService", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "sid", "string", ")", "(", "*", "Queue", ",", "error", ")", "{", "queue", ":=", "new", "(", "Queue", ")", "\n", "err", ":=", "c", ".", "<mask>", ".", "GetResource", "(", "ctx", ",", "queuePathPart", ",", "sid", ",", "queue", ")", "\n", "return", "queue", ",", "err", "\n", "}" ]
21,768
all-21769
[ "Set", "is", "part", "of", "the", "flag", ".", "Value", "interface", "." ]
[ "func", "(", "s", "*", "Severity", ")", "<mask>", "(", "value", "string", ")", "error", "{", "var", "threshold", "Severity", "\n", "// Is it a known name?", "if", "v", ",", "ok", ":=", "severityByName", "(", "value", ")", ";", "ok", "{", "threshold", "=", "v", "\n", "}", "else", "{", "v", ",", "err", ":=", "strconv", ".", "Atoi", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "threshold", "=", "Severity", "(", "v", ")", "\n", "}", "\n", "*", "s", "=", "threshold", "\n", "return", "nil", "\n", "}" ]
21,769
all-21770
[ "/", "1", ".", "0", "/", "storage", "-", "pools", "/", "{", "name", "}", "/", "resources", "Get", "resources", "for", "a", "specific", "storage", "pool" ]
[ "func", "storagePoolResourcesGet", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "Response", "{", "// If a target was specified, forward the request to the relevant node.", "response", ":=", "ForwardedResponseIfTargetIsRemote", "(", "d", ",", "r", ")", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "// Get the existing storage pool", "poolName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n", "s", ",", "err", ":=", "storagePoolInit", "(", "d", ".", "State", "(", ")", ",", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "err", "=", "s", ".", "StoragePoolCheck", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "res", ",", "err", ":=", "s", ".", "StoragePoolResources", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "InternalError", "(", "err", ")", "\n", "}", "\n\n", "return", "SyncResponse", "(", "<mask>", ",", "&", "res", ")", "\n", "}" ]
21,770
all-21771
[ "AddContainer", "adds", "a", "container", "to", "the", "state", ".", "If", "the", "container", "has", "been", "added", "with", "only", "a", "name", "and", "no", "docker", "-", "id", "this", "updates", "the", "state", "to", "include", "the", "docker", "id" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "AddContainer", "(", "container", "*", "apicontainer", ".", "DockerContainer", ",", "task", "*", "apitask", ".", "Task", ")", "{", "state", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "task", "==", "nil", "||", "container", "==", "nil", "{", "log", ".", "Crit", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "_", ",", "exists", ":=", "state", ".", "tasks", "[", "task", ".", "Arn", "]", "\n", "if", "!", "exists", "{", "log", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "task", ".", "Arn", ")", "\n", "state", ".", "tasks", "[", "task", ".", "Arn", "]", "=", "task", "\n", "}", "\n\n", "state", ".", "storeIDToContainerTaskUnsafe", "(", "container", ",", "task", ")", "\n\n", "dockerID", ":=", "container", ".", "DockerID", "\n", "v3EndpointID", ":=", "container", ".", "Container", ".", "V3EndpointID", "\n", "// stores the v3EndpointID mappings only if container's dockerID exists and container's v3EndpointID has been generated", "if", "dockerID", "!=", "\"", "\"", "&&", "v3EndpointID", "!=", "\"", "\"", "{", "state", ".", "storeV3EndpointIDToTaskUnsafe", "(", "v3EndpointID", ",", "task", ".", "Arn", ")", "\n", "state", ".", "storeV3EndpointIDToDockerIDUnsafe", "(", "v3EndpointID", ",", "dockerID", ")", "\n", "}", "\n\n", "existingMap", ",", "exists", ":=", "state", ".", "taskToID", "[", "task", ".", "Arn", "]", "\n", "if", "!", "exists", "{", "existingMap", "=", "make", "(", "map", "[", "string", "]", "*", "apicontainer", ".", "DockerContainer", ",", "len", "(", "task", ".", "Containers", ")", ")", "\n", "state", ".", "taskToID", "[", "task", ".", "Arn", "]", "=", "existingMap", "\n", "}", "\n", "existingMap", "[", "<mask>", ".", "Container", ".", "Name", "]", "=", "container", "\n", "}" ]
21,771
all-21772
[ "Allows", "this", "client", "to", "call", "your", "application", "with", "id", "appSid", "(", "See", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "user", "/", "account", "/", "apps", ")", ".", "When", "the", "call", "connects", "Twilio", "will", "call", "your", "voiceUrl", "REST", "endpoint", ".", "The", "appParams", "argument", "will", "get", "passed", "through", "to", "your", "voiceUrl", "REST", "endpoint", "as", "GET", "or", "POST", "parameters", "." ]
[ "func", "(", "c", "*", "Capability", ")", "AllowClientOutgoing", "(", "appSid", "string", ",", "appParams", "<mask>", "[", "string", "]", "string", ")", "{", "c", ".", "shouldBuildOutgoingScope", "=", "true", "\n", "c", ".", "appSid", "=", "appSid", "\n", "c", ".", "outgoingParams", "=", "appParams", "\n", "}" ]
21,772
all-21773
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "LedgerEntryChangeType", ")", "String", "(", ")", "string", "{", "<mask>", ",", "_", ":=", "ledgerEntryChangeTypeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
21,773
all-21774
[ "GetPaletteOk", "returns", "a", "tuple", "with", "the", "Palette", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequestStyle", ")", "GetPaletteOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Palette", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "g", ".", "Palette", ",", "<mask>", "\n", "}" ]
21,774
all-21775
[ "rewrites", "supplied", "host", "entries", "to", "use", "the", "domain", "this", "dns", "server", "manages" ]
[ "func", "(", "<mask>", "*", "DNSServer", ")", "qualifySrvHosts", "(", "srvs", "[", "]", "SRVRecord", ")", "[", "]", "SRVRecord", "{", "newsrvs", ":=", "[", "]", "SRVRecord", "{", "}", "\n\n", "for", "_", ",", "srv", ":=", "range", "srvs", "{", "newsrvs", "=", "append", "(", "newsrvs", ",", "SRVRecord", "{", "Host", ":", "ds", ".", "qualifyHost", "(", "srv", ".", "Host", ")", ",", "Port", ":", "srv", ".", "Port", ",", "}", ")", "\n", "}", "\n\n", "return", "newsrvs", "\n", "}" ]
21,775
all-21776
[ "GetStringOk", "is", "a", "helper", "routine", "that", "returns", "a", "boolean", "representing", "if", "a", "value", "was", "set", "and", "if", "so", "dereferences", "the", "pointer", "to", "it", "." ]
[ "func", "GetStringOk", "(", "v", "*", "string", ")", "(", "string", ",", "bool", ")", "{", "if", "v", "!=", "nil", "{", "return", "*", "v", ",", "true", "\n", "}", "\n\n", "return", "\"", "\"", ",", "<mask>", "\n", "}" ]
21,776
all-21777
[ "NewPageWriter", "creates", "a", "new", "PageWriter", ".", "pageBytes", "is", "the", "number", "of", "bytes", "to", "write", "per", "page", ".", "pageOffset", "is", "the", "starting", "offset", "of", "io", ".", "Writer", "." ]
[ "func", "NewPageWriter", "(", "w", "io", ".", "<mask>", ",", "pageBytes", ",", "pageOffset", "int", ")", "*", "PageWriter", "{", "return", "&", "PageWriter", "{", "w", ":", "w", ",", "pageOffset", ":", "pageOffset", ",", "pageBytes", ":", "pageBytes", ",", "buf", ":", "make", "(", "[", "]", "byte", ",", "defaultBufferBytes", "+", "pageBytes", ")", ",", "bufWatermarkBytes", ":", "defaultBufferBytes", ",", "}", "\n", "}" ]
21,777
all-21778
[ "newCipherBlockReader", "returns", "a", "cipherBlockReader", "that", "decrypts", "the", "given", "io", ".", "Reader", "using", "the", "provided", "block", "mode", "cipher", "." ]
[ "func", "newCipherBlockReader", "(", "r", "io", ".", "Reader", ",", "mode", "cipher", ".", "BlockMode", ")", "*", "cipherBlockReader", "{", "cr", ":=", "&", "cipherBlockReader", "{", "r", ":", "r", ",", "mode", ":", "mode", "}", "\n", "cr", ".", "outbuf", "=", "make", "(", "[", "]", "byte", ",", "0", ",", "mode", ".", "BlockSize", "(", ")", ")", "\n", "cr", ".", "inbuf", "=", "<mask>", "(", "[", "]", "byte", ",", "0", ",", "mode", ".", "BlockSize", "(", ")", ")", "\n", "return", "cr", "\n", "}" ]
21,778
all-21779
[ "FileLastModified", "returns", "last", "modified", "time", "for", "the", "file", "." ]
[ "func", "FileLastModified", "(", "path", "string", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "zeroTime", ",", "err", "\n", "}", "\n", "fileInfo", ",", "err", ":=", "f", ".", "Stat", "(", ")", "\n", "f", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "zeroTime", ",", "err", "\n", "}", "\n", "return", "fsModTime", "(", "fileInfo", ".", "ModTime", "(", ")", ")", ",", "nil", "\n", "}" ]
21,779
all-21780
[ "Returns", "a", "map", "[", "string", "]", "interface", "{}", "at", "the", "key", "or", "the", "specified", "default", "if", "the", "key", "doesn", "t", "exist", "or", "if", "the", "key", "isn", "t", "a", "map", "[", "string", "]", "interface" ]
[ "func", "(", "t", "Typed", ")", "MapOr", "(", "key", "string", ",", "d", "map", "[", "string", "]", "<mask>", "{", "}", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "if", "value", ",", "exists", ":=", "t", ".", "MapIf", "(", "key", ")", ";", "exists", "{", "return", "value", "\n", "}", "\n", "return", "d", "\n", "}" ]
21,780
all-21781
[ "ReleaseOne", "returns", "one", "of", "owned", "resources", "back", "to", "boskos", "and", "set", "it", "to", "dest", "state", "." ]
[ "func", "(", "c", "*", "Client", ")", "ReleaseOne", "(", "name", ",", "dest", "string", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "err", ":=", "c", ".", "storage", ".", "Get", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "c", ".", "storage", ".", "Delete", "(", "name", ")", "\n", "if", "err", ":=", "c", ".", "release", "(", "name", ",", "dest", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
21,781
all-21782
[ "Do", "executes", "DeviceOrientation", ".", "clearDeviceOrientationOverride", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ClearDeviceOrientationOverrideParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandClearDeviceOrientationOverride", ",", "nil", ",", "nil", ")", "\n", "}" ]
21,782
all-21783
[ "NewForConfig", "creates", "a", "new", "Clientset", "for", "the", "given", "config", "." ]
[ "func", "NewForConfig", "(", "c", "*", "rest", ".", "Config", ")", "(", "*", "Clientset", ",", "error", ")", "{", "configShallowCopy", ":=", "*", "c", "\n", "if", "configShallowCopy", ".", "RateLimiter", "==", "nil", "&&", "configShallowCopy", ".", "QPS", ">", "0", "{", "configShallowCopy", ".", "RateLimiter", "=", "flowcontrol", ".", "NewTokenBucketRateLimiter", "(", "configShallowCopy", ".", "QPS", ",", "configShallowCopy", ".", "Burst", ")", "\n", "}", "\n", "<mask>", "cs", "Clientset", "\n", "var", "err", "error", "\n", "cs", ".", "tsuruV1", ",", "err", "=", "tsuruv1", ".", "NewForConfig", "(", "&", "configShallowCopy", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "cs", ".", "DiscoveryClient", ",", "err", "=", "discovery", ".", "NewDiscoveryClientForConfig", "(", "&", "configShallowCopy", ")", "\n", "if", "err", "!=", "nil", "{", "glog", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "cs", ",", "nil", "\n", "}" ]
21,783
all-21784
[ "typecheck", "checks", "correct", "typing", "of", "the", "parsed", "statements", "or", "expression", "." ]
[ "func", "(", "p", "*", "<mask>", ")", "typecheck", "(", "node", "Node", ")", "(", "err", "error", ")", "{", "defer", "p", ".", "recover", "(", "&", "err", ")", "\n\n", "p", ".", "checkType", "(", "node", ")", "\n", "return", "nil", "\n", "}" ]
21,784
all-21785
[ "HashDatum", "computes", "and", "returns", "the", "hash", "of", "datum", "+", "pipeline", "with", "a", "pipeline", "-", "specific", "prefix", "." ]
[ "func", "HashDatum", "(", "pipelineName", "string", ",", "pipelineSalt", "string", ",", "data", "[", "]", "*", "Input", ")", "string", "{", "hash", ":=", "sha256", ".", "New", "(", ")", "\n", "for", "_", ",", "datum", ":=", "range", "data", "{", "hash", ".", "Write", "(", "[", "]", "byte", "(", "datum", ".", "Name", ")", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "datum", ".", "FileInfo", ".", "File", ".", "Path", ")", ")", "\n", "hash", ".", "Write", "(", "datum", ".", "FileInfo", ".", "Hash", ")", "\n", "}", "\n\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "pipelineName", ")", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "pipelineSalt", ")", ")", "\n\n", "return", "client", ".", "DatumTagPrefix", "(", "pipelineSalt", ")", "+", "hex", ".", "EncodeToString", "(", "<mask>", ".", "Sum", "(", "nil", ")", ")", "\n", "}" ]
21,785
all-21786
[ "SetAllowAsync", "()", "is", "a", "wrapper", "around", "gtk_print_operation_set_allow_async", "()", "." ]
[ "func", "(", "po", "*", "PrintOperation", ")", "PrintOperationSetAllowAsync", "(", "allowSync", "bool", ")", "{", "C", ".", "gtk_print_operation_set_allow_async", "(", "<mask>", ".", "native", "(", ")", ",", "gbool", "(", "allowSync", ")", ")", "\n", "}" ]
21,786
all-21787
[ "SetStrategy", "sets", "customized", "peer", "selection", "strategy", "." ]
[ "func", "(", "l", "*", "PeerList", ")", "SetStrategy", "(", "sc", "ScoreCalculator", ")", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n\n", "l", ".", "scoreCalculator", "=", "sc", "\n", "for", "_", ",", "<mask>", ":=", "range", "l", ".", "peersByHostPort", "{", "newScore", ":=", "l", ".", "scoreCalculator", ".", "GetScore", "(", "ps", ".", "Peer", ")", "\n", "l", ".", "updatePeer", "(", "ps", ",", "newScore", ")", "\n", "}", "\n", "}" ]
21,787
all-21788
[ "control", "the", "reporting", "of", "debug", "messages", "in", "a", "debug", "context" ]
[ "func", "DebugMessageControl", "(", "source", "uint32", ",", "xtype", "uint32", ",", "severity", "uint32", ",", "count", "int32", ",", "ids", "*", "uint32", ",", "enabled", "bool", ")", "{", "C", ".", "glowDebugMessageControl", "(", "gpDebugMessageControl", ",", "(", "C", ".", "GLenum", ")", "(", "source", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "(", "C", ".", "GLenum", ")", "(", "severity", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "ids", ")", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "enabled", ")", ")", ")", "\n", "}" ]
21,788
all-21789
[ "helperMethodCSS", "creates", "and", "returns", "a", "helper", "method", "css", "." ]
[ "func", "newHelperMethodCSS", "(", "ln", "*", "line", ",", "rslt", "*", "<mask>", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "*", "helperMethodCSS", "{", "return", "&", "helperMethodCSS", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", ",", "}", "\n", "}" ]
21,789
all-21790
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CallArgument", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime49", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
21,790
all-21791
[ "Do", "executes", "Audits", ".", "getEncodedResponse", "against", "the", "provided", "context", ".", "returns", ":", "body", "-", "The", "encoded", "body", "as", "a", "base64", "string", ".", "Omitted", "if", "sizeOnly", "is", "true", ".", "originalSize", "-", "Size", "before", "re", "-", "encoding", ".", "encodedSize", "-", "Size", "after", "re", "-", "encoding", "." ]
[ "func", "(", "p", "*", "GetEncodedResponseParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "body", "[", "]", "byte", ",", "originalSize", "int64", ",", "encodedSize", "int64", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetEncodedResponseReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetEncodedResponse", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "0", ",", "0", ",", "err", "\n", "}", "\n\n", "// decode", "var", "dec", "[", "]", "byte", "\n", "dec", ",", "err", "=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "0", ",", "0", ",", "err", "\n", "}", "\n", "return", "dec", ",", "<mask>", ".", "OriginalSize", ",", "res", ".", "EncodedSize", ",", "nil", "\n", "}" ]
21,791
all-21792
[ "NewCacheServer", "creates", "a", "new", "CacheServer", "." ]
[ "func", "NewCacheServer", "(", "router", "shard", ".", "Router", ",", "shards", "uint64", ")", "CacheServer", "{", "<mask>", ":=", "&", "groupCacheServer", "{", "Logger", ":", "log", ".", "NewLogger", "(", "\"", "\"", ")", ",", "router", ":", "router", ",", "localShards", ":", "make", "(", "map", "[", "uint64", "]", "bool", ")", ",", "shards", ":", "shards", ",", "}", "\n", "groupcache", ".", "RegisterPeerPicker", "(", "func", "(", ")", "groupcache", ".", "PeerPicker", "{", "return", "server", "}", ")", "\n", "return", "server", "\n", "}" ]
21,792
all-21793
[ "Normalize", "returns", "the", "address", "in", "a", "form", "usable", "by", "a", "HTTP", "client", "." ]
[ "func", "(", "u", "*", "URI", ")", "Normalize", "(", ")", "string", "{", "scheme", ":=", "u", ".", "scheme", "\n", "<mask>", ":=", "strings", ".", "Index", "(", "scheme", ",", "\"", "\"", ")", "\n", "if", "index", ">=", "0", "{", "scheme", "=", "scheme", "[", ":", "index", "]", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "scheme", ",", "u", ".", "host", ",", "u", ".", "port", ")", "\n", "}" ]
21,793
all-21794
[ "Mmap", "creates", "a", "new", "CHD", "aliasing", "the", "CHD", "structure", "over", "an", "existing", "byte", "region", "(", "typically", "mmapped", ")", "." ]
[ "func", "Mmap", "(", "b", "[", "]", "byte", ")", "(", "*", "CHD", ",", "error", ")", "{", "c", ":=", "&", "CHD", "{", "}", "\n\n", "bi", ":=", "&", "sliceReader", "{", "b", ":", "b", "}", "\n\n", "// Read vector of hash functions.", "rl", ":=", "bi", ".", "ReadInt", "(", ")", "\n", "c", ".", "r", "=", "bi", ".", "ReadUint64Array", "(", "rl", ")", "\n\n", "// Read hash function indices.", "il", ":=", "bi", ".", "ReadInt", "(", ")", "\n", "c", ".", "indices", "=", "bi", ".", "ReadUint16Array", "(", "il", ")", "\n\n", "<mask>", ":=", "bi", ".", "ReadInt", "(", ")", "\n\n", "c", ".", "keys", "=", "make", "(", "[", "]", "[", "]", "byte", ",", "el", ")", "\n", "c", ".", "values", "=", "make", "(", "[", "]", "[", "]", "byte", ",", "el", ")", "\n\n", "for", "i", ":=", "uint64", "(", "0", ")", ";", "i", "<", "el", ";", "i", "++", "{", "kl", ":=", "bi", ".", "ReadInt", "(", ")", "\n", "vl", ":=", "bi", ".", "ReadInt", "(", ")", "\n", "c", ".", "keys", "[", "i", "]", "=", "bi", ".", "Read", "(", "kl", ")", "\n", "c", ".", "values", "[", "i", "]", "=", "bi", ".", "Read", "(", "vl", ")", "\n", "}", "\n\n", "return", "c", ",", "nil", "\n", "}" ]
21,794
all-21795
[ "isMultiImage", "returns", "true", "if", "img", "is", "a", "list", "of", "images" ]
[ "func", "isMultiImage", "(", "ctx", "context", ".", "<mask>", ",", "img", "types", ".", "UnparsedImage", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "mt", ",", "err", ":=", "img", ".", "Manifest", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "return", "manifest", ".", "MIMETypeIsMultiImage", "(", "mt", ")", ",", "nil", "\n", "}" ]
21,795
all-21796
[ "RoundTrip", "executes", "a", "single", "HTTP", "transaction", ".", "See", "net", "/", "http", ".", "RoundTripper", "." ]
[ "func", "(", "t", "*", "Transport", ")", "RoundTrip", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "req", ".", "<mask>", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "req", ".", "URL", ".", "Scheme", "!=", "Scheme", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "req", ".", "URL", ".", "Scheme", ")", "\n", "}", "\n", "if", "req", ".", "URL", ".", "Host", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "t", ".", "mu", ".", "Lock", "(", ")", "\n", "path", ",", "ok", ":=", "t", ".", "loc", "[", "req", ".", "URL", ".", "Host", "]", "\n", "t", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "req", ".", "Host", ")", "\n", "}", "\n\n", "c", ",", "err", ":=", "net", ".", "DialTimeout", "(", "\"", "\"", ",", "path", ",", "t", ".", "DialTimeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ":=", "bufio", ".", "NewReader", "(", "c", ")", "\n", "if", "t", ".", "RequestTimeout", ">", "0", "{", "c", ".", "SetWriteDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "t", ".", "RequestTimeout", ")", ")", "\n", "}", "\n", "if", "err", ":=", "req", ".", "Write", "(", "c", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "t", ".", "ResponseHeaderTimeout", ">", "0", "{", "c", ".", "SetReadDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "t", ".", "ResponseHeaderTimeout", ")", ")", "\n", "}", "\n", "resp", ",", "err", ":=", "http", ".", "ReadResponse", "(", "r", ",", "req", ")", "\n", "return", "resp", ",", "err", "\n", "}" ]
21,796
all-21797
[ "Zones", "filters", "map", "[", "zoneID", "]", "zoneName", "for", "names", "having", "f", ".", "domain", "as", "suffix" ]
[ "func", "(", "f", "*", "filter", ")", "Zones", "(", "zones", "map", "[", "string", "]", "string", ")", "<mask>", "[", "string", "]", "string", "{", "result", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "zoneID", ",", "zoneName", ":=", "range", "zones", "{", "if", "strings", ".", "HasSuffix", "(", "zoneName", ",", "f", ".", "domain", ")", "{", "result", "[", "zoneID", "]", "=", "zoneName", "\n", "}", "\n", "}", "\n", "return", "result", "\n", "}" ]
21,797
all-21798
[ "Build", "will", "validate", "the", "set", "properties", "and", "return", "a", "ExecStreamer" ]
[ "func", "(", "e", "*", "execStreamerBuilder", ")", "Build", "(", ")", "(", "ExecStreamer", ",", "error", ")", "{", "if", "e", ".", "d", ".", "ExecutorName", "==", "\"", "\"", "{", "return", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "e", ".", "d", ".", "Exe", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "e", ".", "d", ".", "StdoutWriter", "==", "nil", "{", "e", ".", "d", ".", "StdoutWriter", "=", "ioutil", ".", "Discard", "\n", "}", "\n", "if", "e", ".", "d", ".", "StderrWriter", "==", "nil", "{", "e", ".", "d", ".", "StderrWriter", "=", "ioutil", ".", "Discard", "\n", "}", "\n\n", "return", "e", ".", "d", ",", "nil", "\n", "}" ]
21,798
all-21799
[ "GetManageDataOp", "retrieves", "the", "ManageDataOp", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "OperationBody", ")", "GetManageDataOp", "(", ")", "(", "<mask>", "ManageDataOp", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "ManageDataOp", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
21,799
all-21800
[ "hasConflict", "must", "be", "called", "while", "having", "a", "lock", "." ]
[ "func", "(", "o", "*", "oracle", ")", "hasConflict", "(", "txn", "*", "Txn", ")", "bool", "{", "if", "len", "(", "txn", ".", "reads", ")", "==", "0", "{", "return", "false", "\n", "}", "\n", "for", "_", ",", "ro", ":=", "range", "txn", ".", "reads", "{", "// A commit at the read timestamp is expected.", "// But, any commit after the read timestamp should cause a conflict.", "if", "<mask>", ",", "has", ":=", "o", ".", "commits", "[", "ro", "]", ";", "has", "&&", "ts", ">", "txn", ".", "readTs", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]