id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
2,100
all-2101
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Rect", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom18", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,101
all-2102
[ "BuildHTTPRequest", "creates", "a", "http", ".", "Request", "given", "all", "its", "parts", ".", "If", "any", "member", "of", "the", "Payload", "field", "is", "of", "type", "io", ".", "Reader", "then", "the", "resulting", "request", "has", "a", "multipart", "body", "where", "each", "member", "of", "type", "io", ".", "Reader", "is", "mapped", "to", "a", "single", "part", "and", "all", "other", "members", "make", "up", "the", "first", "part", "." ]
[ "func", "(", "a", "*", "API", ")", "BuildHTTPRequest", "(", "verb", ",", "path", ",", "version", "string", ",", "params", ",", "payload", "APIParams", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "u", ":=", "url", ".", "URL", "{", "Host", ":", "a", ".", "Host", ",", "Path", ":", "path", "}", "\n", "if", "params", "!=", "nil", "{", "var", "values", "=", "u", ".", "<mask>", "(", ")", "\n", "for", "n", ",", "p", ":=", "range", "params", "{", "switch", "t", ":=", "p", ".", "(", "type", ")", "{", "case", "string", ":", "values", ".", "Set", "(", "n", ",", "t", ")", "\n", "case", "int", ":", "values", ".", "Set", "(", "n", ",", "strconv", ".", "Itoa", "(", "t", ")", ")", "\n", "case", "bool", ":", "values", ".", "Set", "(", "n", ",", "strconv", ".", "FormatBool", "(", "t", ")", ")", "\n", "case", "[", "]", "string", ":", "for", "_", ",", "e", ":=", "range", "t", "{", "values", ".", "Add", "(", "n", ",", "e", ")", "\n", "}", "\n", "case", "[", "]", "int", ":", "for", "_", ",", "e", ":=", "range", "t", "{", "values", ".", "Add", "(", "n", ",", "strconv", ".", "Itoa", "(", "e", ")", ")", "\n", "}", "\n", "case", "[", "]", "bool", ":", "for", "_", ",", "e", ":=", "range", "t", "{", "values", ".", "Add", "(", "n", ",", "strconv", ".", "FormatBool", "(", "e", ")", ")", "\n", "}", "\n", "case", "[", "]", "interface", "{", "}", ":", "for", "_", ",", "e", ":=", "range", "t", "{", "values", ".", "Add", "(", "n", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ")", ")", "\n", "}", "\n", "case", "map", "[", "string", "]", "string", ":", "for", "pn", ",", "e", ":=", "range", "t", "{", "values", ".", "Add", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ",", "pn", ")", ",", "e", ")", "\n", "}", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "p", ",", "n", ")", "\n", "}", "\n", "}", "\n", "u", ".", "RawQuery", "=", "values", ".", "Encode", "(", ")", "\n", "}", "\n", "var", "jsonBytes", "[", "]", "byte", "\n", "var", "body", "io", ".", "Reader", "\n", "var", "isMultipart", "bool", "\n", "var", "isSourceUpload", "bool", "\n", "var", "boundary", "string", "\n", "if", "payload", "!=", "nil", "{", "var", "fields", "io", ".", "Reader", "\n", "var", "multiPartUploads", "[", "]", "*", "FileUpload", "\n", "if", "a", ".", "FileEncoding", "==", "FileEncodingMime", "{", "multiPartUploads", "=", "extractUploads", "(", "&", "payload", ")", "\n", "isMultipart", "=", "len", "(", "multiPartUploads", ")", ">", "0", "\n", "}", "\n", "sourceUpload", ":=", "extractSourceUpload", "(", "&", "payload", ")", "\n\n", "if", "len", "(", "payload", ")", ">", "0", "{", "var", "err", "error", "\n", "if", "jsonBytes", ",", "err", "=", "json", ".", "Marshal", "(", "payload", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "fields", "=", "bytes", ".", "NewBuffer", "(", "jsonBytes", ")", "\n", "}", "\n", "if", "isMultipart", "{", "var", "buffer", "bytes", ".", "Buffer", "\n", "w", ":=", "multipart", ".", "NewWriter", "(", "&", "buffer", ")", "\n", "if", "len", "(", "payload", ")", ">", "0", "{", "err", ":=", "writeMultipartParams", "(", "w", ",", "payload", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n", "for", "_", ",", "u", ":=", "range", "multiPartUploads", "{", "p", ",", "err", ":=", "w", ".", "CreateFormFile", "(", "u", ".", "Name", ",", "u", ".", "Filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "p", ",", "u", ".", "Reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "w", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "boundary", "=", "w", ".", "Boundary", "(", ")", "\n", "body", "=", "&", "buffer", "\n", "}", "else", "if", "sourceUpload", "!=", "nil", "{", "isSourceUpload", "=", "true", "\n", "body", "=", "sourceUpload", ".", "Reader", "\n", "}", "else", "{", "body", "=", "fields", "\n", "}", "\n", "}", "\n", "var", "req", ",", "err", "=", "http", ".", "NewRequest", "(", "verb", ",", "u", ".", "String", "(", ")", ",", "body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "version", "!=", "\"", "\"", "{", "if", "a", ".", "VersionHeader", "!=", "\"", "\"", "{", "req", ".", "Header", ".", "Set", "(", "a", ".", "VersionHeader", ",", "version", ")", "\n", "}", "else", "{", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "version", ")", "\n", "}", "\n", "}", "\n", "if", "isMultipart", "{", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "boundary", ")", ")", "\n", "}", "else", "if", "isSourceUpload", "{", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "else", "{", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "req", ",", "nil", "\n", "}" ]
2,102
all-2103
[ "NewWorld", "creates", "a", "new", "world", "." ]
[ "func", "NewWorld", "(", "width", ",", "height", "int", ",", "maxInitLiveCells", "int", ")", "*", "World", "{", "w", ":=", "&", "World", "{", "area", ":", "make", "(", "[", "]", "bool", ",", "<mask>", "*", "height", ")", ",", "width", ":", "width", ",", "height", ":", "height", ",", "}", "\n", "w", ".", "init", "(", "maxInitLiveCells", ")", "\n", "return", "w", "\n", "}" ]
2,103
all-2104
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetInfoParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,104
all-2105
[ "getResourcesUnsafe", "returns", "the", "list", "of", "task", "resources", "from", "ResourcesMap" ]
[ "func", "(", "task", "*", "Task", ")", "getResourcesUnsafe", "(", ")", "[", "]", "taskresource", ".", "TaskResource", "{", "var", "resourceList", "[", "]", "taskresource", ".", "TaskResource", "\n", "for", "_", ",", "resources", ":=", "range", "task", ".", "ResourcesMapUnsafe", "{", "resourceList", "=", "append", "(", "resourceList", ",", "<mask>", "...", ")", "\n", "}", "\n", "return", "resourceList", "\n", "}" ]
2,105
all-2106
[ "WriteTLSSecret", "creates", "a", "new", "TLS", "secret", "in", "the", "kubernetes", "manifest", "(", "equivalent", "to", "one", "generate", "by", "kubectl", "create", "secret", "tls", ")", ".", "This", "will", "be", "mounted", "by", "the", "pachd", "pod", "and", "used", "as", "its", "TLS", "public", "certificate", "and", "private", "key" ]
[ "func", "WriteTLSSecret", "(", "encoder", "Encoder", ",", "opts", "*", "AssetOpts", ")", "error", "{", "// Validate arguments", "if", "opts", ".", "DashOnly", "{", "return", "nil", "\n", "}", "\n", "if", "opts", ".", "TLS", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "opts", ".", "TLS", ".", "ServerKey", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n", "if", "opts", ".", "TLS", ".", "ServerCert", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Attempt to copy server cert and key files into config (kubernetes client", "// does the base64-encoding)", "certBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "opts", ".", "TLS", ".", "ServerCert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ",", "opts", ".", "TLS", ".", "ServerCert", ",", "err", ")", "\n", "}", "\n", "keyBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "opts", ".", "TLS", ".", "ServerKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ",", "opts", ".", "TLS", ".", "ServerKey", ",", "err", ")", "\n", "}", "\n", "secret", ":=", "&", "v1", ".", "Secret", "{", "TypeMeta", ":", "metav1", ".", "TypeMeta", "{", "Kind", ":", "\"", "\"", ",", "APIVersion", ":", "\"", "\"", ",", "}", ",", "ObjectMeta", ":", "objectMeta", "(", "tlsSecretName", ",", "labels", "(", "tlsSecretName", ")", ",", "nil", ",", "opts", ".", "Namespace", ")", ",", "Data", ":", "map", "[", "string", "]", "[", "]", "<mask>", "{", "grpcutil", ".", "TLSCertFile", ":", "certBytes", ",", "grpcutil", ".", "TLSKeyFile", ":", "keyBytes", ",", "}", ",", "}", "\n", "return", "encoder", ".", "Encode", "(", "secret", ")", "\n", "}" ]
2,106
all-2107
[ "SetShowDefaultItem", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_button_set_show_default_item", "()", "." ]
[ "func", "(", "v", "*", "AppChooserButton", ")", "SetShowDefaultItem", "(", "setting", "bool", ")", "{", "C", ".", "gtk_app_chooser_button_set_show_default_item", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "<mask>", ")", ")", "\n", "}" ]
2,107
all-2108
[ "IntrospectList", "returns", "the", "list", "of", "peers", "(", "hostport", "score", ")", "in", "this", "peer", "list", "." ]
[ "func", "(", "l", "*", "PeerList", ")", "IntrospectList", "(", "opts", "*", "IntrospectionOptions", ")", "[", "]", "SubPeerScore", "{", "var", "peers", "[", "]", "SubPeerScore", "\n", "l", ".", "RLock", "(", ")", "\n", "for", "_", ",", "ps", ":=", "range", "l", ".", "peerHeap", ".", "peerScores", "{", "peers", "=", "append", "(", "peers", ",", "SubPeerScore", "{", "HostPort", ":", "ps", ".", "Peer", ".", "hostPort", ",", "Score", ":", "<mask>", ".", "score", ",", "}", ")", "\n", "}", "\n", "l", ".", "RUnlock", "(", ")", "\n\n", "return", "peers", "\n", "}" ]
2,108
all-2109
[ "Returns", "the", "value", "of", "a", "uniform", "variable" ]
[ "func", "GetUniformiv", "(", "program", "uint32", ",", "<mask>", "int32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetUniformiv", "(", "gpGetUniformiv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
2,109
all-2110
[ "NewJWKClientWithCache", "creates", "a", "new", "JWKClient", "instance", "from", "the", "provided", "options", "and", "a", "custom", "keycacher", "interface", ".", "Passing", "nil", "to", "keyCacher", "will", "create", "a", "persistent", "key", "cacher" ]
[ "func", "NewJWKClientWithCache", "(", "options", "JWKClientOptions", ",", "extractor", "RequestTokenExtractor", ",", "keyCacher", "KeyCacher", ")", "*", "JWKClient", "{", "if", "extractor", "==", "nil", "{", "extractor", "=", "RequestTokenExtractorFunc", "(", "FromHeader", ")", "\n", "}", "\n", "if", "keyCacher", "==", "nil", "{", "keyCacher", "=", "newMemoryPersistentKeyCacher", "(", ")", "\n", "}", "\n", "if", "options", ".", "Client", "==", "nil", "{", "options", ".", "<mask>", "=", "http", ".", "DefaultClient", "\n", "}", "\n\n", "return", "&", "JWKClient", "{", "keyCacher", ":", "keyCacher", ",", "options", ":", "options", ",", "extractor", ":", "extractor", ",", "}", "\n", "}" ]
2,110
all-2111
[ "NewLabelsFromString", "constructs", "endpoints", "labels", "from", "a", "provided", "format", "string", "if", "heritage", "set", "to", "another", "value", "is", "found", "then", "error", "is", "returned", "no", "heritage", "automatically", "assumes", "is", "not", "owned", "by", "external", "-", "dns", "and", "returns", "invalidHeritage", "error" ]
[ "func", "NewLabelsFromString", "(", "labelText", "string", ")", "(", "Labels", ",", "error", ")", "{", "endpointLabels", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "labelText", "=", "strings", ".", "Trim", "(", "labelText", ",", "\"", "\\\"", "\"", ")", "// drop quotes", "\n", "tokens", ":=", "strings", ".", "Split", "(", "labelText", ",", "\"", "\"", ")", "\n", "foundExternalDNSHeritage", ":=", "false", "\n", "for", "_", ",", "token", ":=", "range", "tokens", "{", "if", "len", "(", "strings", ".", "Split", "(", "token", ",", "\"", "\"", ")", ")", "!=", "2", "{", "continue", "\n", "}", "\n", "key", ":=", "strings", ".", "Split", "(", "token", ",", "\"", "\"", ")", "[", "0", "]", "\n", "val", ":=", "strings", ".", "Split", "(", "token", ",", "\"", "\"", ")", "[", "1", "]", "\n", "if", "key", "==", "\"", "\"", "&&", "val", "!=", "heritage", "{", "return", "nil", ",", "ErrInvalidHeritage", "\n", "}", "\n", "if", "<mask>", "==", "\"", "\"", "{", "foundExternalDNSHeritage", "=", "true", "\n", "continue", "\n", "}", "\n", "if", "strings", ".", "HasPrefix", "(", "key", ",", "heritage", ")", "{", "endpointLabels", "[", "strings", ".", "TrimPrefix", "(", "key", ",", "heritage", "+", "\"", "\"", ")", "]", "=", "val", "\n", "}", "\n", "}", "\n\n", "if", "!", "foundExternalDNSHeritage", "{", "return", "nil", ",", "ErrInvalidHeritage", "\n", "}", "\n\n", "return", "endpointLabels", ",", "nil", "\n", "}" ]
2,111
all-2112
[ "SliceStringsToInterfaces", "converts", "a", "string", "slice", "to", "an", "interface", "slice", "." ]
[ "func", "SliceStringsToInterfaces", "(", "s", "[", "]", "string", ")", "[", "]", "interface", "{", "}", "{", "var", "d", "[", "]", "<mask>", "{", "}", "\n", "for", "_", ",", "v", ":=", "range", "s", "{", "d", "=", "append", "(", "d", ",", "v", ")", "\n", "}", "\n", "return", "d", "\n", "}" ]
2,112
all-2113
[ "ListenAndServe", "listens", "on", "the", "given", "address", "and", "serves", "incoming", "requests", ".", "The", "port", "may", "be", "0", "in", "which", "case", "the", "channel", "will", "use", "an", "OS", "assigned", "port", "This", "method", "does", "not", "block", "as", "the", "handling", "of", "connections", "is", "done", "in", "a", "goroutine", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "ListenAndServe", "(", "hostPort", "string", ")", "error", "{", "mutable", ":=", "&", "ch", ".", "mutable", "\n", "mutable", ".", "RLock", "(", ")", "\n\n", "if", "mutable", ".", "l", "!=", "nil", "{", "mutable", ".", "RUnlock", "(", ")", "\n", "return", "errAlreadyListening", "\n", "}", "\n\n", "l", ",", "err", ":=", "<mask>", ".", "Listen", "(", "\"", "\"", ",", "hostPort", ")", "\n", "if", "err", "!=", "nil", "{", "mutable", ".", "RUnlock", "(", ")", "\n", "return", "err", "\n", "}", "\n\n", "mutable", ".", "RUnlock", "(", ")", "\n", "return", "ch", ".", "Serve", "(", "l", ")", "\n", "}" ]
2,113
all-2114
[ "title", ":", "user", "info", "path", ":", "/", "users", "/", "info", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized" ]
[ "func", "userInfo", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "<mask>", ",", "err", ":=", "auth", ".", "ConvertNewUser", "(", "t", ".", "User", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "perms", ",", "err", ":=", "t", ".", "Permissions", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "userData", ",", "err", ":=", "createAPIUser", "(", "perms", ",", "user", ",", "nil", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "userData", ")", "\n", "}" ]
2,114
all-2115
[ "ImageGetNodesWithImage", "returns", "the", "addresses", "of", "online", "nodes", "which", "already", "have", "the", "image", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageGetNodesWithImage", "(", "fingerprint", "<mask>", ")", "(", "[", "]", "string", ",", "error", ")", "{", "q", ":=", "`\nSELECT DISTINCT nodes.address FROM nodes\n LEFT JOIN images_nodes ON images_nodes.node_id = nodes.id\n LEFT JOIN images ON images_nodes.image_id = images.id\nWHERE images.fingerprint = ?\n\t`", "\n", "return", "c", ".", "getNodesByImageFingerprint", "(", "q", ",", "fingerprint", ")", "\n", "}" ]
2,115
all-2116
[ "HasApmQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "ToplistRequest", ")", "HasApmQuery", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "ApmQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
2,116
all-2117
[ "FindId", "is", "a", "convenience", "helper", "equivalent", "to", ":", "query", ":", "=", "collection", ".", "Find", "(", "bson", ".", "M", "{", "_id", ":", "id", "}", ")", "See", "the", "Find", "method", "for", "more", "details", "." ]
[ "func", "(", "c", "*", "Collection", ")", "FindId", "(", "id", "interface", "{", "}", ")", "*", "<mask>", "{", "return", "c", ".", "Find", "(", "bson", ".", "D", "{", "{", "\"", "\"", ",", "id", "}", "}", ")", "\n", "}" ]
2,117
all-2118
[ "LogKV", "belongs", "to", "the", "Span", "interface", ".", "This", "implementations", "coerces", "all", "values", "to", "strings", "though", "that", "is", "not", "something", "all", "implementations", "need", "to", "do", ".", "Indeed", "a", "motivated", "person", "can", "and", "probably", "should", "have", "this", "do", "a", "typed", "switch", "on", "the", "values", "." ]
[ "func", "(", "s", "*", "MockSpan", ")", "LogKV", "(", "keyValues", "...", "interface", "{", "}", ")", "{", "if", "len", "(", "keyValues", ")", "%", "2", "!=", "0", "{", "s", ".", "LogFields", "(", "log", ".", "Error", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "keyValues", ")", ")", ")", ")", "\n", "return", "\n", "}", "\n", "fields", ",", "err", ":=", "log", ".", "InterleavedKVToFields", "(", "keyValues", "...", ")", "\n", "if", "err", "!=", "nil", "{", "s", ".", "LogFields", "(", "log", ".", "Error", "(", "err", ")", ",", "<mask>", ".", "String", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "return", "\n", "}", "\n", "s", ".", "LogFields", "(", "fields", "...", ")", "\n", "}" ]
2,118
all-2119
[ "SubscribeToTopic", "subscribes", "a", "particular", "device", "to", "topics", "(", "when", "you", "want", "to", "do", "from", "backend", ")" ]
[ "func", "(", "p", "*", "Pushy", ")", "SubscribeToTopic", "(", "deviceID", "string", ",", "topics", "...", "string", ")", "(", "*", "SimpleSuccess", ",", "*", "Error", ",", "error", ")", "{", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "APIEndpoint", ",", "p", ".", "APIToken", ")", "\n", "request", ":=", "DeviceSubscriptionRequest", "{", "Token", ":", "deviceID", ",", "Topics", ":", "topics", ",", "}", "\n", "var", "success", "*", "SimpleSuccess", "\n", "var", "pushyErr", "*", "Error", "\n", "err", ":=", "post", "(", "p", ".", "httpClient", ",", "url", ",", "<mask>", ",", "&", "success", ",", "&", "pushyErr", ")", "\n", "return", "success", ",", "pushyErr", ",", "err", "\n", "}" ]
2,119
all-2120
[ "AgentAfterOfferingMsgBCPublish", "updates", "offering", "status", "and", "creates", "somc", "publish", "job", "." ]
[ "func", "(", "w", "*", "Worker", ")", "AgentAfterOfferingMsgBCPublish", "(", "<mask>", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n", "offering", ",", "err", ":=", "w", ".", "relatedOffering", "(", "logger", ",", "job", ",", "data", ".", "JobAgentAfterOfferingMsgBCPublish", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "ethLog", ",", "err", ":=", "w", ".", "ethLog", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "ethLog", ")", "\n\n", "offering", ".", "Status", "=", "data", ".", "OfferRegistered", "\n", "offering", ".", "BlockNumberUpdated", "=", "ethLog", ".", "Block", "\n", "if", "err", "=", "w", ".", "db", ".", "Update", "(", "offering", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrInternal", "\n", "}", "\n\n", "agent", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "offering", ".", "Agent", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "addJob", "(", "logger", ",", "nil", ",", "data", ".", "JobAccountUpdateBalances", ",", "data", ".", "JobAccount", ",", "agent", ".", "ID", ")", "\n", "}" ]
2,120
all-2121
[ "NewRemoveCommand", "returns", "the", "CLI", "command", "for", "rm", "." ]
[ "func", "NewRemoveCommand", "(", ")", "cli", ".", "Command", "{", "return", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", ",", "ArgsUsage", ":", "\"", "\"", ",", "Flags", ":", "[", "]", "cli", ".", "Flag", "{", "cli", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", "}", ",", "cli", ".", "BoolFlag", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", "}", ",", "cli", ".", "StringFlag", "{", "Name", ":", "\"", "\"", ",", "<mask>", ":", "\"", "\"", ",", "Usage", ":", "\"", "\"", "}", ",", "cli", ".", "IntFlag", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "0", ",", "Usage", ":", "\"", "\"", "}", ",", "}", ",", "Action", ":", "func", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "rmCommandFunc", "(", "c", ",", "mustNewKeyAPI", "(", "c", ")", ")", "\n", "return", "nil", "\n", "}", ",", "}", "\n", "}" ]
2,121
all-2122
[ "HasThreshold", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "Rule", ")", "HasThreshold", "(", ")", "bool", "{", "if", "r", "!=", "nil", "&&", "r", ".", "Threshold", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,122
all-2123
[ "ParseString", "is", "the", "same", "as", "Parse", "but", "receives", "a", "string", "instead", "of", "[]", "byte" ]
[ "func", "(", "p", "*", "TTerse", ")", "ParseString", "(", "name", ",", "template", "string", ")", "(", "*", "<mask>", ".", "AST", ",", "error", ")", "{", "b", ":=", "parser", ".", "NewBuilder", "(", ")", "\n", "lex", ":=", "NewStringLexer", "(", "template", ")", "\n", "return", "b", ".", "Parse", "(", "name", ",", "lex", ")", "\n", "}" ]
2,123
all-2124
[ "createHostonlyAdapter", "creates", "a", "new", "host", "-", "only", "network", "." ]
[ "func", "createHostonlyAdapter", "(", "vbox", "VBoxManager", ")", "(", "*", "hostOnlyNetwork", ",", "error", ")", "{", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "log", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "\n\n", "out", ",", "err", ":=", "vbox", ".", "vbmOut", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "res", ":=", "reHostOnlyAdapterCreated", ".", "FindStringSubmatch", "(", "string", "(", "out", ")", ")", "\n", "if", "<mask>", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "&", "hostOnlyNetwork", "{", "Name", ":", "res", "[", "1", "]", "}", ",", "nil", "\n", "}" ]
2,124
all-2125
[ "Touches", "is", "deprecated", "as", "of", "1", ".", "7", ".", "0", ".", "Use", "TouchIDs", "instead", "." ]
[ "func", "Touches", "(", ")", "[", "]", "Touch", "{", "var", "ts", "[", "]", "Touch", "\n", "for", "_", ",", "id", ":=", "range", "TouchIDs", "(", ")", "{", "x", ",", "y", ":=", "TouchPosition", "(", "id", ")", "\n", "ts", "=", "<mask>", "(", "ts", ",", "&", "touch", "{", "id", ":", "id", ",", "x", ":", "x", ",", "y", ":", "y", ",", "}", ")", "\n", "}", "\n", "return", "ts", "\n", "}" ]
2,125
all-2126
[ "Device", "fetches", "an", "device", "with", "a", "given", "nickname", "from", "PushBullet", "." ]
[ "func", "(", "c", "*", "Client", ")", "Device", "(", "nickname", "string", ")", "(", "*", "Device", ",", "error", ")", "{", "devices", ",", "err", ":=", "c", ".", "Devices", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "i", ":=", "range", "devices", "{", "if", "devices", "[", "i", "]", ".", "Nickname", "==", "nickname", "{", "devices", "[", "i", "]", ".", "Client", "=", "c", "\n", "return", "<mask>", "[", "i", "]", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "ErrDeviceNotFound", "\n", "}" ]
2,126
all-2127
[ "GetMiterLimit", "is", "a", "wrapper", "around", "cairo_get_miter_limit", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetMiterLimit", "(", ")", "float64", "{", "c", ":=", "C", ".", "cairo_get_miter_limit", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
2,127
all-2128
[ "export", "IsFrameRange" ]
[ "func", "IsFrameRange", "(", "frange", "*", "C", ".", "<mask>", ")", "bool", "{", "return", "fileseq", ".", "IsFrameRange", "(", "C", ".", "GoString", "(", "frange", ")", ")", "\n", "}" ]
2,128
all-2129
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetEncodedResponseParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAudits1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,129
all-2130
[ "GetResizable", "is", "a", "wrapper", "around", "gtk_window_get_resizable", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetResizable", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_window_get_resizable", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
2,130
all-2131
[ "New", "returns", "a", "rand", ".", "Rand", "that", "is", "threadsafe", "." ]
[ "func", "New", "(", "seed", "int64", ")", "*", "rand", ".", "Rand", "{", "return", "rand", ".", "New", "(", "&", "lockedSource", "{", "src", ":", "rand", ".", "NewSource", "(", "<mask>", ")", "}", ")", "\n", "}" ]
2,131
all-2132
[ "Printf", "records", "the", "log", "with", "trace", "level" ]
[ "func", "(", "l", "*", "Logger", ")", "Printf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Output", "(", "2", ",", "LevelTrace", ",", "fmt", ".", "Sprintf", "(", "<mask>", ",", "args", "...", ")", ")", "\n", "}" ]
2,132
all-2133
[ "GetExecutablePath", "returns", "the", "absolute", "path", "to", "the", "currently", "running", "executable", ".", "It", "is", "used", "internally", "by", "the", "godaemon", "package", "and", "exported", "publicly", "because", "it", "s", "useful", "outside", "of", "the", "package", "too", "." ]
[ "func", "GetExecutablePath", "(", ")", "(", "string", ",", "error", ")", "{", "PATH_MAX", ":=", "1024", "// From <sys/syslimits.h>", "\n", "exePath", ":=", "<mask>", "(", "[", "]", "byte", ",", "PATH_MAX", ")", "\n", "exeLen", ":=", "C", ".", "uint32_t", "(", "len", "(", "exePath", ")", ")", "\n\n", "status", ",", "err", ":=", "C", ".", "_NSGetExecutablePath", "(", "(", "*", "C", ".", "char", ")", "(", "unsafe", ".", "Pointer", "(", "&", "exePath", "[", "0", "]", ")", ")", ",", "&", "exeLen", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Not sure why this might happen with err being nil, but...", "if", "status", "!=", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "status", ")", "\n", "}", "\n\n", "// Convert from null-padded []byte to a clean string. (Can't simply cast!)", "exePathStringLen", ":=", "bytes", ".", "Index", "(", "exePath", ",", "[", "]", "byte", "{", "0", "}", ")", "\n", "exePathString", ":=", "string", "(", "exePath", "[", ":", "exePathStringLen", "]", ")", "\n\n", "return", "filepath", ".", "Clean", "(", "exePathString", ")", ",", "nil", "\n", "}" ]
2,133
all-2134
[ "Swap", "switches", "the", "positions", "in", "which", "two", "values", "are", "stored", "in", "this", "list", ".", "x", "and", "y", "represent", "the", "indexes", "of", "the", "items", "that", "should", "be", "swapped", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "Swap", "(", "x", ",", "y", "uint", ")", "error", "{", "list", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "list", ".", "key", ".", "Unlock", "(", ")", "\n\n", "var", "xNode", ",", "yNode", "*", "llNode", "\n", "if", "temp", ",", "ok", ":=", "get", "(", "list", ".", "first", ",", "x", ")", ";", "ok", "{", "xNode", "=", "temp", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "list", ".", "length", ",", "x", ")", "\n", "}", "\n", "if", "temp", ",", "ok", ":=", "get", "(", "list", ".", "first", ",", "y", ")", ";", "ok", "{", "yNode", "=", "temp", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ".", "length", ",", "y", ")", "\n", "}", "\n\n", "temp", ":=", "xNode", ".", "payload", "\n", "xNode", ".", "payload", "=", "yNode", ".", "payload", "\n", "yNode", ".", "payload", "=", "temp", "\n", "return", "nil", "\n", "}" ]
2,134
all-2135
[ "GetShowErrorsOk", "returns", "a", "tuple", "with", "the", "ShowErrors", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetShowErrorsOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "ShowErrors", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "ShowErrors", ",", "true", "\n", "}" ]
2,135
all-2136
[ "FlowBoxChildNew", "is", "a", "wrapper", "around", "gtk_flow_box_child_new", "()" ]
[ "func", "FlowBoxChildNew", "(", ")", "(", "*", "FlowBoxChild", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_flow_box_child_new", "(", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "<mask>", "wrapFlowBoxChild", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
2,136
all-2137
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "GetAppsAppReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "<mask>", "200", ":", "result", ":=", "NewGetAppsAppOK", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewGetAppsAppNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewGetAppsAppDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "response", ".", "Code", "(", ")", "/", "100", "==", "2", "{", "return", "result", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "result", "\n", "}", "\n", "}" ]
2,137
all-2138
[ "Equal", "returns", "whether", "two", "labels", "are", "exactly", "the", "same", ".", "It", "does", "not", "return", "true", "for", "different", "labels", "that", "refer", "to", "the", "same", "target", "." ]
[ "func", "(", "l", "Label", ")", "Equal", "(", "other", "Label", ")", "bool", "{", "return", "l", ".", "Repo", "==", "other", ".", "Repo", "&&", "l", ".", "Pkg", "==", "other", ".", "Pkg", "&&", "l", ".", "Name", "==", "other", ".", "<mask>", "&&", "l", ".", "Relative", "==", "other", ".", "Relative", "\n", "}" ]
2,138
all-2139
[ "Do", "executes", "Tethering", ".", "bind", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "BindParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandBind", ",", "p", ",", "nil", ")", "\n", "}" ]
2,139
all-2140
[ "projects", "returns", "the", "list", "of", "accessible", "gcp", "projects" ]
[ "func", "projects", "(", "max", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "out", ",", "err", ":=", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "max", ")", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "strings", ".", "Split", "(", "out", ",", "\"", "\\n", "\"", ")", ",", "nil", "\n", "}" ]
2,140
all-2141
[ "Do", "executes", "DOM", ".", "getAttributes", "against", "the", "provided", "context", ".", "returns", ":", "attributes", "-", "An", "interleaved", "array", "of", "node", "attribute", "names", "and", "values", "." ]
[ "func", "(", "p", "*", "GetAttributesParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "attributes", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetAttributesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetAttributes", ",", "p", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Attributes", ",", "nil", "\n", "}" ]
2,141
all-2142
[ "Fetch", "gets", "the", "agent", "settings", "for", "a", "given", "instance", "ID", "." ]
[ "func", "(", "c", "*", "FakeClient", ")", "Fetch", "(", "instanceID", "string", ")", "(", "registry", ".", "AgentSettings", ",", "error", ")", "{", "c", ".", "FetchCalled", "=", "<mask>", "\n", "return", "c", ".", "FetchSettings", ",", "c", ".", "FetchErr", "\n", "}" ]
2,142
all-2143
[ "NewDockerGoClient", "creates", "a", "new", "DockerGoClient", "TODO", "Remove", "clientfactory", "parameter", "once", "migration", "to", "Docker", "SDK", "is", "complete", "." ]
[ "func", "NewDockerGoClient", "(", "sdkclientFactory", "sdkclientfactory", ".", "Factory", ",", "cfg", "*", "config", ".", "Config", ",", "ctx", "context", ".", "Context", ")", "(", "DockerClient", ",", "error", ")", "{", "// Ensure SDK client can connect to the Docker daemon.", "sdkclient", ",", "err", ":=", "sdkclientFactory", ".", "GetDefaultClient", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Even if we have a DockerClient, the daemon might not be running. Ping from both clients", "// to ensure it's up.", "_", ",", "err", "=", "sdkclient", ".", "Ping", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "dockerAuthData", "json", ".", "RawMessage", "\n", "if", "cfg", ".", "EngineAuthData", "!=", "nil", "{", "dockerAuthData", "=", "cfg", ".", "EngineAuthData", ".", "Contents", "(", ")", "\n", "}", "\n", "return", "&", "dockerGoClient", "{", "sdkClientFactory", ":", "sdkclientFactory", ",", "auth", ":", "dockerauth", ".", "NewDockerAuthProvider", "(", "cfg", ".", "EngineAuthType", ",", "dockerAuthData", ")", ",", "ecrClientFactory", ":", "ecr", ".", "NewECRFactory", "(", "cfg", ".", "AcceptInsecureCert", ")", ",", "ecrTokenCache", ":", "async", ".", "NewLRUCache", "(", "tokenCacheSize", ",", "tokenCacheTTL", ")", ",", "config", ":", "cfg", ",", "<mask>", ":", "ctx", ",", "imagePullBackoff", ":", "retry", ".", "NewExponentialBackoff", "(", "minimumPullRetryDelay", ",", "maximumPullRetryDelay", ",", "pullRetryJitterMultiplier", ",", "pullRetryDelayMultiplier", ")", ",", "}", ",", "nil", "\n", "}" ]
2,143
all-2144
[ "AddUnits", "creates", "n", "new", "units", "within", "the", "provisioner", "saves", "new", "units", "in", "the", "database", "and", "enqueues", "the", "apprc", "serialization", "." ]
[ "func", "(", "app", "*", "App", ")", "AddUnits", "(", "n", "uint", ",", "process", "string", ",", "w", "io", ".", "<mask>", ")", "error", "{", "if", "n", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "units", ",", "err", ":=", "app", ".", "Units", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "u", ":=", "range", "units", "{", "if", "(", "u", ".", "Status", "==", "provision", ".", "StatusAsleep", ")", "||", "(", "u", ".", "Status", "==", "provision", ".", "StatusStopped", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "w", "=", "app", ".", "withLogWriter", "(", "w", ")", "\n", "err", "=", "action", ".", "NewPipeline", "(", "&", "reserveUnitsToAdd", ",", "&", "provisionAddUnits", ",", ")", ".", "Execute", "(", "app", ",", "n", ",", "w", ",", "process", ")", "\n", "rebuild", ".", "RoutesRebuildOrEnqueue", "(", "app", ".", "Name", ")", "\n", "quotaErr", ":=", "app", ".", "fixQuota", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "quotaErr", "\n", "}" ]
2,144
all-2145
[ "GetWidthOk", "returns", "a", "tuple", "with", "the", "Width", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequestStyle", ")", "GetWidthOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "g", "==", "nil", "||", "g", ".", "Width", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "g", ".", "Width", ",", "<mask>", "\n", "}" ]
2,145
all-2146
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform3i", "(", "<mask>", "int32", ",", "v0", "int32", ",", "v1", "int32", ",", "v2", "int32", ")", "{", "C", ".", "glowUniform3i", "(", "gpUniform3i", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLint", ")", "(", "v0", ")", ",", "(", "C", ".", "GLint", ")", "(", "v1", ")", ",", "(", "C", ".", "GLint", ")", "(", "v2", ")", ")", "\n", "}" ]
2,146
all-2147
[ "/", "*", "Blake2b", "s", "rotation" ]
[ "func", "rotr64", "(", "w", "uint64", ",", "c", "<mask>", ")", "uint64", "{", "return", "(", "w", ">>", "c", ")", "|", "(", "w", "<<", "(", "64", "-", "c", ")", ")", "\n", "}" ]
2,147
all-2148
[ "lexValueSequence", "scans", "a", "value", "sequence", "of", "a", "series", "description", "." ]
[ "func", "lexValueSequence", "(", "l", "*", "lexer", ")", "stateFn", "{", "switch", "r", ":=", "l", ".", "next", "(", ")", ";", "{", "case", "r", "==", "eof", ":", "return", "lexStatements", "\n", "case", "isSpace", "(", "r", ")", ":", "l", ".", "emit", "(", "ItemSpace", ")", "\n", "lexSpace", "(", "l", ")", "\n", "case", "r", "==", "'+'", ":", "l", ".", "emit", "(", "ItemADD", ")", "\n", "case", "r", "==", "'-'", ":", "l", ".", "emit", "(", "ItemSUB", ")", "\n", "case", "r", "==", "'x'", ":", "l", ".", "emit", "(", "ItemTimes", ")", "\n", "case", "r", "==", "'_'", ":", "l", ".", "emit", "(", "ItemBlank", ")", "\n", "case", "isDigit", "(", "r", ")", "||", "(", "r", "==", "'.'", "&&", "isDigit", "(", "l", ".", "peek", "(", ")", ")", ")", ":", "l", ".", "backup", "(", ")", "\n", "lexNumber", "(", "l", ")", "\n", "case", "isAlpha", "(", "r", ")", ":", "l", ".", "backup", "(", ")", "\n", "// We might lex invalid items here but this will be caught by the parser.", "return", "lexKeywordOrIdentifier", "\n", "<mask>", ":", "return", "l", ".", "errorf", "(", "\"", "\"", ",", "r", ")", "\n", "}", "\n", "return", "lexValueSequence", "\n", "}" ]
2,148
all-2149
[ "Purge", "removes", "all", "tasks", "from", "a", "queue", "." ]
[ "func", "Purge", "(", "c", "context", ".", "Context", ",", "queueName", "string", ")", "error", "{", "if", "queueName", "==", "\"", "\"", "{", "queueName", "=", "\"", "\"", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "TaskQueuePurgeQueueRequest", "{", "QueueName", ":", "[", "]", "byte", "(", "queueName", ")", ",", "}", "\n", "res", ":=", "&", "pb", ".", "TaskQueuePurgeQueueResponse", "{", "}", "\n", "return", "<mask>", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "}" ]
2,149
all-2150
[ "New", "creates", "a", "new", "discover", "client", "with", "the", "given", "options", "." ]
[ "func", "New", "(", "opts", "...", "Option", ")", "(", "*", "Discover", ",", "error", ")", "{", "d", ":=", "new", "(", "Discover", ")", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "opts", "{", "if", "err", ":=", "opt", "(", "d", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "d", ".", "once", ".", "Do", "(", "d", ".", "initProviders", ")", "\n\n", "return", "d", ",", "nil", "\n", "}" ]
2,150
all-2151
[ "ClearDataForOrigin", "clears", "storage", "for", "origin", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Storage#method", "-", "clearDataForOrigin", "parameters", ":", "origin", "-", "Security", "origin", ".", "storageTypes", "-", "Comma", "separated", "list", "of", "StorageType", "to", "clear", "." ]
[ "func", "ClearDataForOrigin", "(", "<mask>", "string", ",", "storageTypes", "string", ")", "*", "ClearDataForOriginParams", "{", "return", "&", "ClearDataForOriginParams", "{", "Origin", ":", "origin", ",", "StorageTypes", ":", "storageTypes", ",", "}", "\n", "}" ]
2,151
all-2152
[ "LazyHandler", "writes", "all", "values", "to", "the", "wrapped", "handler", "after", "evaluating", "any", "lazy", "functions", "in", "the", "record", "s", "context", ".", "It", "is", "already", "wrapped", "around", "StreamHandler", "and", "SyslogHandler", "in", "this", "library", "you", "ll", "only", "need", "it", "if", "you", "write", "your", "own", "Handler", "." ]
[ "func", "LazyHandler", "(", "h", "Handler", ")", "Handler", "{", "return", "FuncHandler", "(", "func", "(", "r", "*", "Record", ")", "error", "{", "// go through the values (odd indices) and reassign", "// the values of any lazy fn to the result of its execution", "hadErr", ":=", "false", "\n", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "r", ".", "Ctx", ")", ";", "i", "+=", "2", "{", "lz", ",", "ok", ":=", "r", ".", "Ctx", "[", "i", "]", ".", "(", "Lazy", ")", "\n", "if", "ok", "{", "v", ",", "err", ":=", "evaluateLazy", "(", "lz", ")", "\n", "if", "err", "!=", "nil", "{", "hadErr", "=", "true", "\n", "r", ".", "Ctx", "[", "i", "]", "=", "err", "\n", "}", "else", "{", "if", "cs", ",", "ok", ":=", "v", ".", "(", "stack", ".", "Trace", ")", ";", "<mask>", "{", "v", "=", "cs", ".", "TrimBelow", "(", "stack", ".", "Call", "(", "r", ".", "CallPC", "[", "0", "]", ")", ")", ".", "TrimRuntime", "(", ")", "\n", "}", "\n", "r", ".", "Ctx", "[", "i", "]", "=", "v", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "hadErr", "{", "r", ".", "Ctx", "=", "append", "(", "r", ".", "Ctx", ",", "errorKey", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "h", ".", "Log", "(", "r", ")", "\n", "}", ")", "\n", "}" ]
2,152
all-2153
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform1f", "(", "<mask>", "int32", ",", "v0", "float32", ")", "{", "C", ".", "glowUniform1f", "(", "gpUniform1f", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v0", ")", ")", "\n", "}" ]
2,153
all-2154
[ "GetInterval", "returns", "the", "Interval", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "ApmOrLogQueryCompute", ")", "GetInterval", "(", ")", "int", "{", "if", "a", "==", "nil", "||", "a", ".", "Interval", "==", "nil", "{", "<mask>", "0", "\n", "}", "\n", "return", "*", "a", ".", "Interval", "\n", "}" ]
2,154
all-2155
[ "Dial", "creates", "new", "client<", "-", ">", "server", "connection", ".", "Just", "like", "a", "real", "Dial", "it", "only", "returns", "once", "the", "server", "has", "accepted", "the", "connection", ".", "It", "is", "safe", "calling", "Dial", "from", "concurrently", "running", "goroutines", "." ]
[ "func", "(", "ln", "*", "InmemoryListener", ")", "Dial", "(", ")", "(", "<mask>", ".", "Conn", ",", "error", ")", "{", "pc", ":=", "NewPipeConns", "(", ")", "\n", "cConn", ":=", "pc", ".", "Conn1", "(", ")", "\n", "sConn", ":=", "pc", ".", "Conn2", "(", ")", "\n", "ln", ".", "lock", ".", "Lock", "(", ")", "\n", "accepted", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "if", "!", "ln", ".", "closed", "{", "ln", ".", "conns", "<-", "acceptConn", "{", "sConn", ",", "accepted", "}", "\n", "// Wait until the connection has been accepted.", "<-", "accepted", "\n", "}", "else", "{", "sConn", ".", "Close", "(", ")", "\n", "cConn", ".", "Close", "(", ")", "\n", "cConn", "=", "nil", "\n", "}", "\n", "ln", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "cConn", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "cConn", ",", "nil", "\n", "}" ]
2,155
all-2156
[ "CheckInstallation", "checks", "installation", "of", "all", "of", "the", "tools" ]
[ "func", "(", "i", "*", "Installer", ")", "CheckInstallation", "(", ")", "error", "{", "for", "binary", ",", "versionRange", ":=", "range", "versionMap", "{", "log", ".", "Println", "(", "\"", "\"", ",", "binary", ",", "\"", "\"", ",", "versionRange", ")", "\n\n", "<mask>", ",", "err", ":=", "i", ".", "GetVersionForBinary", "(", "binary", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", "=", "i", ".", "CheckVersion", "(", "binary", ",", "version", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,156
all-2157
[ "readBoshRelease", "reads", "a", "bosh", "release", "out", "of", "the", "given", "reader", "into", "a", "new", "boshRelease", "struct" ]
[ "func", "(", "r", "*", "BoshRelease", ")", "readBoshRelease", "(", "rr", "io", ".", "Reader", ")", "error", "{", "w", ":=", "pkg", ".", "NewTgzWalker", "(", "rr", ")", "\n", "w", ".", "OnMatch", "(", "\"", "\"", ",", "func", "(", "<mask>", "pkg", ".", "FileEntry", ")", "error", "{", "return", "decodeYaml", "(", "file", ".", "Reader", ",", "&", "r", ".", "ReleaseManifest", ")", "\n", "}", ")", "\n", "w", ".", "OnMatch", "(", "\"", "\"", ",", "func", "(", "file", "pkg", ".", "FileEntry", ")", "error", "{", "job", ",", "jerr", ":=", "r", ".", "readBoshJob", "(", "file", ".", "Reader", ")", "\n", "if", "jerr", "==", "nil", "{", "r", ".", "JobManifests", "[", "job", ".", "Name", "]", "=", "job", "\n", "}", "\n", "return", "jerr", "\n", "}", ")", "\n", "err", ":=", "w", ".", "Walk", "(", ")", "\n", "return", "err", "\n", "}" ]
2,157
all-2158
[ "PATCH", "/", "api", "/", "current_user", "Update", "the", "user", "s", "details", "." ]
[ "func", "(", "loc", "*", "CurrentUserLocator", ")", "Update", "(", "password", "string", ",", "options", "rsapi", ".", "APIParams", ")", "(", "*", "CurrentUser", ",", "error", ")", "{", "var", "res", "*", "CurrentUser", "\n", "if", "password", "==", "\"", "\"", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "params", "=", "rsapi", ".", "APIParams", "{", "}", "\n", "var", "viewOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "viewOpt", "!=", "nil", "{", "params", "[", "\"", "\"", "]", "=", "viewOpt", "\n", "}", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "\"", "\"", ":", "password", ",", "}", "\n", "var", "companyOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "companyOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "companyOpt", "\n", "}", "\n", "var", "emailOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "emailOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "emailOpt", "\n", "}", "\n", "var", "firstNameOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "firstNameOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "firstNameOpt", "\n", "}", "\n", "var", "lastNameOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "lastNameOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "lastNameOpt", "\n", "}", "\n", "var", "newPasswordOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "newPasswordOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "newPasswordOpt", "\n", "}", "\n", "var", "phoneOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "phoneOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "phoneOpt", "\n", "}", "\n", "var", "timezoneOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "timezoneOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "timezoneOpt", "\n", "}", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "Path", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ",", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "sr", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "sr", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "respBody", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "err", "=", "json", ".", "Unmarshal", "(", "respBody", ",", "&", "res", ")", "\n", "return", "res", ",", "err", "\n", "}" ]
2,158
all-2159
[ "SearchOutlierReports", "returns", "outlier", "report", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "outlier", "report", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchOutlierReports", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "OutlierReport", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "<mask>", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchOutlierReports", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "OutlierReportPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "reports", "[", "]", "OutlierReport", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "reports", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "reports", ",", "nil", "\n", "}" ]
2,159
all-2160
[ "URLFor", "builds", "path", "part", "of", "URL", "by", "given", "pair", "values", "." ]
[ "func", "(", "r", "*", "Router", ")", "URLFor", "(", "<mask>", "string", ",", "pairs", "...", "string", ")", "string", "{", "leaf", ",", "ok", ":=", "r", ".", "namedRoutes", "[", "name", "]", "\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", "+", "name", ")", "\n", "}", "\n", "return", "leaf", ".", "URLPath", "(", "pairs", "...", ")", "\n", "}" ]
2,160
all-2161
[ "getGoRoutineMaxNum", "calculates", "the", "maximum", "number", "of", "goroutines", "that", "we", "need", "to", "spin", "up", "to", "retrieve", "secret", "values", "from", "SSM", "parameter", "store", ".", "Assume", "each", "goroutine", "initiates", "one", "SSM", "GetParameters", "call", "and", "each", "call", "will", "have", "10", "parameters" ]
[ "func", "(", "secret", "*", "SSMSecretResource", ")", "getGoRoutineMaxNum", "(", ")", "int", "{", "total", ":=", "0", "\n", "for", "_", ",", "secrets", ":=", "range", "secret", ".", "requiredSecrets", "{", "<mask>", "+=", "len", "(", "secrets", ")", "/", "MaxBatchNum", "+", "1", "\n", "}", "\n", "return", "total", "\n", "}" ]
2,161
all-2162
[ "GetIconAtPos", "()", "is", "a", "wrapper", "around", "gtk_entry_get_icon_at_pos", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "GetIconAtPos", "(", "x", ",", "y", "int", ")", "int", "{", "c", ":=", "C", ".", "gtk_entry_get_icon_at_pos", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "x", ")", ",", "C", ".", "gint", "(", "y", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
2,162
all-2163
[ "List", "returns", "the", "keys", "from", "storage", "in", "alphabetical", "order", "." ]
[ "func", "(", "kb", "dbKeybase", ")", "List", "(", ")", "(", "[", "]", "Info", ",", "error", ")", "{", "var", "res", "[", "]", "Info", "\n", "iter", ":=", "kb", ".", "db", ".", "Iterator", "(", "nil", ",", "nil", ")", "\n", "defer", "iter", ".", "Close", "(", ")", "\n", "for", ";", "iter", ".", "Valid", "(", ")", ";", "iter", ".", "Next", "(", ")", "{", "<mask>", ",", "err", ":=", "readInfo", "(", "iter", ".", "Value", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "res", "=", "append", "(", "res", ",", "info", ")", "\n", "}", "\n", "return", "res", ",", "nil", "\n", "}" ]
2,163
all-2164
[ "HashPipeline", "computes", "and", "returns", "the", "hash", "of", "a", "pipeline", "." ]
[ "func", "(", "s", "*", "Hasher", ")", "HashPipeline", "(", "pipelineName", "string", ")", "uint64", "{", "return", "uint64", "(", "adler32", ".", "Checksum", "(", "[", "]", "<mask>", "(", "pipelineName", ")", ")", ")", "%", "s", ".", "PipelineModulus", "\n", "}" ]
2,164
all-2165
[ "SetHasSubtitle", "is", "a", "wrapper", "around", "gtk_header_bar_set_has_subtitle", "()", "." ]
[ "func", "(", "v", "*", "HeaderBar", ")", "SetHasSubtitle", "(", "setting", "bool", ")", "{", "C", ".", "gtk_header_bar_set_has_subtitle", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "<mask>", ")", ")", "\n", "}" ]
2,165
all-2166
[ "GetBool", "returns", "bool", "value", "for", "the", "given", "key" ]
[ "func", "(", "c", "GConfig", ")", "GetBool", "(", "<mask>", "string", ")", "bool", "{", "b", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "c", ".", "getStringValue", "(", "key", ")", ")", "\n", "return", "b", "\n", "}" ]
2,166
all-2167
[ "GetStopSequenceNumber", "returns", "the", "stop", "sequence", "number", "of", "a", "task" ]
[ "func", "(", "task", "*", "Task", ")", "GetStopSequenceNumber", "(", ")", "int64", "{", "task", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "<mask>", ".", "StopSequenceNumber", "\n", "}" ]
2,167
all-2168
[ "newDefaultLogger", "creates", "new", "logger", "that", "writes", "log", "messages", "to", "standard", "output", "in", "DEBUG", "level", ".", "This", "logger", "is", "automatically", "created", "and", "this", "function", "needs", "to", "be", "called", "only", "if", "all", "loggers", "were", "removed", "and", "default", "logger", "needs", "recreating", "." ]
[ "func", "newDefaultLogger", "(", ")", "*", "Logger", "{", "return", "NewLogger", "(", "\"", "\"", ",", "DEBUG", ",", "[", "]", "Handler", "{", "&", "WriteHandler", "{", "Level", ":", "<mask>", ",", "Formatter", ":", "&", "StandardFormatter", "{", "TimeFormat", ":", "StandardTimeFormat", "}", ",", "Writer", ":", "os", ".", "Stderr", ",", "}", ",", "}", ",", "0", ")", "\n", "}" ]
2,168
all-2169
[ "NewTracerFromRequest", "returns", "a", "new", "tracer", "that", "has", "a", "root", "span", "derived", "from", "the", "specified", "request", ".", "A", "span", "previously", "added", "to", "the", "request", "context", "using", "Context", "is", "automatically", "used", "as", "the", "parent", "." ]
[ "func", "NewTracerFromRequest", "(", "r", "*", "<mask>", ".", "Request", ",", "name", "string", ")", "*", "Tracer", "{", "span", ",", "_", ":=", "opentracing", ".", "StartSpanFromContext", "(", "r", ".", "Context", "(", ")", ",", "name", ")", "\n", "return", "NewTracer", "(", "span", ")", "\n", "}" ]
2,169
all-2170
[ "regexReplaceAll", "replaces", "all", "occurrences", "of", "a", "regular", "expression", "with", "the", "given", "replacement", "value", "." ]
[ "func", "regexReplaceAll", "(", "<mask>", ",", "pl", ",", "s", "string", ")", "(", "string", ",", "error", ")", "{", "compiled", ",", "err", ":=", "regexp", ".", "Compile", "(", "re", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "compiled", ".", "ReplaceAllString", "(", "s", ",", "pl", ")", ",", "nil", "\n", "}" ]
2,170
all-2171
[ "SetInt", "is", "a", "wrapper", "around", "g_settings_set_int", "()", "." ]
[ "func", "(", "v", "*", "Settings", ")", "SetInt", "(", "name", "string", ",", "value", "int", ")", "bool", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "<mask>", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "return", "gobool", "(", "C", ".", "g_settings_set_int", "(", "v", ".", "native", "(", ")", ",", "cstr1", ",", "C", ".", "gint", "(", "value", ")", ")", ")", "\n", "}" ]
2,171
all-2172
[ "RetryMaintenanceClient", "implements", "a", "Maintenance", "." ]
[ "func", "RetryMaintenanceClient", "(", "c", "*", "Client", ",", "conn", "*", "grpc", ".", "ClientConn", ")", "pb", ".", "MaintenanceClient", "{", "return", "&", "retryMaintenanceClient", "{", "mc", ":", "<mask>", ".", "NewMaintenanceClient", "(", "conn", ")", ",", "}", "\n", "}" ]
2,172
all-2173
[ "SetName", "is", "a", "wrapper", "around", "gtk_status_icon_set_name", "()" ]
[ "func", "(", "v", "*", "StatusIcon", ")", "SetName", "(", "name", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_status_icon_set_name", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
2,173
all-2174
[ "GetEnvOk", "returns", "a", "tuple", "with", "the", "Env", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetEnvOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "Env", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "Env", ",", "<mask>", "\n", "}" ]
2,174
all-2175
[ "SubstrF", "is", "the", "filter", "form", "of", "Substr", "." ]
[ "func", "SubstrF", "(", "index", ",", "n", "int", ")", "func", "(", "string", ")", "string", "{", "return", "func", "(", "s", "string", ")", "string", "{", "return", "Substr", "(", "s", ",", "<mask>", ",", "n", ")", "\n", "}", "\n", "}" ]
2,175
all-2176
[ "State", "returns", "current", "state", "of", "CheckBox" ]
[ "func", "(", "c", "*", "CheckBox", ")", "State", "(", ")", "int", "{", "c", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "<mask>", "\n", "}" ]
2,176
all-2177
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopScreencastParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,177
all-2178
[ "Categories", "returns", "a", "hierarchical", "list", "of", "categories", "applied", "to", "venues", ".", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "categories" ]
[ "func", "(", "s", "*", "VenueService", ")", "Categories", "(", ")", "(", "[", "]", "Category", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "cats", ":=", "new", "(", "categoriesResp", ")", "\n", "response", ":=", "new", "(", "Response", ")", "\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "\"", "\"", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "cats", ")", "\n", "}", "\n\n", "return", "cats", ".", "Categories", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "<mask>", ")", "\n", "}" ]
2,178
all-2179
[ "Update", "finds", "a", "single", "document", "matching", "the", "provided", "selector", "document", "and", "modifies", "it", "according", "to", "the", "update", "document", ".", "If", "the", "session", "is", "in", "safe", "mode", "(", "see", "SetSafe", ")", "a", "ErrNotFound", "error", "is", "returned", "if", "a", "document", "isn", "t", "found", "or", "a", "value", "of", "type", "*", "LastError", "when", "some", "other", "error", "is", "detected", ".", "Relevant", "documentation", ":", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Updating", "http", ":", "//", "www", ".", "mongodb", ".", "org", "/", "display", "/", "DOCS", "/", "Atomic", "+", "Operations" ]
[ "func", "(", "c", "*", "Collection", ")", "Update", "(", "selector", "interface", "{", "}", ",", "update", "interface", "{", "}", ")", "error", "{", "lerr", ",", "err", ":=", "c", ".", "writeQuery", "(", "&", "updateOp", "{", "c", ".", "FullName", ",", "selector", ",", "<mask>", ",", "0", "}", ")", "\n", "if", "err", "==", "nil", "&&", "lerr", "!=", "nil", "&&", "!", "lerr", ".", "UpdatedExisting", "{", "return", "ErrNotFound", "\n", "}", "\n", "return", "err", "\n", "}" ]
2,179
all-2180
[ "Connect", "is", "a", "wrapper", "around", "gtk_accel_group_connect", "()", "." ]
[ "func", "(", "v", "*", "AccelGroup", ")", "Connect", "(", "<mask>", "uint", ",", "mods", "gdk", ".", "ModifierType", ",", "flags", "AccelFlags", ",", "f", "interface", "{", "}", ")", "{", "closure", ",", "_", ":=", "glib", ".", "ClosureNew", "(", "f", ")", "\n", "cl", ":=", "(", "*", "C", ".", "struct__GClosure", ")", "(", "unsafe", ".", "Pointer", "(", "closure", ")", ")", "\n", "C", ".", "gtk_accel_group_connect", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "key", ")", ",", "C", ".", "GdkModifierType", "(", "mods", ")", ",", "C", ".", "GtkAccelFlags", "(", "flags", ")", ",", "cl", ")", "\n", "}" ]
2,180
all-2181
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HostmapDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
2,181
all-2182
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "LoadSnapshotParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree13", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
2,182
all-2183
[ "New", "creates", "a", "clientv3", "client", "that", "wraps", "an", "in", "-", "process", "EtcdServer", ".", "Instead", "of", "making", "gRPC", "calls", "through", "sockets", "the", "client", "makes", "direct", "function", "calls", "to", "the", "etcd", "server", "through", "its", "api", "/", "v3rpc", "function", "interfaces", "." ]
[ "func", "New", "(", "s", "*", "etcdserver", ".", "EtcdServer", ")", "*", "clientv3", ".", "Client", "{", "c", ":=", "clientv3", ".", "NewCtxClient", "(", "context", ".", "Background", "(", ")", ")", "\n\n", "kvc", ":=", "adapter", ".", "KvServerToKvClient", "(", "v3rpc", ".", "NewQuotaKVServer", "(", "s", ")", ")", "\n", "c", ".", "KV", "=", "clientv3", ".", "NewKVFromKVClient", "(", "kvc", ",", "c", ")", "\n\n", "lc", ":=", "adapter", ".", "LeaseServerToLeaseClient", "(", "v3rpc", ".", "NewQuotaLeaseServer", "(", "s", ")", ")", "\n", "c", ".", "Lease", "=", "clientv3", ".", "NewLeaseFromLeaseClient", "(", "lc", ",", "c", ",", "<mask>", ".", "Second", ")", "\n\n", "wc", ":=", "adapter", ".", "WatchServerToWatchClient", "(", "v3rpc", ".", "NewWatchServer", "(", "s", ")", ")", "\n", "c", ".", "Watcher", "=", "&", "watchWrapper", "{", "clientv3", ".", "NewWatchFromWatchClient", "(", "wc", ",", "c", ")", "}", "\n\n", "mc", ":=", "adapter", ".", "MaintenanceServerToMaintenanceClient", "(", "v3rpc", ".", "NewMaintenanceServer", "(", "s", ")", ")", "\n", "c", ".", "Maintenance", "=", "clientv3", ".", "NewMaintenanceFromMaintenanceClient", "(", "mc", ",", "c", ")", "\n\n", "clc", ":=", "adapter", ".", "ClusterServerToClusterClient", "(", "v3rpc", ".", "NewClusterServer", "(", "s", ")", ")", "\n", "c", ".", "Cluster", "=", "clientv3", ".", "NewClusterFromClusterClient", "(", "clc", ",", "c", ")", "\n\n", "// TODO: implement clientv3.Auth interface?", "return", "c", "\n", "}" ]
2,183
all-2184
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventExecutionContextDestroyed", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime31", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
2,184
all-2185
[ "GetIpv6", "retrieves", "the", "Ipv6", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "PeerAddressIp", ")", "GetIpv6", "(", ")", "(", "result", "[", "16", "]", "byte", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "Ipv6", "\n", "<mask>", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
2,185
all-2186
[ "caseSensitiveJsonIterator", "returns", "a", "jsoniterator", "API", "that", "s", "configured", "to", "be", "case", "-", "sensitive", "when", "unmarshalling", "and", "otherwise", "compatible", "with", "the", "encoding", "/", "json", "standard", "library", "." ]
[ "func", "caseSensitiveJsonIterator", "(", ")", "jsoniter", ".", "API", "{", "config", ":=", "jsoniter", ".", "Config", "{", "EscapeHTML", ":", "<mask>", ",", "SortMapKeys", ":", "true", ",", "ValidateJsonRawMessage", ":", "true", ",", "CaseSensitive", ":", "true", ",", "}", ".", "Froze", "(", ")", "\n", "// Force jsoniter to decode number to interface{} via int64/float64, if possible.", "config", ".", "RegisterExtension", "(", "&", "customNumberExtension", "{", "}", ")", "\n", "return", "config", "\n", "}" ]
2,186
all-2187
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Metric", ")", "HasType", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
2,187
all-2188
[ "AfterAccountReturnBalance", "updates", "psc", "and", "ptc", "balance", "of", "an", "account", "." ]
[ "func", "(", "w", "*", "Worker", ")", "AfterAccountReturnBalance", "(", "job", "*", "data", ".", "<mask>", ")", "error", "{", "return", "w", ".", "updateAccountBalancesJob", "(", "job", ",", "data", ".", "JobAfterAccountReturnBalance", ")", "\n", "}" ]
2,188
all-2189
[ "NewIndex", "creates", "an", "index", "with", "a", "name", "." ]
[ "func", "NewIndex", "(", "name", "string", ")", "*", "Index", "{", "options", ":=", "&", "IndexOptions", "{", "}", "\n", "return", "&", "Index", "{", "name", ":", "<mask>", ",", "options", ":", "options", ".", "withDefaults", "(", ")", ",", "fields", ":", "map", "[", "string", "]", "*", "Field", "{", "}", ",", "}", "\n", "}" ]
2,189
all-2190
[ "Value", "returns", "the", "value", "at", "the", "given", "index", "in", "the", "total", "range", ".", "If", "the", "index", "is", "invalid", "/", "exceeds", "the", "valid", "range", "an", "error", "will", "be", "returned", "." ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "Value", "(", "idx", "int", ")", "(", "int", ",", "error", ")", "{", "if", "idx", "<", "0", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "idx", ")", "\n", "}", "\n\n", "var", "err", "error", "\n", "var", "val", ",", "size", ",", "n", "int", "\n\n", "for", "_", ",", "b", ":=", "range", "l", ".", "blocks", "{", "size", "=", "b", ".", "Len", "(", ")", "\n\n", "// modify the original index to be within", "// the range of the current range block, and", "// then check that it is a valid index value", "if", "(", "idx", "-", "n", ")", "<", "<mask>", "{", "if", "val", ",", "err", "=", "b", ".", "Value", "(", "idx", "-", "n", ")", ";", "err", "==", "nil", "{", "return", "val", ",", "nil", "\n", "}", "\n", "}", "\n\n", "// record the offset so we can continue to", "// modify the original index value to the local range", "n", "+=", "size", "\n", "}", "\n\n", "// The previous loop ended in error", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "idx", ")", "\n", "}" ]
2,190
all-2191
[ "Set", "the", "value", "of", "a", "query", "parameter", "in", "the", "given", "URI", "." ]
[ "func", "setQueryParam", "(", "uri", ",", "param", ",", "<mask>", "string", ")", "(", "string", ",", "error", ")", "{", "fields", ",", "err", ":=", "url", ".", "Parse", "(", "uri", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "values", ":=", "fields", ".", "Query", "(", ")", "\n", "values", ".", "Set", "(", "param", ",", "url", ".", "QueryEscape", "(", "value", ")", ")", "\n\n", "fields", ".", "RawQuery", "=", "values", ".", "Encode", "(", ")", "\n\n", "return", "fields", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
2,191
all-2192
[ "validateDatastore", "does", "one", "of", "two", "things", ":", "either", "stores", "the", "current", "datastore", "in", "the", "processor", "if", "it", "s", "missing", "or", "validates", "the", "supplied", "datastore", "with", "the", "one", "currently", "in", "the", "processor", "by", "checking", "if", "their", "IDs", "match", "." ]
[ "func", "(", "p", "*", "nasDatastoreMountProcessor", ")", "validateDatastore", "(", "ds", "*", "object", ".", "Datastore", ")", "error", "{", "if", "p", ".", "ds", "==", "nil", "{", "p", ".", "ds", "=", "ds", "\n", "return", "nil", "\n", "}", "\n", "<mask>", ":=", "p", ".", "ds", ".", "Reference", "(", ")", ".", "Value", "\n", "actual", ":=", "ds", ".", "Reference", "(", ")", ".", "Value", "\n", "if", "expected", "!=", "actual", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "expected", ",", "actual", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
2,192
all-2193
[ "ClosureNew", "creates", "a", "new", "GClosure", "and", "adds", "its", "callback", "function", "to", "the", "internally", "-", "maintained", "map", ".", "It", "s", "exported", "for", "visibility", "to", "other", "gotk3", "packages", "and", "shouldn", "t", "be", "used", "in", "application", "code", "." ]
[ "func", "ClosureNew", "(", "f", "interface", "{", "}", ",", "marshalData", "...", "<mask>", "{", "}", ")", "(", "*", "C", ".", "GClosure", ",", "error", ")", "{", "// Create a reflect.Value from f. This is called when the", "// returned GClosure runs.", "rf", ":=", "reflect", ".", "ValueOf", "(", "f", ")", "\n\n", "// Create closure context which points to the reflected func.", "cc", ":=", "closureContext", "{", "rf", ":", "rf", "}", "\n\n", "// Closures can only be created from funcs.", "if", "rf", ".", "Type", "(", ")", ".", "Kind", "(", ")", "!=", "reflect", ".", "Func", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "marshalData", ")", ">", "0", "{", "cc", ".", "userData", "=", "reflect", ".", "ValueOf", "(", "marshalData", "[", "0", "]", ")", "\n", "}", "\n\n", "c", ":=", "C", ".", "_g_closure_new", "(", ")", "\n\n", "// Associate the GClosure with rf. rf will be looked up in this", "// map by the closure when the closure runs.", "closures", ".", "Lock", "(", ")", "\n", "closures", ".", "m", "[", "c", "]", "=", "cc", "\n", "closures", ".", "Unlock", "(", ")", "\n\n", "return", "c", ",", "nil", "\n", "}" ]
2,193
all-2194
[ "MigrateStoragePoolVolume", "requests", "that", "LXD", "prepares", "for", "a", "storage", "volume", "migration" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "MigrateStoragePoolVolume", "(", "pool", "string", ",", "volume", "api", ".", "StorageVolumePost", ")", "(", "Operation", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Sanity check", "if", "!", "volume", ".", "Migration", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "pool", ")", ",", "volume", ".", "Name", ")", "\n", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "path", ",", "volume", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
2,194
all-2195
[ "ExpandVirtualMachineCloneSpec", "creates", "a", "clone", "spec", "for", "an", "existing", "virtual", "machine", ".", "The", "clone", "spec", "built", "by", "this", "function", "for", "the", "clone", "contains", "the", "target", "datastore", "the", "source", "snapshot", "in", "the", "event", "of", "linked", "clones", "and", "a", "relocate", "spec", "that", "contains", "the", "new", "locations", "and", "configuration", "details", "of", "the", "new", "virtual", "disks", "." ]
[ "func", "ExpandVirtualMachineCloneSpec", "(", "d", "*", "schema", ".", "ResourceData", ",", "c", "*", "govmomi", ".", "Client", ")", "(", "types", ".", "VirtualMachineCloneSpec", ",", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "var", "<mask>", "types", ".", "VirtualMachineCloneSpec", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n\n", "// Populate the datastore only if we have a datastore ID. The ID may not be", "// specified in the event a datastore cluster is specified instead.", "if", "dsID", ",", "ok", ":=", "d", ".", "GetOk", "(", "\"", "\"", ")", ";", "ok", "{", "ds", ",", "err", ":=", "datastore", ".", "FromID", "(", "c", ",", "dsID", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "spec", ".", "Location", ".", "Datastore", "=", "types", ".", "NewReference", "(", "ds", ".", "Reference", "(", ")", ")", "\n", "}", "\n\n", "tUUID", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "tUUID", ")", "\n", "vm", ",", "err", ":=", "virtualmachine", ".", "FromUUID", "(", "c", ",", "tUUID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "tUUID", ",", "err", ")", "\n", "}", "\n", "vprops", ",", "err", ":=", "virtualmachine", ".", "Properties", "(", "vm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "// If we are creating a linked clone, grab the current snapshot of the", "// source, and populate the appropriate field. This should have already been", "// validated, but just in case, validate it again here.", "if", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "tUUID", ")", "\n", "if", "err", ":=", "validateCloneSnapshots", "(", "vprops", ")", ";", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "err", "\n", "}", "\n", "spec", ".", "Snapshot", "=", "vprops", ".", "Snapshot", ".", "CurrentSnapshot", "\n", "spec", ".", "Location", ".", "DiskMoveType", "=", "string", "(", "types", ".", "VirtualMachineRelocateDiskMoveOptionsCreateNewChildDiskBacking", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vprops", ".", "Snapshot", ".", "CurrentSnapshot", ".", "Value", ")", "\n", "}", "\n\n", "// Set the target host system and resource pool.", "poolID", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "pool", ",", "err", ":=", "resourcepool", ".", "FromID", "(", "c", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "poolID", ",", "err", ")", "\n", "}", "\n", "var", "hs", "*", "object", ".", "HostSystem", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOk", "(", "\"", "\"", ")", ";", "ok", "{", "hsID", ":=", "v", ".", "(", "string", ")", "\n", "var", "err", "error", "\n", "if", "hs", ",", "err", "=", "hostsystem", ".", "FromID", "(", "c", ",", "hsID", ")", ";", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "hsID", ",", "err", ")", "\n", "}", "\n", "}", "\n", "// Validate that the host is part of the resource pool before proceeding", "if", "err", ":=", "resourcepool", ".", "ValidateHost", "(", "c", ",", "pool", ",", "hs", ")", ";", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "err", "\n", "}", "\n", "poolRef", ":=", "pool", ".", "Reference", "(", ")", "\n", "spec", ".", "Location", ".", "Pool", "=", "&", "poolRef", "\n", "if", "hs", "!=", "nil", "{", "hsRef", ":=", "hs", ".", "Reference", "(", ")", "\n", "spec", ".", "Location", ".", "Host", "=", "&", "hsRef", "\n", "}", "\n\n", "// Grab the relocate spec for the disks.", "l", ":=", "object", ".", "VirtualDeviceList", "(", "vprops", ".", "Config", ".", "Hardware", ".", "Device", ")", "\n", "relocators", ",", "err", ":=", "virtualdevice", ".", "DiskCloneRelocateOperation", "(", "d", ",", "c", ",", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "spec", ",", "nil", ",", "err", "\n", "}", "\n", "spec", ".", "Location", ".", "Disk", "=", "relocators", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "spec", ",", "vm", ",", "nil", "\n", "}" ]
2,195
all-2196
[ "MustRemoved", "retrieves", "the", "Removed", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "LedgerEntryChange", ")", "MustRemoved", "(", ")", "LedgerKey", "{", "val", ",", "<mask>", ":=", "u", ".", "GetRemoved", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
2,196
all-2197
[ "Seek", "moves", "cursor", "to", "the", "specified", "item", "if", "present" ]
[ "func", "(", "mit", "*", "MergeIterator", ")", "Seek", "(", "itm", "unsafe", ".", "Pointer", ")", "bool", "{", "var", "found", "bool", "\n", "for", "_", ",", "<mask>", ":=", "range", "mit", ".", "iters", "{", "if", "it", ".", "Seek", "(", "itm", ")", "{", "found", "=", "true", "\n", "}", "\n", "if", "it", ".", "Valid", "(", ")", "{", "n", ":=", "it", ".", "GetNode", "(", ")", "\n", "mit", ".", "h", "=", "append", "(", "mit", ".", "h", ",", "heapItem", "{", "iter", ":", "it", ",", "n", ":", "n", "}", ")", "\n", "}", "\n", "}", "\n\n", "heap", ".", "Init", "(", "&", "mit", ".", "h", ")", "\n", "mit", ".", "Next", "(", ")", "\n\n", "return", "found", "\n", "}" ]
2,197
all-2198
[ "Inline", "includes", "a", "file", "as", "an", "inline", "attachment", "." ]
[ "func", "(", "m", "*", "Message", ")", "Inline", "(", "file", "string", ")", "error", "{", "return", "m", ".", "<mask>", "(", "file", ",", "true", ")", "\n", "}" ]
2,198
all-2199
[ "Wait", "lets", "you", "wait", "until", "the", "operation", "reaches", "a", "final", "state" ]
[ "func", "(", "op", "*", "<mask>", ")", "Wait", "(", ")", "error", "{", "// Check if not done already", "if", "op", ".", "StatusCode", ".", "IsFinal", "(", ")", "{", "if", "op", ".", "Err", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "op", ".", "Err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n\n", "// Make sure we have a listener setup", "err", ":=", "op", ".", "setupListener", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "<-", "op", ".", "chActive", "\n\n", "// We're done, parse the result", "if", "op", ".", "Err", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "op", ".", "Err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
2,199
all-2200
[ "Just", "like", "os", ".", "Getenv", "but", "with", "a", "second", "return", "value", ";", "a", "boolean", "specifying", "if", "name", "was", "actually", "set", "in", "the", "environment", "." ]
[ "func", "getenv", "(", "name", "string", ")", "(", "s", "string", ",", "ok", "bool", ")", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n\n", "for", "_", ",", "keyVal", ":=", "range", "os", ".", "Environ", "(", ")", "{", "split", ":=", "strings", ".", "Split", "(", "keyVal", ",", "\"", "\"", ")", "\n", "m", "[", "<mask>", "[", "0", "]", "]", "=", "true", "\n", "}", "\n\n", "name", "=", "flagAsEnv", "(", "name", ")", "\n", "if", "_", ",", "ok", "=", "m", "[", "name", "]", ";", "ok", "{", "s", "=", "os", ".", "Getenv", "(", "name", ")", "\n", "}", "\n\n", "return", "\n", "}" ]