id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
15,500
all-15501
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FontFamilies", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage49", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
15,501
all-15502
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertGraphDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "a", "!=", "nil", "&&", "a", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
15,502
all-15503
[ "double", "cvContourArea", "(", "const", "CvArr", "*", "contour", "CvSlice", "slice", "=", "CV_WHOLE_SEQ", "int", "oriented", "=", "0", ")" ]
[ "func", "ContourArea", "(", "contour", "*", "Seq", ",", "slice", "Slice", ",", "oriented", "int", ")", "float64", "{", "return", "float64", "(", "C", ".", "cvContourArea", "(", "unsafe", ".", "Pointer", "(", "contour", ")", ",", "(", "C", ".", "CvSlice", ")", "(", "<mask>", ")", ",", "C", ".", "int", "(", "oriented", ")", ")", ")", "\n", "}" ]
15,503
all-15504
[ "DialTimeout", "is", "like", "Dial", "but", "takes", "a", "timeout", ".", "The", "timeout", "includes", "name", "resolution", "if", "required", "." ]
[ "func", "DialTimeout", "(", "ctx", "<mask>", ".", "Context", ",", "protocol", ",", "addr", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "*", "Conn", ",", "error", ")", "{", "conn", ",", "err", ":=", "net", ".", "DialTimeout", "(", "protocol", ",", "addr", ",", "timeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "Conn", "{", "conn", "}", ",", "nil", "\n", "}" ]
15,504
all-15505
[ "Merge", "the", "gossiped", "data", "represented", "by", "buf", "into", "our", "state", ".", "Return", "the", "state", "information", "that", "was", "modified", "." ]
[ "func", "(", "p", "*", "peer", ")", "OnGossip", "(", "buf", "[", "]", "byte", ")", "(", "delta", "mesh", ".", "GossipData", ",", "err", "error", ")", "{", "var", "<mask>", "map", "[", "mesh", ".", "PeerName", "]", "int", "\n", "if", "err", ":=", "gob", ".", "NewDecoder", "(", "bytes", ".", "NewReader", "(", "buf", ")", ")", ".", "Decode", "(", "&", "set", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "delta", "=", "p", ".", "st", ".", "mergeDelta", "(", "set", ")", "\n", "if", "delta", "==", "nil", "{", "p", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "set", ",", "delta", ")", "\n", "}", "else", "{", "p", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "set", ",", "delta", ".", "(", "*", "state", ")", ".", "set", ")", "\n", "}", "\n", "return", "delta", ",", "nil", "\n", "}" ]
15,505
all-15506
[ "djb2", "with", "better", "shuffling", ".", "5x", "faster", "than", "FNV", "with", "the", "hash", ".", "Hash", "overhead", "." ]
[ "func", "djb33", "(", "seed", "uint32", ",", "k", "string", ")", "uint32", "{", "var", "(", "l", "=", "uint32", "(", "len", "(", "k", ")", ")", "\n", "d", "=", "5381", "+", "seed", "+", "l", "\n", "i", "=", "uint32", "(", "0", ")", "\n", ")", "\n", "// Why is all this 5x faster than a for loop?", "if", "l", ">=", "4", "{", "for", "i", "<", "l", "-", "4", "{", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "1", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "2", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "3", "]", ")", "\n", "i", "+=", "4", "\n", "}", "\n", "}", "\n", "switch", "l", "-", "i", "{", "case", "1", ":", "case", "2", ":", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "]", ")", "\n", "<mask>", "3", ":", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "1", "]", ")", "\n", "case", "4", ":", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "1", "]", ")", "\n", "d", "=", "(", "d", "*", "33", ")", "^", "uint32", "(", "k", "[", "i", "+", "2", "]", ")", "\n", "}", "\n", "return", "d", "^", "(", "d", ">>", "16", ")", "\n", "}" ]
15,506
all-15507
[ "Calculates", "the", "per", "-", "element", "bit", "-", "wise", "conjunction", "of", "an", "array", "and", "a", "scalar", "." ]
[ "func", "AndScalar", "(", "src", "*", "IplImage", ",", "value", "Scalar", ",", "dst", "*", "IplImage", ")", "{", "AndScalarWithMask", "(", "src", ",", "<mask>", ",", "dst", ",", "nil", ")", "\n", "}" ]
15,507
all-15508
[ "HasClientCertificate", "will", "return", "true", "if", "a", "client", "certificate", "has", "already", "been", "generated" ]
[ "func", "(", "c", "*", "Config", ")", "HasClientCertificate", "(", ")", "bool", "{", "certf", ":=", "c", ".", "ConfigPath", "(", "\"", "\"", ")", "\n", "keyf", ":=", "c", ".", "ConfigPath", "(", "\"", "\"", ")", "\n", "if", "!", "<mask>", ".", "PathExists", "(", "certf", ")", "||", "!", "shared", ".", "PathExists", "(", "keyf", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
15,508
all-15509
[ "HasUnit", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "p", "*", "Period", ")", "HasUnit", "(", ")", "bool", "{", "if", "p", "!=", "nil", "&&", "p", ".", "Unit", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
15,509
all-15510
[ "Result", "returns", "the", "first", "result", "or", "nil", "." ]
[ "func", "(", "qr", "*", "QueryResponse", ")", "<mask>", "(", ")", "QueryResult", "{", "if", "len", "(", "qr", ".", "ResultList", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "return", "qr", ".", "ResultList", "[", "0", "]", "\n", "}" ]
15,510
all-15511
[ "rootedIn", "returns", "a", "root", "if", "the", "file", "split", "in", "parts", "is", "rooted", "in", "root", "." ]
[ "func", "rootedIn", "(", "root", "string", ",", "parts", "[", "]", "string", ")", "string", "{", "//log.Printf(\"rootIn(%s, %v)\", root, parts)", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "parts", ")", ";", "i", "++", "{", "suffix", ":=", "filepath", ".", "Join", "(", "<mask>", "[", "i", ":", "]", "...", ")", "\n", "if", "isFile", "(", "filepath", ".", "Join", "(", "root", ",", "suffix", ")", ")", "{", "return", "filepath", ".", "Join", "(", "parts", "[", ":", "i", "]", "...", ")", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
15,511
all-15512
[ "/", "*", "GetAppsAppRoutes", "gets", "route", "list", "by", "app", "name" ]
[ "func", "(", "a", "*", "Client", ")", "GetAppsAppRoutes", "(", "params", "*", "GetAppsAppRoutesParams", ")", "(", "*", "GetAppsAppRoutesOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewGetAppsAppRoutesParams", "(", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "GetAppsAppRoutesReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "<mask>", ":", "params", ".", "Context", ",", "Client", ":", "params", ".", "HTTPClient", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "GetAppsAppRoutesOK", ")", ",", "nil", "\n\n", "}" ]
15,512
all-15513
[ "Register", "registers", "a", "new", "instrument", "." ]
[ "func", "(", "r", "*", "Registry", ")", "Register", "(", "name", "string", ",", "tags", "[", "]", "string", ",", "v", "interface", "{", "}", ")", "{", "switch", "v", ".", "(", "type", ")", "{", "<mask>", "Discrete", ",", "Sample", ":", "key", ":=", "MetricID", "(", "name", ",", "tags", ")", "\n", "r", ".", "mutex", ".", "Lock", "(", ")", "\n", "r", ".", "instruments", "[", "key", "]", "=", "v", "\n", "r", ".", "mutex", ".", "Unlock", "(", ")", "\n", "}", "\n", "}" ]
15,513
all-15514
[ "Render", "a", "status", "code", "and", "render", ".", "Renderer", "to", "the", "associated", "Response", ".", "The", "request", "parameters", "will", "be", "made", "available", "to", "the", "render", ".", "Renderer", "{{", ".", "params", "}}", ".", "Any", "values", "set", "onto", "the", "Context", "will", "also", "automatically", "be", "made", "available", "to", "the", "render", ".", "Renderer", ".", "To", "render", "no", "content", "pass", "in", "a", "nil", "render", ".", "Renderer", "." ]
[ "func", "(", "d", "*", "DefaultContext", ")", "Render", "(", "status", "int", ",", "rr", "render", ".", "Renderer", ")", "error", "{", "start", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "func", "(", ")", "{", "d", ".", "LogField", "(", "\"", "\"", ",", "time", ".", "Since", "(", "start", ")", ")", "\n", "}", "(", ")", "\n", "if", "rr", "!=", "nil", "{", "data", ":=", "d", ".", "Data", "(", ")", "\n", "pp", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "d", ".", "params", "{", "pp", "[", "k", "]", "=", "v", "[", "0", "]", "\n", "}", "\n", "data", "[", "\"", "\"", "]", "=", "pp", "\n", "data", "[", "\"", "\"", "]", "=", "d", ".", "Flash", "(", ")", ".", "data", "\n", "data", "[", "\"", "\"", "]", "=", "d", ".", "Session", "(", ")", "\n", "data", "[", "\"", "\"", "]", "=", "d", ".", "Request", "(", ")", "\n", "data", "[", "\"", "\"", "]", "=", "status", "\n", "bb", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n\n", "err", ":=", "rr", ".", "Render", "(", "bb", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "if", "er", ",", "<mask>", ":=", "errors", ".", "Cause", "(", "err", ")", ".", "(", "render", ".", "ErrRedirect", ")", ";", "ok", "{", "return", "d", ".", "Redirect", "(", "er", ".", "Status", ",", "er", ".", "URL", ")", "\n", "}", "\n", "return", "HTTPError", "{", "Status", ":", "500", ",", "Cause", ":", "err", "}", "\n", "}", "\n\n", "if", "d", ".", "Session", "(", ")", "!=", "nil", "{", "d", ".", "Flash", "(", ")", ".", "Clear", "(", ")", "\n", "d", ".", "Flash", "(", ")", ".", "persist", "(", "d", ".", "Session", "(", ")", ")", "\n", "}", "\n\n", "d", ".", "Response", "(", ")", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "rr", ".", "ContentType", "(", ")", ")", "\n", "if", "p", ",", "ok", ":=", "data", "[", "\"", "\"", "]", ".", "(", "paginable", ")", ";", "ok", "{", "d", ".", "Response", "(", ")", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "p", ".", "Paginate", "(", ")", ")", "\n", "}", "\n", "d", ".", "Response", "(", ")", ".", "WriteHeader", "(", "status", ")", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "d", ".", "Response", "(", ")", ",", "bb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "HTTPError", "{", "Status", ":", "500", ",", "Cause", ":", "err", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n", "d", ".", "Response", "(", ")", ".", "WriteHeader", "(", "status", ")", "\n", "return", "nil", "\n", "}" ]
15,514
all-15515
[ "Write", "serializes", "the", "command", "to", "the", "given", "buffered", "output", "satisfies", "the", "Command", "interface", "." ]
[ "func", "(", "c", "Rdy", ")", "Write", "(", "w", "*", "bufio", ".", "<mask>", ")", "(", "err", "error", ")", "{", "if", "_", ",", "err", "=", "w", ".", "WriteString", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "err", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "b", ":=", "strconv", ".", "AppendUint", "(", "make", "(", "[", "]", "byte", ",", "0", ",", "64", ")", ",", "uint64", "(", "c", ".", "Count", ")", ",", "10", ")", "\n", "b", "=", "append", "(", "b", ",", "'\\n'", ")", "\n\n", "if", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", ";", "err", "!=", "nil", "{", "err", "=", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "return", "\n", "}" ]
15,515
all-15516
[ "Inject", "belongs", "to", "the", "Tracer", "interface", "." ]
[ "func", "(", "t", "*", "MockTracer", ")", "Inject", "(", "<mask>", "opentracing", ".", "SpanContext", ",", "format", "interface", "{", "}", ",", "carrier", "interface", "{", "}", ")", "error", "{", "spanContext", ",", "ok", ":=", "sm", ".", "(", "MockSpanContext", ")", "\n", "if", "!", "ok", "{", "return", "opentracing", ".", "ErrInvalidCarrier", "\n", "}", "\n", "injector", ",", "ok", ":=", "t", ".", "injectors", "[", "format", "]", "\n", "if", "!", "ok", "{", "return", "opentracing", ".", "ErrUnsupportedFormat", "\n", "}", "\n", "return", "injector", ".", "Inject", "(", "spanContext", ",", "carrier", ")", "\n", "}" ]
15,516
all-15517
[ "checkExistingLabels", "will", "check", "the", "provided", "PR", "for", "the", "dco", "sign", "off", "labels", "returning", "bool", "s", "indicating", "whether", "the", "yes", "and", "the", "no", "label", "are", "present", "." ]
[ "func", "checkExistingLabels", "(", "gc", "gitHubClient", ",", "l", "*", "logrus", ".", "Entry", ",", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "hasYesLabel", ",", "hasNoLabel", "bool", ",", "err", "error", ")", "{", "labels", ",", "err", ":=", "gc", ".", "GetIssueLabels", "(", "org", ",", "repo", ",", "number", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "l", ":=", "<mask>", "labels", "{", "if", "l", ".", "Name", "==", "dcoYesLabel", "{", "hasYesLabel", "=", "true", "\n", "}", "\n", "if", "l", ".", "Name", "==", "dcoNoLabel", "{", "hasNoLabel", "=", "true", "\n", "}", "\n", "}", "\n\n", "return", "hasYesLabel", ",", "hasNoLabel", ",", "nil", "\n", "}" ]
15,517
all-15518
[ "GetStrv", "is", "a", "wrapper", "around", "g_settings_get_strv", "()", "." ]
[ "func", "(", "v", "*", "Settings", ")", "GetStrv", "(", "<mask>", "string", ")", "[", "]", "string", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "name", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n", "return", "toGoStringArray", "(", "C", ".", "g_settings_get_strv", "(", "v", ".", "native", "(", ")", ",", "cstr1", ")", ")", "\n", "}" ]
15,518
all-15519
[ "ApplyChanges", "applies", "the", "given", "changes", ".", "Returns", "nil", "if", "the", "operation", "was", "successful", "or", "an", "error", "if", "the", "operation", "failed", "." ]
[ "func", "(", "p", "*", "AlibabaCloudProvider", ")", "ApplyChanges", "(", "changes", "*", "<mask>", ".", "Changes", ")", "error", "{", "if", "changes", "==", "nil", "||", "len", "(", "changes", ".", "Create", ")", "+", "len", "(", "changes", ".", "Delete", ")", "+", "len", "(", "changes", ".", "UpdateNew", ")", "==", "0", "{", "// No op", "return", "nil", "\n", "}", "\n\n", "if", "p", ".", "privateZone", "{", "return", "p", ".", "applyChangesForPrivateZone", "(", "changes", ")", "\n", "}", "\n", "return", "p", ".", "applyChangesForDNS", "(", "changes", ")", "\n", "}" ]
15,519
all-15520
[ "PopulateASMAuthData", "sets", "docker", "auth", "credentials", "for", "a", "container" ]
[ "func", "(", "task", "*", "Task", ")", "PopulateASMAuthData", "(", "container", "*", "apicontainer", ".", "Container", ")", "error", "{", "secretID", ":=", "container", ".", "RegistryAuthentication", ".", "ASMAuthData", ".", "CredentialsParameter", "\n", "resource", ",", "ok", ":=", "<mask>", ".", "getASMAuthResource", "(", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "// This will cause a panic if the resource is not of ASMAuthResource type.", "// But, it's better to panic as we should have never reached condition", "// unless we released an agent without any testing around that code path", "asmResource", ":=", "resource", "[", "0", "]", ".", "(", "*", "asmauth", ".", "ASMAuthResource", ")", "\n", "dac", ",", "ok", ":=", "asmResource", ".", "GetASMDockerAuthConfig", "(", "secretID", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "secretID", ")", "\n", "}", "\n", "container", ".", "SetASMDockerAuthConfig", "(", "dac", ")", "\n", "return", "nil", "\n", "}" ]
15,520
all-15521
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetCustomObjectFormatterEnabledParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
15,521
all-15522
[ "NetworkOptionGroupLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "NetworkOptionGroupLocator", "(", "href", "<mask>", ")", "*", "NetworkOptionGroupLocator", "{", "return", "&", "NetworkOptionGroupLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
15,522
all-15523
[ "SetPaperSize", "()", "is", "a", "wrapper", "around", "gtk_page_setup_set_paper_size", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "SetPaperSize", "(", "size", "*", "PaperSize", ")", "{", "C", ".", "gtk_page_setup_set_paper_size", "(", "ps", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
15,523
all-15524
[ "Debugf", "records", "the", "log", "with", "debug", "level" ]
[ "func", "(", "l", "*", "Logger", ")", "Debugf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Output", "(", "2", ",", "LevelDebug", ",", "fmt", ".", "Sprintf", "(", "<mask>", ",", "args", "...", ")", ")", "\n", "}" ]
15,524
all-15525
[ "NewGroup", "creates", "and", "returns", "a", "new", "group", "." ]
[ "func", "NewGroup", "(", ")", "*", "Group", "{", "return", "&", "Group", "{", "controllers", ":", "<mask>", "(", "map", "[", "string", "]", "*", "Controller", ")", ",", "actions", ":", "make", "(", "map", "[", "string", "]", "*", "GroupAction", ")", ",", "}", "\n", "}" ]
15,525
all-15526
[ "GenerateCode", "takes", "the", "objects", "loaded", "into", "memory", "in", "LoadAPIs", "and", "writes", "them", "out", "as", "go", "code", "." ]
[ "func", "(", "apiDefs", "APIDefinitions", ")", "GenerateCode", "(", "goOutputDir", ",", "modelData", "string", ",", "downloaded", "time", ".", "Time", ")", "{", "downloadedTime", "=", "downloaded", "\n", "for", "i", ":=", "range", "apiDefs", "{", "apiDefs", "[", "i", "]", ".", "PackageName", "=", "\"", "\"", "+", "strings", ".", "ToLower", "(", "apiDefs", "[", "i", "]", ".", "Data", ".", "Name", "(", ")", ")", "\n", "// Used throughout docs, and also methods that use the class, we need a", "// variable name to be used when referencing the go type. It should not", "// clash with either the package name or the go type of the principle", "// member of the package (e.g. awsprovisioner.AwsProvisioner). We'll", "// lowercase the name (e.g. awsProvisioner) and if that clashes with", "// either package or principle member, we'll just use my<Name>. This", "// results in e.g. `var myQueue queue.Queue`, but `var awsProvisioner", "// awsprovisioner.AwsProvisioner`.", "apiDefs", "[", "i", "]", ".", "ExampleVarName", "=", "strings", ".", "ToLower", "(", "string", "(", "apiDefs", "[", "i", "]", ".", "Data", ".", "Name", "(", ")", "[", "0", "]", ")", ")", "+", "apiDefs", "[", "i", "]", ".", "Data", ".", "Name", "(", ")", "[", "1", ":", "]", "\n", "if", "apiDefs", "[", "i", "]", ".", "ExampleVarName", "==", "apiDefs", "[", "i", "]", ".", "Data", ".", "Name", "(", ")", "||", "apiDefs", "[", "i", "]", ".", "ExampleVarName", "==", "apiDefs", "[", "i", "]", ".", "PackageName", "{", "apiDefs", "[", "i", "]", ".", "ExampleVarName", "=", "\"", "\"", "+", "apiDefs", "[", "i", "]", ".", "Data", ".", "Name", "(", ")", "\n", "}", "\n", "apiDefs", "[", "i", "]", ".", "PackagePath", "=", "filepath", ".", "Join", "(", "goOutputDir", ",", "apiDefs", "[", "i", "]", ".", "PackageName", ")", "\n", "err", "=", "os", ".", "MkdirAll", "(", "apiDefs", "[", "i", "]", ".", "PackagePath", ",", "0755", ")", "\n", "exitOnFail", "(", "err", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "apiDefs", "[", "i", "]", ".", "PackageName", ")", "\n", "job", ":=", "&", "jsonschema2go", ".", "<mask>", "{", "Package", ":", "apiDefs", "[", "i", "]", ".", "PackageName", ",", "URLs", ":", "apiDefs", "[", "i", "]", ".", "schemaURLs", ",", "ExportTypes", ":", "true", ",", "TypeNameBlacklist", ":", "apiDefs", "[", "i", "]", ".", "members", ",", "DisableNestedStructs", ":", "true", ",", "}", "\n", "result", ",", "err", ":=", "job", ".", "Execute", "(", ")", "\n", "exitOnFail", "(", "err", ")", "\n\n", "apiDefs", "[", "i", "]", ".", "schemas", "=", "result", ".", "SchemaSet", "\n", "typesSourceFile", ":=", "filepath", ".", "Join", "(", "apiDefs", "[", "i", "]", ".", "PackagePath", ",", "\"", "\"", ")", "\n", "FormatSourceAndSave", "(", "typesSourceFile", ",", "result", ".", "SourceCode", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "job", ".", "Package", ")", "\n", "content", ":=", "`\n// The following code is AUTO-GENERATED. Please DO NOT edit.\n// To update this generated code, run the following command:\n// in the /codegenerator/model subdirectory of this project,\n// making sure that `", "+", "\"", "\"", "+", "`:\n//\n// go install && go generate\n//\n// This package was generated from the schema defined at\n// `", "+", "apiDefs", "[", "i", "]", ".", "URL", "+", "`\n\n`", "\n", "content", "+=", "apiDefs", "[", "i", "]", ".", "generateAPICode", "(", ")", "\n", "sourceFile", ":=", "filepath", ".", "Join", "(", "apiDefs", "[", "i", "]", ".", "PackagePath", ",", "apiDefs", "[", "i", "]", ".", "PackageName", "+", "\"", "\"", ")", "\n", "FormatSourceAndSave", "(", "sourceFile", ",", "[", "]", "byte", "(", "content", ")", ")", "\n", "}", "\n\n", "content", ":=", "\"", "\"", "+", "strconv", ".", "FormatInt", "(", "downloadedTime", ".", "Unix", "(", ")", ",", "10", ")", "+", "\"", "\\n", "\"", "\n", "content", "+=", "\"", "\\n", "\"", "\n", "content", "+=", "\"", "\\n", "\"", "\n", "content", "+=", "\"", "\\n", "\"", "\n", "for", "i", ":=", "range", "apiDefs", "{", "content", "+=", "text", ".", "Underline", "(", "apiDefs", "[", "i", "]", ".", "URL", ")", "\n", "content", "+=", "apiDefs", "[", "i", "]", ".", "Data", ".", "String", "(", ")", "+", "\"", "\\n", "\\n", "\"", "\n", "for", "_", ",", "url", ":=", "range", "apiDefs", "[", "i", "]", ".", "schemas", ".", "SortedSanitizedURLs", "(", ")", "{", "content", "+=", "text", ".", "Underline", "(", "url", ")", "\n", "content", "+=", "apiDefs", "[", "i", "]", ".", "schemas", ".", "SubSchema", "(", "url", ")", ".", "String", "(", ")", "+", "\"", "\\n", "\\n", "\"", "\n", "}", "\n", "}", "\n", "exitOnFail", "(", "ioutil", ".", "WriteFile", "(", "modelData", ",", "[", "]", "byte", "(", "content", ")", ",", "0644", ")", ")", "\n", "}" ]
15,526
all-15527
[ "SysColor", "returns", "attribute", "by", "its", "id", "for", "the", "current", "theme", ".", "The", "method", "panics", "if", "theme", "loop", "is", "detected", "-", "check", "if", "parent", "attribute", "is", "correct" ]
[ "func", "SysColor", "(", "<mask>", "string", ")", "term", ".", "Attribute", "{", "thememtx", ".", "RLock", "(", ")", "\n", "sch", ",", "ok", ":=", "themeManager", ".", "themes", "[", "themeManager", ".", "current", "]", "\n", "if", "!", "ok", "{", "sch", "=", "themeManager", ".", "themes", "[", "defaultTheme", "]", "\n", "}", "\n", "thememtx", ".", "RUnlock", "(", ")", "\n\n", "clr", ",", "okclr", ":=", "sch", ".", "colors", "[", "color", "]", "\n", "if", "!", "okclr", "{", "visited", ":=", "make", "(", "map", "[", "string", "]", "int", ",", "0", ")", "\n", "visited", "[", "themeManager", ".", "current", "]", "=", "1", "\n", "if", "!", "ok", "{", "visited", "[", "defaultTheme", "]", "=", "1", "\n", "}", "\n\n", "for", "{", "if", "sch", ".", "parent", "==", "\"", "\"", "{", "break", "\n", "}", "\n", "themeManager", ".", "loadTheme", "(", "sch", ".", "parent", ")", "\n", "thememtx", ".", "RLock", "(", ")", "\n", "sch", "=", "themeManager", ".", "themes", "[", "sch", ".", "parent", "]", "\n", "clr", ",", "okclr", "=", "sch", ".", "colors", "[", "color", "]", "\n", "thememtx", ".", "RUnlock", "(", ")", "\n\n", "if", "ok", "{", "break", "\n", "}", "else", "{", "if", "_", ",", "okSch", ":=", "visited", "[", "sch", ".", "parent", "]", ";", "okSch", "{", "panic", "(", "\"", "\"", "+", "color", "+", "\"", "\"", "+", "sch", ".", "title", "+", "\"", "\"", "+", "sch", ".", "parent", ")", "\n", "}", "else", "{", "visited", "[", "sch", ".", "parent", "]", "=", "1", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "clr", "\n", "}" ]
15,527
all-15528
[ "Type", "returns", "the", "type", "of", "the", "update", "." ]
[ "func", "(", "u", "*", "Update", ")", "Type", "(", ")", "UpdateType", "{", "if", "u", ".", "<mask>", "!=", "nil", "{", "return", "MessageUpdate", "\n", "}", "else", "if", "u", ".", "InlineQuery", "!=", "nil", "{", "return", "InlineQueryUpdate", "\n", "}", "else", "if", "u", ".", "ChosenInlineResult", "!=", "nil", "{", "return", "ChosenInlineResultUpdate", "\n", "}", "\n", "return", "UnknownUpdate", "\n", "}" ]
15,528
all-15529
[ "FromUUID", "locates", "a", "virtualMachine", "by", "its", "UUID", "." ]
[ "func", "FromUUID", "(", "client", "*", "govmomi", ".", "Client", ",", "uuid", "string", ")", "(", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "uuid", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "var", "result", "object", ".", "Reference", "\n", "var", "err", "error", "\n", "version", ":=", "viapi", ".", "ParseVersionFromClient", "(", "client", ")", "\n", "expected", ":=", "vmUUIDSearchIndexVersion", "\n", "expected", ".", "Product", "=", "version", ".", "Product", "\n", "if", "version", ".", "Older", "(", "expected", ")", "{", "result", ",", "err", "=", "virtualMachineFromContainerView", "(", "ctx", ",", "client", ",", "uuid", ")", "\n", "}", "else", "{", "result", ",", "err", "=", "virtualMachineFromSearchIndex", "(", "ctx", ",", "client", ",", "uuid", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// We need to filter our object through finder to ensure that the", "// InventoryPath field is populated, or else functions that depend on this", "// being present will fail.", "finder", ":=", "find", ".", "NewFinder", "(", "client", ".", "Client", ",", "false", ")", "\n\n", "vm", ",", "err", ":=", "<mask>", ".", "ObjectReference", "(", "ctx", ",", "result", ".", "Reference", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Should be safe to return here. If our reference returned here and is not a", "// VM, then we have bigger problems and to be honest we should be panicking", "// anyway.", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "(", "*", "object", ".", "VirtualMachine", ")", ".", "InventoryPath", ",", "uuid", ")", "\n", "return", "vm", ".", "(", "*", "object", ".", "VirtualMachine", ")", ",", "nil", "\n", "}" ]
15,529
all-15530
[ "FromQueryResult", "unpacks", "a", "QueryResult", "proto", "." ]
[ "func", "FromQueryResult", "(", "res", "*", "prompb", ".", "QueryResult", ")", "storage", ".", "SeriesSet", "{", "series", ":=", "make", "(", "[", "]", "<mask>", ".", "Series", ",", "0", ",", "len", "(", "res", ".", "Timeseries", ")", ")", "\n", "for", "_", ",", "ts", ":=", "range", "res", ".", "Timeseries", "{", "labels", ":=", "labelProtosToLabels", "(", "ts", ".", "Labels", ")", "\n", "if", "err", ":=", "validateLabelsAndMetricName", "(", "labels", ")", ";", "err", "!=", "nil", "{", "return", "errSeriesSet", "{", "err", ":", "err", "}", "\n", "}", "\n\n", "series", "=", "append", "(", "series", ",", "&", "concreteSeries", "{", "labels", ":", "labels", ",", "samples", ":", "ts", ".", "Samples", ",", "}", ")", "\n", "}", "\n", "sort", ".", "Sort", "(", "byLabel", "(", "series", ")", ")", "\n", "return", "&", "concreteSeriesSet", "{", "series", ":", "series", ",", "}", "\n", "}" ]
15,530
all-15531
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventNeedsBeginFramesChanged", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
15,531
all-15532
[ "Redirect", "from", "one", "URL", "to", "another", "URL", ".", "Only", "works", "for", "GET", "requests", "." ]
[ "func", "(", "a", "*", "App", ")", "Redirect", "(", "status", "int", ",", "from", ",", "to", "string", ")", "*", "RouteInfo", "{", "return", "a", ".", "<mask>", "(", "from", ",", "func", "(", "c", "Context", ")", "error", "{", "return", "c", ".", "Redirect", "(", "status", ",", "to", ")", "\n", "}", ")", "\n", "}" ]
15,532
all-15533
[ "GetMustShowHitsOk", "returns", "a", "tuple", "with", "the", "MustShowHits", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetMustShowHitsOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "MustShowHits", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "MustShowHits", ",", "true", "\n", "}" ]
15,533
all-15534
[ "GetAppMesh", "returns", "the", "app", "mesh", "config", "of", "the", "task" ]
[ "func", "(", "task", "*", "Task", ")", "GetAppMesh", "(", ")", "*", "apiappmesh", ".", "AppMesh", "{", "task", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "task", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "return", "task", ".", "AppMesh", "\n", "}" ]
15,534
all-15535
[ "RemoveHandler", "removes", "a", "function", "to", "be", "called", "whenever", "an", "event", "is", "received" ]
[ "func", "(", "op", "*", "operation", ")", "RemoveHandler", "(", "<mask>", "*", "EventTarget", ")", "error", "{", "// Make sure we're not racing with ourselves", "op", ".", "handlerLock", ".", "Lock", "(", ")", "\n", "defer", "op", ".", "handlerLock", ".", "Unlock", "(", ")", "\n\n", "// If the listener is gone, just return", "if", "op", ".", "listener", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "return", "op", ".", "listener", ".", "RemoveHandler", "(", "target", ")", "\n", "}" ]
15,535
all-15536
[ "StatusEventHandlers", "returns", "a", "map", "of", "plugin", "names", "to", "handlers", "for", "the", "repo", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "StatusEventHandlers", "(", "owner", ",", "repo", "string", ")", "map", "[", "string", "]", "StatusEventHandler", "{", "pa", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "pa", ".", "mut", ".", "Unlock", "(", ")", "\n\n", "hs", ":=", "map", "[", "string", "]", "StatusEventHandler", "{", "}", "\n", "for", "_", ",", "p", ":=", "<mask>", "pa", ".", "getPlugins", "(", "owner", ",", "repo", ")", "{", "if", "h", ",", "ok", ":=", "statusEventHandlers", "[", "p", "]", ";", "ok", "{", "hs", "[", "p", "]", "=", "h", "\n", "}", "\n", "}", "\n\n", "return", "hs", "\n", "}" ]
15,536
all-15537
[ "title", ":", "remove", "service", "instance", "path", ":", "/", "services", "/", "{", "name", "}", "/", "instances", "/", "{", "instance", "}", "method", ":", "DELETE", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Service", "removed", "400", ":", "Bad", "request", "401", ":", "Unauthorized", "404", ":", "Service", "instance", "not", "found" ]
[ "func", "removeServiceInstance", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "unbindAll", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "serviceName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "instanceName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "serviceInstance", ",", "err", ":=", "getServiceInstanceOrError", "(", "serviceName", ",", "instanceName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermServiceInstanceDelete", ",", "contextsForServiceInstance", "(", "serviceInstance", ",", "serviceName", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "<mask>", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "serviceInstanceTarget", "(", "serviceName", ",", "instanceName", ")", ",", "Kind", ":", "permission", ".", "PermServiceInstanceDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermServiceInstanceReadEvents", ",", "contextsForServiceInstance", "(", "serviceInstance", ",", "serviceName", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "requestID", ":=", "requestIDHeader", "(", "r", ")", "\n", "unbindAllBool", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "unbindAll", ")", "\n", "if", "unbindAllBool", "{", "if", "len", "(", "serviceInstance", ".", "Apps", ")", ">", "0", "{", "for", "_", ",", "appName", ":=", "range", "serviceInstance", ".", "Apps", "{", "_", ",", "app", ",", "instErr", ":=", "getServiceInstance", "(", "serviceInstance", ".", "ServiceName", ",", "serviceInstance", ".", "Name", ",", "appName", ")", "\n", "if", "instErr", "!=", "nil", "{", "return", "instErr", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "evt", ",", "\"", "\\n", "\"", ",", "app", ".", "GetName", "(", ")", ")", "\n", "instErr", "=", "serviceInstance", ".", "UnbindApp", "(", "service", ".", "UnbindAppArgs", "{", "App", ":", "app", ",", "Restart", ":", "true", ",", "ForceRemove", ":", "false", ",", "Event", ":", "evt", ",", "RequestID", ":", "requestID", ",", "}", ")", "\n", "if", "instErr", "!=", "nil", "{", "return", "instErr", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "evt", ",", "\"", "\\n", "\\n", "\"", ",", "serviceInstance", ".", "Name", ",", "app", ".", "GetName", "(", ")", ")", "\n", "}", "\n", "serviceInstance", ",", "err", "=", "getServiceInstanceOrError", "(", "serviceName", ",", "instanceName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "err", "=", "service", ".", "DeleteInstance", "(", "serviceInstance", ",", "evt", ",", "requestID", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "service", ".", "ErrServiceInstanceBound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Message", ":", "errors", ".", "Wrapf", "(", "err", ",", "`Applications bound to the service \"%s\": \"%s\"`", "+", "\"", "\\n", "\"", ",", "instanceName", ",", "strings", ".", "Join", "(", "serviceInstance", ".", "Apps", ",", "\"", "\"", ")", ")", ".", "Error", "(", ")", ",", "Code", ":", "http", ".", "StatusBadRequest", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "evt", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ")", "\n", "return", "nil", "\n", "}" ]
15,537
all-15538
[ "<unqualified", "-", "name", ">", "::", "=", "<operator", "-", "name", ">", "::", "=", "<ctor", "-", "dtor", "-", "name", ">", "::", "=", "<source", "-", "name", ">", "::", "=", "<local", "-", "source", "-", "name", ">", "<local", "-", "source", "-", "name", ">", "::", "=", "L", "<source", "-", "name", ">", "<discriminator", ">" ]
[ "func", "(", "st", "*", "state", ")", "unqualifiedName", "(", ")", "(", "r", "AST", ",", "isCast", "bool", ")", "{", "if", "len", "(", "st", ".", "str", ")", "<", "1", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "a", "AST", "\n", "isCast", "=", "false", "\n", "c", ":=", "st", ".", "str", "[", "0", "]", "\n", "if", "isDigit", "(", "c", ")", "{", "a", "=", "st", ".", "sourceName", "(", ")", "\n", "}", "else", "if", "isLower", "(", "c", ")", "{", "a", ",", "_", "=", "st", ".", "operatorName", "(", "false", ")", "\n", "if", "_", ",", "ok", ":=", "a", ".", "(", "*", "Cast", ")", ";", "ok", "{", "isCast", "=", "true", "\n", "}", "\n", "if", "op", ",", "ok", ":=", "a", ".", "(", "*", "Operator", ")", ";", "ok", "&&", "op", ".", "Name", "==", "`operator\"\" `", "{", "n", ":=", "st", ".", "sourceName", "(", ")", "\n", "a", "=", "&", "Unary", "{", "Op", ":", "op", ",", "Expr", ":", "n", ",", "Suffix", ":", "false", ",", "SizeofType", ":", "false", "}", "\n", "}", "\n", "}", "else", "{", "<mask>", "c", "{", "case", "'C'", ",", "'D'", ":", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "case", "'L'", ":", "st", ".", "advance", "(", "1", ")", "\n", "a", "=", "st", ".", "sourceName", "(", ")", "\n", "a", "=", "st", ".", "discriminator", "(", "a", ")", "\n", "case", "'U'", ":", "if", "len", "(", "st", ".", "str", ")", "<", "2", "{", "st", ".", "advance", "(", "1", ")", "\n", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "c", ":=", "st", ".", "str", "[", "1", "]", "\n", "switch", "c", "{", "case", "'l'", ":", "a", "=", "st", ".", "closureTypeName", "(", ")", "\n", "case", "'t'", ":", "a", "=", "st", ".", "unnamedTypeName", "(", ")", "\n", "default", ":", "st", ".", "advance", "(", "1", ")", "\n", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "default", ":", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "st", ".", "str", ")", ">", "0", "&&", "st", ".", "str", "[", "0", "]", "==", "'B'", "{", "a", "=", "st", ".", "taggedName", "(", "a", ")", "\n", "}", "\n\n", "return", "a", ",", "isCast", "\n", "}" ]
15,538
all-15539
[ "RegisterClusterHandler", "registers", "the", "http", "handlers", "for", "service", "Cluster", "to", "mux", ".", "The", "handlers", "forward", "requests", "to", "the", "grpc", "endpoint", "over", "conn", "." ]
[ "func", "RegisterClusterHandler", "(", "ctx", "context", ".", "<mask>", ",", "mux", "*", "runtime", ".", "ServeMux", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "error", "{", "return", "RegisterClusterHandlerClient", "(", "ctx", ",", "mux", ",", "etcdserverpb", ".", "NewClusterClient", "(", "conn", ")", ")", "\n", "}" ]
15,539
all-15540
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "GetType", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "<mask>", "\n", "}" ]
15,540
all-15541
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventIndexedDBContentUpdated", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage8", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
15,541
all-15542
[ "Out", "returns", "true", "if", "the", "parameter", "field", "is", "an", "output", "field", "." ]
[ "func", "(", "f", "*", "ParameterField", ")", "Out", "(", ")", "bool", "{", "return", "f", ".", "mode", "==", "pmInout", "||", "f", ".", "<mask>", "==", "pmOut", "\n", "}" ]
15,542
all-15543
[ "ProwJobs", "returns", "an", "object", "that", "can", "list", "and", "get", "ProwJobs", "." ]
[ "func", "(", "s", "*", "prowJobLister", ")", "ProwJobs", "(", "namespace", "<mask>", ")", "ProwJobNamespaceLister", "{", "return", "prowJobNamespaceLister", "{", "indexer", ":", "s", ".", "indexer", ",", "namespace", ":", "namespace", "}", "\n", "}" ]
15,543
all-15544
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetKeyframeKeyReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss19", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
15,544
all-15545
[ "Panicf", "records", "the", "log", "with", "fatal", "level", "and", "panics" ]
[ "func", "(", "l", "*", "Logger", ")", "Panicf", "(", "<mask>", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", "\n", "l", ".", "Output", "(", "2", ",", "LevelError", ",", "msg", ")", "\n", "panic", "(", "msg", ")", "\n", "}" ]
15,545
all-15546
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "HexColor", "." ]
[ "func", "(", "h", "*", "HexColor", ")", "DeepCopy", "(", ")", "*", "HexColor", "{", "if", "h", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "HexColor", ")", "\n", "h", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
15,546
all-15547
[ "Subject", "returns", "a", "copy", "of", "MailBuilder", "with", "the", "specified", "Subject", "header", "." ]
[ "func", "(", "p", "MailBuilder", ")", "Subject", "(", "subject", "string", ")", "MailBuilder", "{", "p", ".", "<mask>", "=", "subject", "\n", "return", "p", "\n", "}" ]
15,547
all-15548
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "VersionStatus", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "VersionStatus", "(", "in", ".", "String", "(", ")", ")", "{", "case", "VersionStatusNew", ":", "*", "t", "=", "VersionStatusNew", "\n", "case", "VersionStatusInstalling", ":", "*", "t", "=", "VersionStatusInstalling", "\n", "case", "VersionStatusInstalled", ":", "*", "t", "=", "VersionStatusInstalled", "\n", "case", "VersionStatusActivating", ":", "*", "t", "=", "VersionStatusActivating", "\n", "case", "VersionStatusActivated", ":", "*", "t", "=", "VersionStatusActivated", "\n", "<mask>", "VersionStatusRedundant", ":", "*", "t", "=", "VersionStatusRedundant", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
15,548
all-15549
[ "New", "takes", "a", "configuration", "and", "returns", "a", "configured", "service", "." ]
[ "func", "New", "(", "config", "Config", ")", "(", "Service", ",", "error", ")", "{", "// Dependencies.", "if", "config", ".", "VaultClient", "==", "nil", "{", "return", "nil", ",", "microerror", ".", "Maskf", "(", "invalidConfigError", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "config", ".", "PKIMountpoint", "==", "\"", "\"", "{", "return", "nil", ",", "microerror", ".", "Maskf", "(", "invalidConfigError", ",", "\"", "\"", ")", "\n", "}", "\n\n", "service", ":=", "&", "service", "{", "vaultClient", ":", "config", ".", "VaultClient", ",", "pkiMountpoint", ":", "config", ".", "PKIMountpoint", ",", "}", "\n\n", "return", "<mask>", ",", "nil", "\n", "}" ]
15,549
all-15550
[ "FetchAcknowledgement", "retrieves", "acknowledgement", "with", "passed", "cid", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchAcknowledgement", "(", "cid", "CIDType", ")", "(", "*", "Acknowledgement", ",", "error", ")", "{", "if", "cid", "==", "nil", "||", "*", "cid", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "acknowledgementCID", ":=", "string", "(", "*", "cid", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "AcknowledgementCIDRegex", ",", "acknowledgementCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "acknowledgementCID", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "acknowledgementCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "<mask>", ")", ")", "\n", "}", "\n\n", "acknowledgement", ":=", "&", "Acknowledgement", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "acknowledgement", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "acknowledgement", ",", "nil", "\n", "}" ]
15,550
all-15551
[ "NewWatcher", "creates", "a", "new", "watcher", "using", "the", "given", "API", "client", "." ]
[ "func", "NewWatcher", "(", "i", "*", "NewWatcherInput", ")", "(", "*", "Watcher", ",", "error", ")", "{", "w", ":=", "&", "Watcher", "{", "clients", ":", "i", ".", "Clients", ",", "depViewMap", ":", "make", "(", "map", "[", "string", "]", "*", "View", ")", ",", "dataCh", ":", "make", "(", "chan", "*", "View", ",", "dataBufferSize", ")", ",", "errCh", ":", "<mask>", "(", "chan", "error", ")", ",", "maxStale", ":", "i", ".", "MaxStale", ",", "once", ":", "i", ".", "Once", ",", "retryFuncConsul", ":", "i", ".", "RetryFuncConsul", ",", "retryFuncDefault", ":", "i", ".", "RetryFuncDefault", ",", "retryFuncVault", ":", "i", ".", "RetryFuncVault", ",", "vaultGrace", ":", "i", ".", "VaultGrace", ",", "}", "\n\n", "// Start a watcher for the Vault renew if that config was specified", "if", "i", ".", "RenewVault", "{", "vt", ",", "err", ":=", "dep", ".", "NewVaultTokenQuery", "(", "i", ".", "VaultToken", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "w", ".", "Add", "(", "vt", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "i", ".", "VaultAgentTokenFile", ")", ">", "0", "{", "vag", ",", "err", ":=", "dep", ".", "NewVaultAgentTokenQuery", "(", "i", ".", "VaultAgentTokenFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "w", ".", "Add", "(", "vag", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "return", "w", ",", "nil", "\n", "}" ]
15,551
all-15552
[ "SysObject", "returns", "object", "look", "by", "its", "id", "for", "the", "current", "theme", ".", "E", ".", "g", "border", "lines", "for", "frame", "or", "arrows", "for", "scrollbar", ".", "The", "method", "panics", "if", "theme", "loop", "is", "detected", "-", "check", "if", "parent", "attribute", "is", "correct" ]
[ "func", "SysObject", "(", "object", "string", ")", "string", "{", "thememtx", ".", "RLock", "(", ")", "\n", "sch", ",", "ok", ":=", "themeManager", ".", "themes", "[", "themeManager", ".", "current", "]", "\n", "if", "!", "ok", "{", "sch", "=", "themeManager", ".", "themes", "[", "defaultTheme", "]", "\n", "}", "\n", "thememtx", ".", "RUnlock", "(", ")", "\n\n", "obj", ",", "okobj", ":=", "sch", ".", "objects", "[", "<mask>", "]", "\n", "if", "!", "okobj", "{", "visited", ":=", "make", "(", "map", "[", "string", "]", "int", ",", "0", ")", "\n", "visited", "[", "themeManager", ".", "current", "]", "=", "1", "\n", "if", "!", "ok", "{", "visited", "[", "defaultTheme", "]", "=", "1", "\n", "}", "\n\n", "for", "{", "if", "sch", ".", "parent", "==", "\"", "\"", "{", "break", "\n", "}", "\n\n", "themeManager", ".", "loadTheme", "(", "sch", ".", "parent", ")", "\n", "thememtx", ".", "RLock", "(", ")", "\n", "sch", "=", "themeManager", ".", "themes", "[", "sch", ".", "parent", "]", "\n", "obj", ",", "okobj", "=", "sch", ".", "objects", "[", "object", "]", "\n", "thememtx", ".", "RUnlock", "(", ")", "\n\n", "if", "ok", "{", "break", "\n", "}", "else", "{", "if", "_", ",", "okSch", ":=", "visited", "[", "sch", ".", "parent", "]", ";", "okSch", "{", "panic", "(", "\"", "\"", "+", "object", "+", "\"", "\"", "+", "sch", ".", "title", "+", "\"", "\"", "+", "sch", ".", "parent", ")", "\n", "}", "else", "{", "visited", "[", "sch", ".", "parent", "]", "=", "1", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "obj", "\n", "}" ]
15,552
all-15553
[ "Copy", "returns", "a", "deep", "copy", "of", "this", "configuration", "." ]
[ "func", "(", "c", "*", "ConsulConfig", ")", "Copy", "(", ")", "*", "ConsulConfig", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "var", "o", "ConsulConfig", "\n\n", "o", ".", "Address", "=", "c", ".", "Address", "\n\n", "if", "c", ".", "Auth", "!=", "nil", "{", "o", ".", "Auth", "=", "c", ".", "Auth", ".", "Copy", "(", ")", "\n", "}", "\n\n", "if", "c", ".", "Retry", "!=", "nil", "{", "o", ".", "Retry", "=", "c", ".", "Retry", ".", "Copy", "(", ")", "\n", "}", "\n\n", "if", "c", ".", "SSL", "!=", "nil", "{", "o", ".", "SSL", "=", "c", ".", "SSL", ".", "Copy", "(", ")", "\n", "}", "\n\n", "o", ".", "<mask>", "=", "c", ".", "Token", "\n\n", "if", "c", ".", "Transport", "!=", "nil", "{", "o", ".", "Transport", "=", "c", ".", "Transport", ".", "Copy", "(", ")", "\n", "}", "\n\n", "return", "&", "o", "\n", "}" ]
15,553
all-15554
[ "Do", "executes", "CSS", ".", "getMatchedStylesForNode", "against", "the", "provided", "context", ".", "returns", ":", "inlineStyle", "-", "Inline", "style", "for", "the", "specified", "DOM", "node", ".", "attributesStyle", "-", "Attribute", "-", "defined", "element", "style", "(", "e", ".", "g", ".", "resulting", "from", "width", "=", "20", "height", "=", "100%", ")", ".", "matchedCSSRules", "-", "CSS", "rules", "matching", "this", "node", "from", "all", "applicable", "stylesheets", ".", "pseudoElements", "-", "Pseudo", "style", "matches", "for", "this", "node", ".", "inherited", "-", "A", "chain", "of", "inherited", "styles", "(", "from", "the", "immediate", "node", "parent", "up", "to", "the", "DOM", "tree", "root", ")", ".", "cssKeyframesRules", "-", "A", "list", "of", "CSS", "keyframed", "animations", "matching", "this", "node", "." ]
[ "func", "(", "p", "*", "GetMatchedStylesForNodeParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "inlineStyle", "*", "Style", ",", "attributesStyle", "*", "Style", ",", "matchedCSSRules", "[", "]", "*", "RuleMatch", ",", "pseudoElements", "[", "]", "*", "PseudoElementMatches", ",", "inherited", "[", "]", "*", "InheritedStyleEntry", ",", "cssKeyframesRules", "[", "]", "*", "KeyframesRule", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetMatchedStylesForNodeReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetMatchedStylesForNode", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "InlineStyle", ",", "res", ".", "AttributesStyle", ",", "res", ".", "MatchedCSSRules", ",", "<mask>", ".", "PseudoElements", ",", "res", ".", "Inherited", ",", "res", ".", "CSSKeyframesRules", ",", "nil", "\n", "}" ]
15,554
all-15555
[ "Any", "deleted", "or", "invalid", "versions", "at", "or", "below", "ts", "would", "be", "discarded", "during", "compaction", "to", "reclaim", "disk", "space", "in", "LSM", "tree", "and", "thence", "value", "log", "." ]
[ "func", "(", "o", "*", "oracle", ")", "setDiscardTs", "(", "ts", "uint64", ")", "{", "o", ".", "Lock", "(", ")", "\n", "defer", "o", ".", "Unlock", "(", ")", "\n", "o", ".", "discardTs", "=", "<mask>", "\n", "}" ]
15,555
all-15556
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "TouchPoint", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
15,556
all-15557
[ "ParseAuthHeaders", "parses", "authentication", "headers", "from", "HTTP", "request", "it", "currently", "detects", "Bearer", "and", "Basic", "auth", "types" ]
[ "func", "ParseAuthHeaders", "(", "r", "*", "http", ".", "Request", ")", "(", "*", "AuthCreds", ",", "error", ")", "{", "// according to the doc below oauth 2.0 bearer access token can", "// come with query parameter", "// http://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html#query-param", "// we are going to support this", "if", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "AccessTokenQueryParam", ")", "!=", "\"", "\"", "{", "return", "&", "AuthCreds", "{", "Type", ":", "AuthBearer", ",", "Password", ":", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "AccessTokenQueryParam", ")", ",", "}", ",", "nil", "\n", "}", "\n\n", "authHeader", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "authHeader", "==", "\"", "\"", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "&", "AccessDeniedError", "{", "Message", ":", "\"", "\"", "}", ")", "\n", "}", "\n\n", "auth", ":=", "strings", ".", "SplitN", "(", "authHeader", ",", "\"", "\"", ",", "2", ")", "\n\n", "if", "len", "(", "auth", ")", "!=", "2", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "&", "ParameterError", "{", "Name", ":", "\"", "\"", ",", "Message", ":", "\"", "\"", "}", ")", "\n", "}", "\n\n", "switch", "auth", "[", "0", "]", "{", "case", "AuthBasic", ":", "payload", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "auth", "[", "1", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "<mask>", ".", "Wrap", "(", "&", "ParameterError", "{", "Name", ":", "\"", "\"", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", ")", "\n", "}", "\n", "pair", ":=", "strings", ".", "SplitN", "(", "string", "(", "payload", ")", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "pair", ")", "!=", "2", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "&", "ParameterError", "{", "Name", ":", "\"", "\"", ",", "Message", ":", "\"", "\"", "}", ")", "\n", "}", "\n", "return", "&", "AuthCreds", "{", "Type", ":", "AuthBasic", ",", "Username", ":", "pair", "[", "0", "]", ",", "Password", ":", "pair", "[", "1", "]", "}", ",", "nil", "\n", "case", "AuthBearer", ":", "return", "&", "AuthCreds", "{", "Type", ":", "AuthBearer", ",", "Password", ":", "auth", "[", "1", "]", "}", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "trace", ".", "Wrap", "(", "&", "ParameterError", "{", "Name", ":", "\"", "\"", ",", "Message", ":", "\"", "\"", "}", ")", "\n", "}" ]
15,557
all-15558
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetOuterHTMLParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom2", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
15,558
all-15559
[ "AddImageState", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "AddImageState", "(", "arg0", "*", "<mask>", ".", "ImageState", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
15,559
all-15560
[ "Do", "executes", "Memory", ".", "startSampling", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StartSamplingParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStartSampling", ",", "p", ",", "nil", ")", "\n", "}" ]
15,560
all-15561
[ "terminateDupes", "aborts", "presubmits", "that", "have", "a", "newer", "version", ".", "It", "modifies", "pjs", "in", "-", "place", "when", "it", "aborts", ".", "TODO", ":", "Dry", "this", "out", "-", "need", "to", "ensure", "we", "can", "abstract", "children", "cancellation", "first", "." ]
[ "func", "(", "c", "*", "Controller", ")", "terminateDupes", "(", "pjs", "[", "]", "prowapi", ".", "ProwJob", ",", "pm", "map", "[", "string", "]", "coreapi", ".", "Pod", ")", "error", "{", "<mask>", ":=", "c", ".", "log", ".", "WithField", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "pjutil", ".", "TerminateOlderPresubmitJobs", "(", "c", ".", "kc", ",", "log", ",", "pjs", ",", "func", "(", "toCancel", "prowapi", ".", "ProwJob", ")", "error", "{", "// Allow aborting presubmit jobs for commits that have been superseded by", "// newer commits in GitHub pull requests.", "if", "c", ".", "config", "(", ")", ".", "Plank", ".", "AllowCancellations", "{", "if", "pod", ",", "exists", ":=", "pm", "[", "toCancel", ".", "ObjectMeta", ".", "Name", "]", ";", "exists", "{", "if", "client", ",", "ok", ":=", "c", ".", "pkcs", "[", "toCancel", ".", "ClusterAlias", "(", ")", "]", ";", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "toCancel", ".", "ClusterAlias", "(", ")", ")", "\n", "}", "else", "if", "err", ":=", "client", ".", "DeletePod", "(", "pod", ".", "ObjectMeta", ".", "Name", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
15,561
all-15562
[ "validateCloneSnapshots", "checks", "a", "VM", "to", "make", "sure", "it", "has", "a", "single", "snapshot", "with", "no", "children", "to", "make", "sure", "there", "is", "no", "ambiguity", "when", "selecting", "a", "snapshot", "for", "linked", "clones", "." ]
[ "func", "validateCloneSnapshots", "(", "props", "*", "mo", ".", "VirtualMachine", ")", "error", "{", "if", "props", ".", "Snapshot", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "props", ".", "Config", ".", "Uuid", ")", "\n", "}", "\n", "// Root snapshot list can only have a singular element", "if", "len", "(", "props", ".", "Snapshot", ".", "RootSnapshotList", ")", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "props", ".", "Config", ".", "Uuid", ",", "len", "(", "props", ".", "Snapshot", ".", "RootSnapshotList", ")", ")", "\n", "}", "\n", "// Check to make sure the root snapshot has no children", "if", "len", "(", "props", ".", "Snapshot", ".", "RootSnapshotList", "[", "0", "]", ".", "ChildSnapshotList", ")", ">", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "props", ".", "Config", ".", "Uuid", ")", "\n", "}", "\n", "// Current snapshot must match root snapshot (this should be the case anyway)", "if", "props", ".", "Snapshot", ".", "CurrentSnapshot", ".", "<mask>", "!=", "props", ".", "Snapshot", ".", "RootSnapshotList", "[", "0", "]", ".", "Snapshot", ".", "Value", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "props", ".", "Config", ".", "Uuid", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,562
all-15563
[ "/", "*", "RunInBackground", "makes", "an", "API", "call", "that", "triggers", "an", "/", "_ah", "/", "background", "request", "." ]
[ "func", "init", "(", ")", "{", "<mask>", ".", "HandleFunc", "(", "\"", "\"", ",", "handleBackground", ")", "\n\n", "sc", ":=", "make", "(", "chan", "send", ")", "\n", "rc", ":=", "make", "(", "chan", "recv", ")", "\n", "sendc", ",", "recvc", "=", "sc", ",", "rc", "\n", "go", "matchmaker", "(", "sc", ",", "rc", ")", "\n", "}" ]
15,563
all-15564
[ "ApplyConfig", "removes", "all", "running", "discovery", "providers", "and", "starts", "new", "ones", "using", "the", "provided", "config", "." ]
[ "func", "(", "m", "*", "Manager", ")", "ApplyConfig", "(", "cfg", "map", "[", "string", "]", "sd_config", ".", "ServiceDiscoveryConfig", ")", "error", "{", "m", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "for", "pk", ":=", "range", "m", ".", "targets", "{", "if", "_", ",", "ok", ":=", "cfg", "[", "pk", ".", "setName", "]", ";", "!", "<mask>", "{", "discoveredTargets", ".", "DeleteLabelValues", "(", "m", ".", "name", ",", "pk", ".", "setName", ")", "\n", "}", "\n", "}", "\n", "m", ".", "cancelDiscoverers", "(", ")", "\n", "for", "name", ",", "scfg", ":=", "range", "cfg", "{", "m", ".", "registerProviders", "(", "scfg", ",", "name", ")", "\n", "discoveredTargets", ".", "WithLabelValues", "(", "m", ".", "name", ",", "name", ")", ".", "Set", "(", "0", ")", "\n", "}", "\n", "for", "_", ",", "prov", ":=", "range", "m", ".", "providers", "{", "m", ".", "startProvider", "(", "m", ".", "ctx", ",", "prov", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
15,564
all-15565
[ "addHostOnlyDHCPServer", "adds", "a", "DHCP", "server", "to", "a", "host", "-", "only", "network", "." ]
[ "func", "addHostOnlyDHCPServer", "(", "ifname", "string", ",", "d", "dhcpServer", ",", "vbox", "VBoxManager", ")", "error", "{", "name", ":=", "dhcpPrefix", "+", "ifname", "\n\n", "dhcps", ",", "err", ":=", "listDHCPServers", "(", "vbox", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// On some platforms (OSX), creating a host-only adapter adds a default dhcpserver,", "// while on others (Windows?) it does not.", "command", ":=", "\"", "\"", "\n", "if", "dhcp", ",", "ok", ":=", "dhcps", "[", "name", "]", ";", "ok", "{", "command", "=", "\"", "\"", "\n", "if", "(", "dhcp", ".", "IPv4", ".", "IP", ".", "Equal", "(", "d", ".", "IPv4", ".", "IP", ")", ")", "&&", "(", "dhcp", ".", "IPv4", ".", "Mask", ".", "String", "(", ")", "==", "d", ".", "IPv4", ".", "Mask", ".", "String", "(", ")", ")", "&&", "(", "dhcp", ".", "LowerIP", ".", "Equal", "(", "d", ".", "LowerIP", ")", ")", "&&", "(", "dhcp", ".", "UpperIP", ".", "Equal", "(", "d", ".", "UpperIP", ")", ")", "&&", "(", "dhcp", ".", "Enabled", "==", "d", ".", "Enabled", ")", "{", "// dhcp is up to date", "return", "nil", "\n", "}", "\n", "}", "\n\n", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "command", ",", "\"", "\"", ",", "<mask>", ",", "\"", "\"", ",", "d", ".", "IPv4", ".", "IP", ".", "String", "(", ")", ",", "\"", "\"", ",", "net", ".", "IP", "(", "d", ".", "IPv4", ".", "Mask", ")", ".", "String", "(", ")", ",", "\"", "\"", ",", "d", ".", "LowerIP", ".", "String", "(", ")", ",", "\"", "\"", ",", "d", ".", "UpperIP", ".", "String", "(", ")", ",", "}", "\n", "if", "d", ".", "Enabled", "{", "args", "=", "append", "(", "args", ",", "\"", "\"", ")", "\n", "}", "else", "{", "args", "=", "append", "(", "args", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "log", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "vbox", ".", "vbm", "(", "args", "...", ")", "\n", "}" ]
15,565
all-15566
[ "Validate", "validates", "the", "ServiceDiscoveryConfig", "." ]
[ "func", "(", "c", "*", "ServiceDiscoveryConfig", ")", "Validate", "(", ")", "error", "{", "for", "_", ",", "cfg", ":=", "range", "c", ".", "AzureSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "ConsulSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "DNSSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "EC2SDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "FileSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "GCESDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "KubernetesSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "MarathonSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "NerveSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "<mask>", "c", ".", "OpenstackSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "ServersetSDConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "cfg", ":=", "range", "c", ".", "StaticConfigs", "{", "if", "cfg", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
15,566
all-15567
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetExtraHTTPHeadersParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
15,567
all-15568
[ "handleUnrecognizedTask", "handles", "unrecognized", "tasks", "by", "sending", "stopped", "with", "a", "suitable", "reason", "to", "the", "backend" ]
[ "func", "(", "payloadHandler", "*", "payloadRequestHandler", ")", "handleUnrecognizedTask", "(", "task", "*", "ecsacs", ".", "Task", ",", "err", "error", ",", "payload", "*", "ecsacs", ".", "PayloadMessage", ")", "{", "seelog", ".", "Warnf", "(", "\"", "\"", ",", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", ",", "aws", ".", "StringValue", "(", "task", ".", "Arn", ")", ",", "err", ")", "\n\n", "if", "aws", ".", "StringValue", "(", "task", ".", "Arn", ")", "==", "\"", "\"", "{", "seelog", ".", "Criticalf", "(", "\"", "\"", ",", "aws", ".", "StringValue", "(", "payload", ".", "MessageId", ")", ")", "\n", "return", "\n", "}", "\n\n", "// Only need to stop the task; it brings down the containers too.", "taskEvent", ":=", "api", ".", "TaskStateChange", "{", "TaskARN", ":", "*", "<mask>", ".", "Arn", ",", "Status", ":", "apitaskstatus", ".", "TaskStopped", ",", "Reason", ":", "UnrecognizedTaskError", "{", "err", "}", ".", "Error", "(", ")", ",", "// The real task cannot be extracted from payload message, so we send an empty task.", "// This is necessary because the task handler will not send an event whose", "// Task is nil.", "Task", ":", "&", "apitask", ".", "Task", "{", "}", ",", "}", "\n\n", "payloadHandler", ".", "taskHandler", ".", "AddStateChangeEvent", "(", "taskEvent", ",", "payloadHandler", ".", "ecsClient", ")", "\n", "}" ]
15,568
all-15569
[ "Refresh", "is", "a", "helper", "API", "to", "call", "refresh", "accessor", "tokens", "manually", "This", "would", "enable", "SMR", "to", "reclaim", "objects", "faster", "if", "an", "iterator", "is", "alive", "for", "a", "longer", "duration", "of", "time", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Refresh", "(", ")", "{", "if", "it", ".", "Valid", "(", ")", "{", "itm", ":=", "it", ".", "snap", ".", "db", ".", "ptrToItem", "(", "it", ".", "GetNode", "(", ")", ".", "Item", "(", ")", ")", "\n", "it", ".", "iter", ".", "Close", "(", ")", "\n", "it", ".", "iter", "=", "it", ".", "snap", ".", "<mask>", ".", "store", ".", "NewIterator", "(", "it", ".", "snap", ".", "db", ".", "iterCmp", ",", "it", ".", "buf", ")", "\n", "it", ".", "iter", ".", "Seek", "(", "unsafe", ".", "Pointer", "(", "itm", ")", ")", "\n", "}", "\n", "}" ]
15,569
all-15570
[ "AppendDeviceChangeSpec", "appends", "unique", "copies", "of", "the", "supplied", "device", "change", "operations", "and", "appends", "them", "to", "spec", ".", "The", "resulting", "list", "is", "returned", ".", "The", "object", "of", "this", "function", "is", "to", "provide", "deep", "copies", "of", "each", "virtual", "device", "to", "the", "spec", "as", "they", "looked", "like", "when", "the", "append", "operation", "was", "called", "helping", "facilitate", "multiple", "update", "operations", "to", "the", "same", "device", "in", "a", "single", "reconfigure", "call", "." ]
[ "func", "AppendDeviceChangeSpec", "(", "spec", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "ops", "...", "types", ".", "BaseVirtualDeviceConfigSpec", ",", ")", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", "{", "for", "_", ",", "op", ":=", "range", "ops", "{", "c", ":=", "copystructure", ".", "Must", "(", "copystructure", ".", "Copy", "(", "op", ")", ")", ".", "(", "types", ".", "BaseVirtualDeviceConfigSpec", ")", "\n", "<mask>", "=", "append", "(", "spec", ",", "c", ")", "\n", "}", "\n", "return", "spec", "\n", "}" ]
15,570
all-15571
[ "AddResource", "helper", "to", "add", "a", "resource", "to", "the", "pipeline", "manifest" ]
[ "func", "(", "s", "*", "ConcoursePipeline", ")", "AddResource", "(", "name", "string", ",", "typename", "string", ",", "source", "<mask>", "[", "string", "]", "interface", "{", "}", ")", "{", "s", ".", "Resources", "=", "append", "(", "s", ".", "Resources", ",", "atc", ".", "ResourceConfig", "{", "Name", ":", "name", ",", "Type", ":", "typename", ",", "Source", ":", "source", ",", "}", ")", "\n", "}" ]
15,571
all-15572
[ "DelBytes", "deletes", "argument", "with", "the", "given", "key", "from", "query", "args", "." ]
[ "func", "(", "a", "*", "Args", ")", "DelBytes", "(", "<mask>", "[", "]", "byte", ")", "{", "a", ".", "args", "=", "delAllArgs", "(", "a", ".", "args", ",", "b2s", "(", "key", ")", ")", "\n", "}" ]
15,572
all-15573
[ "Write", "is", "used", "to", "append", "to", "the", "state", "file", ".", "We", "write", "to", "the", "buffered", "IO", "object", "to", "reduce", "the", "amount", "of", "context", "switches", "." ]
[ "func", "(", "s", "*", "FileSnapshotSink", ")", "Write", "(", "b", "[", "]", "<mask>", ")", "(", "int", ",", "error", ")", "{", "return", "s", ".", "buffered", ".", "Write", "(", "b", ")", "\n", "}" ]
15,573
all-15574
[ "UpdateTouchesOnAndroid", "updates", "the", "touch", "state", "on", "Android", ".", "This", "should", "be", "called", "with", "onTouchEvent", "of", "GLSurfaceView", "like", "this", ":", "private", "double", "mDeviceScale", "=", "0", ".", "0", ";", "//", "pxToDp", "converts", "an", "value", "in", "pixels", "to", "dp", ".", "private", "double", "pxToDp", "(", "double", "x", ")", "{", "if", "(", "mDeviceScale", "==", "0", ".", "0", ")", "{", "mDeviceScale", "=", "getResources", "()", ".", "getDisplayMetrics", "()", ".", "density", ";", "}", "return", "x", "/", "mDeviceScale", ";", "}" ]
[ "func", "UpdateTouchesOnAndroid", "(", "action", "int", ",", "id", "int", ",", "x", ",", "y", "int", ")", "{", "mobileMutex", ".", "Lock", "(", ")", "\n", "defer", "mobileMutex", ".", "Unlock", "(", ")", "\n\n", "updateTouchesOnAndroid", "(", "<mask>", ",", "id", ",", "x", ",", "y", ")", "\n", "}" ]
15,574
all-15575
[ "Humanize", "transforms", "s", "into", "a", "human", "friendly", "form", "." ]
[ "func", "Humanize", "(", "s", "string", ")", "string", "{", "if", "s", "==", "\"", "\"", "{", "return", "s", "\n", "}", "\n", "s", "=", "Underscore", "(", "s", ")", "\n", "<mask>", "humanizeRe", "=", "regexp", ".", "MustCompile", "(", "`_id$`", ")", "\n", "s", "=", "humanizeRe", ".", "ReplaceAllString", "(", "s", ",", "\"", "\"", ")", "\n", "s", "=", "strings", ".", "Replace", "(", "s", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "s", "=", "Capitalize", "(", "s", ")", "\n", "return", "s", "\n", "}" ]
15,575
all-15576
[ "ArgList", "returns", "the", "argument", "list", "for", "the", "function", "." ]
[ "func", "(", "m", "*", "Method", ")", "ArgList", "(", ")", "string", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", "+", "contextType", "(", ")", "}", "\n", "for", "_", ",", "arg", ":=", "<mask>", "m", ".", "Arguments", "(", ")", "{", "args", "=", "append", "(", "args", ",", "arg", ".", "Declaration", "(", ")", ")", "\n", "}", "\n", "return", "strings", ".", "Join", "(", "args", ",", "\"", "\"", ")", "\n", "}" ]
15,576
all-15577
[ "MarshalLogObject", "implements", "zapcore", "ObjectMarshaler", "." ]
[ "func", "(", "hr", "HTTPRequest", ")", "MarshalLogObject", "(", "enc", "zapcore", ".", "ObjectEncoder", ")", "error", "{", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "Method", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "<mask>", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "UserAgent", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "Referrer", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "ResponseStatusCode", ")", "\n", "enc", ".", "AddString", "(", "\"", "\"", ",", "hr", ".", "RemoteIP", ")", "\n\n", "return", "nil", "\n", "}" ]
15,577
all-15578
[ "Seek", "seeks", "the", "position", "with", "the", "given", "offset", ".", "The", "passed", "source", "to", "NewPlayer", "must", "be", "io", ".", "Seeker", "or", "Seek", "panics", ".", "Seek", "returns", "error", "when", "seeking", "the", "source", "stream", "returns", "error", "." ]
[ "func", "(", "p", "*", "Player", ")", "Seek", "(", "<mask>", "time", ".", "Duration", ")", "error", "{", "return", "p", ".", "p", ".", "Seek", "(", "offset", ")", "\n", "}" ]
15,578
all-15579
[ "/", "*", "Copies", "source", "array", "to", "destination", "array" ]
[ "func", "Copy", "(", "src", ",", "dst", ",", "mask", "*", "IplImage", ")", "{", "C", ".", "cvCopy", "(", "unsafe", ".", "Pointer", "(", "src", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", "\n", "}" ]
15,579
all-15580
[ "NewJsonXmlContentNegotiator", "creates", "a", "basic", "ContentNegotiator", "and", "attaches", "a", "JSON", "and", "an", "XML", "encoder", "to", "it", "." ]
[ "func", "NewJsonXmlContentNegotiator", "(", "defaultEncoder", "Encoder", ",", "responseWriter", "<mask>", ".", "ResponseWriter", ",", "prettyPrint", "bool", ")", "*", "ContentNegotiator", "{", "result", ":=", "NewContentNegotiator", "(", "defaultEncoder", ",", "responseWriter", ")", "\n", "result", ".", "AddEncoder", "(", "MimeJSON", ",", "JsonEncoder", "{", "prettyPrint", "}", ")", "\n", "result", ".", "AddEncoder", "(", "MimeXML", ",", "XmlEncoder", "{", "prettyPrint", "}", ")", "\n", "return", "result", "\n", "}" ]
15,580
all-15581
[ "ProfileToAPI", "is", "a", "convenience", "to", "convert", "a", "Profile", "db", "struct", "into", "an", "API", "profile", "struct", "." ]
[ "func", "ProfileToAPI", "(", "profile", "*", "Profile", ")", "*", "api", ".", "Profile", "{", "p", ":=", "&", "api", ".", "Profile", "{", "Name", ":", "profile", ".", "Name", ",", "UsedBy", ":", "profile", ".", "UsedBy", ",", "}", "\n", "p", ".", "Description", "=", "<mask>", ".", "Description", "\n", "p", ".", "Config", "=", "profile", ".", "Config", "\n", "p", ".", "Devices", "=", "profile", ".", "Devices", "\n\n", "return", "p", "\n", "}" ]
15,581
all-15582
[ "Last", "returns", "the", "index", "of", "the", "last", "element", "or", "-", "1", "if", "the", "ring", "is", "empty", "." ]
[ "func", "(", "f", "*", "FixedSizeRingBuf", ")", "Last", "(", ")", "int", "{", "if", "f", ".", "Readable", "==", "0", "{", "return", "-", "1", "\n", "}", "\n\n", "last", ":=", "f", ".", "Beg", "+", "f", ".", "Readable", "-", "1", "\n", "if", "<mask>", "<", "f", ".", "N", "{", "// we fit without wrapping", "return", "last", "\n", "}", "\n\n", "return", "last", "%", "f", ".", "N", "\n", "}" ]
15,582
all-15583
[ "GetCurrencies", "gets", "all", "currency", "names", "and", "ISO", "s" ]
[ "func", "(", "c", "Client", ")", "GetCurrencies", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "holder", ":=", "[", "]", "[", "]", "string", "{", "}", "\n", "if", "err", ":=", "c", ".", "Get", "(", "\"", "\"", ",", "nil", ",", "&", "holder", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "finalData", ":=", "[", "]", "currency", "{", "}", "\n", "for", "_", ",", "curr", ":=", "range", "holder", "{", "class", ":=", "currency", "{", "Name", ":", "curr", "[", "0", "]", ",", "Iso", ":", "curr", "[", "1", "]", ",", "}", "\n", "finalData", "=", "append", "(", "finalData", ",", "class", ")", "\n", "}", "\n", "return", "finalData", ",", "nil", "\n", "}" ]
15,583
all-15584
[ "RadioButtonNewFromWidget", "is", "a", "wrapper", "around", "gtk_radio_button_new_from_widget", "()", "." ]
[ "func", "RadioButtonNewFromWidget", "(", "radioGroupMember", "*", "RadioButton", ")", "(", "*", "RadioButton", ",", "<mask>", ")", "{", "c", ":=", "C", ".", "gtk_radio_button_new_from_widget", "(", "radioGroupMember", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapRadioButton", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
15,584
all-15585
[ "Build", "performs", "some", "basic", "validations", "then", "constructs", "a", "tree", "of", "Part", "structs", "from", "the", "configured", "MailBuilder", ".", "It", "will", "set", "the", "Date", "header", "to", "now", "if", "it", "was", "not", "explicitly", "set", "." ]
[ "func", "(", "p", "MailBuilder", ")", "Build", "(", ")", "(", "*", "Part", ",", "error", ")", "{", "if", "p", ".", "err", "!=", "nil", "{", "return", "nil", ",", "p", ".", "err", "\n", "}", "\n", "// Validations", "if", "p", ".", "from", ".", "Address", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "p", ".", "subject", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "p", ".", "to", ")", "+", "len", "(", "p", ".", "<mask>", ")", "+", "len", "(", "p", ".", "bcc", ")", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "// Fully loaded structure; the presence of text, html, inlines, and attachments will determine", "// how much is necessary:", "//", "// multipart/mixed", "// |- multipart/related", "// | |- multipart/alternative", "// | | |- text/plain", "// | | `- text/html", "// | `- inlines..", "// `- attachments..", "//", "// We build this tree starting at the leaves, re-rooting as needed.", "var", "root", ",", "part", "*", "Part", "\n", "if", "p", ".", "text", "!=", "nil", "||", "p", ".", "html", "==", "nil", "{", "root", "=", "NewPart", "(", "ctTextPlain", ")", "\n", "root", ".", "Content", "=", "p", ".", "text", "\n", "root", ".", "Charset", "=", "utf8", "\n", "}", "\n", "if", "p", ".", "html", "!=", "nil", "{", "part", "=", "NewPart", "(", "ctTextHTML", ")", "\n", "part", ".", "Content", "=", "p", ".", "html", "\n", "part", ".", "Charset", "=", "utf8", "\n", "if", "root", "==", "nil", "{", "root", "=", "part", "\n", "}", "else", "{", "root", ".", "NextSibling", "=", "part", "\n", "}", "\n", "}", "\n", "if", "p", ".", "text", "!=", "nil", "&&", "p", ".", "html", "!=", "nil", "{", "// Wrap Text & HTML bodies", "part", "=", "root", "\n", "root", "=", "NewPart", "(", "ctMultipartAltern", ")", "\n", "root", ".", "AddChild", "(", "part", ")", "\n", "}", "\n", "if", "len", "(", "p", ".", "inlines", ")", ">", "0", "{", "part", "=", "root", "\n", "root", "=", "NewPart", "(", "ctMultipartRelated", ")", "\n", "root", ".", "AddChild", "(", "part", ")", "\n", "for", "_", ",", "ip", ":=", "range", "p", ".", "inlines", "{", "// Copy inline Part to isolate mutations", "part", "=", "&", "Part", "{", "}", "\n", "*", "part", "=", "*", "ip", "\n", "part", ".", "Header", "=", "make", "(", "textproto", ".", "MIMEHeader", ")", "\n", "root", ".", "AddChild", "(", "part", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "p", ".", "attachments", ")", ">", "0", "{", "part", "=", "root", "\n", "root", "=", "NewPart", "(", "ctMultipartMixed", ")", "\n", "root", ".", "AddChild", "(", "part", ")", "\n", "for", "_", ",", "ap", ":=", "range", "p", ".", "attachments", "{", "// Copy attachment Part to isolate mutations", "part", "=", "&", "Part", "{", "}", "\n", "*", "part", "=", "*", "ap", "\n", "part", ".", "Header", "=", "make", "(", "textproto", ".", "MIMEHeader", ")", "\n", "root", ".", "AddChild", "(", "part", ")", "\n", "}", "\n", "}", "\n", "// Headers", "h", ":=", "root", ".", "Header", "\n", "h", ".", "Set", "(", "hnMIMEVersion", ",", "\"", "\"", ")", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "p", ".", "from", ".", "String", "(", ")", ")", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "p", ".", "subject", ")", "\n", "if", "len", "(", "p", ".", "to", ")", ">", "0", "{", "h", ".", "Set", "(", "\"", "\"", ",", "stringutil", ".", "JoinAddress", "(", "p", ".", "to", ")", ")", "\n", "}", "\n", "if", "len", "(", "p", ".", "cc", ")", ">", "0", "{", "h", ".", "Set", "(", "\"", "\"", ",", "stringutil", ".", "JoinAddress", "(", "p", ".", "cc", ")", ")", "\n", "}", "\n", "if", "p", ".", "replyTo", ".", "Address", "!=", "\"", "\"", "{", "h", ".", "Set", "(", "\"", "\"", ",", "p", ".", "replyTo", ".", "String", "(", ")", ")", "\n", "}", "\n", "date", ":=", "p", ".", "date", "\n", "if", "date", ".", "IsZero", "(", ")", "{", "date", "=", "time", ".", "Now", "(", ")", "\n", "}", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "date", ".", "Format", "(", "time", ".", "RFC1123Z", ")", ")", "\n", "for", "k", ",", "v", ":=", "range", "p", ".", "header", "{", "for", "_", ",", "s", ":=", "range", "v", "{", "h", ".", "Add", "(", "k", ",", "s", ")", "\n", "}", "\n", "}", "\n", "return", "root", ",", "nil", "\n", "}" ]
15,585
all-15586
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "FocusParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom54", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
15,586
all-15587
[ "Error", "produces", "an", "error", "response", "in", "JSON", "with", "the", "following", "structure", "{", "Error", ":", "My", "error", "message", "}", "The", "standard", "plain", "text", "net", "/", "http", "Error", "helper", "can", "still", "be", "called", "like", "this", ":", "http", ".", "Error", "(", "w", "error", "message", "code", ")" ]
[ "func", "Error", "(", "w", "ResponseWriter", ",", "error", "string", ",", "code", "int", ")", "{", "w", ".", "WriteHeader", "(", "code", ")", "\n", "err", ":=", "w", ".", "WriteJson", "(", "<mask>", "[", "string", "]", "string", "{", "ErrorFieldName", ":", "error", "}", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
15,587
all-15588
[ "HasLegend", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasLegend", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "Legend", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
15,588
all-15589
[ "Equals", "returns", "true", "if", "other", "is", "equivalent", "to", "key" ]
[ "func", "(", "key", "*", "LedgerKey", ")", "Equals", "(", "other", "LedgerKey", ")", "bool", "{", "if", "key", ".", "Type", "!=", "other", ".", "Type", "{", "return", "false", "\n", "}", "\n\n", "switch", "key", ".", "Type", "{", "case", "LedgerEntryTypeAccount", ":", "l", ":=", "key", ".", "MustAccount", "(", ")", "\n", "r", ":=", "other", ".", "MustAccount", "(", ")", "\n", "return", "l", ".", "AccountId", ".", "Equals", "(", "r", ".", "AccountId", ")", "\n", "case", "LedgerEntryTypeData", ":", "l", ":=", "key", ".", "MustData", "(", ")", "\n", "r", ":=", "other", ".", "MustData", "(", ")", "\n", "return", "l", ".", "AccountId", ".", "Equals", "(", "r", ".", "AccountId", ")", "&&", "l", ".", "DataName", "==", "r", ".", "DataName", "\n", "case", "LedgerEntryTypeOffer", ":", "l", ":=", "key", ".", "MustOffer", "(", ")", "\n", "r", ":=", "other", ".", "MustOffer", "(", ")", "\n", "return", "l", ".", "SellerId", ".", "Equals", "(", "r", ".", "SellerId", ")", "&&", "l", ".", "OfferId", "==", "r", ".", "OfferId", "\n", "case", "LedgerEntryTypeTrustline", ":", "l", ":=", "key", ".", "MustTrustLine", "(", ")", "\n", "r", ":=", "other", ".", "MustTrustLine", "(", ")", "\n", "return", "l", ".", "AccountId", ".", "Equals", "(", "r", ".", "AccountId", ")", "&&", "l", ".", "Asset", ".", "Equals", "(", "r", ".", "Asset", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ".", "<mask>", ")", ")", "\n", "}", "\n", "}" ]
15,589
all-15590
[ "SetDetectedContentType", "detects", "sets", "and", "returns", "the", "response", "Conten", "-", "Type", "header", "value", "." ]
[ "func", "SetDetectedContentType", "(", "w", "http", ".", "ResponseWriter", ",", "p", "[", "]", "byte", ")", "string", "{", "ct", ":=", "w", ".", "Header", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "ct", "==", "\"", "\"", "{", "ct", "=", "<mask>", ".", "DetectContentType", "(", "p", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "ct", ")", "\n", "}", "\n", "return", "ct", "\n", "}" ]
15,590
all-15591
[ "Return", "a", "list", "of", "string", "worker", "type", "names", ".", "These", "are", "the", "names", "of", "all", "managed", "worker", "types", "known", "to", "the", "provisioner", ".", "This", "does", "not", "include", "worker", "types", "which", "are", "left", "overs", "from", "a", "deleted", "worker", "type", "definition", "but", "are", "still", "running", "in", "AWS", ".", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "reference", "/", "core", "/", "aws", "-", "provisioner", "/", "api", "-", "docs#listWorkerTypes" ]
[ "func", "(", "awsProvisioner", "*", "AwsProvisioner", ")", "ListWorkerTypes", "(", ")", "(", "*", "ListWorkerTypes", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "awsProvisioner", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "new", "(", "ListWorkerTypes", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "ListWorkerTypes", ")", ",", "err", "\n", "}" ]
15,591
all-15592
[ "ReadFrom", "avoids", "intermediate", "allocation", "and", "copies", ".", "ReadFrom", "()", "reads", "data", "from", "r", "until", "EOF", "or", "error", ".", "The", "return", "value", "n", "is", "the", "number", "of", "bytes", "read", ".", "Any", "error", "except", "io", ".", "EOF", "encountered", "during", "the", "read", "is", "also", "returned", "." ]
[ "func", "(", "b", "*", "AtomicFixedSizeRingBuf", ")", "ReadFrom", "(", "r", "<mask>", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "b", ".", "tex", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "tex", ".", "Unlock", "(", ")", "\n\n", "for", "{", "writeCapacity", ":=", "b", ".", "N", "-", "b", ".", "readable", "\n", "if", "writeCapacity", "<=", "0", "{", "// we are all full", "return", "n", ",", "nil", "\n", "}", "\n", "writeStart", ":=", "(", "b", ".", "Beg", "+", "b", ".", "readable", ")", "%", "b", ".", "N", "\n", "upperLim", ":=", "intMin2", "(", "writeStart", "+", "writeCapacity", ",", "b", ".", "N", ")", "\n\n", "m", ",", "e", ":=", "r", ".", "Read", "(", "b", ".", "A", "[", "b", ".", "Use", "]", "[", "writeStart", ":", "upperLim", "]", ")", "\n", "n", "+=", "int64", "(", "m", ")", "\n", "b", ".", "readable", "+=", "m", "\n", "if", "e", "==", "io", ".", "EOF", "{", "return", "n", ",", "nil", "\n", "}", "\n", "if", "e", "!=", "nil", "{", "return", "n", ",", "e", "\n", "}", "\n", "}", "\n", "}" ]
15,592
all-15593
[ "MOIDsForUUIDs", "returns", "a", "MOIDForUUIDResults", "for", "a", "list", "of", "UUIDs", ".", "If", "one", "UUID", "cannot", "be", "found", "an", "error", "is", "returned", ".", "There", "are", "no", "partial", "results", "returned", "." ]
[ "func", "MOIDsForUUIDs", "(", "client", "*", "govmomi", ".", "Client", ",", "uuids", "[", "]", "string", ")", "(", "MOIDForUUIDResults", ",", "error", ")", "{", "var", "results", "MOIDForUUIDResults", "\n", "for", "_", ",", "uuid", ":=", "range", "uuids", "{", "result", ",", "err", ":=", "MOIDForUUID", "(", "client", ",", "uuid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "results", "=", "append", "(", "results", ",", "<mask>", ")", "\n", "}", "\n", "return", "results", ",", "nil", "\n", "}" ]
15,593
all-15594
[ "ErrorHandler", "simply", "counts", "the", "number", "of", "errors", "in", "the", "context", "and", "if", "more", "than", "0", "writes", "a", "400", "Bad", "Request", "response", "and", "a", "JSON", "payload", "describing", "the", "errors", "with", "the", "Content", "-", "Type", "set", "to", "application", "/", "json", ".", "Middleware", "remaining", "on", "the", "stack", "will", "not", "even", "see", "the", "request", "if", "by", "this", "point", "there", "are", "any", "errors", ".", "This", "is", "a", "default", "handler", "of", "sorts", "and", "you", "are", "welcome", "to", "use", "your", "own", "instead", ".", "The", "Bind", "middleware", "invokes", "this", "automatically", "for", "convenience", "." ]
[ "func", "ErrorHandler", "(", "errs", "Errors", ",", "resp", "http", ".", "ResponseWriter", ")", "{", "if", "errs", ".", "Count", "(", ")", ">", "0", "{", "resp", ".", "<mask>", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "_", ",", "ok", ":=", "errs", ".", "Overall", "[", "DeserializationError", "]", ";", "ok", "{", "resp", ".", "WriteHeader", "(", "http", ".", "StatusBadRequest", ")", "\n", "}", "else", "{", "resp", ".", "WriteHeader", "(", "422", ")", "\n", "}", "\n", "errOutput", ",", "_", ":=", "json", ".", "Marshal", "(", "errs", ")", "\n", "resp", ".", "Write", "(", "errOutput", ")", "\n", "return", "\n", "}", "\n", "}" ]
15,594
all-15595
[ "ListCollaborators", "lists", "the", "collaborators", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "ListCollaborators", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "<mask>", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "github", ".", "User", ",", "0", ",", "len", "(", "f", ".", "Collaborators", ")", ")", "\n", "for", "_", ",", "login", ":=", "range", "f", ".", "Collaborators", "{", "result", "=", "append", "(", "result", ",", "github", ".", "User", "{", "Login", ":", "login", "}", ")", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
15,595
all-15596
[ "ClientPreChannelCreate", "triggers", "a", "channel", "creation", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientPreChannelCreate", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "var", "jdata", "ClientPreChannelCreateData", "\n", "if", "err", ":=", "w", ".", "unmarshalDataTo", "(", "logger", ",", "job", ".", "Data", ",", "&", "jdata", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "acc", ",", "err", ":=", "w", ".", "accountByPK", "(", "logger", ",", "jdata", ".", "Account", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "offering", ",", "err", ":=", "w", ".", "offering", "(", "logger", ",", "jdata", ".", "Offering", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "acc", ",", "\"", "\"", ",", "offering", ")", "\n\n", "deposit", ":=", "jdata", ".", "Deposit", "\n", "if", "jdata", ".", "Deposit", "==", "0", "{", "deposit", "=", "data", ".", "MinDeposit", "(", "offering", ")", "\n", "}", "\n\n", "if", "err", ":=", "w", ".", "checkDeposit", "(", "logger", ",", "acc", ",", "offering", ",", "deposit", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "deposit", "<", "data", ".", "MinDeposit", "(", "offering", ")", "{", "return", "ErrSmallDeposit", "\n", "}", "\n\n", "offerHash", ",", "err", ":=", "data", ".", "HexToHash", "(", "offering", ".", "Hash", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrParseOfferingHash", "\n", "}", "\n\n", "err", "=", "w", ".", "clientPreChannelCreateCheckSupply", "(", "logger", ",", "offering", ",", "offerHash", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "msgRawBytes", ",", "err", ":=", "data", ".", "ToBytes", "(", "offering", ".", "RawMsg", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "msgRaw", ",", "_", ":=", "messages", ".", "UnpackSignature", "(", "msgRawBytes", ")", "\n\n", "<mask>", ":=", "offer", ".", "Message", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "msgRaw", ",", "&", "msg", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "msg", ")", "\n\n", "pubkB", ",", "err", ":=", "data", ".", "ToBytes", "(", "msg", ".", "AgentPubKey", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "pubkey", ",", "err", ":=", "crypto", ".", "UnmarshalPubkey", "(", "pubkB", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "agentEthAddr", ":=", "data", ".", "HexFromBytes", "(", "crypto", ".", "PubkeyToAddress", "(", "*", "pubkey", ")", ".", "Bytes", "(", ")", ")", "\n\n", "_", ",", "err", "=", "w", ".", "db", ".", "FindOneFrom", "(", "data", ".", "UserTable", ",", "\"", "\"", ",", "agentEthAddr", ")", "\n", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "err", "=", "w", ".", "db", ".", "Insert", "(", "&", "data", ".", "User", "{", "ID", ":", "util", ".", "NewUUID", "(", ")", ",", "EthAddr", ":", "agentEthAddr", ",", "PublicKey", ":", "msg", ".", "AgentPubKey", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n", "}", "\n\n", "var", "gasPrice", "*", "big", ".", "Int", "\n", "if", "jdata", ".", "GasPrice", "!=", "0", "{", "gasPrice", "=", "new", "(", "big", ".", "Int", ")", ".", "SetUint64", "(", "jdata", ".", "GasPrice", ")", "\n", "}", "\n\n", "return", "w", ".", "clientPreChannelCreateSaveTX", "(", "logger", ",", "job", ",", "acc", ",", "offering", ",", "offerHash", ",", "deposit", ",", "gasPrice", ")", "\n", "}" ]
15,596
all-15597
[ "fromContext", "returns", "the", "App", "Engine", "context", "or", "nil", "if", "ctx", "is", "not", "derived", "from", "an", "App", "Engine", "context", "." ]
[ "func", "fromContext", "(", "ctx", "netcontext", ".", "Context", ")", "appengine", ".", "Context", "{", "c", ",", "_", ":=", "ctx", ".", "<mask>", "(", "&", "contextKey", ")", ".", "(", "appengine", ".", "Context", ")", "\n", "return", "c", "\n", "}" ]
15,597
all-15598
[ "NewOutgoingVoiceResend", "creates", "a", "new", "outgoing", "voice", "note", "for", "re", "-", "sending", "." ]
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVoiceResend", "(", "recipient", "Recipient", ",", "fileID", "<mask>", ")", "*", "OutgoingVoice", "{", "return", "&", "OutgoingVoice", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":", "api", ",", "Recipient", ":", "recipient", ",", "}", ",", "}", ",", "outgoingFileBase", ":", "outgoingFileBase", "{", "fileID", ":", "fileID", ",", "}", ",", "}", "\n", "}" ]
15,598
all-15599
[ "HasPermission", "returns", "true", "if", "GetUserPermission", "()", "returns", "any", "of", "the", "roles", "." ]
[ "func", "(", "c", "*", "Client", ")", "HasPermission", "(", "org", ",", "repo", ",", "<mask>", "string", ",", "roles", "...", "string", ")", "(", "bool", ",", "error", ")", "{", "perm", ",", "err", ":=", "c", ".", "GetUserPermission", "(", "org", ",", "repo", ",", "user", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "for", "_", ",", "r", ":=", "range", "roles", "{", "if", "r", "==", "perm", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "false", ",", "nil", "\n", "}" ]
15,599
all-15600
[ "NewClient", "returns", "a", "new", "Client", "." ]
[ "func", "NewClient", "(", "httpClient", "*", "http", ".", "<mask>", ",", "mode", ",", "clientID", ",", "clientSecret", ",", "accessToken", "string", ")", "*", "Client", "{", "b", ":=", "sling", ".", "New", "(", ")", ".", "Client", "(", "httpClient", ")", ".", "Base", "(", "baseURL", ")", "\n", "b", ".", "QueryStruct", "(", "struct", "{", "V", "string", "`url:\"v\"`", "\n", "M", "string", "`url:\"m\"`", "\n", "ClientID", "string", "`url:\"client_id\"`", "\n", "ClientSecret", "string", "`url:\"client_secret,omitempty\"`", "\n", "AccessToken", "string", "`url:\"access_token,omitempty\"`", "\n", "}", "{", "V", ":", "version", ",", "M", ":", "mode", ",", "ClientID", ":", "clientID", ",", "ClientSecret", ":", "clientSecret", ",", "AccessToken", ":", "accessToken", ",", "}", ")", "\n\n", "return", "&", "Client", "{", "sling", ":", "b", ",", "Venues", ":", "newVenueService", "(", "b", ".", "New", "(", ")", ")", ",", "}", "\n", "}" ]