id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
7,400
all-7401
[ "HashDatum15", "computes", "and", "returns", "the", "hash", "of", "datum", "+", "pipeline", "for", "version", "<", "=", "1", ".", "5", ".", "0", "with", "a", "pipeline", "-", "specific", "prefix", "." ]
[ "func", "HashDatum15", "(", "pipelineInfo", "*", "pps", ".", "PipelineInfo", ",", "data", "[", "]", "*", "Input", ")", "(", "string", ",", "error", ")", "{", "hash", ":=", "sha256", ".", "New", "(", ")", "\n", "for", "_", ",", "datum", ":=", "range", "<mask>", "{", "hash", ".", "Write", "(", "[", "]", "byte", "(", "datum", ".", "Name", ")", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "datum", ".", "FileInfo", ".", "File", ".", "Path", ")", ")", "\n", "hash", ".", "Write", "(", "datum", ".", "FileInfo", ".", "Hash", ")", "\n", "}", "\n\n", "// We set env to nil because if env contains more than one elements,", "// since it's a map, the output of Marshal() can be non-deterministic.", "env", ":=", "pipelineInfo", ".", "Transform", ".", "Env", "\n", "pipelineInfo", ".", "Transform", ".", "Env", "=", "nil", "\n", "defer", "func", "(", ")", "{", "pipelineInfo", ".", "Transform", ".", "Env", "=", "env", "\n", "}", "(", ")", "\n", "bytes", ",", "err", ":=", "pipelineInfo", ".", "Transform", ".", "Marshal", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "hash", ".", "Write", "(", "bytes", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "pipelineInfo", ".", "Pipeline", ".", "Name", ")", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "pipelineInfo", ".", "ID", ")", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "strconv", ".", "Itoa", "(", "int", "(", "pipelineInfo", ".", "Version", ")", ")", ")", ")", "\n\n", "// Note in 1.5.0 this function was called HashPipelineID, it's now called", "// HashPipelineName but it has the same implementation.", "return", "client", ".", "DatumTagPrefix", "(", "pipelineInfo", ".", "ID", ")", "+", "hex", ".", "EncodeToString", "(", "hash", ".", "Sum", "(", "nil", ")", ")", ",", "nil", "\n", "}" ]
7,401
all-7402
[ "NewReaderEncrypted", "opens", "a", "file", "for", "reading", "using", "the", "data", "in", "f", "with", "the", "given", "total", "size", ".", "If", "the", "PDF", "is", "encrypted", "NewReaderEncrypted", "calls", "pw", "repeatedly", "to", "obtain", "passwords", "to", "try", ".", "If", "pw", "returns", "the", "empty", "string", "NewReaderEncrypted", "stops", "trying", "to", "decrypt", "the", "file", "and", "returns", "an", "error", "." ]
[ "func", "NewReaderEncrypted", "(", "f", "io", ".", "ReaderAt", ",", "size", "int64", ",", "pw", "func", "(", ")", "string", ")", "(", "*", "Reader", ",", "error", ")", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "10", ")", "\n", "f", ".", "ReadAt", "(", "buf", ",", "0", ")", "\n", "if", "!", "bytes", ".", "HasPrefix", "(", "buf", ",", "[", "]", "byte", "(", "\"", "\"", ")", ")", "||", "buf", "[", "7", "]", "<", "'0'", "||", "buf", "[", "7", "]", ">", "'7'", "||", "buf", "[", "8", "]", "!=", "'\\r'", "&&", "buf", "[", "8", "]", "!=", "'\\n'", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "end", ":=", "size", "\n", "const", "endChunk", "=", "100", "\n", "buf", "=", "make", "(", "[", "]", "byte", ",", "endChunk", ")", "\n", "f", ".", "ReadAt", "(", "buf", ",", "end", "-", "endChunk", ")", "\n", "for", "len", "(", "buf", ")", ">", "0", "&&", "buf", "[", "len", "(", "buf", ")", "-", "1", "]", "==", "'\\n'", "||", "buf", "[", "len", "(", "buf", ")", "-", "1", "]", "==", "'\\r'", "{", "buf", "=", "buf", "[", ":", "len", "(", "buf", ")", "-", "1", "]", "\n", "}", "\n", "buf", "=", "bytes", ".", "TrimRight", "(", "buf", ",", "\"", "\\r", "\\n", "\\t", "\"", ")", "\n", "if", "!", "bytes", ".", "HasSuffix", "(", "buf", ",", "[", "]", "byte", "(", "\"", "\"", ")", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "i", ":=", "findLastLine", "(", "buf", ",", "\"", "\"", ")", "\n", "if", "i", "<", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "r", ":=", "&", "Reader", "{", "f", ":", "f", ",", "<mask>", ":", "end", ",", "}", "\n", "pos", ":=", "end", "-", "endChunk", "+", "int64", "(", "i", ")", "\n", "b", ":=", "newBuffer", "(", "io", ".", "NewSectionReader", "(", "f", ",", "pos", ",", "end", "-", "pos", ")", ",", "pos", ")", "\n", "if", "b", ".", "readToken", "(", ")", "!=", "keyword", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "startxref", ",", "ok", ":=", "b", ".", "readToken", "(", ")", ".", "(", "int64", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "b", "=", "newBuffer", "(", "io", ".", "NewSectionReader", "(", "r", ".", "f", ",", "startxref", ",", "r", ".", "end", "-", "startxref", ")", ",", "startxref", ")", "\n", "xref", ",", "trailerptr", ",", "trailer", ",", "err", ":=", "readXref", "(", "r", ",", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "r", ".", "xref", "=", "xref", "\n", "r", ".", "trailer", "=", "trailer", "\n", "r", ".", "trailerptr", "=", "trailerptr", "\n", "if", "trailer", "[", "\"", "\"", "]", "==", "nil", "{", "return", "r", ",", "nil", "\n", "}", "\n", "err", "=", "r", ".", "initEncrypt", "(", "\"", "\"", ")", "\n", "if", "err", "==", "nil", "{", "return", "r", ",", "nil", "\n", "}", "\n", "if", "pw", "==", "nil", "||", "err", "!=", "ErrInvalidPassword", "{", "return", "nil", ",", "err", "\n", "}", "\n", "for", "{", "next", ":=", "pw", "(", ")", "\n", "if", "next", "==", "\"", "\"", "{", "break", "\n", "}", "\n", "if", "r", ".", "initEncrypt", "(", "next", ")", "==", "nil", "{", "return", "r", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}" ]
7,402
all-7403
[ "converts", "domain", "names", "to", "FQDN" ]
[ "func", "canonicalizeDomainNames", "(", "domains", "[", "]", "string", ")", "[", "]", "string", "{", "var", "cDomains", "[", "]", "string", "\n", "for", "_", ",", "d", ":=", "<mask>", "domains", "{", "if", "!", "strings", ".", "HasSuffix", "(", "d", ",", "\"", "\"", ")", "{", "d", "+=", "\"", "\"", "\n", "cDomains", "=", "append", "(", "cDomains", ",", "strings", ".", "ToLower", "(", "d", ")", ")", "\n", "}", "\n", "}", "\n", "return", "cDomains", "\n", "}" ]
7,403
all-7404
[ "PipelineRcName", "generates", "the", "name", "of", "the", "k8s", "replication", "controller", "that", "manages", "a", "pipeline", "s", "workers" ]
[ "func", "PipelineRcName", "(", "name", "string", ",", "version", "uint64", ")", "string", "{", "// k8s won't allow RC names that contain upper-case letters", "// or underscores", "// TODO: deal with name collision", "name", "=", "strings", ".", "Replace", "(", "name", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "ToLower", "(", "name", ")", ",", "<mask>", ")", "\n", "}" ]
7,404
all-7405
[ "RunStdin", "runs", "the", "command", "with", "the", "given", "stdin", "and", "arguments", "." ]
[ "func", "RunStdin", "(", "stdin", "<mask>", ".", "Reader", ",", "args", "...", "string", ")", "error", "{", "return", "RunIO", "(", "IO", "{", "Stdin", ":", "stdin", "}", ",", "args", "...", ")", "\n", "}" ]
7,405
all-7406
[ "UnmarshalText", "implements", "encoding", ".", "TextUnmarshaler", "." ]
[ "func", "(", "uuid", "*", "UUID", ")", "UnmarshalText", "(", "data", "[", "]", "byte", ")", "error", "{", "<mask>", ",", "err", ":=", "ParseBytes", "(", "data", ")", "\n", "if", "err", "==", "nil", "{", "*", "uuid", "=", "id", "\n", "}", "\n", "return", "err", "\n", "}" ]
7,406
all-7407
[ "pluckParams", "converts", "a", "pact", "tag", "into", "a", "pactParams", "struct", "Supported", "Tag", "Formats", "Minimum", "Slice", "Size", ":", "pact", ":", "min", "=", "2", "String", "RegEx", ":", "pact", ":", "example", "=", "2000", "-", "01", "-", "01", "regex", "=", "^", "\\\\", "d", "{", "4", "}", "-", "\\\\", "d", "{", "2", "}", "-", "\\\\", "d", "{", "2", "}", "$" ]
[ "func", "pluckParams", "(", "srcType", "reflect", ".", "Type", ",", "pactTag", "string", ")", "params", "{", "params", ":=", "getDefaults", "(", ")", "\n", "if", "pactTag", "==", "\"", "\"", "{", "return", "params", "\n", "}", "\n\n", "switch", "kind", ":=", "srcType", ".", "Kind", "(", ")", ";", "<mask>", "{", "case", "reflect", ".", "Slice", ":", "if", "_", ",", "err", ":=", "fmt", ".", "Sscanf", "(", "pactTag", ",", "\"", "\"", ",", "&", "params", ".", "slice", ".", "min", ")", ";", "err", "!=", "nil", "{", "triggerInvalidPactTagPanic", "(", "pactTag", ",", "err", ")", "\n", "}", "\n", "case", "reflect", ".", "String", ":", "fullRegex", ",", "_", ":=", "regexp", ".", "Compile", "(", "`regex=(.*)$`", ")", "\n", "exampleRegex", ",", "_", ":=", "regexp", ".", "Compile", "(", "`^example=(.*)`", ")", "\n\n", "if", "fullRegex", ".", "Match", "(", "[", "]", "byte", "(", "pactTag", ")", ")", "{", "components", ":=", "strings", ".", "Split", "(", "pactTag", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "components", "[", "1", "]", ")", "==", "0", "{", "triggerInvalidPactTagPanic", "(", "pactTag", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "if", "_", ",", "err", ":=", "fmt", ".", "Sscanf", "(", "components", "[", "0", "]", ",", "\"", "\"", ",", "&", "params", ".", "str", ".", "example", ")", ";", "err", "!=", "nil", "{", "triggerInvalidPactTagPanic", "(", "pactTag", ",", "err", ")", "\n", "}", "\n", "params", ".", "str", ".", "regEx", "=", "strings", ".", "Replace", "(", "components", "[", "1", "]", ",", "`\\`", ",", "`\\\\`", ",", "-", "1", ")", "\n\n", "}", "else", "if", "exampleRegex", ".", "Match", "(", "[", "]", "byte", "(", "pactTag", ")", ")", "{", "components", ":=", "strings", ".", "Split", "(", "pactTag", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "components", ")", "!=", "2", "||", "strings", ".", "TrimSpace", "(", "components", "[", "1", "]", ")", "==", "\"", "\"", "{", "triggerInvalidPactTagPanic", "(", "pactTag", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "params", ".", "str", ".", "example", "=", "components", "[", "1", "]", "\n", "}", "\n", "}", "\n\n", "return", "params", "\n", "}" ]
7,407
all-7408
[ "CalcClipper", "calculates", "the", "clipper", "size", "based", "on", "the", "control", "s", "size", "position", "and", "paddings" ]
[ "func", "CalcClipper", "(", "c", "<mask>", ")", "(", "int", ",", "int", ",", "int", ",", "int", ")", "{", "w", ",", "h", ":=", "c", ".", "Size", "(", ")", "\n", "x", ",", "y", ":=", "c", ".", "Pos", "(", ")", "\n", "px", ",", "py", ":=", "c", ".", "Paddings", "(", ")", "\n\n", "x", "=", "x", "+", "px", "\n", "y", "=", "y", "+", "py", "\n", "w", "=", "w", "-", "2", "*", "px", "\n", "h", "=", "h", "-", "2", "*", "py", "\n\n", "return", "x", ",", "y", ",", "w", ",", "h", "\n", "}" ]
7,408
all-7409
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "HighlightConfig", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay13", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
7,409
all-7410
[ "resourceVSphereDatastoreClusterFlattenSDRSData", "saves", "the", "DRS", "attributes", "from", "a", "StoragePod", "into", "the", "supplied", "ResourceData", ".", "Note", "that", "other", "functions", "handle", "non", "-", "SDRS", "related", "items", "such", "as", "path", "name", "tags", "and", "custom", "attributes", "." ]
[ "func", "resourceVSphereDatastoreClusterFlattenSDRSData", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "pod", "*", "<mask>", ".", "StoragePod", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", ":=", "viapi", ".", "ValidateVirtualCenter", "(", "client", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Get the version of the vSphere connection to help determine what", "// attributes we need to set", "version", ":=", "viapi", ".", "ParseVersionFromClient", "(", "client", ")", "\n\n", "props", ",", "err", ":=", "storagepod", ".", "Properties", "(", "pod", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "flattenStorageDrsPodConfigInfo", "(", "d", ",", "props", ".", "PodStorageDrsEntry", ".", "StorageDrsConfig", ".", "PodConfig", ",", "version", ")", "\n", "}" ]
7,410
all-7411
[ "Warnm", "is", "a", "short", "-", "hand", "version", "of", "Warningm" ]
[ "func", "(", "b", "*", "Base", ")", "Warnm", "(", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "error", "{", "return", "b", ".", "Warningm", "(", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
7,411
all-7412
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform4i", "(", "program", "uint32", ",", "<mask>", "int32", ",", "v0", "int32", ",", "v1", "int32", ",", "v2", "int32", ",", "v3", "int32", ")", "{", "C", ".", "glowProgramUniform4i", "(", "gpProgramUniform4i", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLint", ")", "(", "v0", ")", ",", "(", "C", ".", "GLint", ")", "(", "v1", ")", ",", "(", "C", ".", "GLint", ")", "(", "v2", ")", ",", "(", "C", ".", "GLint", ")", "(", "v3", ")", ")", "\n", "}" ]
7,412
all-7413
[ "EmulateTouchFromMouseEvent", "emulates", "touch", "event", "from", "the", "mouse", "event", "parameters", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Input#method", "-", "emulateTouchFromMouseEvent", "parameters", ":", "type", "-", "Type", "of", "the", "mouse", "event", ".", "x", "-", "X", "coordinate", "of", "the", "mouse", "pointer", "in", "DIP", ".", "y", "-", "Y", "coordinate", "of", "the", "mouse", "pointer", "in", "DIP", ".", "button", "-", "Mouse", "button", "." ]
[ "func", "EmulateTouchFromMouseEvent", "(", "typeVal", "MouseType", ",", "x", "int64", ",", "y", "int64", ",", "<mask>", "ButtonType", ")", "*", "EmulateTouchFromMouseEventParams", "{", "return", "&", "EmulateTouchFromMouseEventParams", "{", "Type", ":", "typeVal", ",", "X", ":", "x", ",", "Y", ":", "y", ",", "Button", ":", "button", ",", "}", "\n", "}" ]
7,413
all-7414
[ "GetPixels", "is", "a", "wrapper", "around", "gdk_pixbuf_get_pixels_with_length", "()", ".", "A", "Go", "slice", "is", "used", "to", "represent", "the", "underlying", "Pixbuf", "data", "array", "one", "byte", "per", "channel", "." ]
[ "func", "(", "v", "*", "Pixbuf", ")", "GetPixels", "(", ")", "(", "channels", "[", "]", "byte", ")", "{", "var", "length", "C", ".", "guint", "\n", "c", ":=", "C", ".", "gdk_pixbuf_get_pixels_with_length", "(", "v", ".", "native", "(", ")", ",", "&", "<mask>", ")", "\n", "sliceHeader", ":=", "(", "*", "reflect", ".", "SliceHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "channels", ")", ")", "\n", "sliceHeader", ".", "Data", "=", "uintptr", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "sliceHeader", ".", "Len", "=", "int", "(", "length", ")", "\n", "sliceHeader", ".", "Cap", "=", "int", "(", "length", ")", "\n\n", "// To make sure the slice doesn't outlive the Pixbuf, add a reference", "v", ".", "Ref", "(", ")", "\n", "runtime", ".", "SetFinalizer", "(", "&", "channels", ",", "func", "(", "_", "*", "[", "]", "byte", ")", "{", "v", ".", "Unref", "(", ")", "\n", "}", ")", "\n", "return", "\n", "}" ]
7,414
all-7415
[ "ToInfo", "returns", "the", "service", "instance", "as", "a", "struct", "compatible", "with", "the", "return", "of", "the", "service", "info", "api", "call", "." ]
[ "func", "(", "si", "*", "ServiceInstance", ")", "ToInfo", "(", ")", "(", "ServiceInstanceWithInfo", ",", "error", ")", "{", "info", ",", "err", ":=", "si", ".", "Info", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "info", "=", "nil", "\n", "}", "\n", "return", "ServiceInstanceWithInfo", "{", "Id", ":", "si", ".", "Id", ",", "<mask>", ":", "si", ".", "Name", ",", "Teams", ":", "si", ".", "Teams", ",", "PlanName", ":", "si", ".", "PlanName", ",", "Apps", ":", "si", ".", "Apps", ",", "ServiceName", ":", "si", ".", "ServiceName", ",", "Info", ":", "info", ",", "TeamOwner", ":", "si", ".", "TeamOwner", ",", "}", ",", "nil", "\n", "}" ]
7,415
all-7416
[ "IsExist", "returns", "whether", "the", "error", "is", "known", "to", "report", "that", "an", "user", "or", "group", "already", "exists", ".", "It", "is", "satisfied", "by", "ErrUserExist", "and", "ErrGroupExist", "." ]
[ "func", "IsExist", "(", "err", "error", ")", "bool", "{", "if", "err", "==", "ErrUserExist", "||", "err", "==", "ErrGroupExist", "{", "return", "<mask>", "\n", "}", "\n", "return", "false", "\n", "}" ]
7,416
all-7417
[ "HTTPHandler", "returns", "an", "HTTP", "handler", "for", "a", "REST", "API", "gateway", "to", "the", "given", "grpc", "address", "." ]
[ "func", "(", "api", "*", "API", ")", "HTTPHandler", "(", "ctx", "context", ".", "Context", ",", "grpcAddr", "string", ")", "(", "<mask>", ".", "Handler", ",", "error", ")", "{", "enc", ":=", "new", "(", "protoutil", ".", "JSONPb", ")", "\n", "mux", ":=", "runtime", ".", "NewServeMux", "(", "runtime", ".", "WithMarshalerOption", "(", "enc", ".", "ContentType", "(", ")", ",", "enc", ")", ")", "\n\n", "opts", ":=", "[", "]", "grpc", ".", "DialOption", "{", "grpc", ".", "WithInsecure", "(", ")", ",", "// Replace the default dialer that connects through proxy when HTTP_PROXY is set.", "grpc", ".", "WithContextDialer", "(", "func", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "return", "(", "&", "net", ".", "Dialer", "{", "}", ")", ".", "DialContext", "(", "ctx", ",", "\"", "\"", ",", "addr", ")", "\n", "}", ")", ",", "}", "\n\n", "err", ":=", "pb", ".", "RegisterAdminHandlerFromEndpoint", "(", "ctx", ",", "mux", ",", "grpcAddr", ",", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "mux", ",", "nil", "\n", "}" ]
7,417
all-7418
[ "GetId", "returns", "the", "Id", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DashboardList", ")", "GetId", "(", ")", "int", "{", "if", "d", "==", "nil", "||", "d", ".", "Id", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "d", ".", "<mask>", "\n", "}" ]
7,418
all-7419
[ "MiddlewareFunc", "makes", "StatusMiddleware", "implement", "the", "Middleware", "interface", "." ]
[ "func", "(", "mw", "*", "StatusMiddleware", ")", "MiddlewareFunc", "(", "h", "HandlerFunc", ")", "HandlerFunc", "{", "mw", ".", "start", "=", "time", ".", "Now", "(", ")", "\n", "mw", ".", "pid", "=", "os", ".", "Getpid", "(", ")", "\n", "mw", ".", "responseCounts", "=", "map", "[", "string", "]", "int", "{", "}", "\n", "mw", ".", "totalResponseTime", "=", "time", ".", "Time", "{", "}", "\n\n", "return", "func", "(", "w", "ResponseWriter", ",", "r", "*", "Request", ")", "{", "// call the handler", "h", "(", "w", ",", "r", ")", "\n\n", "if", "r", ".", "Env", "[", "\"", "\"", "]", "==", "nil", "{", "<mask>", ".", "Fatal", "(", "\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", ")", "\n", "}", "\n", "statusCode", ":=", "r", ".", "Env", "[", "\"", "\"", "]", ".", "(", "int", ")", "\n\n", "if", "r", ".", "Env", "[", "\"", "\"", "]", "==", "nil", "{", "log", ".", "Fatal", "(", "\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", ")", "\n", "}", "\n", "responseTime", ":=", "r", ".", "Env", "[", "\"", "\"", "]", ".", "(", "*", "time", ".", "Duration", ")", "\n\n", "mw", ".", "lock", ".", "Lock", "(", ")", "\n", "mw", ".", "responseCounts", "[", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "statusCode", ")", "]", "++", "\n", "mw", ".", "totalResponseTime", "=", "mw", ".", "totalResponseTime", ".", "Add", "(", "*", "responseTime", ")", "\n", "mw", ".", "lock", ".", "Unlock", "(", ")", "\n", "}", "\n", "}" ]
7,419
all-7420
[ "RequestCachedResponse", "fetches", "cache", "entry", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "CacheStorage#method", "-", "requestCachedResponse", "parameters", ":", "cacheID", "-", "Id", "of", "cache", "that", "contains", "the", "entry", ".", "requestURL", "-", "URL", "spec", "of", "the", "request", ".", "requestHeaders", "-", "headers", "of", "the", "request", "." ]
[ "func", "RequestCachedResponse", "(", "cacheID", "CacheID", ",", "requestURL", "string", ",", "requestHeaders", "[", "]", "*", "<mask>", ")", "*", "RequestCachedResponseParams", "{", "return", "&", "RequestCachedResponseParams", "{", "CacheID", ":", "cacheID", ",", "RequestURL", ":", "requestURL", ",", "RequestHeaders", ":", "requestHeaders", ",", "}", "\n", "}" ]
7,420
all-7421
[ "applyVirtualDevices", "is", "used", "by", "Create", "and", "Update", "to", "build", "a", "list", "of", "virtual", "device", "changes", "." ]
[ "func", "applyVirtualDevices", "(", "d", "*", "schema", ".", "ResourceData", ",", "c", "*", "govmomi", ".", "Client", ",", "l", "object", ".", "VirtualDeviceList", ")", "(", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "// We filter this device list through each major device class' apply", "// operation. This will give us a final set of changes that will be our", "// deviceChange attribute.", "var", "spec", ",", "delta", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", "\n", "var", "err", "error", "\n", "// First check the state of our SCSI bus. Normalize it if we need to.", "l", ",", "delta", ",", "err", "=", "virtualdevice", ".", "NormalizeSCSIBus", "(", "l", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "delta", ")", ">", "0", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "true", ")", "\n", "}", "\n", "spec", "=", "virtualdevice", ".", "AppendDeviceChangeSpec", "(", "spec", ",", "delta", "...", ")", "\n", "// Disks", "l", ",", "delta", ",", "err", "=", "virtualdevice", ".", "DiskApplyOperation", "(", "d", ",", "c", ",", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "spec", "=", "virtualdevice", ".", "AppendDeviceChangeSpec", "(", "spec", ",", "delta", "...", ")", "\n", "// Network devices", "l", ",", "delta", ",", "err", "=", "virtualdevice", ".", "NetworkInterfaceApplyOperation", "(", "d", ",", "c", ",", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "spec", "=", "virtualdevice", ".", "AppendDeviceChangeSpec", "(", "<mask>", ",", "delta", "...", ")", "\n", "// CDROM", "l", ",", "delta", ",", "err", "=", "virtualdevice", ".", "CdromApplyOperation", "(", "d", ",", "c", ",", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "spec", "=", "virtualdevice", ".", "AppendDeviceChangeSpec", "(", "spec", ",", "delta", "...", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ",", "virtualdevice", ".", "DeviceListString", "(", "l", ")", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ",", "virtualdevice", ".", "DeviceChangeString", "(", "spec", ")", ")", "\n", "return", "spec", ",", "nil", "\n", "}" ]
7,421
all-7422
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "MediaQueryExpression", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss29", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,422
all-7423
[ "Create", "the", "default", "profile", "of", "a", "project", "." ]
[ "func", "projectCreateDefaultProfile", "(", "tx", "*", "db", ".", "ClusterTx", ",", "project", "string", ")", "error", "{", "// Create a default profile", "profile", ":=", "db", ".", "Profile", "{", "}", "\n", "profile", ".", "Project", "=", "project", "\n", "profile", ".", "<mask>", "=", "\"", "\"", "\n", "profile", ".", "Description", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "project", ")", "\n", "profile", ".", "Config", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "profile", ".", "Devices", "=", "types", ".", "Devices", "{", "}", "\n\n", "_", ",", "err", ":=", "tx", ".", "ProfileCreate", "(", "profile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,423
all-7424
[ "Value", "converts", "Date", "to", "a", "primitive", "value", "ready", "to", "written", "to", "a", "database", "." ]
[ "func", "(", "d", "Date", ")", "Value", "(", ")", "(", "driver", ".", "<mask>", ",", "error", ")", "{", "return", "driver", ".", "Value", "(", "d", ".", "String", "(", ")", ")", ",", "nil", "\n", "}" ]
7,424
all-7425
[ "GetColorOk", "returns", "a", "tuple", "with", "the", "Color", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ConditionalFormat", ")", "GetColorOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Color", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "<mask>", ",", "true", "\n", "}" ]
7,425
all-7426
[ "Fill", "copies", "a", "glyph", "from", "the", "cache", "and", "fills", "it" ]
[ "func", "(", "g", "*", "Glyph", ")", "Fill", "(", "gc", "draw2d", ".", "GraphicContext", ",", "x", ",", "y", "float64", ")", "float64", "{", "gc", ".", "Save", "(", ")", "\n", "gc", ".", "BeginPath", "(", ")", "\n", "gc", ".", "Translate", "(", "x", ",", "y", ")", "\n", "gc", ".", "Fill", "(", "g", ".", "<mask>", ")", "\n", "gc", ".", "Restore", "(", ")", "\n", "return", "g", ".", "Width", "\n", "}" ]
7,426
all-7427
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetSamplingProfileParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,427
all-7428
[ "Get", "retrieves", "the", "environment", "variable", "key" ]
[ "func", "(", "e", "EnvVar", ")", "Get", "(", "<mask>", "string", ")", "string", "{", "for", "_", ",", "v", ":=", "range", "e", "{", "env", ":=", "strings", ".", "SplitN", "(", "v", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "env", ")", "<", "2", "{", "continue", "\n", "}", "\n", "if", "env", "[", "0", "]", "==", "key", "{", "return", "env", "[", "1", "]", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
7,428
all-7429
[ "zfsToolVersionGet", "returns", "the", "ZFS", "tools", "version" ]
[ "func", "zfsToolVersionGet", "(", ")", "(", "string", ",", "error", ")", "{", "// This function is only really ever relevant on Ubuntu as the only", "// distro that ships out of sync tools and kernel modules", "out", ",", "err", ":=", "<mask>", ".", "RunCommand", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "strings", ".", "TrimSpace", "(", "string", "(", "out", ")", ")", ",", "nil", "\n", "}" ]
7,429
all-7430
[ "UpdateCheckBundle", "updates", "passed", "check", "bundle", "." ]
[ "func", "(", "a", "*", "API", ")", "UpdateCheckBundle", "(", "cfg", "*", "CheckBundle", ")", "(", "*", "CheckBundle", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "bundleCID", ":=", "string", "(", "cfg", ".", "CID", ")", "\n\n", "matched", ",", "err", ":=", "regexp", ".", "MatchString", "(", "config", ".", "CheckBundleCIDRegex", ",", "bundleCID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "!", "matched", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "bundleCID", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Put", "(", "bundleCID", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "checkBundle", ":=", "&", "CheckBundle", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "<mask>", ",", "checkBundle", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "checkBundle", ",", "nil", "\n", "}" ]
7,430
all-7431
[ "BackwardVisibleCursorPositions", "is", "a", "wrapper", "around", "gtk_text_iter_backward_visible_cursor_positions", "()", "." ]
[ "func", "(", "v", "*", "TextIter", ")", "BackwardVisibleCursorPositions", "(", "v1", "int", ")", "bool", "{", "<mask>", "gobool", "(", "C", ".", "gtk_text_iter_backward_visible_cursor_positions", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "v1", ")", ")", ")", "\n", "}" ]
7,431
all-7432
[ "ParseText", "parse", "text", "protocol", "Point", "host", ".", "Point", ".", "value", "42", "1422641531", "\\", "n" ]
[ "func", "ParseText", "(", "line", "string", ")", "(", "*", "Points", ",", "error", ")", "{", "row", ":=", "strings", ".", "Split", "(", "strings", ".", "Trim", "(", "line", ",", "\"", "\\n", "\\t", "\\r", "\"", ")", ",", "\"", "\"", ")", "\n", "if", "len", "(", "row", ")", "!=", "3", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "line", ")", "\n", "}", "\n\n", "// 0x2e == \".\". Or use split? @TODO: benchmark", "// if strings.Contains(row[0], \"..\") || row[0][0] == 0x2e || row[0][len(row)-1] == 0x2e {", "// \treturn nil, fmt.Errorf(\"bad message: %#v\", line)", "// }", "value", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "row", "[", "1", "]", ",", "64", ")", "\n\n", "if", "err", "!=", "nil", "||", "math", ".", "IsNaN", "(", "<mask>", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "line", ")", "\n", "}", "\n\n", "tsf", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "row", "[", "2", "]", ",", "64", ")", "\n\n", "if", "err", "!=", "nil", "||", "math", ".", "IsNaN", "(", "tsf", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "line", ")", "\n", "}", "\n\n", "// 315522000 == \"1980-01-01 00:00:00\"", "// if tsf < 315532800 {", "// \treturn nil, fmt.Errorf(\"bad message: %#v\", line)", "// }", "// 4102444800 = \"2100-01-01 00:00:00\"", "// Hello people from the future", "// if tsf > 4102444800 {", "// \treturn nil, fmt.Errorf(\"bad message: %#v\", line)", "// }", "return", "OnePoint", "(", "row", "[", "0", "]", ",", "value", ",", "int64", "(", "tsf", ")", ")", ",", "nil", "\n", "}" ]
7,432
all-7433
[ "ValidateConfig", "is", "used", "to", "validate", "a", "sane", "configuration" ]
[ "func", "ValidateConfig", "(", "config", "*", "Config", ")", "error", "{", "// We don't actually support running as 0 in the library any more, but", "// we do understand it.", "protocolMin", ":=", "ProtocolVersionMin", "\n", "if", "protocolMin", "==", "0", "{", "protocolMin", "=", "1", "\n", "}", "\n", "if", "config", ".", "ProtocolVersion", "<", "protocolMin", "||", "config", ".", "ProtocolVersion", ">", "ProtocolVersionMax", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "config", ".", "ProtocolVersion", ",", "protocolMin", ",", "ProtocolVersionMax", ")", "\n", "}", "\n", "if", "len", "(", "config", ".", "LocalID", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "HeartbeatTimeout", "<", "5", "*", "<mask>", ".", "Millisecond", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "ElectionTimeout", "<", "5", "*", "time", ".", "Millisecond", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "CommitTimeout", "<", "time", ".", "Millisecond", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "MaxAppendEntries", "<=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "MaxAppendEntries", ">", "1024", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "SnapshotInterval", "<", "5", "*", "time", ".", "Millisecond", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "LeaderLeaseTimeout", "<", "5", "*", "time", ".", "Millisecond", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "LeaderLeaseTimeout", ">", "config", ".", "HeartbeatTimeout", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "config", ".", "ElectionTimeout", "<", "config", ".", "HeartbeatTimeout", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,433
all-7434
[ "ResetBody", "resets", "response", "body", "." ]
[ "func", "(", "resp", "*", "Response", ")", "ResetBody", "(", ")", "{", "resp", ".", "bodyRaw", "=", "nil", "\n", "resp", ".", "closeBodyStream", "(", ")", "\n", "if", "resp", ".", "body", "!=", "nil", "{", "if", "resp", ".", "keepBodyBuffer", "{", "resp", ".", "body", ".", "Reset", "(", ")", "\n", "}", "else", "{", "responseBodyPool", ".", "Put", "(", "resp", ".", "body", ")", "\n", "resp", ".", "<mask>", "=", "nil", "\n", "}", "\n", "}", "\n", "}" ]
7,434
all-7435
[ "StoragePoolConfigClear", "deletes", "the", "storage", "pool", "config", "." ]
[ "func", "StoragePoolConfigClear", "(", "<mask>", "*", "sql", ".", "Tx", ",", "poolID", ",", "nodeID", "int64", ")", "error", "{", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "\"", "\"", ",", "poolID", ",", "nodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
7,435
all-7436
[ "delegatedGTLDs", "filters", "the", "provided", "list", "of", "GTLDPeriods", "removing", "any", "entries", "that", "were", "never", "delegated", "from", "the", "root", "DNS", "." ]
[ "func", "delegatedGTLDs", "(", "entries", "[", "]", "util", ".", "GTLDPeriod", ")", "[", "]", "util", ".", "GTLDPeriod", "{", "var", "results", "[", "]", "util", ".", "GTLDPeriod", "\n", "for", "_", ",", "gTLD", ":=", "range", "entries", "{", "if", "gTLD", ".", "DelegationDate", "==", "\"", "\"", "{", "<mask>", "\n", "}", "\n", "results", "=", "append", "(", "results", ",", "gTLD", ")", "\n", "}", "\n", "return", "results", "\n", "}" ]
7,436
all-7437
[ "GetSize", "returns", "the", "dimensions", "of", "the", "given", "terminal", "." ]
[ "func", "GetSize", "(", "fd", "int", ")", "(", "width", ",", "height", "int", ",", "err", "error", ")", "{", "ws", ",", "err", ":=", "unix", ".", "IoctlGetWinsize", "(", "fd", ",", "unix", ".", "TIOCGWINSZ", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "-", "1", ",", "err", "\n", "}", "\n", "return", "int", "(", "ws", ".", "Col", ")", ",", "int", "(", "ws", ".", "<mask>", ")", ",", "nil", "\n", "}" ]
7,437
all-7438
[ "nthLast", "returns", "the", "nth", "most", "recent", "element", "added", "to", "the", "ring", "." ]
[ "func", "(", "r", "*", "sampleRing", ")", "nthLast", "(", "n", "int", ")", "(", "int64", ",", "float64", ",", "bool", ")", "{", "if", "n", ">", "r", ".", "l", "{", "return", "0", ",", "0", ",", "false", "\n", "}", "\n", "t", ",", "v", ":=", "r", ".", "<mask>", "(", "r", ".", "l", "-", "n", ")", "\n", "return", "t", ",", "v", ",", "true", "\n", "}" ]
7,438
all-7439
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetApplicationCacheForFrameReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
7,439
all-7440
[ "retrieve", "the", "label", "of", "a", "named", "object", "identified", "within", "a", "namespace" ]
[ "func", "GetObjectLabel", "(", "identifier", "uint32", ",", "name", "uint32", ",", "bufSize", "int32", ",", "<mask>", "*", "int32", ",", "label", "*", "uint8", ")", "{", "C", ".", "glowGetObjectLabel", "(", "gpGetObjectLabel", ",", "(", "C", ".", "GLenum", ")", "(", "identifier", ")", ",", "(", "C", ".", "GLuint", ")", "(", "name", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "label", ")", ")", ")", "\n", "}" ]
7,440
all-7441
[ "Instance", "implements", "gin", "s", "HTML", "render", "interface" ]
[ "func", "(", "r", "*", "Render", ")", "Instance", "(", "name", "string", ",", "data", "interface", "{", "}", ")", "render", ".", "Render", "{", "var", "tpl", "*", "template", ".", "<mask>", "\n\n", "// Check if gin is running in debug mode and load the templates accordingly", "if", "r", ".", "Debug", "{", "tpl", "=", "r", ".", "loadTemplate", "(", "name", ")", "\n", "}", "else", "{", "tpl", "=", "r", ".", "Templates", "[", "name", "]", "\n", "}", "\n\n", "return", "render", ".", "HTML", "{", "Template", ":", "tpl", ",", "Data", ":", "data", ",", "}", "\n", "}" ]
7,441
all-7442
[ "Errorf", "outputs", "formatted", "Error", "log" ]
[ "func", "Errorf", "(", "format", "string", ",", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "glg", ".", "<mask>", "(", "ERR", ",", "format", ",", "val", "...", ")", "\n", "}" ]
7,442
all-7443
[ "PutResourcePolicy", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "PutResourcePolicy", "(", "arg0", "*", "secretsmanager", ".", "PutResourcePolicyInput", ")", "(", "*", "secretsmanager", ".", "PutResourcePolicyOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "PutResourcePolicyOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
7,443
all-7444
[ "Write", "the", "body", "of", "the", "response" ]
[ "func", "(", "w", "*", "Response", ")", "Write", "(", "b", "[", "]", "<mask>", ")", "(", "int", ",", "error", ")", "{", "w", ".", "Size", "=", "binary", ".", "Size", "(", "b", ")", "\n", "return", "w", ".", "ResponseWriter", ".", "Write", "(", "b", ")", "\n", "}" ]
7,444
all-7445
[ "HasHandle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "u", "*", "User", ")", "HasHandle", "(", ")", "bool", "{", "if", "u", "!=", "nil", "&&", "u", ".", "Handle", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
7,445
all-7446
[ "ClientWithTimeout", "is", "an", "http", "client", "optimized", "for", "high", "throughput", "to", "S3", "It", "times", "out", "more", "agressively", "than", "the", "default", "http", "client", "in", "net", "/", "http", "as", "well", "as", "setting", "deadlines", "on", "the", "TCP", "connection" ]
[ "func", "ClientWithTimeout", "(", "timeout", "time", ".", "Duration", ")", "*", "http", ".", "Client", "{", "transport", ":=", "&", "http", ".", "Transport", "{", "Proxy", ":", "http", ".", "ProxyFromEnvironment", ",", "Dial", ":", "func", "(", "netw", ",", "addr", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "c", ",", "err", ":=", "net", ".", "DialTimeout", "(", "netw", ",", "addr", ",", "timeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "tc", ",", "ok", ":=", "c", ".", "(", "*", "net", ".", "TCPConn", ")", ";", "ok", "{", "tc", ".", "SetKeepAlive", "(", "<mask>", ")", "\n", "tc", ".", "SetKeepAlivePeriod", "(", "timeout", ")", "\n", "}", "\n", "return", "&", "deadlineConn", "{", "timeout", ",", "c", "}", ",", "nil", "\n", "}", ",", "ResponseHeaderTimeout", ":", "timeout", ",", "MaxIdleConnsPerHost", ":", "10", ",", "}", "\n", "return", "&", "http", ".", "Client", "{", "Transport", ":", "transport", "}", "\n", "}" ]
7,446
all-7447
[ "buildAndSelectGuestIPs", "builds", "a", "list", "of", "IP", "addresses", "known", "to", "VMware", "tools", "skipping", "local", "and", "auto", "-", "configuration", "addresses", ".", "The", "builder", "is", "non", "-", "discriminate", "and", "is", "only", "deterministic", "to", "the", "order", "that", "it", "discovers", "addresses", "in", "VMware", "tools", "." ]
[ "func", "buildAndSelectGuestIPs", "(", "ctx", "context", ".", "Context", ",", "vm", "*", "object", ".", "VirtualMachine", ")", "(", "[", "]", "string", ",", "error", ")", "{", "logger", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ")", "\n", "var", "addrs", "[", "]", "string", "\n\n", "props", ",", "err", ":=", "virtualMachineProperties", "(", "ctx", ",", "vm", ",", "[", "]", "string", "{", "\"", "\"", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "err", ")", "\n", "}", "\n\n", "if", "props", ".", "Guest", "==", "nil", "||", "props", ".", "Guest", ".", "Net", "==", "nil", "{", "logger", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ")", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// Now fetch all IP addresses, checking at the same time to see if the IP", "// address is eligible to be a primary IP address.", "for", "_", ",", "n", ":=", "range", "props", ".", "Guest", ".", "Net", "{", "if", "n", ".", "IpConfig", "!=", "nil", "{", "for", "_", ",", "addr", ":=", "range", "n", ".", "IpConfig", ".", "IpAddress", "{", "if", "skipIPAddr", "(", "net", ".", "ParseIP", "(", "addr", ".", "IpAddress", ")", ")", "{", "<mask>", "\n", "}", "\n", "addrs", "=", "append", "(", "addrs", ",", "addr", ".", "IpAddress", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "logger", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "Name", "(", ")", ",", "strings", ".", "Join", "(", "addrs", ",", "\"", "\"", ")", ")", "\n", "return", "addrs", ",", "nil", "\n", "}" ]
7,447
all-7448
[ "ResolveWithGoPath", "will", "resolve", "the", "filename", "relative", "to", "GOPATH", "and", "returns", "the", "first", "file", "that", "exists", "or", "an", "error", "otherwise", "." ]
[ "func", "ResolveWithGoPath", "(", "<mask>", "string", ")", "(", "string", ",", "error", ")", "{", "for", "_", ",", "file", ":=", "range", "goPathCandidates", "(", "filename", ")", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "file", ")", ";", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "file", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "filename", ")", "\n", "}" ]
7,448
all-7449
[ "NewWeightedReport", "returns", "a", "report", "that", "includes", "both", "weighted", "and", "unweighted", "statistics", "." ]
[ "func", "NewWeightedReport", "(", "r", "Report", ",", "precision", "string", ")", "Report", "{", "return", "&", "weightedReport", "{", "baseReport", ":", "r", ",", "<mask>", ":", "newReport", "(", "precision", ")", ",", "results", ":", "make", "(", "chan", "Result", ",", "16", ")", ",", "}", "\n", "}" ]
7,449
all-7450
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetAdBlockingEnabledParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage14", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,450
all-7451
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetBestEffortCoverageParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler20", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,451
all-7452
[ "GetRegionalLocations", "returns", "a", "list", "of", "available", "locations", "in", "a", "specific", "region" ]
[ "func", "(", "c", "*", "Client", ")", "GetRegionalLocations", "(", "regid", "string", ")", "(", "*", "Locations", ",", "error", ")", "{", "url", ":=", "locationRegPath", "(", "regid", ")", "+", "c", ".", "client", ".", "<mask>", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Locations", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
7,452
all-7453
[ "GetTitleOk", "returns", "a", "tuple", "with", "the", "Title", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CheckStatusDefinition", ")", "GetTitleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Title", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "Title", ",", "<mask>", "\n", "}" ]
7,453
all-7454
[ "Do", "executes", "Network", ".", "clearBrowserCookies", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ClearBrowserCookiesParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandClearBrowserCookies", ",", "nil", ",", "nil", ")", "\n", "}" ]
7,454
all-7455
[ "BasicAuthDSN", "return", "the", "connector", "DSN", "for", "basic", "authentication", "." ]
[ "func", "(", "c", "*", "Connector", ")", "BasicAuthDSN", "(", ")", "string", "{", "values", ":=", "url", ".", "Values", "{", "}", "\n", "if", "c", ".", "locale", "!=", "\"", "\"", "{", "values", ".", "Set", "(", "DSNLocale", ",", "c", ".", "locale", ")", "\n", "}", "\n", "if", "c", ".", "fetchSize", "!=", "0", "{", "values", ".", "Set", "(", "DSNFetchSize", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "fetchSize", ")", ")", "\n", "}", "\n", "if", "c", ".", "timeout", "!=", "0", "{", "values", ".", "Set", "(", "DSNTimeout", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "timeout", ")", ")", "\n", "}", "\n", "return", "(", "&", "url", ".", "URL", "{", "Scheme", ":", "DriverName", ",", "User", ":", "url", ".", "UserPassword", "(", "c", ".", "username", ",", "c", ".", "password", ")", ",", "Host", ":", "c", ".", "host", ",", "RawQuery", ":", "<mask>", ".", "Encode", "(", ")", ",", "}", ")", ".", "String", "(", ")", "\n", "}" ]
7,455
all-7456
[ "MutateSetOptions", "for", "HomeDomain", "sets", "the", "SetOptionsOp", "s", "HomeDomain", "field" ]
[ "func", "(", "m", "HomeDomain", ")", "MutateSetOptions", "(", "o", "*", "xdr", ".", "SetOptionsOp", ")", "(", "err", "error", ")", "{", "if", "len", "(", "m", ")", ">", "32", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "value", ":=", "xdr", ".", "String32", "(", "m", ")", "\n", "o", ".", "HomeDomain", "=", "&", "value", "\n", "return", "\n", "}" ]
7,456
all-7457
[ "Parse", "parses", "the", "provided", "as", "a", "stellar", "amount", "i", ".", "e", ".", "A", "64", "-", "bit", "signed", "integer", "that", "represents", "a", "decimal", "number", "with", "7", "digits", "of", "significance", "in", "the", "fractional", "portion", "of", "the", "number", "." ]
[ "func", "Parse", "(", "v", "string", ")", "(", "xdr", ".", "Int64", ",", "error", ")", "{", "<mask>", "f", ",", "o", ",", "r", "big", ".", "Rat", "\n\n", "_", ",", "ok", ":=", "f", ".", "SetString", "(", "v", ")", "\n", "if", "!", "ok", "{", "return", "xdr", ".", "Int64", "(", "0", ")", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n\n", "o", ".", "SetInt64", "(", "One", ")", "\n", "r", ".", "Mul", "(", "&", "f", ",", "&", "o", ")", "\n\n", "is", ":=", "r", ".", "FloatString", "(", "0", ")", "\n", "i", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "is", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "xdr", ".", "Int64", "(", "0", ")", ",", "err", "\n", "}", "\n", "return", "xdr", ".", "Int64", "(", "i", ")", ",", "nil", "\n", "}" ]
7,457
all-7458
[ "NewPgDump", "-", "a", "pgdump", "object", "initialized", "for", "local", "fs" ]
[ "func", "NewPgDump", "(", "ip", "string", ",", "<mask>", "int", ",", "database", ",", "username", ",", "password", "string", ")", "*", "PgDump", "{", "return", "&", "PgDump", "{", "IP", ":", "ip", ",", "Port", ":", "port", ",", "Database", ":", "database", ",", "Username", ":", "username", ",", "Password", ":", "password", ",", "Caller", ":", "command", ".", "NewLocalExecuter", "(", ")", ",", "RecreateOnRestore", ":", "false", ",", "}", "\n", "}" ]
7,458
all-7459
[ "AddHandler", "adds", "a", "function", "to", "be", "called", "whenever", "an", "event", "is", "received" ]
[ "func", "(", "op", "*", "operation", ")", "AddHandler", "(", "function", "func", "(", "api", ".", "<mask>", ")", ")", "(", "*", "EventTarget", ",", "error", ")", "{", "// Make sure we have a listener setup", "err", ":=", "op", ".", "setupListener", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Make sure we're not racing with ourselves", "op", ".", "handlerLock", ".", "Lock", "(", ")", "\n", "defer", "op", ".", "handlerLock", ".", "Unlock", "(", ")", "\n\n", "// If we're done already, just return", "if", "op", ".", "StatusCode", ".", "IsFinal", "(", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "// Wrap the function to filter unwanted messages", "wrapped", ":=", "func", "(", "event", "api", ".", "Event", ")", "{", "newOp", ":=", "api", ".", "Operation", "{", "}", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "event", ".", "Metadata", ",", "&", "newOp", ")", "\n", "if", "err", "!=", "nil", "||", "newOp", ".", "ID", "!=", "op", ".", "ID", "{", "return", "\n", "}", "\n\n", "function", "(", "newOp", ")", "\n", "}", "\n\n", "return", "op", ".", "listener", ".", "AddHandler", "(", "[", "]", "string", "{", "\"", "\"", "}", ",", "wrapped", ")", "\n", "}" ]
7,459
all-7460
[ "MutateTransaction", "for", "MemoHash", "sets", "the", "memo", "." ]
[ "func", "(", "m", "MemoHash", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "(", "err", "error", ")", "{", "o", ".", "TX", ".", "Memo", ",", "err", "=", "xdr", ".", "NewMemo", "(", "xdr", ".", "MemoTypeMemoHash", ",", "m", ".", "<mask>", ")", "\n", "return", "\n", "}" ]
7,460
all-7461
[ "SetMarginLeft", "is", "a", "wrapper", "around", "gtk_widget_set_margin_left", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "SetMarginLeft", "(", "<mask>", "int", ")", "{", "C", ".", "gtk_widget_set_margin_left", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "margin", ")", ")", "\n", "}" ]
7,461
all-7462
[ "FlagToEnv", "converts", "flag", "string", "to", "upper", "-", "case", "environment", "variable", "key", "string", "." ]
[ "func", "FlagToEnv", "(", "prefix", ",", "name", "string", ")", "string", "{", "return", "<mask>", "+", "\"", "\"", "+", "strings", ".", "ToUpper", "(", "strings", ".", "Replace", "(", "name", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", ")", "\n", "}" ]
7,462
all-7463
[ "StoreParam", "stores", "a", "variable", "in", "a", "context" ]
[ "func", "StoreParam", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "value", "string", ")", "context", ".", "<mask>", "{", "n", ":=", "paramName", "(", "name", ")", "\n", "return", "context", ".", "WithValue", "(", "ctx", ",", "n", ",", "Param", "(", "value", ")", ")", "\n", "}" ]
7,463
all-7464
[ "Compact", "compacts", "member", "storage", "with", "given", "revision", ".", "It", "blocks", "until", "it", "s", "physically", "done", "." ]
[ "func", "(", "m", "*", "Member", ")", "Compact", "(", "rev", "int64", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "cli", ",", "err", ":=", "m", ".", "CreateEtcdClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ",", "m", ".", "EtcdClientEndpoint", ")", "\n", "}", "\n", "defer", "cli", ".", "Close", "(", ")", "\n\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "timeout", ")", "\n", "_", ",", "err", "=", "cli", ".", "Compact", "(", "ctx", ",", "<mask>", ",", "clientv3", ".", "WithCompactPhysical", "(", ")", ")", "\n", "cancel", "(", ")", "\n", "return", "err", "\n", "}" ]
7,464
all-7465
[ "UnmarshalJSON", "is", "a", "Custom", "Unmarshal", "for", "Yaxis", ".", "Min", "/", "Yaxis", ".", "Max", ".", "If", "the", "datadog", "API", "returns", "auto", "for", "min", "or", "max", "then", "we", "should", "set", "Yaxis", ".", "min", "or", "Yaxis", ".", "max", "to", "nil", "respectively", "." ]
[ "func", "(", "y", "*", "Yaxis", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "type", "Alias", "Yaxis", "\n", "wrapper", ":=", "&", "struct", "{", "Min", "*", "json", ".", "Number", "`json:\"min,omitempty\"`", "\n", "Max", "*", "json", ".", "Number", "`json:\"max,omitempty\"`", "\n", "*", "Alias", "\n", "}", "{", "Alias", ":", "(", "*", "Alias", ")", "(", "y", ")", ",", "}", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "<mask>", ",", "&", "wrapper", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "wrapper", ".", "Min", "!=", "nil", "{", "if", "*", "wrapper", ".", "Min", "==", "\"", "\"", "{", "y", ".", "AutoMin", "=", "true", "\n", "y", ".", "Min", "=", "nil", "\n", "}", "else", "{", "f", ",", "err", ":=", "wrapper", ".", "Min", ".", "Float64", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "y", ".", "Min", "=", "&", "f", "\n", "}", "\n", "}", "\n\n", "if", "wrapper", ".", "Max", "!=", "nil", "{", "if", "*", "wrapper", ".", "Max", "==", "\"", "\"", "{", "y", ".", "AutoMax", "=", "true", "\n", "y", ".", "Max", "=", "nil", "\n", "}", "else", "{", "f", ",", "err", ":=", "wrapper", ".", "Max", ".", "Float64", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "y", ".", "Max", "=", "&", "f", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,465
all-7466
[ "LoadImage", "invokes", "loads", "an", "image", "from", "an", "input", "stream", "with", "a", "specified", "timeout" ]
[ "func", "(", "dg", "*", "dockerGoClient", ")", "LoadImage", "(", "ctx", "context", ".", "Context", ",", "inputStream", "io", ".", "Reader", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "ctx", ",", "timeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "defer", "metrics", ".", "MetricsEngineGlobal", ".", "RecordDockerMetric", "(", "\"", "\"", ")", "(", ")", "\n", "<mask>", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "response", "<-", "dg", ".", "loadImage", "(", "ctx", ",", "inputStream", ")", "\n", "}", "(", ")", "\n", "select", "{", "case", "resp", ":=", "<-", "response", ":", "return", "resp", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "&", "DockerTimeoutError", "{", "timeout", ",", "\"", "\"", "}", "\n", "}", "\n", "}" ]
7,466
all-7467
[ "ReceiveIssueEvent", "calls", "plugin", ".", "ReceiveIssueEvent", "()", "if", "the", "author", "is", "not", "filtered" ]
[ "func", "(", "a", "*", "AuthorFilterPluginWrapper", ")", "ReceiveIssueEvent", "(", "event", "sql", ".", "IssueEvent", ")", "[", "]", "Point", "{", "if", "event", ".", "Actor", "!=", "nil", "&&", "a", ".", "match", "(", "*", "<mask>", ".", "Actor", ")", "{", "return", "nil", "\n", "}", "\n", "return", "a", ".", "plugin", ".", "ReceiveIssueEvent", "(", "event", ")", "\n", "}" ]
7,467
all-7468
[ "OptImportRoaring", "enables", "importing", "using", "roaring", "bitmaps", "which", "is", "more", "performant", "." ]
[ "func", "OptImportRoaring", "(", "enable", "bool", ")", "ImportOption", "{", "return", "func", "(", "<mask>", "*", "ImportOptions", ")", "error", "{", "options", ".", "wantRoaring", "=", "&", "enable", "\n", "return", "nil", "\n", "}", "\n", "}" ]
7,468
all-7469
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GtkVolumeButton", "." ]
[ "func", "(", "v", "*", "VolumeButton", ")", "native", "(", ")", "*", "C", ".", "GtkVolumeButton", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkVolumeButton", "(", "p", ")", "\n", "}" ]
7,469
all-7470
[ "makePlatformStringsExpr", "constructs", "a", "single", "expression", "from", "the", "sub", "-", "expressions", "in", "ps", "." ]
[ "func", "makePlatformStringsExpr", "(", "ps", "platformStringsExprs", ")", "bzl", ".", "Expr", "{", "makeSelect", ":=", "func", "(", "dict", "*", "bzl", ".", "DictExpr", ")", "bzl", ".", "Expr", "{", "return", "&", "bzl", ".", "CallExpr", "{", "X", ":", "&", "bzl", ".", "Ident", "{", "Name", ":", "\"", "\"", "}", ",", "List", ":", "[", "]", "bzl", ".", "Expr", "{", "dict", "}", ",", "}", "\n", "}", "\n", "forceMultiline", ":=", "func", "(", "e", "bzl", ".", "Expr", ")", "{", "switch", "e", ":=", "e", ".", "(", "type", ")", "{", "case", "*", "bzl", ".", "ListExpr", ":", "e", ".", "ForceMultiLine", "=", "true", "\n", "<mask>", "*", "bzl", ".", "CallExpr", ":", "e", ".", "List", "[", "0", "]", ".", "(", "*", "bzl", ".", "DictExpr", ")", ".", "ForceMultiLine", "=", "true", "\n", "}", "\n", "}", "\n\n", "var", "parts", "[", "]", "bzl", ".", "Expr", "\n", "if", "ps", ".", "generic", "!=", "nil", "{", "parts", "=", "append", "(", "parts", ",", "ps", ".", "generic", ")", "\n", "}", "\n", "if", "ps", ".", "os", "!=", "nil", "{", "parts", "=", "append", "(", "parts", ",", "makeSelect", "(", "ps", ".", "os", ")", ")", "\n", "}", "\n", "if", "ps", ".", "arch", "!=", "nil", "{", "parts", "=", "append", "(", "parts", ",", "makeSelect", "(", "ps", ".", "arch", ")", ")", "\n", "}", "\n", "if", "ps", ".", "platform", "!=", "nil", "{", "parts", "=", "append", "(", "parts", ",", "makeSelect", "(", "ps", ".", "platform", ")", ")", "\n", "}", "\n\n", "if", "len", "(", "parts", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "if", "len", "(", "parts", ")", "==", "1", "{", "return", "parts", "[", "0", "]", "\n", "}", "\n", "expr", ":=", "parts", "[", "0", "]", "\n", "forceMultiline", "(", "expr", ")", "\n", "for", "_", ",", "part", ":=", "range", "parts", "[", "1", ":", "]", "{", "forceMultiline", "(", "part", ")", "\n", "expr", "=", "&", "bzl", ".", "BinaryExpr", "{", "Op", ":", "\"", "\"", ",", "X", ":", "expr", ",", "Y", ":", "part", ",", "}", "\n", "}", "\n", "return", "expr", "\n", "}" ]
7,470
all-7471
[ "Do", "executes", "DOM", ".", "moveTo", "against", "the", "provided", "context", ".", "returns", ":", "nodeID", "-", "New", "id", "of", "the", "moved", "node", "." ]
[ "func", "(", "p", "*", "MoveToParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "nodeID", "cdp", ".", "NodeID", ",", "err", "error", ")", "{", "// execute", "var", "res", "MoveToReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandMoveTo", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "NodeID", ",", "nil", "\n", "}" ]
7,471
all-7472
[ "decodeContent", "performs", "transport", "decoding", "(", "base64", "quoted", "-", "printable", ")", "and", "charset", "decoding", "placing", "the", "result", "into", "Part", ".", "Content", ".", "IO", "errors", "will", "be", "returned", "immediately", ";", "other", "errors", "and", "warnings", "will", "be", "added", "to", "Part", ".", "Errors", "." ]
[ "func", "(", "p", "*", "Part", ")", "decodeContent", "(", "r", "io", ".", "Reader", ")", "error", "{", "// contentReader will point to the end of the content decoding pipeline.", "contentReader", ":=", "r", "\n", "// b64cleaner aggregates errors, must maintain a reference to it to get them later.", "var", "b64cleaner", "*", "coding", ".", "Base64Cleaner", "\n", "// Build content decoding reader.", "encoding", ":=", "p", ".", "Header", ".", "Get", "(", "hnContentEncoding", ")", "\n", "validEncoding", ":=", "<mask>", "\n", "switch", "strings", ".", "ToLower", "(", "encoding", ")", "{", "case", "cteQuotedPrintable", ":", "contentReader", "=", "coding", ".", "NewQPCleaner", "(", "contentReader", ")", "\n", "contentReader", "=", "quotedprintable", ".", "NewReader", "(", "contentReader", ")", "\n", "case", "cteBase64", ":", "b64cleaner", "=", "coding", ".", "NewBase64Cleaner", "(", "contentReader", ")", "\n", "contentReader", "=", "base64", ".", "NewDecoder", "(", "base64", ".", "RawStdEncoding", ",", "b64cleaner", ")", "\n", "case", "cte8Bit", ",", "cte7Bit", ",", "cteBinary", ",", "\"", "\"", ":", "// No decoding required.", "default", ":", "// Unknown encoding.", "validEncoding", "=", "false", "\n", "p", ".", "addWarning", "(", "ErrorContentEncoding", ",", "\"", "\"", ",", "encoding", ")", "\n", "}", "\n", "// Build charset decoding reader.", "if", "validEncoding", "&&", "strings", ".", "HasPrefix", "(", "p", ".", "ContentType", ",", "\"", "\"", ")", "{", "var", "err", "error", "\n", "contentReader", ",", "err", "=", "p", ".", "convertFromDetectedCharset", "(", "contentReader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "// Decode and store content.", "content", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "contentReader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "WithStack", "(", "err", ")", "\n", "}", "\n", "p", ".", "Content", "=", "content", "\n", "// Collect base64 errors.", "if", "b64cleaner", "!=", "nil", "{", "for", "_", ",", "err", ":=", "range", "b64cleaner", ".", "Errors", "{", "p", ".", "Errors", "=", "append", "(", "p", ".", "Errors", ",", "&", "Error", "{", "Name", ":", "ErrorMalformedBase64", ",", "Detail", ":", "err", ".", "Error", "(", ")", ",", "Severe", ":", "false", ",", "}", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
7,472
all-7473
[ "Fail", "outputs", "Failed", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Fail", "(", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "g", ".", "out", "(", "FAIL", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
7,473
all-7474
[ "FromYAML", "allows", "a", "fixture", "to", "be", "created", "from", "yaml", "input" ]
[ "func", "FromYAML", "(", "db", "*", "sql", ".", "<mask>", ",", "yamlIn", "[", "]", "byte", ")", "(", "Fixture", ",", "error", ")", "{", "var", "tables", "Tables", "\n", "err", ":=", "yaml", ".", "Unmarshal", "(", "yamlIn", ",", "&", "tables", ")", "\n", "return", "New", "(", "db", ",", "tables", ")", ",", "err", "\n", "}" ]
7,474
all-7475
[ "AppChooserWidgetNew", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_widget_new", "()", "." ]
[ "func", "AppChooserWidgetNew", "(", "content_type", "string", ")", "(", "*", "AppChooserWidget", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "content_type", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_app_chooser_widget_new", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "return", "wrapAppChooserWidget", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
7,475
all-7476
[ "BlockPathFromEnv", "gets", "the", "path", "to", "an", "object", "storage", "block", "based", "on", "environment", "variables", "." ]
[ "func", "BlockPathFromEnv", "(", "block", "*", "pfs", ".", "Block", ")", "(", "string", ",", "error", ")", "{", "storageRoot", ",", "err", ":=", "StorageRootFromEnv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "filepath", ".", "Join", "(", "storageRoot", ",", "\"", "\"", ",", "<mask>", ".", "Hash", ")", ",", "nil", "\n", "}" ]
7,476
all-7477
[ "newEphemeralGPGSigningMechanism", "returns", "a", "new", "GPG", "/", "OpenPGP", "signing", "mechanism", "which", "recognizes", "_only_", "public", "keys", "from", "the", "supplied", "blob", "and", "returns", "the", "identities", "of", "these", "keys", ".", "The", "caller", "must", "call", ".", "Close", "()", "on", "the", "returned", "SigningMechanism", "." ]
[ "func", "newEphemeralGPGSigningMechanism", "(", "blob", "[", "]", "<mask>", ")", "(", "SigningMechanism", ",", "[", "]", "string", ",", "error", ")", "{", "m", ":=", "&", "openpgpSigningMechanism", "{", "keyring", ":", "openpgp", ".", "EntityList", "{", "}", ",", "}", "\n", "keyIdentities", ",", "err", ":=", "m", ".", "importKeysFromBytes", "(", "blob", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "return", "m", ",", "keyIdentities", ",", "nil", "\n", "}" ]
7,477
all-7478
[ "AddressList", "returns", "a", "mail", ".", "Address", "slice", "with", "RFC", "2047", "encoded", "names", "converted", "to", "UTF", "-", "8" ]
[ "func", "(", "e", "*", "Envelope", ")", "AddressList", "(", "key", "string", ")", "(", "[", "]", "*", "mail", ".", "Address", ",", "error", ")", "{", "if", "e", ".", "header", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "AddressHeaders", "[", "strings", ".", "ToLower", "(", "key", ")", "]", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ")", "\n", "}", "\n\n", "str", ":=", "decodeToUTF8Base64Header", "(", "e", ".", "header", ".", "Get", "(", "key", ")", ")", "\n", "if", "str", "==", "\"", "\"", "{", "return", "nil", ",", "mail", ".", "ErrHeaderNotPresent", "\n", "}", "\n\n", "// These statements are handy for debugging ParseAddressList errors", "// fmt.Println(\"in: \", m.header.Get(key))", "// fmt.Println(\"out: \", str)", "ret", ",", "err", ":=", "mail", ".", "ParseAddressList", "(", "str", ")", "\n", "switch", "{", "case", "err", "==", "nil", ":", "// carry on", "case", "err", ".", "Error", "(", ")", "==", "\"", "\"", ":", "<mask>", ",", "err", "=", "mail", ".", "ParseAddressList", "(", "ensureCommaDelimitedAddresses", "(", "str", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "default", ":", "return", "nil", ",", "err", "\n", "}", "\n", "return", "ret", ",", "nil", "\n", "}" ]
7,478
all-7479
[ "returns", "next", "sparse", "array", "node", "(", "or", "NULL", "if", "there", "is", "no", "more", "nodes", ")" ]
[ "func", "(", "iter", "*", "SparseMatIterator", ")", "Next", "(", ")", "*", "SparseNode", "{", "node", ":=", "C", ".", "cvGetNextSparseNode", "(", "(", "*", "C", ".", "CvSparseMatIterator", ")", "(", "iter", ")", ")", "\n", "return", "(", "*", "SparseNode", ")", "(", "<mask>", ")", "\n", "}" ]
7,479
all-7480
[ "define", "an", "array", "of", "secondary", "colors" ]
[ "func", "SecondaryColorPointer", "(", "size", "int32", ",", "xtype", "uint32", ",", "stride", "int32", ",", "pointer", "unsafe", ".", "Pointer", ")", "{", "C", ".", "glowSecondaryColorPointer", "(", "gpSecondaryColorPointer", ",", "(", "C", ".", "GLint", ")", "(", "size", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "stride", ")", ",", "<mask>", ")", "\n", "}" ]
7,480
all-7481
[ "SetBoolStringPtr", "sets", "a", "stringified", "ResoruceData", "bool", "field", ".", "This", "is", "a", "field", "that", "is", "supposed", "to", "behave", "like", "a", "bool", "(", "true", "/", "false", ")", "but", "needs", "to", "be", "a", "string", "to", "represent", "a", "nil", "state", "as", "well", ".", "This", "is", "designed", "to", "address", "the", "current", "lack", "of", "HCL", "and", "Terraform", "to", "be", "able", "to", "distinguish", "between", "nil", "states", "and", "zero", "values", "properly", ".", "This", "is", "a", "systemic", "issue", "that", "affects", "reading", "writing", "and", "diffing", "of", "these", "values", ".", "These", "issues", "will", "eventually", "be", "addressed", "in", "HCL2", "." ]
[ "func", "SetBoolStringPtr", "(", "d", "*", "schema", ".", "ResourceData", ",", "key", "string", ",", "val", "*", "bool", ")", "error", "{", "var", "s", "string", "\n", "if", "val", "!=", "nil", "{", "s", "=", "strconv", ".", "FormatBool", "(", "*", "val", ")", "\n", "}", "\n", "return", "d", ".", "<mask>", "(", "key", ",", "s", ")", "\n", "}" ]
7,481
all-7482
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "UsageForType", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoStorage", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
7,482
all-7483
[ "Add", "adds", "a", "point", "." ]
[ "func", "(", "countIndex", "*", "CountIndex", ")", "Add", "(", "point", "Point", ")", "{", "countIndex", ".", "Remove", "(", "point", ".", "<mask>", "(", ")", ")", "\n", "countIndex", ".", "currentPosition", "[", "point", ".", "Id", "(", ")", "]", "=", "point", "\n", "countIndex", ".", "index", ".", "AddEntryAt", "(", "point", ")", ".", "(", "counter", ")", ".", "Add", "(", "point", ")", "\n", "}" ]
7,483
all-7484
[ "Join", "returns", "a", "new", "JoinCondition", "of", "JOIN", "clause", "." ]
[ "func", "(", "db", "*", "DB", ")", "Join", "(", "table", "<mask>", "{", "}", ")", "*", "JoinCondition", "{", "return", "(", "&", "JoinCondition", "{", "db", ":", "db", "}", ")", ".", "Join", "(", "table", ")", "\n", "}" ]
7,484
all-7485
[ "expandClusterVMHostRuleInfo", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterVmHostRuleInfo", "." ]
[ "func", "expandClusterVMHostRuleInfo", "(", "d", "*", "schema", ".", "ResourceData", ")", "(", "*", "<mask>", ".", "ClusterVmHostRuleInfo", ",", "error", ")", "{", "obj", ":=", "&", "types", ".", "ClusterVmHostRuleInfo", "{", "ClusterRuleInfo", ":", "types", ".", "ClusterRuleInfo", "{", "Enabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "Mandatory", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "Name", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "UserCreated", ":", "structure", ".", "BoolPtr", "(", "true", ")", ",", "}", ",", "AffineHostGroupName", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "AntiAffineHostGroupName", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "VmGroupName", ":", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "}", "\n", "return", "obj", ",", "nil", "\n", "}" ]
7,485
all-7486
[ "New", "will", "create", "an", "ActionBar", "object" ]
[ "func", "New", "(", "admin", "*", "admin", ".", "Admin", ")", "*", "ActionBar", "{", "bar", ":=", "&", "ActionBar", "{", "Admin", ":", "admin", "}", "\n", "ctr", ":=", "&", "controller", "{", "ActionBar", ":", "<mask>", "}", "\n", "admin", ".", "GetRouter", "(", ")", ".", "Get", "(", "\"", "\"", ",", "ctr", ".", "SwitchMode", ")", "\n", "admin", ".", "GetRouter", "(", ")", ".", "Get", "(", "\"", "\"", ",", "ctr", ".", "InlineEdit", ")", "\n", "return", "bar", "\n", "}" ]
7,486
all-7487
[ "NewMinioClientFromEnv", "creates", "a", "Minio", "client", "based", "on", "environment", "variables", "." ]
[ "func", "NewMinioClientFromEnv", "(", ")", "(", "Client", ",", "error", ")", "{", "bucket", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioBucketEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioBucketEnvVar", ")", "\n", "}", "\n", "endpoint", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioEndpointEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioEndpointEnvVar", ")", "\n", "}", "\n", "id", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioIDEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioIDEnvVar", ")", "\n", "}", "\n", "<mask>", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioSecretEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioSecretEnvVar", ")", "\n", "}", "\n", "secure", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioSecureEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioSecureEnvVar", ")", "\n", "}", "\n", "isS3V2", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "MinioSignatureEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "MinioSignatureEnvVar", ")", "\n", "}", "\n", "return", "NewMinioClient", "(", "endpoint", ",", "bucket", ",", "id", ",", "secret", ",", "secure", "==", "\"", "\"", ",", "isS3V2", "==", "\"", "\"", ")", "\n", "}" ]
7,487
all-7488
[ "Create", "a", "NestedError", "with", "the", "given", "path", ".", "If", "err", "is", "a", "NestedError", "prepend", "the", "path", "to", "it", ".", "If", "err", "is", "an", "AggregateError", "recursively", "Nest", "each", "error", "." ]
[ "func", "Nest", "(", "path", "string", ",", "err", "error", ")", "error", "{", "if", "ag", ",", "ok", ":=", "err", ".", "(", "AggregateError", ")", ";", "ok", "{", "var", "errs", "AggregateError", "\n", "for", "_", ",", "e", ":=", "range", "ag", "{", "errs", "=", "append", "(", "errs", ",", "Nest", "(", "path", ",", "e", ")", ")", "\n", "}", "\n", "return", "errs", "\n", "}", "\n", "if", "ne", ",", "ok", ":=", "err", ".", "(", "*", "NestedError", ")", ";", "ok", "{", "return", "&", "NestedError", "{", "<mask>", ":", "path", "+", "ne", ".", "Path", ",", "Err", ":", "ne", ".", "Err", ",", "}", "\n", "}", "\n", "return", "&", "NestedError", "{", "Path", ":", "path", ",", "Err", ":", "err", ",", "}", "\n", "}" ]
7,488
all-7489
[ "Font", "returns", "the", "font", "with", "the", "given", "name", "associated", "with", "the", "page", "." ]
[ "func", "(", "p", "Page", ")", "Font", "(", "name", "string", ")", "Font", "{", "return", "Font", "{", "p", ".", "Resources", "(", ")", ".", "Key", "(", "\"", "\"", ")", ".", "Key", "(", "<mask>", ")", "}", "\n", "}" ]
7,489
all-7490
[ "ErrMissingRequiredField", "indicates", "the", "request", "is", "missing", "a", "required", "field", "." ]
[ "func", "ErrMissingRequiredField", "(", "field", "string", ")", "error", "{", "return", "ErrorResponse", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", ",", "}", "\n", "}" ]
7,490
all-7491
[ "NewRoundTripper", "returns", "a", "roundTripper", "used", "to", "send", "requests", "to", "rafthttp", "listener", "of", "remote", "peers", "." ]
[ "func", "NewRoundTripper", "(", "tlsInfo", "transport", ".", "TLSInfo", ",", "dialTimeout", "time", ".", "Duration", ")", "(", "<mask>", ".", "RoundTripper", ",", "error", ")", "{", "// It uses timeout transport to pair with remote timeout listeners.", "// It sets no read/write timeout, because message in requests may", "// take long time to write out before reading out the response.", "return", "transport", ".", "NewTimeoutTransport", "(", "tlsInfo", ",", "dialTimeout", ",", "0", ",", "0", ")", "\n", "}" ]
7,491
all-7492
[ "Do", "executes", "Page", ".", "addCompilationCache", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "AddCompilationCacheParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandAddCompilationCache", ",", "p", ",", "nil", ")", "\n", "}" ]
7,492
all-7493
[ "IsError", "implements", "the", "driver", ".", "Error", "interface", "." ]
[ "func", "(", "e", "*", "hdbErrors", ")", "IsError", "(", ")", "bool", "{", "return", "e", ".", "<mask>", "[", "e", ".", "idx", "]", ".", "errorLevel", "==", "errorLevelError", "\n", "}" ]
7,493
all-7494
[ "title", ":", "machine", "list", "path", ":", "/", "iaas", "/", "machines", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized" ]
[ "func", "machinesList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "token", "auth", ".", "<mask>", ")", "error", "{", "machines", ",", "err", ":=", "iaas", ".", "ListMachines", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "contexts", ":=", "permission", ".", "ContextsForPermission", "(", "token", ",", "permission", ".", "PermMachineRead", ")", "\n", "allowedIaaS", ":=", "map", "[", "string", "]", "struct", "{", "}", "{", "}", "\n", "for", "_", ",", "c", ":=", "range", "contexts", "{", "if", "c", ".", "CtxType", "==", "permTypes", ".", "CtxGlobal", "{", "allowedIaaS", "=", "nil", "\n", "break", "\n", "}", "\n", "if", "c", ".", "CtxType", "==", "permTypes", ".", "CtxIaaS", "{", "allowedIaaS", "[", "c", ".", "Value", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "}", "\n", "for", "i", ":=", "0", ";", "allowedIaaS", "!=", "nil", "&&", "i", "<", "len", "(", "machines", ")", ";", "i", "++", "{", "if", "_", ",", "ok", ":=", "allowedIaaS", "[", "machines", "[", "i", "]", ".", "Iaas", "]", ";", "!", "ok", "{", "machines", "=", "append", "(", "machines", "[", ":", "i", "]", ",", "machines", "[", "i", "+", "1", ":", "]", "...", ")", "\n", "i", "--", "\n", "}", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "machines", ")", "\n", "}" ]
7,494
all-7495
[ "NewMulti", "creates", "a", "MultiLog" ]
[ "func", "NewMulti", "(", "vals", "...", "interface", "{", "}", ")", "LogBackend", "{", "if", "len", "(", "vals", ")", "%", "2", "!=", "0", "{", "Fail", "(", "e", ".", "New", "(", "\"", "\"", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "l", ":=", "len", "(", "vals", ")", "/", "2", "\n", "mp", ":=", "make", "(", "[", "]", "LogBackend", ",", "0", ",", "l", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "vals", ")", ";", "i", "+=", "2", "{", "bak", ",", "ok", ":=", "vals", "[", "i", "]", ".", "(", "LogBackend", ")", "\n", "if", "!", "<mask>", "{", "Fail", "(", "e", ".", "New", "(", "\"", "\"", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "f", ",", "ok", ":=", "vals", "[", "i", "+", "1", "]", ".", "(", "Formatter", ")", "\n", "if", "!", "ok", "{", "Fail", "(", "e", ".", "New", "(", "\"", "\"", ")", ")", "\n", "return", "nil", "\n", "}", "\n", "bak", ".", "F", "(", "f", ")", "\n", "mp", "=", "append", "(", "mp", ",", "bak", ")", "\n", "}", "\n", "return", "&", "MultiLog", "{", "mp", ":", "mp", ",", "}", "\n", "}" ]
7,495
all-7496
[ "RemoteAddr", "returns", "client", "address", "for", "the", "given", "request", ".", "Always", "returns", "non", "-", "nil", "result", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "RemoteAddr", "(", ")", "<mask>", ".", "Addr", "{", "if", "ctx", ".", "c", "==", "nil", "{", "return", "zeroTCPAddr", "\n", "}", "\n", "addr", ":=", "ctx", ".", "c", ".", "RemoteAddr", "(", ")", "\n", "if", "addr", "==", "nil", "{", "return", "zeroTCPAddr", "\n", "}", "\n", "return", "addr", "\n", "}" ]
7,496
all-7497
[ "A", "word", "is", "called", "short", "if", "it", "ends", "in", "a", "short", "syllable", "and", "if", "R1", "is", "null", "." ]
[ "func", "isShortWord", "(", "w", "*", "snowballword", ".", "SnowballWord", ")", "(", "isShort", "bool", ")", "{", "// If r1 is not empty, the word is not short", "if", "w", ".", "R1start", "<", "len", "(", "w", ".", "RS", ")", "{", "<mask>", "\n", "}", "\n\n", "// Otherwise it must end in a short syllable", "return", "endsShortSyllable", "(", "w", ",", "len", "(", "w", ".", "RS", ")", ")", "\n", "}" ]
7,497
all-7498
[ "See", "bcd", ".", "Tracer", ".", "Finalize", "()", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "Finalize", "(", "options", "[", "]", "string", ")", "*", "exec", ".", "Cmd", "{", "t", ".", "m", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "m", ".", "RUnlock", "(", ")", "\n\n", "tracer", ":=", "<mask>", ".", "Command", "(", "t", ".", "cmd", ",", "options", "...", ")", "\n", "tracer", ".", "Dir", "=", "t", ".", "outputDir", "\n", "tracer", ".", "Stdin", "=", "t", ".", "p", ".", "stdin", "\n", "tracer", ".", "Stderr", "=", "t", ".", "p", ".", "stderr", "\n\n", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ",", "tracer", ")", "\n\n", "return", "tracer", "\n", "}" ]
7,498
all-7499
[ "ResetConnectionClose", "clears", "Connection", ":", "close", "header", "if", "it", "exists", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "ResetConnectionClose", "(", ")", "{", "h", ".", "parseRawHeaders", "(", ")", "\n", "if", "h", ".", "connectionClose", "{", "h", ".", "connectionClose", "=", "<mask>", "\n", "h", ".", "h", "=", "delAllArgsBytes", "(", "h", ".", "h", ",", "strConnection", ")", "\n", "}", "\n", "}" ]
7,499
all-7500
[ "HostFromLogin", "returns", "the", "policy", "endpoint", "from", "its", "login", "endpoint", ".", "The", "following", "isn", "t", "great", "but", "seems", "better", "than", "having", "to", "enter", "by", "hand", "." ]
[ "func", "HostFromLogin", "(", "host", "string", ")", "string", "{", "urlElems", ":=", "strings", ".", "Split", "(", "host", ",", "\"", "\"", ")", "\n", "hostPrefix", ":=", "urlElems", "[", "0", "]", "\n", "elems", ":=", "strings", ".", "Split", "(", "hostPrefix", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "elems", ")", "==", "1", "&&", "elems", "[", "0", "]", "==", "\"", "\"", "{", "// accommodates micromoo host inference, such as \"cm.rightscale.local\" => \"selfservice.rightscale.local\"", "elems", "[", "0", "]", "=", "\"", "\"", "\n", "}", "else", "if", "len", "(", "elems", ")", "<", "2", "{", "// don't know how to compute this policy host; use the cm host", "return", "<mask>", "\n", "}", "else", "{", "elems", "[", "len", "(", "elems", ")", "-", "2", "]", "=", "\"", "\"", "\n", "}", "\n", "policyHostPrefix", ":=", "strings", ".", "Join", "(", "elems", ",", "\"", "\"", ")", "\n", "return", "strings", ".", "Join", "(", "append", "(", "[", "]", "string", "{", "policyHostPrefix", "}", ",", "urlElems", "[", "1", ":", "]", "...", ")", ",", "\"", "\"", ")", "\n", "}" ]