id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
13,300
all-13301
[ "AddFromResource", "is", "a", "wrapper", "around", "gtk_builder_add_from_resource", "()", "." ]
[ "func", "(", "b", "*", "Builder", ")", "AddFromResource", "(", "path", "string", ")", "error", "{", "cstr", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "var", "err", "*", "C", ".", "GError", "=", "nil", "\n", "<mask>", ":=", "C", ".", "gtk_builder_add_from_resource", "(", "b", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "&", "err", ")", "\n", "if", "res", "==", "0", "{", "defer", "C", ".", "g_error_free", "(", "err", ")", "\n", "return", "errors", ".", "New", "(", "goString", "(", "err", ".", "message", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,301
all-13302
[ "Lob" ]
[ "func", "convertNvLob", "(", "idx", "int", ",", "f", "*", "p", ".", "ParameterField", ",", "v", "interface", "{", "}", ")", "(", "driver", ".", "<mask>", ",", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "v", ",", "nil", "\n", "}", "\n\n", "switch", "v", ":=", "v", ".", "(", "type", ")", "{", "case", "Lob", ":", "if", "v", ".", "rd", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n", "f", ".", "SetLobReader", "(", "v", ".", "rd", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "idx", ")", ",", "nil", "\n", "case", "*", "Lob", ":", "if", "v", ".", "rd", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n", "f", ".", "SetLobReader", "(", "v", ".", "rd", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "idx", ")", ",", "nil", "\n", "case", "NullLob", ":", "if", "!", "v", ".", "Valid", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "if", "v", ".", "Lob", ".", "rd", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n", "f", ".", "SetLobReader", "(", "v", ".", "Lob", ".", "rd", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "idx", ")", ",", "nil", "\n", "case", "*", "NullLob", ":", "if", "!", "v", ".", "Valid", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "if", "v", ".", "Lob", ".", "rd", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}", "\n", "f", ".", "SetLobReader", "(", "v", ".", "Lob", ".", "rd", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "idx", ")", ",", "nil", "\n", "}", "\n\n", "rv", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n\n", "switch", "rv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Ptr", ":", "// indirect pointers", "if", "rv", ".", "IsNil", "(", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "convertNvLob", "(", "idx", ",", "f", ",", "rv", ".", "Elem", "(", ")", ".", "Interface", "(", ")", ")", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}" ]
13,302
all-13303
[ "===", "stddev_over_time", "(", "Matrix", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcStddevOverTime", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "aggrOverTime", "(", "vals", ",", "enh", ",", "func", "(", "values", "[", "]", "Point", ")", "float64", "{", "var", "aux", ",", "count", ",", "mean", "float64", "\n", "for", "_", ",", "v", ":=", "<mask>", "values", "{", "count", "++", "\n", "delta", ":=", "v", ".", "V", "-", "mean", "\n", "mean", "+=", "delta", "/", "count", "\n", "aux", "+=", "delta", "*", "(", "v", ".", "V", "-", "mean", ")", "\n", "}", "\n", "return", "math", ".", "Sqrt", "(", "aux", "/", "count", ")", "\n", "}", ")", "\n", "}" ]
13,303
all-13304
[ "GetIdOk", "returns", "a", "tuple", "with", "the", "Id", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "Event", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "<mask>", ",", "true", "\n", "}" ]
13,304
all-13305
[ "TagLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "TagLocator", "(", "href", "string", ")", "*", "TagLocator", "{", "<mask>", "&", "TagLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
13,305
all-13306
[ "GetKey", "returns", "the", "Key", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "APIKey", ")", "GetKey", "(", ")", "string", "{", "if", "a", "==", "nil", "||", "a", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "a", ".", "Key", "\n", "}" ]
13,306
all-13307
[ "exchangeUpdated", "updates", "the", "peer", "heap", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "exchangeUpdated", "(", "c", "*", "<mask>", ")", "{", "if", "c", ".", "remotePeerInfo", ".", "HostPort", "==", "\"", "\"", "{", "// Hostport is unknown until we get init resp.", "return", "\n", "}", "\n\n", "p", ",", "ok", ":=", "ch", ".", "RootPeers", "(", ")", ".", "Get", "(", "c", ".", "remotePeerInfo", ".", "HostPort", ")", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n\n", "ch", ".", "updatePeer", "(", "p", ")", "\n", "}" ]
13,307
all-13308
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "SDConfig", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "*", "c", "=", "DefaultSDConfig", "\n", "type", "plain", "SDConfig", "\n", "err", ":=", "unmarshal", "(", "(", "*", "plain", ")", "(", "c", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "c", ".", "Names", ")", "==", "0", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "switch", "strings", ".", "ToUpper", "(", "c", ".", "Type", ")", "{", "case", "\"", "\"", ":", "case", "\"", "\"", ",", "\"", "\"", ":", "if", "c", ".", "Port", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "default", ":", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "Type", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,308
all-13309
[ "Chunk", "splits", "a", "piece", "of", "data", "up", "this", "is", "useful", "for", "splitting", "up", "data", "that", "s", "bigger", "than", "MaxMsgSize" ]
[ "func", "Chunk", "(", "data", "[", "]", "byte", ",", "chunkSize", "int", ")", "[", "]", "[", "]", "byte", "{", "var", "result", "[", "]", "[", "]", "byte", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "data", ")", ";", "i", "+=", "chunkSize", "{", "end", ":=", "i", "+", "chunkSize", "\n", "if", "end", ">", "len", "(", "data", ")", "{", "end", "=", "len", "(", "data", ")", "\n", "}", "\n", "result", "=", "append", "(", "<mask>", ",", "data", "[", "i", ":", "end", "]", ")", "\n", "}", "\n", "return", "result", "\n", "}" ]
13,309
all-13310
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Response", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
13,310
all-13311
[ "buildParams", "takes", "the", "image", "options", "set", "by", "the", "user", "and", "turns", "them", "into", "command", "flags", "for", "wkhtmltoimage", "It", "returns", "an", "array", "of", "command", "flags", "." ]
[ "func", "buildParams", "(", "options", "*", "ImageOptions", ")", "(", "[", "]", "string", ",", "error", ")", "{", "a", ":=", "[", "]", "string", "{", "}", "\n\n", "if", "options", ".", "Input", "==", "\"", "\"", "{", "return", "[", "]", "string", "{", "}", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// silence extra wkhtmltoimage output", "// might want to add --javascript-delay too?", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n\n", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "if", "options", ".", "Format", "!=", "\"", "\"", "{", "a", "=", "append", "(", "a", ",", "options", ".", "Format", ")", "\n", "}", "else", "{", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "options", ".", "Height", "!=", "0", "{", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "a", "=", "append", "(", "a", ",", "strconv", ".", "Itoa", "(", "options", ".", "Height", ")", ")", "\n", "}", "\n\n", "if", "options", ".", "Width", "!=", "0", "{", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "a", "=", "append", "(", "a", ",", "strconv", ".", "Itoa", "(", "options", ".", "Width", ")", ")", "\n", "}", "\n\n", "if", "options", ".", "Quality", "!=", "0", "{", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "a", "=", "append", "(", "a", ",", "strconv", ".", "Itoa", "(", "<mask>", ".", "Quality", ")", ")", "\n", "}", "\n\n", "// url and output come last", "if", "options", ".", "Input", "!=", "\"", "\"", "{", "// make sure we dont pass stdin if we aren't expecting it", "options", ".", "Html", "=", "\"", "\"", "\n", "}", "\n\n", "a", "=", "append", "(", "a", ",", "options", ".", "Input", ")", "\n\n", "if", "options", ".", "Output", "==", "\"", "\"", "{", "a", "=", "append", "(", "a", ",", "\"", "\"", ")", "\n", "}", "else", "{", "a", "=", "append", "(", "a", ",", "options", ".", "Output", ")", "\n", "}", "\n\n", "return", "a", ",", "nil", "\n", "}" ]
13,311
all-13312
[ "WithModifiers", "bit", "field", "representing", "pressed", "modifier", "keys", ".", "Alt", "=", "1", "Ctrl", "=", "2", "Meta", "/", "Command", "=", "4", "Shift", "=", "8", "(", "default", ":", "0", ")", "." ]
[ "func", "(", "p", "DispatchMouseEventParams", ")", "WithModifiers", "(", "modifiers", "Modifier", ")", "*", "DispatchMouseEventParams", "{", "p", ".", "Modifiers", "=", "modifiers", "\n", "<mask>", "&", "p", "\n", "}" ]
13,312
all-13313
[ "keyNames", "returns", "a", "slice", "of", "the", "provided", "keys", "names", "(", "string", "IDs", ")", "." ]
[ "func", "keyNames", "(", "keys", "[", "]", "*", "Key", ")", "[", "]", "string", "{", "n", ":=", "<mask>", "(", "[", "]", "string", ",", "0", ",", "len", "(", "keys", ")", ")", "\n", "for", "_", ",", "k", ":=", "range", "keys", "{", "n", "=", "append", "(", "n", ",", "k", ".", "StringID", "(", ")", ")", "\n", "}", "\n", "return", "n", "\n", "}" ]
13,313
all-13314
[ "Process", "fetches", "active", "jobs", "and", "processes", "them", "in", "parallel", ".", "This", "function", "does", "not", "return", "until", "an", "error", "occurs", "or", "Close", "()", "is", "called", "." ]
[ "func", "(", "q", "*", "queue", ")", "Process", "(", ")", "error", "{", "logger", ":=", "q", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "q", ".", "mtx", ".", "Lock", "(", ")", "\n\n", "if", "q", ".", "exit", "!=", "nil", "{", "q", ".", "mtx", ".", "Unlock", "(", ")", "\n", "return", "ErrAlreadyProcessing", "\n", "}", "\n\n", "num", ":=", "int", "(", "q", ".", "conf", ".", "Workers", ")", "\n", "if", "num", "==", "0", "{", "num", "=", "runtime", ".", "NumCPU", "(", ")", "\n", "}", "\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "num", ")", "\n\n", "// Make sure all workers can signal about errors simultaneously.", "q", ".", "exit", "=", "make", "(", "chan", "struct", "{", "}", ",", "num", ")", "\n", "q", ".", "exited", "=", "<mask>", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n\n", "q", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "q", ".", "workers", "=", "nil", "\n", "for", "i", ":=", "0", ";", "i", "<", "num", ";", "i", "++", "{", "w", ":=", "workerIO", "{", "job", ":", "make", "(", "chan", "string", ",", "q", ".", "conf", ".", "WorkerBufLen", ")", ",", "result", ":", "make", "(", "chan", "error", ",", "1", ")", ",", "}", "\n", "q", ".", "workers", "=", "append", "(", "q", ".", "workers", ",", "w", ")", "\n", "go", "q", ".", "processWorker", "(", "w", ")", "\n", "}", "\n\n", "err", ":=", "q", ".", "processMain", "(", ")", "\n\n", "// Stop the worker routines.", "for", "_", ",", "w", ":=", "range", "q", ".", "workers", "{", "close", "(", "w", ".", "job", ")", "\n", "}", "\n\n", "for", "_", ",", "w", ":=", "range", "q", ".", "workers", "{", "werr", ":=", "<-", "w", ".", "result", "\n", "if", "werr", "!=", "nil", "&&", "err", "==", "ErrQueueClosed", "{", "err", "=", "werr", "\n", "}", "\n", "}", "\n\n", "q", ".", "exited", "<-", "struct", "{", "}", "{", "}", "\n\n", "q", ".", "mtx", ".", "Lock", "(", ")", "\n", "q", ".", "exit", "=", "nil", "\n", "q", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "return", "err", "\n", "}" ]
13,314
all-13315
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SourceRange", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss9", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
13,315
all-13316
[ "--------------------------------------------------------------------" ]
[ "func", "(", "r", "*", "Registry", ")", "fetchCounter", "(", "<mask>", "string", ",", "tags", "[", "]", "string", ",", "factory", "func", "(", ")", "interface", "{", "}", ")", "*", "Counter", "{", "v", ":=", "r", ".", "Fetch", "(", "name", ",", "tags", ",", "factory", ")", "\n", "if", "i", ",", "ok", ":=", "v", ".", "(", "*", "Counter", ")", ";", "ok", "{", "return", "i", "\n", "}", "\n", "r", ".", "handleFetchError", "(", "\"", "\"", ",", "name", ",", "tags", ",", "v", ")", "\n", "return", "factory", "(", ")", ".", "(", "*", "Counter", ")", "\n", "}" ]
13,316
all-13317
[ "NewFactory", "initializes", "a", "client", "factory", "using", "a", "specified", "endpoint", "." ]
[ "func", "NewFactory", "(", "ctx", "<mask>", ".", "Context", ",", "endpoint", "string", ")", "Factory", "{", "return", "&", "factory", "{", "endpoint", ":", "endpoint", ",", "clients", ":", "findDockerVersions", "(", "ctx", ",", "endpoint", ")", ",", "}", "\n", "}" ]
13,317
all-13318
[ "Run", "all", "compatible", "checks" ]
[ "func", "Run", "(", ")", "error", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "runtime", ".", "Version", ")", "\n", "if", "!", "ask", "(", "\"", "\"", ")", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "r", ":=", "&", "Runner", "{", "App", ":", "meta", ".", "New", "(", "\"", "\"", ")", ",", "Warnings", ":", "[", "]", "string", "{", "}", ",", "}", "\n\n", "defer", "func", "(", ")", "{", "if", "len", "(", "r", ".", "Warnings", ")", "==", "0", "{", "return", "\n", "}", "\n\n", "fmt", ".", "Println", "(", "\"", "\\n", "\\n", "\"", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\"", ",", "len", "(", "r", ".", "Warnings", ")", ")", "\n", "for", "_", ",", "w", ":=", "<mask>", "r", ".", "Warnings", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "w", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "for", "_", ",", "c", ":=", "range", "checks", "{", "if", "err", ":=", "c", "(", "r", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,318
all-13319
[ "NotificationNew", "is", "a", "wrapper", "around", "g_notification_new", "()", "." ]
[ "func", "NotificationNew", "(", "title", "string", ")", "*", "Notification", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "<mask>", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "c", ":=", "C", ".", "g_notification_new", "(", "cstr1", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "wrapNotification", "(", "wrapObject", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
13,319
all-13320
[ "NewError", "returns", "an", "error", "with", "the", "given", "message", "and", "a", "list", "of", "key", "/", "value", "pairs", "copied", "from", "the", "list", "." ]
[ "func", "(", "l", "List", ")", "NewError", "(", "<mask>", "string", ")", "Error", "{", "e", ":=", "newError", "(", "nil", ",", "nil", ",", "text", ")", "\n", "e", ".", "list", "=", "l", "\n", "return", "e", "\n", "}" ]
13,320
all-13321
[ "toTypeDescription", "converts", "Go", "types", "into", "a", "human", "readable", "description" ]
[ "func", "toTypeDescription", "(", "t", "reflect", ".", "<mask>", ")", "string", "{", "switch", "t", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Array", ",", "reflect", ".", "Slice", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "toTypeDescription", "(", "t", ".", "Elem", "(", ")", ")", ")", "\n", "case", "reflect", ".", "Map", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "toTypeDescription", "(", "t", ".", "Key", "(", ")", ")", ",", "toTypeDescription", "(", "t", ".", "Elem", "(", ")", ")", ",", ")", "\n", "case", "reflect", ".", "Ptr", ":", "return", "toTypeDescription", "(", "t", ".", "Elem", "(", ")", ")", "\n", "case", "reflect", ".", "Struct", ":", "if", "implementsInterface", "(", "t", ")", "&&", "t", ".", "Name", "(", ")", "!=", "\"", "\"", "{", "return", "t", ".", "Name", "(", ")", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "reflect", ".", "String", ":", "name", ":=", "t", ".", "Name", "(", ")", "\n", "if", "name", "!=", "\"", "\"", "&&", "name", "!=", "\"", "\"", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "reflect", ".", "Bool", ":", "name", ":=", "t", ".", "Name", "(", ")", "\n", "if", "name", "!=", "\"", "\"", "&&", "name", "!=", "\"", "\"", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "name", ":=", "t", ".", "Name", "(", ")", "\n", "if", "name", "!=", "\"", "\"", "&&", "!", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ":", "name", ":=", "t", ".", "Name", "(", ")", "\n", "if", "name", "!=", "\"", "\"", "&&", "!", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "name", ":=", "t", ".", "Name", "(", ")", "\n", "if", "name", "!=", "\"", "\"", "&&", "!", "strings", ".", "HasPrefix", "(", "name", ",", "\"", "\"", ")", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n", "}" ]
13,321
all-13322
[ "GetNotifyNoData", "returns", "the", "NotifyNoData", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetNotifyNoData", "(", ")", "bool", "{", "if", "a", "==", "nil", "||", "a", ".", "NotifyNoData", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "a", ".", "NotifyNoData", "\n", "}" ]
13,322
all-13323
[ "Do", "executes", "Runtime", ".", "getProperties", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "Object", "properties", ".", "internalProperties", "-", "Internal", "object", "properties", "(", "only", "of", "the", "element", "itself", ")", ".", "privateProperties", "-", "Object", "private", "properties", ".", "exceptionDetails", "-", "Exception", "details", "." ]
[ "func", "(", "p", "*", "GetPropertiesParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "result", "[", "]", "*", "PropertyDescriptor", ",", "internalProperties", "[", "]", "*", "InternalPropertyDescriptor", ",", "privateProperties", "[", "]", "*", "PrivatePropertyDescriptor", ",", "exceptionDetails", "*", "ExceptionDetails", ",", "err", "error", ")", "{", "// execute", "<mask>", "res", "GetPropertiesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetProperties", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Result", ",", "res", ".", "InternalProperties", ",", "res", ".", "PrivateProperties", ",", "res", ".", "ExceptionDetails", ",", "nil", "\n", "}" ]
13,323
all-13324
[ "Peak", "of", "stack", "-", "get", "one", "segment", "from", "stack", "but", "not", "remove" ]
[ "func", "(", "s", "*", "Stack", ")", "Peak", "(", ")", "(", "header", ",", "data", "[", "]", "byte", ",", "err", "error", ")", "{", "if", "s", ".", "depth", "==", "0", "{", "return", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "s", ".", "guard", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "s", ".", "lastAccess", "=", "time", ".", "Now", "(", ")", "\n", "file", ",", "err", ":=", "s", ".", "getFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "data", "=", "make", "(", "[", "]", "byte", ",", "s", ".", "currentBlock", ".", "DataSize", ")", "\n", "header", "=", "make", "(", "[", "]", "byte", ",", "s", ".", "currentBlock", ".", "HeaderSize", ")", "\n", "// Read header", "_", ",", "err", "=", "file", ".", "ReadAt", "(", "header", ",", "int64", "(", "s", ".", "currentBlock", ".", "HeaderPoint", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "// Read data", "_", ",", "err", "=", "file", ".", "ReadAt", "(", "data", ",", "int64", "(", "s", ".", "currentBlock", ".", "DataPoint", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "return", "header", ",", "data", ",", "nil", "\n", "}" ]
13,324
all-13325
[ "clearTemplateArgs", "gives", "an", "error", "for", "any", "unset", "Template", "field", "in", "args", ".", "This", "handles", "erroneous", "cases", "where", "a", "cast", "operator", "with", "a", "forward", "referenced", "template", "is", "in", "the", "scope", "of", "another", "cast", "operator", "." ]
[ "func", "(", "st", "*", "<mask>", ")", "clearTemplateArgs", "(", "args", "[", "]", "AST", ")", "{", "for", "_", ",", "a", ":=", "range", "args", "{", "st", ".", "setTemplate", "(", "a", ",", "nil", ")", "\n", "}", "\n", "}" ]
13,325
all-13326
[ "Return", "a", "generic", "vertex", "attribute", "parameter" ]
[ "func", "GetVertexAttribLdv", "(", "index", "uint32", ",", "pname", "uint32", ",", "params", "*", "float64", ")", "{", "C", ".", "glowGetVertexAttribLdv", "(", "gpGetVertexAttribLdv", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "*", "C", ".", "GLdouble", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
13,326
all-13327
[ "String", "returns", "a", "string", "representation", "of", "r", "like", "with", "(", "o", ":", "Vec", "v", ":", "Vec", ")", "." ]
[ "func", "(", "r", "Ray", ")", "<mask>", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "o", ",", "r", ".", "v", ")", "\n", "}" ]
13,327
all-13328
[ "ClusterAlias", "specifies", "the", "key", "in", "the", "clusters", "map", "to", "use", ".", "This", "allows", "scheduling", "a", "prow", "job", "somewhere", "aside", "from", "the", "default", "build", "cluster", "." ]
[ "func", "(", "j", "*", "ProwJob", ")", "ClusterAlias", "(", ")", "string", "{", "if", "j", ".", "Spec", ".", "Cluster", "==", "\"", "\"", "{", "return", "DefaultClusterAlias", "\n", "}", "\n", "<mask>", "j", ".", "Spec", ".", "Cluster", "\n", "}" ]
13,328
all-13329
[ "GetPageIterator", "returns", "a", "AccountPageIterator", "with", "the", "given", "page", "filters", ".", "Call", "iterator", ".", "Next", "()", "to", "get", "the", "first", "page", "of", "resources", "(", "and", "again", "to", "retrieve", "subsequent", "pages", ")", "." ]
[ "func", "(", "c", "*", "AccountService", ")", "GetPageIterator", "(", "data", "url", ".", "Values", ")", "*", "AccountPageIterator", "{", "iter", ":=", "NewPageIterator", "(", "c", ".", "<mask>", ",", "data", ",", "accountPathPart", "+", "\"", "\"", ")", "\n", "return", "&", "AccountPageIterator", "{", "p", ":", "iter", ",", "}", "\n", "}" ]
13,329
all-13330
[ "ContainerSnapshotRename", "renames", "a", "snapshot", "of", "a", "container", "." ]
[ "func", "(", "s", "*", "storageBtrfs", ")", "ContainerSnapshotRename", "(", "snapshotContainer", "container", ",", "newName", "string", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\\\"", "\\\"", "\"", ",", "s", ".", "volume", ".", "Name", ",", "s", ".", "volume", ".", "Name", ",", "newName", ")", "\n\n", "// The storage pool must be mounted.", "_", ",", "err", ":=", "s", ".", "StoragePoolMount", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Unmount the snapshot if it is mounted otherwise we'll get EBUSY.", "// Rename the subvolume on the storage pool.", "oldSnapshotSubvolumeName", ":=", "getSnapshotMountPoint", "(", "snapshotContainer", ".", "Project", "(", ")", ",", "s", ".", "pool", ".", "Name", ",", "snapshotContainer", ".", "<mask>", "(", ")", ")", "\n", "newSnapshotSubvolumeName", ":=", "getSnapshotMountPoint", "(", "snapshotContainer", ".", "Project", "(", ")", ",", "s", ".", "pool", ".", "Name", ",", "newName", ")", "\n", "err", "=", "os", ".", "Rename", "(", "oldSnapshotSubvolumeName", ",", "newSnapshotSubvolumeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", ".", "Debugf", "(", "\"", "\\\"", "\\\"", "\"", ",", "s", ".", "volume", ".", "Name", ",", "s", ".", "volume", ".", "Name", ",", "newName", ")", "\n", "return", "nil", "\n", "}" ]
13,330
all-13331
[ "Close", "closes", "the", "listener", ".", "Any", "blocked", "Accept", "operations", "will", "be", "unblocked", "and", "return", "errors", "." ]
[ "func", "(", "s", "*", "listener", ")", "Close", "(", ")", "error", "{", "if", "err", ":=", "s", ".", "Listener", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "<mask>", "err", "\n", "}", "\n\n", "s", ".", "cond", ".", "L", ".", "Lock", "(", ")", "\n", "for", "s", ".", "refs", ">", "0", "{", "s", ".", "cond", ".", "Wait", "(", ")", "\n", "}", "\n", "s", ".", "cond", ".", "L", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}" ]
13,331
all-13332
[ "newUniqueEphemeralKey", "creates", "a", "new", "unique", "valueless", "key", "associated", "with", "a", "session", "lease" ]
[ "func", "newUniqueEphemeralKey", "(", "s", "*", "concurrency", ".", "Session", ",", "prefix", "string", ")", "(", "*", "EphemeralKV", ",", "error", ")", "{", "return", "newUniqueEphemeralKV", "(", "s", ",", "<mask>", ",", "\"", "\"", ")", "\n", "}" ]
13,332
all-13333
[ "PrintVersions", "prints", "the", "version", "information", "on", "stdout", "as", "a", "multi", "-", "line", "string", ".", "The", "output", "will", "look", "similar", "to", "the", "following", ":", "Amazon", "ECS", "Agent", ":", "Version", ":", "0", ".", "0", ".", "3", "Commit", ":", "4bdc7fc" ]
[ "func", "PrintVersion", "(", ")", "int", "{", "cleanliness", ":=", "\"", "\"", "\n", "if", "GitDirty", "{", "cleanliness", "=", "\"", "\\t", "\\n", "\"", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", "`Amazon ECS Agent:\n\tVersion: %v\n\tCommit: %v\n%v`", ",", "<mask>", ",", "GitShortHash", ",", "cleanliness", ")", "\n\n", "return", "exitcodes", ".", "ExitSuccess", "\n", "}" ]
13,333
all-13334
[ "Fetch", "details", "about", "all", "servers", "and", "server", "arrays", "in", "an", "environment" ]
[ "func", "fetchDetails", "(", "client", "*", "cm15", ".", "API", ",", "envName", "string", ",", "envDetail", "EnvironmentDetail", ",", "sshConfig", "*", "[", "]", "SSHConfig", ")", "{", "for", "nickname", ",", "name", ":=", "range", "envDetail", ".", "ServerArrays", "{", "// Obtain the resource", "instances", ":=", "serverArray", "(", "client", ",", "name", ")", "\n", "// Obtain the IP address of the first instance (only one instance is considered here -- for now)", "for", "_", ",", "instance", ":=", "range", "instances", "{", "ipAddress", ":=", "instance", ".", "PublicIpAddresses", "[", "0", "]", "\n", "number", ":=", "getInstanceNumber", "(", "instance", ".", "Name", ")", "\n", "*", "sshConfig", "=", "append", "(", "*", "sshConfig", ",", "SSHConfig", "{", "Name", ":", "envName", "+", "\"", "\"", "+", "nickname", "+", "number", ",", "IPAddress", ":", "ipAddress", "}", ")", "\n", "}", "\n", "}", "\n", "for", "nickname", ",", "name", ":=", "range", "envDetail", ".", "Servers", "{", "instance", ":=", "server", "(", "client", ",", "name", ")", "\n", "ipAddress", ":=", "<mask>", ".", "PublicIpAddresses", "[", "0", "]", "\n", "*", "sshConfig", "=", "append", "(", "*", "sshConfig", ",", "SSHConfig", "{", "Name", ":", "envName", "+", "\"", "\"", "+", "nickname", ",", "IPAddress", ":", "ipAddress", "}", ")", "\n", "}", "\n", "}" ]
13,334
all-13335
[ "OriginAllowed", "determines", "whether", "the", "server", "will", "allow", "a", "given", "CORS", "origin", ".", "If", "CORS", "is", "empty", "allow", "all", "." ]
[ "func", "(", "ac", "*", "AccessController", ")", "OriginAllowed", "(", "<mask>", "string", ")", "bool", "{", "ac", ".", "corsMu", ".", "RLock", "(", ")", "\n", "defer", "ac", ".", "corsMu", ".", "RUnlock", "(", ")", "\n", "if", "len", "(", "ac", ".", "CORS", ")", "==", "0", "{", "// allow all", "return", "true", "\n", "}", "\n", "_", ",", "ok", ":=", "ac", ".", "CORS", "[", "\"", "\"", "]", "\n", "if", "ok", "{", "return", "true", "\n", "}", "\n", "_", ",", "ok", "=", "ac", ".", "CORS", "[", "origin", "]", "\n", "return", "ok", "\n", "}" ]
13,335
all-13336
[ "Collect", "implements", "prometheus", "Collector", "interface", "." ]
[ "func", "(", "s", "*", "Storage", ")", "Collect", "(", "in", "chan", "<-", "prometheus", ".", "Metric", ")", "{", "s", ".", "connections", ".", "<mask>", "(", "float64", "(", "s", ".", "db", ".", "Stats", "(", ")", ".", "OpenConnections", ")", ")", "\n\n", "s", ".", "connections", ".", "Collect", "(", "in", ")", "\n", "s", ".", "queriesTotal", ".", "Collect", "(", "in", ")", "\n", "s", ".", "queriesDuration", ".", "Collect", "(", "in", ")", "\n", "s", ".", "errors", ".", "Collect", "(", "in", ")", "\n", "}" ]
13,336
all-13337
[ "Records", "returns", "the", "list", "of", "endpoints" ]
[ "func", "(", "im", "*", "InMemoryProvider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "defer", "im", ".", "OnRecords", "(", ")", "\n\n", "endpoints", ":=", "make", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "0", ")", "\n\n", "for", "zoneID", ":=", "<mask>", "im", ".", "Zones", "(", ")", "{", "records", ",", "err", ":=", "im", ".", "client", ".", "Records", "(", "zoneID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "record", ":=", "range", "records", "{", "endpoints", "=", "append", "(", "endpoints", ",", "endpoint", ".", "NewEndpoint", "(", "record", ".", "Name", ",", "record", ".", "Type", ",", "record", ".", "Target", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "endpoints", ",", "nil", "\n", "}" ]
13,337
all-13338
[ "Serve", "begins", "serving", "requests", "using", "previously", "registered", "handlers", "(", "see", "AddRequestHandler", ")", ".", "All", "request", "handlers", "should", "be", "added", "prior", "to", "making", "this", "call", "as", "unhandled", "requests", "will", "be", "discarded", "." ]
[ "func", "(", "<mask>", "*", "clientServer", ")", "Serve", "(", ")", "error", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "if", "!", "cs", ".", "IsReady", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "cs", ".", "statsEngine", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Start the timer function to publish metrics to the backend.", "cs", ".", "publishTicker", "=", "time", ".", "NewTicker", "(", "cs", ".", "publishMetricsInterval", ")", "\n", "cs", ".", "publishHealthTicker", "=", "time", ".", "NewTicker", "(", "cs", ".", "publishMetricsInterval", ")", "\n\n", "if", "!", "cs", ".", "disableResourceMetrics", "{", "go", "cs", ".", "publishMetrics", "(", ")", "\n", "}", "\n", "go", "cs", ".", "publishHealthMetrics", "(", ")", "\n\n", "return", "cs", ".", "ConsumeMessages", "(", ")", "\n", "}" ]
13,338
all-13339
[ "Join", "enter", "a", "twitch", "channel", "to", "read", "more", "messages" ]
[ "func", "(", "c", "*", "Client", ")", "Join", "(", "channel", "string", ")", "{", "channel", "=", "strings", ".", "ToLower", "(", "channel", ")", "\n\n", "// If we don't have the channel in our map AND we have an", "// active connection, explicitly join before we add it to our map", "c", ".", "channelsMtx", ".", "Lock", "(", ")", "\n", "if", "!", "c", ".", "channels", "[", "channel", "]", "&&", "c", ".", "connActive", ".", "get", "(", ")", "{", "<mask>", "c", ".", "send", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "channel", ")", ")", "\n", "}", "\n\n", "c", ".", "channels", "[", "channel", "]", "=", "true", "\n", "c", ".", "channelUserlistMutex", ".", "Lock", "(", ")", "\n", "c", ".", "channelUserlist", "[", "channel", "]", "=", "map", "[", "string", "]", "bool", "{", "}", "\n", "c", ".", "channelUserlistMutex", ".", "Unlock", "(", ")", "\n", "c", ".", "channelsMtx", ".", "Unlock", "(", ")", "\n", "}" ]
13,339
all-13340
[ "DeleteAnnotation", "deletes", "passed", "annotation", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteAnnotation", "(", "cfg", "*", "Annotation", ")", "(", "bool", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "<mask>", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "a", ".", "DeleteAnnotationByCID", "(", "CIDType", "(", "&", "cfg", ".", "CID", ")", ")", "\n", "}" ]
13,340
all-13341
[ "notifyAll", "is", "used", "to", "notify", "all", "the", "waiting", "verify", "futures", "if", "the", "follower", "believes", "we", "are", "still", "the", "leader", "." ]
[ "func", "(", "s", "*", "followerReplication", ")", "notifyAll", "(", "leader", "bool", ")", "{", "// Clear the waiting notifies minimizing lock time", "s", ".", "notifyLock", ".", "Lock", "(", ")", "\n", "n", ":=", "s", ".", "notify", "\n", "s", ".", "notify", "=", "make", "(", "<mask>", "[", "*", "verifyFuture", "]", "struct", "{", "}", ")", "\n", "s", ".", "notifyLock", ".", "Unlock", "(", ")", "\n\n", "// Submit our votes", "for", "v", ",", "_", ":=", "range", "n", "{", "v", ".", "vote", "(", "leader", ")", "\n", "}", "\n", "}" ]
13,341
all-13342
[ "MultiCloudImageSettingLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "MultiCloudImageSettingLocator", "(", "href", "<mask>", ")", "*", "MultiCloudImageSettingLocator", "{", "return", "&", "MultiCloudImageSettingLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
13,342
all-13343
[ "seek", "seeks", "to", "the", "given", "offset", "with", "an", "effective", "whence", "equal", "to", "SEEK_SET", ".", "It", "discards", "the", "read", "buffer", "if", "the", "invariant", "cannot", "be", "maintained", "." ]
[ "func", "(", "r", "*", "<mask>", ")", "seek", "(", "off", "int64", ")", "(", "int64", ",", "error", ")", "{", "delta", ":=", "off", "-", "r", ".", "off", "\n", "if", "delta", ">=", "0", "&&", "delta", "<", "int64", "(", "len", "(", "r", ".", "buf", ")", ")", "{", "r", ".", "r", "=", "int", "(", "delta", ")", "\n", "return", "off", ",", "nil", "\n", "}", "\n", "r", ".", "buf", ",", "r", ".", "r", ",", "r", ".", "off", "=", "nil", ",", "0", ",", "off", "\n", "return", "off", ",", "nil", "\n", "}" ]
13,343
all-13344
[ "split", "is", "a", "version", "of", "strings", ".", "Split", "that", "can", "be", "piped" ]
[ "func", "<mask>", "(", "sep", ",", "s", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "[", "]", "string", "{", "}", ",", "nil", "\n", "}", "\n", "return", "strings", ".", "Split", "(", "s", ",", "sep", ")", ",", "nil", "\n", "}" ]
13,344
all-13345
[ "/", "*", "Terminate", "sends", "a", "SIGTERM", "signal", "to", "all", "the", "processes", "started", "by", "Run", ".", "It", "does", "not", "wait", "for", "the", "processes", "to", "exit", "." ]
[ "func", "Terminate", "(", ")", "{", "trackedSessionsMutex", ".", "Lock", "(", ")", "\n", "defer", "trackedSessionsMutex", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "session", ":=", "<mask>", "trackedSessions", "{", "session", ".", "Terminate", "(", ")", "\n", "}", "\n", "}" ]
13,345
all-13346
[ "Restore", "restores", "a", "new", "etcd", "data", "directory", "from", "given", "snapshot", "file", "." ]
[ "func", "(", "s", "*", "v3Manager", ")", "Restore", "(", "cfg", "RestoreConfig", ")", "error", "{", "pURLs", ",", "err", ":=", "<mask>", ".", "NewURLs", "(", "cfg", ".", "PeerURLs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "var", "ics", "types", ".", "URLsMap", "\n", "ics", ",", "err", "=", "types", ".", "NewURLsMap", "(", "cfg", ".", "InitialCluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "srv", ":=", "etcdserver", ".", "ServerConfig", "{", "Logger", ":", "s", ".", "lg", ",", "Name", ":", "cfg", ".", "Name", ",", "PeerURLs", ":", "pURLs", ",", "InitialPeerURLsMap", ":", "ics", ",", "InitialClusterToken", ":", "cfg", ".", "InitialClusterToken", ",", "}", "\n", "if", "err", "=", "srv", ".", "VerifyBootstrap", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "s", ".", "cl", ",", "err", "=", "membership", ".", "NewClusterFromURLsMap", "(", "s", ".", "lg", ",", "cfg", ".", "InitialClusterToken", ",", "ics", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "dataDir", ":=", "cfg", ".", "OutputDataDir", "\n", "if", "dataDir", "==", "\"", "\"", "{", "dataDir", "=", "cfg", ".", "Name", "+", "\"", "\"", "\n", "}", "\n", "if", "fileutil", ".", "Exist", "(", "dataDir", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dataDir", ")", "\n", "}", "\n\n", "walDir", ":=", "cfg", ".", "OutputWALDir", "\n", "if", "walDir", "==", "\"", "\"", "{", "walDir", "=", "filepath", ".", "Join", "(", "dataDir", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "else", "if", "fileutil", ".", "Exist", "(", "walDir", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "walDir", ")", "\n", "}", "\n\n", "s", ".", "name", "=", "cfg", ".", "Name", "\n", "s", ".", "dbPath", "=", "cfg", ".", "SnapshotPath", "\n", "s", ".", "walDir", "=", "walDir", "\n", "s", ".", "snapDir", "=", "filepath", ".", "Join", "(", "dataDir", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "s", ".", "skipHashCheck", "=", "cfg", ".", "SkipHashCheck", "\n\n", "s", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "dbPath", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "walDir", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "dataDir", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "snapDir", ")", ",", ")", "\n", "if", "err", "=", "s", ".", "saveDB", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "s", ".", "saveWALAndSnap", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "s", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "dbPath", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "walDir", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "dataDir", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "s", ".", "snapDir", ")", ",", ")", "\n\n", "return", "nil", "\n", "}" ]
13,346
all-13347
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "PushNodeByPathToFrontendParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom26", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
13,347
all-13348
[ "Hijack", "tries", "to", "use", "the", "original", "http", ".", "ResponseWriter", "for", "hijacking", ".", "If", "the", "original", "writer", "doesn", "t", "implement", "http", ".", "Hijacker", "it", "returns", "an", "error", "." ]
[ "func", "(", "w", "*", "ResponseWrapper", ")", "Hijack", "(", ")", "(", "<mask>", ".", "Conn", ",", "*", "bufio", ".", "ReadWriter", ",", "error", ")", "{", "if", "hijacker", ",", "ok", ":=", "w", ".", "writer", ".", "(", "http", ".", "Hijacker", ")", ";", "ok", "{", "c", ",", "rw", ",", "err", ":=", "hijacker", ".", "Hijack", "(", ")", "\n\n", "if", "err", "==", "nil", "{", "w", ".", "Hijacked", "=", "true", "\n", "}", "\n\n", "return", "c", ",", "rw", ",", "err", "\n", "}", "\n\n", "return", "nil", ",", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
13,348
all-13349
[ "Pack1", "()", "is", "a", "wrapper", "around", "gtk_paned_pack1", "()", "." ]
[ "func", "(", "v", "*", "Paned", ")", "Pack1", "(", "child", "IWidget", ",", "resize", ",", "shrink", "bool", ")", "{", "C", ".", "gtk_paned_pack1", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "gbool", "(", "resize", ")", ",", "gbool", "(", "shrink", ")", ")", "\n", "}" ]
13,349
all-13350
[ "Decode", "decodes", "a", "serialized", "JWT", "in", "buf", "into", "obj", "and", "verifies", "the", "JWT", "signature", "using", "the", "Algorithm", "and", "Signer", ".", "If", "the", "token", "or", "signature", "is", "invalid", "ErrInvalidToken", "or", "ErrInvalidSignature", "will", "be", "returned", "respectively", ".", "Otherwise", "any", "other", "errors", "encountered", "during", "token", "decoding", "will", "be", "returned", "." ]
[ "func", "Decode", "(", "alg", "Algorithm", ",", "signer", "Signer", ",", "buf", "[", "]", "byte", ",", "obj", "interface", "{", "}", ")", "error", "{", "var", "err", "error", "\n\n", "// split token", "ut", ":=", "UnverifiedToken", "{", "}", "\n", "err", "=", "DecodeUnverifiedToken", "(", "buf", ",", "&", "ut", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// verify signature", "sig", ",", "err", ":=", "signer", ".", "Verify", "(", "buf", "[", ":", "len", "(", "ut", ".", "Header", ")", "+", "len", "(", "tokenSep", ")", "+", "len", "(", "ut", ".", "Payload", ")", "]", ",", "ut", ".", "Signature", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ErrInvalidSignature", "\n", "}", "\n\n", "// b64 decode header", "headerBuf", ",", "err", ":=", "b64", ".", "DecodeString", "(", "string", "(", "ut", ".", "Header", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// json decode header", "header", ":=", "Header", "{", "}", "\n", "err", "=", "json", ".", "Unmarshal", "(", "headerBuf", ",", "&", "header", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// verify alg matches header algorithm", "if", "alg", "!=", "header", ".", "Algorithm", "{", "return", "ErrInvalidAlgorithm", "\n", "}", "\n\n", "// set header in the provided obj", "err", "=", "decodeToObjOrFieldWithTag", "(", "headerBuf", ",", "obj", ",", "\"", "\"", ",", "&", "header", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// b64 decode payload", "payloadBuf", ",", "err", ":=", "b64", ".", "DecodeString", "(", "string", "(", "ut", ".", "Payload", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// json decode payload", "payload", ":=", "Claims", "{", "}", "\n", "err", "=", "json", ".", "Unmarshal", "(", "payloadBuf", ",", "&", "payload", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// set payload in the provided obj", "err", "=", "decodeToObjOrFieldWithTag", "(", "payloadBuf", ",", "obj", ",", "\"", "\"", ",", "&", "payload", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// set sig in the provided obj", "field", ":=", "getFieldWithTag", "(", "obj", ",", "\"", "\"", ")", "\n", "if", "<mask>", "!=", "nil", "{", "field", ".", "Set", "(", "reflect", ".", "ValueOf", "(", "sig", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
13,350
all-13351
[ "Check", "provisioner", "configs" ]
[ "func", "checkProvisioner", "(", ")", "error", "{", "if", "value", ",", "_", ":=", "config", ".", "Get", "(", "\"", "\"", ")", ";", "<mask>", "==", "defaultProvisionerName", "||", "value", "==", "\"", "\"", "{", "return", "checkDocker", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,351
all-13352
[ "SetMenubar", "is", "a", "wrapper", "around", "gtk_application_set_menubar", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetMenubar", "(", "m", "*", "glib", ".", "MenuModel", ")", "{", "mptr", ":=", "(", "*", "C", ".", "GMenuModel", ")", "(", "unsafe", ".", "Pointer", "(", "m", ".", "Native", "(", ")", ")", ")", "\n", "C", ".", "gtk_application_set_menubar", "(", "v", ".", "native", "(", ")", ",", "mptr", ")", "\n", "}" ]
13,352
all-13353
[ "Do", "executes", "Debugger", ".", "pause", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "PauseParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandPause", ",", "nil", ",", "nil", ")", "\n", "}" ]
13,353
all-13354
[ "NewDebugServer", "creates", "a", "new", "server", "that", "serves", "the", "debug", "api", "over", "GRPC" ]
[ "func", "NewDebugServer", "(", "name", "string", ",", "etcdClient", "*", "etcd", ".", "Client", ",", "etcdPrefix", "string", ",", "workerGrpcPort", "uint16", ")", "<mask>", ".", "DebugServer", "{", "return", "&", "debugServer", "{", "name", ":", "name", ",", "etcdClient", ":", "etcdClient", ",", "etcdPrefix", ":", "etcdPrefix", ",", "workerGrpcPort", ":", "workerGrpcPort", ",", "}", "\n", "}" ]
13,354
all-13355
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ResolveNodeReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
13,355
all-13356
[ "SetBodyString", "sets", "request", "body", "." ]
[ "func", "(", "req", "*", "Request", ")", "SetBodyString", "(", "<mask>", "string", ")", "{", "req", ".", "RemoveMultipartFormFiles", "(", ")", "\n", "req", ".", "closeBodyStream", "(", ")", "\n", "req", ".", "bodyBuffer", "(", ")", ".", "SetString", "(", "body", ")", "\n", "}" ]
13,356
all-13357
[ "NewExpectWithEnv", "creates", "a", "new", "process", "with", "user", "defined", "env", "variables", "for", "expect", "testing", "." ]
[ "func", "NewExpectWithEnv", "(", "name", "string", ",", "args", "[", "]", "string", ",", "env", "[", "]", "string", ")", "(", "ep", "*", "ExpectProcess", ",", "err", "error", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "name", ",", "args", "...", ")", "\n", "cmd", ".", "Env", "=", "env", "\n", "ep", "=", "&", "ExpectProcess", "{", "cmd", ":", "cmd", ",", "StopSignal", ":", "syscall", ".", "SIGKILL", ",", "}", "\n", "ep", ".", "cond", "=", "sync", ".", "NewCond", "(", "&", "ep", ".", "mu", ")", "\n", "ep", ".", "cmd", ".", "Stderr", "=", "ep", ".", "cmd", ".", "Stdout", "\n", "ep", ".", "cmd", ".", "Stdin", "=", "nil", "\n\n", "if", "ep", ".", "fpty", ",", "err", "=", "pty", ".", "Start", "(", "ep", ".", "cmd", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "ep", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "ep", ".", "<mask>", "(", ")", "\n", "return", "ep", ",", "nil", "\n", "}" ]
13,357
all-13358
[ "Returns", "a", "signed", "URL", "for", "FindArtifactFromTask", "valid", "for", "the", "specified", "duration", ".", "Required", "scopes", ":", "If", "private", ":", "queue", ":", "get", "-", "artifact", ":", "<name", ">", "See", "FindArtifactFromTask", "for", "more", "details", "." ]
[ "func", "(", "index", "*", "Index", ")", "FindArtifactFromTask_SignedURL", "(", "indexPath", ",", "name", "string", ",", "duration", "time", ".", "Duration", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "index", ")", "\n", "return", "(", "&", "cd", ")", ".", "SignedURL", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "indexPath", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "name", ")", ",", "nil", ",", "duration", ")", "\n", "}" ]
13,358
all-13359
[ "Index", "returns", "the", "0", "-", "based", "index", "of", "the", "first", "occurrence", "given", "value", "within", "the", "range", ".", "If", "the", "value", "does", "not", "exist", "in", "the", "range", "a", "value", "of", "-", "1", "will", "be", "returned" ]
[ "func", "(", "f", "*", "InclusiveRange", ")", "Index", "(", "value", "int", ")", "int", "{", "closest", ":=", "f", ".", "closestInRange", "(", "value", ",", "f", ".", "start", ",", "f", ".", "End", "(", ")", ",", "f", ".", "step", ")", "\n", "if", "closest", "!=", "value", "{", "return", "-", "1", "\n", "}", "\n", "idx", ":=", "(", "value", "-", "f", ".", "start", ")", "/", "f", ".", "<mask>", "\n", "if", "idx", "<", "0", "{", "idx", "*=", "-", "1", "\n", "}", "\n", "return", "idx", "\n", "}" ]
13,359
all-13360
[ "gather", "metrics", "from", "plank", ".", "Meant", "to", "be", "called", "inside", "a", "goroutine", "." ]
[ "func", "gather", "(", "c", "*", "plank", ".", "Controller", ")", "{", "tick", ":=", "time", ".", "Tick", "(", "30", "*", "time", ".", "Second", ")", "\n", "sig", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "sig", ",", "os", ".", "Interrupt", ",", "syscall", ".", "SIGTERM", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "tick", ":", "start", ":=", "time", ".", "Now", "(", ")", "\n", "c", ".", "SyncMetrics", "(", ")", "\n", "logrus", ".", "WithField", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "time", ".", "Since", "(", "<mask>", ")", ")", ")", ".", "Debug", "(", "\"", "\"", ")", "\n", "case", "<-", "sig", ":", "logrus", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "}" ]
13,360
all-13361
[ "===", "rate", "(", "node", "ValueTypeMatrix", ")", "Vector", "===" ]
[ "func", "funcRate", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "return", "extrapolatedRate", "(", "vals", ",", "args", ",", "enh", ",", "<mask>", ",", "true", ")", "\n", "}" ]
13,361
all-13362
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Notification", ")", "Locator", "(", "api", "*", "API", ")", "*", "NotificationLocator", "{", "<mask>", "api", ".", "NotificationLocator", "(", "r", ".", "Href", ")", "\n", "}" ]
13,362
all-13363
[ "init", "initializes", "the", "scratch", "." ]
[ "func", "(", "s", "*", "Scratch", ")", "init", "(", ")", "{", "if", "s", ".", "values", "==", "nil", "{", "s", ".", "values", "=", "<mask>", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "}", "\n", "}" ]
13,363
all-13364
[ "ServeTLSEmbed", "serves", "HTTPS", "requests", "from", "the", "given", "net", ".", "Listener", "using", "the", "given", "handler", ".", "certData", "and", "keyData", "must", "contain", "valid", "TLS", "certificate", "and", "key", "data", "." ]
[ "func", "ServeTLSEmbed", "(", "ln", "<mask>", ".", "Listener", ",", "certData", ",", "keyData", "[", "]", "byte", ",", "handler", "RequestHandler", ")", "error", "{", "s", ":=", "&", "Server", "{", "Handler", ":", "handler", ",", "}", "\n", "return", "s", ".", "ServeTLSEmbed", "(", "ln", ",", "certData", ",", "keyData", ")", "\n", "}" ]
13,364
all-13365
[ "establish", "data", "storage", "format", "dimensions", "and", "sample", "count", "of", "a", "renderbuffer", "object", "s", "image" ]
[ "func", "RenderbufferStorageMultisample", "(", "target", "uint32", ",", "samples", "int32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ")", "{", "C", ".", "glowRenderbufferStorageMultisample", "(", "gpRenderbufferStorageMultisample", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "samples", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "width", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "<mask>", ")", ")", "\n", "}" ]
13,365
all-13366
[ "Close", "starts", "a", "graceful", "Close", "for", "the", "channel", ".", "This", "does", "not", "happen", "immediately", ":", "1", ".", "This", "call", "closes", "the", "Listener", "and", "starts", "closing", "connections", ".", "2", ".", "When", "all", "incoming", "connections", "are", "drained", "the", "connection", "blocks", "new", "outgoing", "calls", ".", "3", ".", "When", "all", "connections", "are", "drained", "the", "channel", "s", "state", "is", "updated", "to", "Closed", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "Close", "(", ")", "{", "ch", ".", "Logger", "(", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "var", "connections", "[", "]", "*", "Connection", "\n", "var", "channelClosed", "bool", "\n\n", "func", "(", ")", "{", "ch", ".", "mutable", ".", "Lock", "(", ")", "\n", "defer", "ch", ".", "mutable", ".", "Unlock", "(", ")", "\n\n", "if", "ch", ".", "mutable", ".", "<mask>", "==", "ChannelClosed", "{", "ch", ".", "Logger", "(", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "if", "ch", ".", "mutable", ".", "l", "!=", "nil", "{", "ch", ".", "mutable", ".", "l", ".", "Close", "(", ")", "\n", "}", "\n\n", "// Stop the idle connections timer.", "ch", ".", "mutable", ".", "idleSweep", ".", "Stop", "(", ")", "\n\n", "ch", ".", "mutable", ".", "state", "=", "ChannelStartClose", "\n", "if", "len", "(", "ch", ".", "mutable", ".", "conns", ")", "==", "0", "{", "ch", ".", "mutable", ".", "state", "=", "ChannelClosed", "\n", "channelClosed", "=", "true", "\n", "}", "\n", "for", "_", ",", "c", ":=", "range", "ch", ".", "mutable", ".", "conns", "{", "connections", "=", "append", "(", "connections", ",", "c", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "for", "_", ",", "c", ":=", "range", "connections", "{", "c", ".", "close", "(", "LogField", "{", "\"", "\"", ",", "\"", "\"", "}", ")", "\n", "}", "\n\n", "if", "channelClosed", "{", "ch", ".", "onClosed", "(", ")", "\n", "}", "\n", "}" ]
13,366
all-13367
[ "WithContext", "adds", "the", "context", "to", "the", "post", "apps", "app", "routes", "params" ]
[ "func", "(", "o", "*", "PostAppsAppRoutesParams", ")", "WithContext", "(", "ctx", "context", ".", "<mask>", ")", "*", "PostAppsAppRoutesParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
13,367
all-13368
[ "tickElection", "is", "run", "by", "followers", "and", "candidates", "after", "r", ".", "electionTimeout", "." ]
[ "func", "(", "r", "*", "raft", ")", "tickElection", "(", ")", "{", "r", ".", "electionElapsed", "++", "\n\n", "if", "r", ".", "promotable", "(", ")", "&&", "r", ".", "pastElectionTimeout", "(", ")", "{", "r", ".", "electionElapsed", "=", "0", "\n", "r", ".", "Step", "(", "pb", ".", "Message", "{", "From", ":", "r", ".", "<mask>", ",", "Type", ":", "pb", ".", "MsgHup", "}", ")", "\n", "}", "\n", "}" ]
13,368
all-13369
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GdkWindow", "." ]
[ "func", "(", "v", "*", "Window", ")", "native", "(", ")", "*", "C", ".", "GdkWindow", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGdkWindow", "(", "p", ")", "\n", "}" ]
13,369
all-13370
[ "DefaultServiceConfig", "provides", "a", "default", "configuration", "to", "create", "a", "PKI", "controller", "." ]
[ "func", "DefaultServiceConfig", "(", ")", "ServiceConfig", "{", "newClientConfig", ":=", "vaultclient", ".", "DefaultConfig", "(", ")", "\n", "newClientConfig", ".", "<mask>", "=", "\"", "\"", "\n", "newVaultClient", ",", "err", ":=", "vaultclient", ".", "NewClient", "(", "newClientConfig", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "newConfig", ":=", "ServiceConfig", "{", "// Dependencies.", "VaultClient", ":", "newVaultClient", ",", "}", "\n\n", "return", "newConfig", "\n", "}" ]
13,370
all-13371
[ "HasChangeType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "HasChangeType", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "ChangeType", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
13,371
all-13372
[ "/", "*", "FromImage", "converts", "a", "go", "image", ".", "Image", "to", "an", "opencv", ".", "IplImage", "." ]
[ "func", "FromImage", "(", "img", "image", ".", "Image", ")", "*", "IplImage", "{", "b", ":=", "img", ".", "Bounds", "(", ")", "\n", "<mask>", ":=", "color", ".", "RGBAModel", "\n", "dst", ":=", "CreateImage", "(", "b", ".", "Max", ".", "X", "-", "b", ".", "Min", ".", "X", ",", "b", ".", "Max", ".", "Y", "-", "b", ".", "Min", ".", "Y", ",", "IPL_DEPTH_8U", ",", "4", ")", "\n\n", "for", "y", ":=", "b", ".", "Min", ".", "Y", ";", "y", "<", "b", ".", "Max", ".", "Y", ";", "y", "++", "{", "for", "x", ":=", "b", ".", "Min", ".", "X", ";", "x", "<", "b", ".", "Max", ".", "X", ";", "x", "++", "{", "px", ":=", "img", ".", "At", "(", "x", ",", "y", ")", "\n", "c", ":=", "model", ".", "Convert", "(", "px", ")", ".", "(", "color", ".", "RGBA", ")", "\n\n", "value", ":=", "NewScalar", "(", "float64", "(", "c", ".", "B", ")", ",", "float64", "(", "c", ".", "G", ")", ",", "float64", "(", "c", ".", "R", ")", ",", "float64", "(", "c", ".", "A", ")", ")", "\n", "dst", ".", "Set2D", "(", "x", "-", "b", ".", "Min", ".", "X", ",", "y", "-", "b", ".", "Min", ".", "Y", ",", "value", ")", "\n", "}", "\n", "}", "\n\n", "return", "dst", "\n", "}" ]
13,372
all-13373
[ "isComment", "returns", "true", "if", "the", "line", "is", "a", "comment", "." ]
[ "func", "(", "l", "*", "<mask>", ")", "isComment", "(", ")", "bool", "{", "return", "len", "(", "l", ".", "tokens", ")", ">", "0", "&&", "l", ".", "tokens", "[", "0", "]", "==", "slash", "\n", "}" ]
13,373
all-13374
[ "resourceVSphereComputeClusterVMAntiAffinityRuleFlattenID", "makes", "an", "ID", "for", "the", "vsphere_compute_cluster_vm_anti_affinity_rule", "resource", "." ]
[ "func", "resourceVSphereComputeClusterVMAntiAffinityRuleFlattenID", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "<mask>", "int32", ")", "(", "string", ",", "error", ")", "{", "clusterID", ":=", "cluster", ".", "Reference", "(", ")", ".", "Value", "\n", "return", "strings", ".", "Join", "(", "[", "]", "string", "{", "clusterID", ",", "strconv", ".", "Itoa", "(", "int", "(", "key", ")", ")", "}", ",", "\"", "\"", ")", ",", "nil", "\n", "}" ]
13,374
all-13375
[ "HasNotifyNoData", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "o", "*", "Options", ")", "HasNotifyNoData", "(", ")", "bool", "{", "if", "o", "!=", "nil", "&&", "o", ".", "NotifyNoData", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
13,375
all-13376
[ "InterceptGomegaFailures", "runs", "a", "given", "callback", "and", "returns", "an", "array", "of", "failure", "messages", "generated", "by", "any", "Gomega", "assertions", "within", "the", "callback", ".", "This", "is", "accomplished", "by", "temporarily", "replacing", "the", "*", "global", "*", "fail", "handler", "with", "a", "fail", "handler", "that", "simply", "annotates", "failures", ".", "The", "original", "fail", "handler", "is", "reset", "when", "InterceptGomegaFailures", "returns", ".", "This", "is", "most", "useful", "when", "testing", "custom", "matchers", "but", "can", "also", "be", "used", "to", "check", "on", "a", "value", "using", "a", "Gomega", "assertion", "without", "causing", "a", "test", "failure", "." ]
[ "func", "InterceptGomegaFailures", "(", "f", "func", "(", ")", ")", "[", "]", "string", "{", "originalHandler", ":=", "globalFailWrapper", ".", "Fail", "\n", "failures", ":=", "[", "]", "string", "{", "}", "\n", "RegisterFailHandler", "(", "func", "(", "<mask>", "string", ",", "callerSkip", "...", "int", ")", "{", "failures", "=", "append", "(", "failures", ",", "message", ")", "\n", "}", ")", "\n", "f", "(", ")", "\n", "RegisterFailHandler", "(", "originalHandler", ")", "\n", "return", "failures", "\n", "}" ]
13,376
all-13377
[ "MutateTransaction", "for", "Defaults", "sets", "reasonable", "defaults", "on", "the", "transaction", "being", "built" ]
[ "func", "(", "m", "Defaults", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "error", "{", "if", "o", ".", "TX", ".", "Fee", "==", "0", "{", "o", ".", "TX", ".", "Fee", "=", "xdr", ".", "Uint32", "(", "100", "*", "len", "(", "o", ".", "TX", ".", "Operations", ")", ")", "\n", "}", "\n\n", "if", "o", ".", "NetworkID", "==", "[", "32", "]", "byte", "{", "}", "{", "o", ".", "NetworkID", "=", "DefaultNetwork", ".", "<mask>", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,377
all-13378
[ "SetTaskCredentials", "adds", "or", "updates", "credentials", "in", "the", "credentials", "manager" ]
[ "func", "(", "manager", "*", "credentialsManager", ")", "SetTaskCredentials", "(", "taskCredentials", "*", "TaskIAMRoleCredentials", ")", "error", "{", "manager", ".", "taskCredentialsLock", ".", "Lock", "(", ")", "\n", "defer", "<mask>", ".", "taskCredentialsLock", ".", "Unlock", "(", ")", "\n\n", "credentials", ":=", "taskCredentials", ".", "IAMRoleCredentials", "\n", "// Validate that credentials id is not empty", "if", "credentials", ".", "CredentialsID", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Validate that task arn is not empty", "if", "taskCredentials", ".", "ARN", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "manager", ".", "idToTaskCredentials", "[", "credentials", ".", "CredentialsID", "]", "=", "TaskIAMRoleCredentials", "{", "ARN", ":", "taskCredentials", ".", "ARN", ",", "IAMRoleCredentials", ":", "taskCredentials", ".", "GetIAMRoleCredentials", "(", ")", ",", "}", "\n\n", "return", "nil", "\n", "}" ]
13,378
all-13379
[ "FromParameter", "returns", "a", "function", "that", "extracts", "the", "token", "from", "the", "specified", "query", "string", "parameter" ]
[ "func", "FromParameter", "(", "param", "string", ")", "TokenExtractor", "{", "return", "func", "(", "r", "*", "http", ".", "<mask>", ")", "(", "string", ",", "error", ")", "{", "return", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "param", ")", ",", "nil", "\n", "}", "\n", "}" ]
13,379
all-13380
[ "Collection", "-" ]
[ "func", "(", "s", "*", "MockMongo", ")", "<mask>", "(", ")", "pezdispenser", ".", "Persistence", "{", "return", "&", "MockPersistence", "{", "Err", ":", "s", ".", "Err", ",", "Result", ":", "s", ".", "Result", ",", "}", "\n", "}" ]
13,380
all-13381
[ "stop", "the", "stopwatch" ]
[ "func", "(", "m", "*", "Monitor", ")", "StopAndLog", "(", "sectionName", "string", ")", "error", "{", "err", ":=", "m", ".", "Stop", "(", "sectionName", ")", "\n", "if", "err", "==", "nil", "{", "m", ".", "<mask>", "(", "sectionName", ")", "\n", "}", "\n\n", "return", "err", "\n", "}" ]
13,381
all-13382
[ "SetNumberUp", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_number_up", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "SetNumberUp", "(", "numberUp", "int", ")", "{", "C", ".", "gtk_print_settings_set_number_up", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "numberUp", ")", ")", "\n", "}" ]
13,382
all-13383
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetMaxCallStackSizeToCaptureParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
13,383
all-13384
[ "ValidateConfig", "performs", "validation", "on", "the", "Config", "object" ]
[ "func", "ValidateConfig", "(", "cfg", "*", "externaldns", ".", "Config", ")", "error", "{", "// TODO: Should probably return field.ErrorList", "if", "cfg", ".", "LogFormat", "!=", "\"", "\"", "&&", "cfg", ".", "LogFormat", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cfg", ".", "LogFormat", ")", "\n", "}", "\n", "if", "len", "(", "cfg", ".", "Sources", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "cfg", ".", "Provider", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Azure provider specific validations", "if", "cfg", ".", "Provider", "==", "\"", "\"", "{", "if", "cfg", ".", "AzureConfigFile", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Infoblox provider specific validations", "if", "cfg", ".", "Provider", "==", "\"", "\"", "{", "if", "cfg", ".", "InfobloxGridHost", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "cfg", ".", "InfobloxWapiPassword", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "if", "cfg", ".", "Provider", "==", "\"", "\"", "{", "if", "cfg", ".", "DynUsername", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "cfg", ".", "DynCustomerName", "==", "\"", "\"", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "cfg", ".", "DynMinTTLSeconds", "<", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "if", "cfg", ".", "IgnoreHostnameAnnotation", "&&", "cfg", ".", "FQDNTemplate", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
13,384
all-13385
[ "Return", "a", "name", "with", "a", "tag", "prefixed", "with", "the", "graph", "root", "and", "driver", "name", "to", "disambiguate", "between", "images", "which", "may", "be", "present", "in", "multiple", "stores", "and", "share", "only", "their", "names", "." ]
[ "func", "(", "s", "storageReference", ")", "StringWithinTransport", "(", ")", "string", "{", "optionsList", ":=", "\"", "\"", "\n", "<mask>", ":=", "s", ".", "transport", ".", "store", ".", "GraphOptions", "(", ")", "\n", "if", "len", "(", "options", ")", ">", "0", "{", "optionsList", "=", "\"", "\"", "+", "strings", ".", "Join", "(", "options", ",", "\"", "\"", ")", "\n", "}", "\n", "res", ":=", "\"", "\"", "+", "s", ".", "transport", ".", "store", ".", "GraphDriverName", "(", ")", "+", "\"", "\"", "+", "s", ".", "transport", ".", "store", ".", "GraphRoot", "(", ")", "+", "\"", "\"", "+", "s", ".", "transport", ".", "store", ".", "RunRoot", "(", ")", "+", "optionsList", "+", "\"", "\"", "\n", "if", "s", ".", "named", "!=", "nil", "{", "res", "=", "res", "+", "s", ".", "named", ".", "String", "(", ")", "\n", "}", "\n", "if", "s", ".", "id", "!=", "\"", "\"", "{", "res", "=", "res", "+", "\"", "\"", "+", "s", ".", "id", "\n", "}", "\n", "return", "res", "\n", "}" ]
13,385
all-13386
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetFocusEmulationEnabledParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation8", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
13,386
all-13387
[ "DefaultMetricPrefix", "is", "the", "default", "mapping", "for", "metrics", "to", "statsd", "keys", ".", "It", "uses", "a", "tchannel", "prefix", "for", "all", "stats", "." ]
[ "func", "DefaultMetricPrefix", "(", "name", "string", ",", "tags", "map", "[", "string", "]", "string", ")", "string", "{", "return", "MetricWithPrefix", "(", "\"", "\"", ",", "name", ",", "<mask>", ")", "\n", "}" ]
13,387
all-13388
[ "GenFromURL", "returns", "a", "func", "that", "generates", "a", "DSN", "using", "urlstr", "as", "the", "default", "URL", "parameters", "overriding", "the", "values", "only", "if", "when", "in", "the", "passed", "URL", "." ]
[ "func", "GenFromURL", "(", "urlstr", "string", ")", "func", "(", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "z", ",", "err", ":=", "url", ".", "Parse", "(", "urlstr", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "return", "func", "(", "u", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "opaque", ":=", "z", ".", "Opaque", "\n", "if", "u", ".", "Opaque", "!=", "\"", "\"", "{", "opaque", "=", "u", ".", "Opaque", "\n", "}", "\n\n", "user", ":=", "z", ".", "User", "\n", "if", "u", ".", "User", "!=", "nil", "{", "user", "=", "u", ".", "User", "\n", "}", "\n\n", "host", ",", "port", ":=", "hostname", "(", "z", ".", "Host", ")", ",", "hostport", "(", "z", ".", "Host", ")", "\n", "if", "h", ":=", "hostname", "(", "u", ".", "Host", ")", ";", "h", "!=", "\"", "\"", "{", "host", "=", "h", "\n", "}", "\n", "if", "p", ":=", "hostport", "(", "u", ".", "Host", ")", ";", "p", "!=", "\"", "\"", "{", "port", "=", "p", "\n", "}", "\n", "if", "port", "!=", "\"", "\"", "{", "host", "+=", "\"", "\"", "+", "port", "\n", "}", "\n\n", "path", ":=", "z", ".", "Path", "\n", "if", "u", ".", "Path", "!=", "\"", "\"", "{", "path", "=", "u", ".", "Path", "\n", "}", "\n\n", "rawPath", ":=", "z", ".", "RawPath", "\n", "if", "u", ".", "RawPath", "!=", "\"", "\"", "{", "rawPath", "=", "u", ".", "RawPath", "\n", "}", "\n\n", "q", ":=", "z", ".", "Query", "(", ")", "\n", "for", "k", ",", "v", ":=", "range", "u", ".", "Query", "(", ")", "{", "q", ".", "Set", "(", "k", ",", "strings", ".", "Join", "(", "v", ",", "\"", "\"", ")", ")", "\n", "}", "\n\n", "fragment", ":=", "z", ".", "Fragment", "\n", "if", "u", ".", "Fragment", "!=", "\"", "\"", "{", "fragment", "=", "u", ".", "Fragment", "\n", "}", "\n\n", "y", ":=", "&", "url", ".", "URL", "{", "Scheme", ":", "z", ".", "Scheme", ",", "Opaque", ":", "opaque", ",", "<mask>", ":", "user", ",", "Host", ":", "host", ",", "Path", ":", "path", ",", "RawPath", ":", "rawPath", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "Fragment", ":", "fragment", ",", "}", "\n\n", "return", "y", ".", "String", "(", ")", ",", "nil", "\n", "}", "\n", "}" ]
13,388
all-13389
[ "ExpectsToReceive", "specifies", "the", "content", "it", "is", "expecting", "to", "be", "given", "from", "the", "Provider", ".", "The", "function", "must", "be", "able", "to", "handle", "this", "message", "for", "the", "interaction", "to", "succeed", "." ]
[ "func", "(", "p", "*", "Message", ")", "ExpectsToReceive", "(", "description", "string", ")", "*", "Message", "{", "p", ".", "<mask>", "=", "description", "\n", "return", "p", "\n", "}" ]
13,389
all-13390
[ "NewStringByteCodeLoader", "creates", "a", "new", "object" ]
[ "func", "NewStringByteCodeLoader", "(", "p", "<mask>", ".", "Parser", ",", "c", "compiler", ".", "Compiler", ")", "*", "StringByteCodeLoader", "{", "return", "&", "StringByteCodeLoader", "{", "NewFlags", "(", ")", ",", "p", ",", "c", "}", "\n", "}" ]
13,390
all-13391
[ "not", "a", "real", "fork" ]
[ "func", "(", "mp", "*", "<mask>", ")", "forkLoop", "(", ")", "error", "{", "//loop, restart command", "for", "{", "if", "err", ":=", "mp", ".", "fork", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}" ]
13,391
all-13392
[ "GetDpiX", "()", "is", "a", "wrapper", "around", "gtk_print_context_get_dpi_x", "()", "." ]
[ "func", "(", "pc", "*", "PrintContext", ")", "GetDpiX", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_print_context_get_dpi_x", "(", "<mask>", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
13,392
all-13393
[ "readFile", "reads", "a", "file", "and", "returns", "a", "file", "struct", "." ]
[ "func", "readFile", "(", "path", "string", ",", "opts", "*", "Options", ")", "(", "*", "<mask>", ",", "error", ")", "{", "var", "data", "[", "]", "byte", "\n", "var", "err", "error", "\n\n", "if", "path", "!=", "\"", "\"", "{", "name", ":=", "filepath", ".", "Join", "(", "opts", ".", "BaseDir", ",", "path", "+", "dot", "+", "opts", ".", "Extension", ")", "\n\n", "if", "opts", ".", "Asset", "!=", "nil", "{", "data", ",", "err", "=", "opts", ".", "Asset", "(", "name", ")", "\n", "}", "else", "{", "data", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "name", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "NewFile", "(", "path", ",", "data", ")", ",", "nil", "\n", "}" ]
13,393
all-13394
[ "platformHostConfigOverride", "provides", "an", "entry", "point", "to", "set", "up", "default", "HostConfig", "options", "to", "be", "passed", "to", "Docker", "API", "." ]
[ "func", "(", "task", "*", "<mask>", ")", "platformHostConfigOverride", "(", "hostConfig", "*", "dockercontainer", ".", "HostConfig", ")", "error", "{", "// Convert the CPUShares to CPUPercent", "hostConfig", ".", "CPUPercent", "=", "hostConfig", ".", "CPUShares", "*", "percentageFactor", "/", "int64", "(", "cpuShareScaleFactor", ")", "\n", "if", "hostConfig", ".", "CPUPercent", "==", "0", "&&", "hostConfig", ".", "CPUShares", "!=", "0", "{", "// if CPU percent is too low, we set it to the minimum(linux and some windows tasks).", "// if the CPU is explicitly set to zero or not set at all, and CPU unbounded", "// tasks are allowed for windows, let CPU percent be zero.", "// this is a workaround to allow CPU unbounded tasks(https://github.com/aws/amazon-ecs-agent/issues/1127)", "hostConfig", ".", "CPUPercent", "=", "minimumCPUPercent", "\n", "}", "\n", "hostConfig", ".", "CPUShares", "=", "0", "\n", "return", "nil", "\n", "}" ]
13,394
all-13395
[ "Read", "method", "for", "io", ".", "Reader", "interface", "." ]
[ "func", "(", "qp", "*", "QPCleaner", ")", "Read", "(", "dest", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "// Ensure room to write a byte or =XX string.", "destLen", ":=", "len", "(", "<mask>", ")", "-", "3", "\n", "// Loop over bytes in qp.in ByteReader.", "for", "n", "<", "destLen", "{", "b", ",", "err", ":=", "qp", ".", "in", ".", "ReadByte", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "n", ",", "err", "\n", "}", "\n", "switch", "{", "case", "b", "==", "'='", ":", "// Pass valid hex bytes through.", "hexBytes", ",", "err", ":=", "qp", ".", "in", ".", "Peek", "(", "2", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "io", ".", "EOF", "{", "return", "0", ",", "err", "\n", "}", "\n", "if", "validHexBytes", "(", "hexBytes", ")", "{", "dest", "[", "n", "]", "=", "b", "\n", "n", "++", "\n", "}", "else", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "b", ")", "\n", "n", "+=", "copy", "(", "dest", "[", "n", ":", "]", ",", "s", ")", "\n", "}", "\n", "case", "b", "==", "'\\t'", "||", "b", "==", "'\\r'", "||", "b", "==", "'\\n'", ":", "// Valid special character.", "dest", "[", "n", "]", "=", "b", "\n", "n", "++", "\n", "case", "b", "<", "' '", "||", "'~'", "<", "b", ":", "// Invalid character, render quoted-printable into buffer.", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "b", ")", "\n", "n", "+=", "copy", "(", "dest", "[", "n", ":", "]", ",", "s", ")", "\n", "default", ":", "// Acceptable character.", "dest", "[", "n", "]", "=", "b", "\n", "n", "++", "\n", "}", "\n", "}", "\n", "return", "n", ",", "err", "\n", "}" ]
13,395
all-13396
[ "GetTextOk", "returns", "a", "tuple", "with", "the", "Text", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "f", "*", "FreeTextDefinition", ")", "GetTextOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "f", "==", "nil", "||", "f", ".", "Text", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "f", ".", "<mask>", ",", "true", "\n", "}" ]
13,396
all-13397
[ "extractStorageAccountFromVHDURL", "parses", "a", "blob", "URL", "and", "extracts", "the", "Azure", "Storage", "account", "name", "from", "the", "URL", "namely", "first", "subdomain", "of", "the", "hostname", "and", "the", "Azure", "Storage", "service", "base", "URL", "(", "e", ".", "g", ".", "core", ".", "windows", ".", "net", ")", ".", "If", "it", "could", "not", "be", "parsed", "returns", "empty", "string", "." ]
[ "func", "extractStorageAccountFromVHDURL", "(", "vhdURL", "string", ")", "(", "string", ",", "string", ")", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "vhdURL", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Warn", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "vhdURL", "}", ")", "\n", "return", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "<mask>", ":=", "strings", ".", "SplitN", "(", "u", ".", "Host", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "log", ".", "Warnf", "(", "\"", "\"", ",", "vhdURL", ")", "\n", "return", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n", "return", "parts", "[", "0", "]", ",", "strings", ".", "TrimPrefix", "(", "parts", "[", "1", "]", ",", "\"", "\"", ")", "// \"blob.\" prefix will added by azure storage sdk", "\n", "}" ]
13,397
all-13398
[ "CreateFileSelectDialog", "creates", "a", "new", "file", "select", "dialog", ".", "It", "is", "useful", "if", "the", "application", "needs", "a", "way", "to", "select", "a", "file", "or", "directory", "for", "reading", "and", "writing", "data", ".", "*", "title", "-", "custom", "dialog", "title", "(", "the", "final", "dialog", "title", "includes", "this", "one", "and", "the", "file", "mask", "*", "fileMasks", "-", "a", "list", "of", "file", "masks", "separated", "with", "comma", "or", "path", "separator", ".", "If", "selectDir", "is", "true", "this", "option", "is", "not", "used", ".", "Setting", "fileMasks", "to", "*", "*", ".", "*", "or", "empty", "string", "means", "all", "files", "*", "selectDir", "-", "what", "kind", "of", "object", "to", "select", ":", "file", "(", "false", ")", "or", "directory", "(", "true", ")", ".", "If", "selectDir", "is", "true", "then", "the", "dialog", "does", "not", "show", "files", "*", "mustExists", "-", "if", "it", "is", "true", "then", "the", "dialog", "allows", "a", "user", "to", "select", "only", "existing", "object", "(", "open", "file", "case", ")", ".", "If", "it", "is", "false", "then", "the", "dialog", "makes", "possible", "to", "enter", "a", "name", "manually", "and", "click", "Select", "(", "useful", "for", "file", "file", "save", "case", ")" ]
[ "func", "CreateFileSelectDialog", "(", "title", ",", "fileMasks", ",", "initPath", "string", ",", "selectDir", ",", "mustExist", "bool", ")", "*", "FileSelectDialog", "{", "dlg", ":=", "new", "(", "FileSelectDialog", ")", "\n", "cw", ",", "ch", ":=", "term", ".", "Size", "(", ")", "\n", "dlg", ".", "selectDir", "=", "selectDir", "\n", "dlg", ".", "mustExist", "=", "mustExist", "\n\n", "if", "fileMasks", "!=", "\"", "\"", "{", "maskList", ":=", "strings", ".", "FieldsFunc", "(", "fileMasks", ",", "func", "(", "c", "rune", ")", "bool", "{", "return", "c", "==", "','", "||", "c", "==", "':'", "}", ")", "\n", "dlg", ".", "fileMasks", "=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "maskList", ")", ")", "\n", "for", "_", ",", "m", ":=", "range", "maskList", "{", "if", "m", "!=", "\"", "\"", "{", "dlg", ".", "fileMasks", "=", "append", "(", "dlg", ".", "fileMasks", ",", "m", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "dlg", ".", "<mask>", "=", "AddWindow", "(", "10", ",", "4", ",", "20", ",", "16", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "title", ",", "fileMasks", ")", ")", "\n", "WindowManager", "(", ")", ".", "BeginUpdate", "(", ")", "\n", "defer", "WindowManager", "(", ")", ".", "EndUpdate", "(", ")", "\n\n", "dlg", ".", "View", ".", "SetModal", "(", "true", ")", "\n", "dlg", ".", "View", ".", "SetPack", "(", "Vertical", ")", "\n\n", "dlg", ".", "currPath", "=", "initPath", "\n", "dlg", ".", "detectPath", "(", ")", "\n", "dlg", ".", "curDir", "=", "CreateLabel", "(", "dlg", ".", "View", ",", "AutoSize", ",", "AutoSize", ",", "\"", "\"", ",", "Fixed", ")", "\n", "dlg", ".", "curDir", ".", "SetTextDisplay", "(", "AlignRight", ")", "\n\n", "flist", ":=", "CreateFrame", "(", "dlg", ".", "View", ",", "1", ",", "1", ",", "BorderNone", ",", "1", ")", "\n", "flist", ".", "SetPaddings", "(", "1", ",", "1", ")", "\n", "flist", ".", "SetPack", "(", "Horizontal", ")", "\n", "dlg", ".", "listBox", "=", "CreateListBox", "(", "flist", ",", "16", ",", "ch", "-", "20", ",", "1", ")", "\n\n", "fselected", ":=", "CreateFrame", "(", "dlg", ".", "View", ",", "1", ",", "1", ",", "BorderNone", ",", "Fixed", ")", "\n", "// text + edit field to enter name manually", "fselected", ".", "SetPack", "(", "Vertical", ")", "\n", "fselected", ".", "SetPaddings", "(", "1", ",", "0", ")", "\n", "CreateLabel", "(", "fselected", ",", "AutoSize", ",", "AutoSize", ",", "\"", "\"", ",", "1", ")", "\n", "dlg", ".", "edFile", "=", "CreateEditField", "(", "fselected", ",", "cw", "-", "22", ",", "\"", "\"", ",", "1", ")", "\n\n", "// buttons at the right", "blist", ":=", "CreateFrame", "(", "flist", ",", "1", ",", "1", ",", "BorderNone", ",", "Fixed", ")", "\n", "blist", ".", "SetPack", "(", "Vertical", ")", "\n", "blist", ".", "SetPaddings", "(", "1", ",", "1", ")", "\n", "btnOpen", ":=", "CreateButton", "(", "blist", ",", "AutoSize", ",", "AutoSize", ",", "\"", "\"", ",", "Fixed", ")", "\n", "btnSelect", ":=", "CreateButton", "(", "blist", ",", "AutoSize", ",", "AutoSize", ",", "\"", "\"", ",", "Fixed", ")", "\n", "btnCancel", ":=", "CreateButton", "(", "blist", ",", "AutoSize", ",", "AutoSize", ",", "\"", "\"", ",", "Fixed", ")", "\n\n", "btnCancel", ".", "OnClick", "(", "func", "(", "ev", "Event", ")", "{", "WindowManager", "(", ")", ".", "DestroyWindow", "(", "dlg", ".", "View", ")", "\n", "WindowManager", "(", ")", ".", "BeginUpdate", "(", ")", "\n", "dlg", ".", "Selected", "=", "false", "\n", "closeFunc", ":=", "dlg", ".", "onClose", "\n", "WindowManager", "(", ")", ".", "EndUpdate", "(", ")", "\n", "if", "closeFunc", "!=", "nil", "{", "closeFunc", "(", ")", "\n", "}", "\n", "}", ")", "\n\n", "btnSelect", ".", "OnClick", "(", "func", "(", "ev", "Event", ")", "{", "WindowManager", "(", ")", ".", "DestroyWindow", "(", "dlg", ".", "View", ")", "\n", "WindowManager", "(", ")", ".", "BeginUpdate", "(", ")", "\n", "dlg", ".", "Selected", "=", "true", "\n\n", "dlg", ".", "FilePath", "=", "filepath", ".", "Join", "(", "dlg", ".", "currPath", ",", "dlg", ".", "listBox", ".", "SelectedItemText", "(", ")", ")", "\n", "if", "dlg", ".", "edFile", ".", "Title", "(", ")", "!=", "\"", "\"", "{", "dlg", ".", "FilePath", "=", "filepath", ".", "Join", "(", "dlg", ".", "currPath", ",", "dlg", ".", "edFile", ".", "Title", "(", ")", ")", "\n", "}", "\n", "_", ",", "err", ":=", "os", ".", "Stat", "(", "dlg", ".", "FilePath", ")", "\n", "dlg", ".", "Exists", "=", "!", "os", ".", "IsNotExist", "(", "err", ")", "\n\n", "closeFunc", ":=", "dlg", ".", "onClose", "\n", "WindowManager", "(", ")", ".", "EndUpdate", "(", ")", "\n", "if", "closeFunc", "!=", "nil", "{", "closeFunc", "(", ")", "\n", "}", "\n", "}", ")", "\n\n", "dlg", ".", "View", ".", "OnClose", "(", "func", "(", "ev", "Event", ")", "bool", "{", "if", "dlg", ".", "result", "==", "DialogAlive", "{", "dlg", ".", "result", "=", "DialogClosed", "\n", "if", "ev", ".", "X", "!=", "1", "{", "WindowManager", "(", ")", ".", "DestroyWindow", "(", "dlg", ".", "View", ")", "\n", "}", "\n", "if", "dlg", ".", "onClose", "!=", "nil", "{", "dlg", ".", "onClose", "(", ")", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}", ")", "\n\n", "dlg", ".", "listBox", ".", "OnSelectItem", "(", "func", "(", "ev", "Event", ")", "{", "item", ":=", "ev", ".", "Msg", "\n", "if", "item", "==", "\"", "\"", "{", "btnSelect", ".", "SetEnabled", "(", "false", ")", "\n", "btnOpen", ".", "SetEnabled", "(", "true", ")", "\n", "return", "\n", "}", "\n", "isDir", ":=", "strings", ".", "HasSuffix", "(", "item", ",", "string", "(", "os", ".", "PathSeparator", ")", ")", "\n", "if", "isDir", "{", "btnOpen", ".", "SetEnabled", "(", "true", ")", "\n", "if", "!", "dlg", ".", "selectDir", "{", "btnSelect", ".", "SetEnabled", "(", "false", ")", "\n", "return", "\n", "}", "\n", "}", "\n", "if", "!", "isDir", "{", "btnOpen", ".", "SetEnabled", "(", "false", ")", "\n", "}", "\n\n", "btnSelect", ".", "SetEnabled", "(", "true", ")", "\n", "if", "(", "isDir", "&&", "dlg", ".", "selectDir", ")", "||", "!", "isDir", "{", "dlg", ".", "edFile", ".", "SetTitle", "(", "item", ")", "\n", "}", "else", "{", "dlg", ".", "edFile", ".", "Clear", "(", ")", "\n", "}", "\n", "}", ")", "\n\n", "btnOpen", ".", "OnClick", "(", "func", "(", "ev", "Event", ")", "{", "s", ":=", "dlg", ".", "listBox", ".", "SelectedItemText", "(", ")", "\n", "if", "s", "!=", "\"", "\"", "&&", "(", "s", "==", "\"", "\"", "||", "!", "strings", ".", "HasSuffix", "(", "s", ",", "string", "(", "os", ".", "PathSeparator", ")", ")", ")", "{", "return", "\n", "}", "\n\n", "if", "s", "==", "\"", "\"", "{", "dlg", ".", "pathUp", "(", ")", "\n", "}", "else", "{", "dlg", ".", "pathDown", "(", "s", ")", "\n", "}", "\n", "}", ")", "\n\n", "dlg", ".", "edFile", ".", "OnChange", "(", "func", "(", "ev", "Event", ")", "{", "s", ":=", "\"", "\"", "\n", "lowCurrText", ":=", "strings", ".", "ToLower", "(", "dlg", ".", "listBox", ".", "SelectedItemText", "(", ")", ")", "\n", "lowEditText", ":=", "strings", ".", "ToLower", "(", "dlg", ".", "edFile", ".", "Title", "(", ")", ")", "\n", "if", "!", "strings", ".", "HasPrefix", "(", "lowCurrText", ",", "lowEditText", ")", "{", "itemIdx", ":=", "dlg", ".", "listBox", ".", "PartialFindItem", "(", "dlg", ".", "edFile", ".", "Title", "(", ")", ",", "false", ")", "\n", "if", "itemIdx", "==", "-", "1", "{", "if", "dlg", ".", "mustExist", "{", "btnSelect", ".", "SetEnabled", "(", "false", ")", "\n", "}", "\n", "return", "\n", "}", "\n\n", "s", ",", "_", "=", "dlg", ".", "listBox", ".", "Item", "(", "itemIdx", ")", "\n", "dlg", ".", "listBox", ".", "SelectItem", "(", "itemIdx", ")", "\n", "}", "else", "{", "s", "=", "dlg", ".", "listBox", ".", "SelectedItemText", "(", ")", "\n", "}", "\n\n", "isDir", ":=", "strings", ".", "HasSuffix", "(", "s", ",", "string", "(", "os", ".", "PathSeparator", ")", ")", "\n", "equal", ":=", "strings", ".", "EqualFold", "(", "s", ",", "dlg", ".", "edFile", ".", "Title", "(", ")", ")", "||", "strings", ".", "EqualFold", "(", "s", ",", "dlg", ".", "edFile", ".", "Title", "(", ")", "+", "string", "(", "os", ".", "PathSeparator", ")", ")", "\n\n", "btnOpen", ".", "SetEnabled", "(", "isDir", "||", "s", "==", "\"", "\"", ")", "\n", "if", "isDir", "{", "btnSelect", ".", "SetEnabled", "(", "dlg", ".", "selectDir", "&&", "(", "equal", "||", "!", "dlg", ".", "mustExist", ")", ")", "\n", "return", "\n", "}", "\n\n", "btnSelect", ".", "SetEnabled", "(", "equal", "||", "!", "dlg", ".", "mustExist", ")", "\n", "}", ")", "\n\n", "dlg", ".", "edFile", ".", "OnKeyPress", "(", "func", "(", "key", "term", ".", "Key", ",", "c", "rune", ")", "bool", "{", "if", "key", "==", "term", ".", "KeyArrowUp", "{", "idx", ":=", "dlg", ".", "listBox", ".", "SelectedItem", "(", ")", "\n", "if", "idx", ">", "0", "{", "dlg", ".", "listBox", ".", "SelectItem", "(", "idx", "-", "1", ")", "\n", "dlg", ".", "updateEditBox", "(", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n", "if", "key", "==", "term", ".", "KeyArrowDown", "{", "idx", ":=", "dlg", ".", "listBox", ".", "SelectedItem", "(", ")", "\n", "if", "idx", "<", "dlg", ".", "listBox", ".", "ItemCount", "(", ")", "-", "1", "{", "dlg", ".", "listBox", ".", "SelectItem", "(", "idx", "+", "1", ")", "\n", "dlg", ".", "updateEditBox", "(", ")", "\n", "}", "\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}", ")", "\n\n", "dlg", ".", "listBox", ".", "OnKeyPress", "(", "func", "(", "key", "term", ".", "Key", ")", "bool", "{", "if", "key", "==", "term", ".", "KeyBackspace", "||", "key", "==", "term", ".", "KeyBackspace2", "{", "dlg", ".", "pathUp", "(", ")", "\n", "return", "true", "\n", "}", "\n\n", "if", "key", "==", "term", ".", "KeyCtrlM", "{", "s", ":=", "dlg", ".", "listBox", ".", "SelectedItemText", "(", ")", "\n", "if", "s", "==", "\"", "\"", "{", "dlg", ".", "pathUp", "(", ")", "\n", "return", "true", "\n", "}", "\n\n", "if", "strings", ".", "HasSuffix", "(", "s", ",", "string", "(", "os", ".", "PathSeparator", ")", ")", "{", "dlg", ".", "pathDown", "(", "s", ")", "\n", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}", "\n\n", "return", "false", "\n", "}", ")", "\n\n", "dlg", ".", "curDir", ".", "SetTitle", "(", "dlg", ".", "currPath", ")", "\n", "dlg", ".", "populateFiles", "(", ")", "\n", "dlg", ".", "selectFirst", "(", ")", "\n\n", "ActivateControl", "(", "dlg", ".", "View", ",", "dlg", ".", "listBox", ")", "\n", "return", "dlg", "\n", "}" ]
13,398
all-13399
[ "newHelperMethodInclude", "creates", "and", "returns", "a", "helper", "method", "include", "." ]
[ "func", "newHelperMethodInclude", "(", "ln", "*", "line", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "(", "*", "helperMethodInclude", ",", "error", ")", "{", "if", "len", "(", "ln", ".", "tokens", ")", "<", "3", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ln", ".", "fileName", "(", ")", ",", "ln", ".", "<mask>", ")", "\n", "}", "\n\n", "var", "pipeline", "string", "\n\n", "if", "len", "(", "ln", ".", "tokens", ")", ">", "3", "{", "pipeline", "=", "strings", ".", "Join", "(", "ln", ".", "tokens", "[", "3", ":", "]", ",", "space", ")", "\n", "}", "\n\n", "e", ":=", "&", "helperMethodInclude", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", ",", "templateName", ":", "ln", ".", "tokens", "[", "2", "]", ",", "pipeline", ":", "pipeline", ",", "}", "\n\n", "return", "e", ",", "nil", "\n", "}" ]
13,399
all-13400
[ "SetVirtualHwVersion", "sets", "a", "virtual", "hardware", "version", "in", "the", "VMX", "file", "of", "the", "VM", "." ]
[ "func", "(", "v", "*", "VM", ")", "SetVirtualHwVersion", "(", "version", "string", ")", "error", "{", "return", "v", ".", "updateVMX", "(", "func", "(", "model", "*", "vmx", ".", "VirtualMachine", ")", "error", "{", "version", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "<mask>", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "model", ".", "Vhardware", ".", "Compat", "=", "\"", "\"", "\n", "model", ".", "Vhardware", ".", "Version", "=", "int", "(", "version", ")", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]