id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
8,400
all-8401
[ "IsEnabledFor", "returns", "true", "if", "any", "of", "the", "backends", "are", "enabled", "for", "it", "." ]
[ "func", "(", "b", "*", "multiLogger", ")", "IsEnabledFor", "(", "level", "Level", ",", "module", "string", ")", "bool", "{", "for", "_", ",", "backend", ":=", "range", "b", ".", "backends", "{", "if", "backend", ".", "IsEnabledFor", "(", "<mask>", ",", "module", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
8,401
all-8402
[ "ListResources", "lists", "all", "resources" ]
[ "func", "(", "c", "*", "Client", ")", "ListResources", "(", ")", "(", "*", "Resources", ",", "error", ")", "{", "url", ":=", "umResources", "(", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Resources", "{", "}", "\n", "err", ":=", "c", ".", "<mask>", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
8,402
all-8403
[ "Error", "implements", "the", "error", "interface", "." ]
[ "func", "(", "e", "Error", ")", "Error", "(", ")", "string", "{", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Name", ")", "\n", "if", "e", ".", "Value", "!=", "nil", "{", "message", "+=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Value", ")", "\n", "}", "\n", "return", "message", "+", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Reason", ")", "\n", "}" ]
8,403
all-8404
[ "AllByLabel", "finds", "zero", "or", "more", "elements", "by", "associated", "label", "text", "." ]
[ "func", "(", "s", "*", "selectable", ")", "AllByLabel", "(", "text", "string", ")", "*", "MultiSelection", "{", "return", "newMultiSelection", "(", "s", ".", "session", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "<mask>", ",", "text", ")", ")", "\n", "}" ]
8,404
all-8405
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "PressureLevel", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
8,405
all-8406
[ "/", "*", "Record", "CPU", "user", "time", "in", "seconds", "and", "as", "a", "percentage", "of", "CPU", "capacity", "." ]
[ "func", "RecordCPUUsage", "(", "userTimeSecs", ",", "cpuUsagePerc", "float64", ")", "(", "int", ",", "<mask>", ")", "{", "return", "errNo", "(", "C", ".", "newrelic_record_cpu_usage", "(", "C", ".", "double", "(", "userTimeSecs", ")", ",", "C", ".", "double", "(", "cpuUsagePerc", ")", ")", ")", "\n", "}" ]
8,406
all-8407
[ "Search", "allows", "the", "list", "to", "be", "filtered", "by", "a", "given", "term", ".", "The", "list", "must", "implement", "the", "searcher", "function", "signature", "for", "this", "functionality", "to", "work", "." ]
[ "func", "(", "l", "*", "List", ")", "Search", "(", "term", "string", ")", "{", "term", "=", "strings", ".", "Trim", "(", "term", ",", "\"", "\"", ")", "\n", "l", ".", "cursor", "=", "0", "\n", "l", ".", "start", "=", "0", "\n", "l", ".", "search", "(", "<mask>", ")", "\n", "}" ]
8,407
all-8408
[ "Respond", "without", "doing", "anything", ".", "This", "endpoint", "is", "used", "to", "check", "that", "the", "service", "is", "up", ".", "See", "#ping" ]
[ "func", "(", "notify", "*", "Notify", ")", "Ping", "(", ")", "error", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "notify", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "<mask>", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
8,408
all-8409
[ "Value", "converts", "a", "value", "to", "a", "database", "driver", "value" ]
[ "func", "(", "h", "HexColor", ")", "Value", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "return", "driver", ".", "<mask>", "(", "string", "(", "h", ")", ")", ",", "nil", "\n", "}" ]
8,409
all-8410
[ "GetProjectID", "returns", "the", "ProjectID", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "IntegrationGCPUpdateRequest", ")", "GetProjectID", "(", ")", "<mask>", "{", "if", "i", "==", "nil", "||", "i", ".", "ProjectID", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "i", ".", "ProjectID", "\n", "}" ]
8,410
all-8411
[ "WithDepth", "the", "maximum", "depth", "at", "which", "children", "should", "be", "retrieved", "defaults", "to", "1", ".", "Use", "-", "1", "for", "the", "entire", "subtree", "or", "provide", "an", "integer", "larger", "than", "0", "." ]
[ "func", "(", "p", "GetFlattenedDocumentParams", ")", "WithDepth", "(", "depth", "int64", ")", "*", "GetFlattenedDocumentParams", "{", "p", ".", "Depth", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
8,411
all-8412
[ "SearchDashboards", "returns", "dashboards", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "dashboards", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchDashboards", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Dashboard", ",", "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", ".", "FetchDashboards", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "DashboardPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "dashboards", "[", "]", "Dashboard", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "dashboards", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "dashboards", ",", "nil", "\n", "}" ]
8,412
all-8413
[ "GetTimeOk", "returns", "a", "tuple", "with", "the", "Time", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueDefinition", ")", "GetTimeOk", "(", ")", "(", "WidgetTime", ",", "bool", ")", "{", "if", "q", "==", "nil", "||", "q", ".", "Time", "==", "nil", "{", "return", "WidgetTime", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "q", ".", "Time", ",", "<mask>", "\n", "}" ]
8,413
all-8414
[ "OptClientTracer", "sets", "the", "Open", "Tracing", "tracer", "See", ":", "https", ":", "//", "opentracing", ".", "io" ]
[ "func", "OptClientTracer", "(", "tracer", "opentracing", ".", "Tracer", ")", "ClientOption", "{", "return", "func", "(", "<mask>", "*", "ClientOptions", ")", "error", "{", "options", ".", "tracer", "=", "tracer", "\n", "return", "nil", "\n", "}", "\n", "}" ]
8,414
all-8415
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "SetWebLifecycleStateState", ")", "MarshalEasyJSON", "(", "<mask>", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
8,415
all-8416
[ "selectEncoder", "returns", "the", "encoder", "the", "name", "of", "the", "encoder", "and", "a", "closer", "function", "." ]
[ "func", "(", "c", "*", "Compressor", ")", "selectEncoder", "(", "h", "http", ".", "Header", ",", "w", "<mask>", ".", "Writer", ")", "(", "io", ".", "Writer", ",", "string", ",", "func", "(", ")", ")", "{", "header", ":=", "h", ".", "Get", "(", "\"", "\"", ")", "\n\n", "// Parse the names of all accepted algorithms from the header.", "accepted", ":=", "strings", ".", "Split", "(", "strings", ".", "ToLower", "(", "header", ")", ",", "\"", "\"", ")", "\n\n", "// Find supported encoder by accepted list by precedence", "for", "_", ",", "name", ":=", "range", "c", ".", "encodingPrecedence", "{", "if", "matchAcceptEncoding", "(", "accepted", ",", "name", ")", "{", "if", "pool", ",", "ok", ":=", "c", ".", "pooledEncoders", "[", "name", "]", ";", "ok", "{", "encoder", ":=", "pool", ".", "Get", "(", ")", ".", "(", "ioResetterWriter", ")", "\n", "cleanup", ":=", "func", "(", ")", "{", "pool", ".", "Put", "(", "encoder", ")", "\n", "}", "\n", "encoder", ".", "Reset", "(", "w", ")", "\n", "return", "encoder", ",", "name", ",", "cleanup", "\n\n", "}", "\n", "if", "fn", ",", "ok", ":=", "c", ".", "encoders", "[", "name", "]", ";", "ok", "{", "return", "fn", "(", "w", ",", "c", ".", "level", ")", ",", "name", ",", "func", "(", ")", "{", "}", "\n", "}", "\n", "}", "\n\n", "}", "\n\n", "// No encoder found to match the accepted encoding", "return", "nil", ",", "\"", "\"", ",", "func", "(", ")", "{", "}", "\n", "}" ]
8,416
all-8417
[ "NewBatchReporter", "creates", "a", "batching", "stat", "reporter", ".", "The", "interval", "parameter", "specifies", "how", "often", "stats", "should", "be", "posted", "to", "the", "StatHat", "server", "." ]
[ "func", "NewBatchReporter", "(", "reporter", "Reporter", ",", "interval", "time", ".", "Duration", ")", "Reporter", "{", "br", ":=", "&", "BatchReporter", "{", "r", ":", "reporter", ",", "batchInterval", ":", "interval", ",", "caches", ":", "make", "(", "map", "[", "string", "]", "*", "statCache", ")", ",", "shutdownBatchCh", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n\n", "go", "br", ".", "batchLoop", "(", ")", "\n\n", "return", "<mask>", "\n", "}" ]
8,417
all-8418
[ "newImageDestination", "returns", "an", "ImageDestination", "for", "writing", "to", "an", "existing", "directory", "." ]
[ "func", "newImageDestination", "(", "sys", "*", "types", ".", "SystemContext", ",", "ref", "ociReference", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "var", "index", "*", "imgspecv1", ".", "Index", "\n", "if", "indexExists", "(", "ref", ")", "{", "var", "err", "error", "\n", "<mask>", ",", "err", "=", "ref", ".", "getIndex", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "index", "=", "&", "imgspecv1", ".", "Index", "{", "Versioned", ":", "imgspec", ".", "Versioned", "{", "SchemaVersion", ":", "2", ",", "}", ",", "}", "\n", "}", "\n\n", "d", ":=", "&", "ociImageDestination", "{", "ref", ":", "ref", ",", "index", ":", "*", "index", "}", "\n", "if", "sys", "!=", "nil", "{", "d", ".", "sharedBlobDir", "=", "sys", ".", "OCISharedBlobDirPath", "\n", "d", ".", "acceptUncompressedLayers", "=", "sys", ".", "OCIAcceptUncompressedLayers", "\n", "}", "\n\n", "if", "err", ":=", "ensureDirectoryExists", "(", "d", ".", "ref", ".", "dir", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// Per the OCI image specification, layouts MUST have a \"blobs\" subdirectory,", "// but it MAY be empty (e.g. if we never end up calling PutBlob)", "// https://github.com/opencontainers/image-spec/blame/7c889fafd04a893f5c5f50b7ab9963d5d64e5242/image-layout.md#L19", "if", "err", ":=", "ensureDirectoryExists", "(", "filepath", ".", "Join", "(", "d", ".", "ref", ".", "dir", ",", "\"", "\"", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "d", ",", "nil", "\n", "}" ]
8,418
all-8419
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventNetworkStateUpdated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoApplicationcache8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,419
all-8420
[ "CopyFile", "copys", "a", "file", "from", "one", "pfs", "location", "to", "another", ".", "It", "can", "be", "used", "on", "directories", "or", "regular", "files", "." ]
[ "func", "(", "c", "APIClient", ")", "CopyFile", "(", "srcRepo", ",", "srcCommit", ",", "srcPath", ",", "dstRepo", ",", "dstCommit", ",", "dstPath", "<mask>", ",", "overwrite", "bool", ")", "error", "{", "if", "_", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "CopyFile", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "CopyFileRequest", "{", "Src", ":", "NewFile", "(", "srcRepo", ",", "srcCommit", ",", "srcPath", ")", ",", "Dst", ":", "NewFile", "(", "dstRepo", ",", "dstCommit", ",", "dstPath", ")", ",", "Overwrite", ":", "overwrite", ",", "}", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,420
all-8421
[ "For", "IPv4", "these", "are", "either", "a", "0", "or", "all", "bits", "set", "address", ".", "For", "IPv6", "a", "zero", "address", "or", "one", "that", "matches", "the", "RFC3849", "documentation", "address", "format", "." ]
[ "func", "(", "na", "*", "NetAddress", ")", "Valid", "(", ")", "bool", "{", "return", "na", ".", "IP", "!=", "nil", "&&", "!", "(", "na", ".", "IP", ".", "IsUnspecified", "(", ")", "||", "na", ".", "RFC3849", "(", ")", "||", "na", ".", "IP", ".", "Equal", "(", "<mask>", ".", "IPv4bcast", ")", ")", "\n", "}" ]
8,421
all-8422
[ "handleOverflow", "deletes", "the", "oldest", "key", "from", "the", "cache", "if", "overflowed" ]
[ "func", "(", "mkc", "*", "memoryKeyCacher", ")", "handleOverflow", "(", ")", "{", "if", "mkc", ".", "maxCacheSize", "<", "len", "(", "mkc", ".", "entries", ")", "{", "var", "oldestEntryKeyID", "string", "\n", "var", "latestAddedTime", "=", "time", ".", "Now", "(", ")", "\n", "for", "entryKeyID", ",", "entry", ":=", "range", "mkc", ".", "entries", "{", "if", "<mask>", ".", "addedAt", ".", "Before", "(", "latestAddedTime", ")", "{", "latestAddedTime", "=", "entry", ".", "addedAt", "\n", "oldestEntryKeyID", "=", "entryKeyID", "\n", "}", "\n", "}", "\n", "delete", "(", "mkc", ".", "entries", ",", "oldestEntryKeyID", ")", "\n", "}", "\n", "}" ]
8,422
all-8423
[ "flattenVirtualMachineBootOptions", "reads", "various", "fields", "from", "a", "VirtualMachineBootOptions", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenVirtualMachineBootOptions", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "VirtualMachineBootOptions", ")", "error", "{", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BootDelay", ")", "\n", "structure", ".", "SetBoolPtr", "(", "d", ",", "\"", "\"", ",", "obj", ".", "EfiSecureBootEnabled", ")", "\n", "structure", ".", "SetBoolPtr", "(", "d", ",", "\"", "\"", ",", "obj", ".", "BootRetryEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BootRetryDelay", ")", "\n", "return", "nil", "\n", "}" ]
8,423
all-8424
[ "Start", "returns", "the", "first", "value", "of", "the", "first", "range" ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "Start", "(", ")", "int", "{", "for", "_", ",", "b", ":=", "<mask>", "l", ".", "blocks", "{", "return", "b", ".", "Start", "(", ")", "\n", "}", "\n", "return", "0", "\n", "}" ]
8,424
all-8425
[ "void", "pango_layout_set_markup", "(", "PangoLayout", "*", "layout", "const", "char", "*", "markup", "int", "length", ")", ";" ]
[ "func", "(", "v", "*", "Layout", ")", "SetMarkup", "(", "text", "string", ",", "length", "int", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "text", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "pango_layout_set_markup", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "<mask>", ")", "(", "cstr", ")", ",", "(", "C", ".", "int", ")", "(", "length", ")", ")", "\n", "}" ]
8,425
all-8426
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "RequestEntriesParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
8,426
all-8427
[ "Makes", "a", "GET", "call", "on", "the", "given", "server", "array", "and", "returns", "all", "its", "current", "instances", "." ]
[ "func", "serverArray", "(", "client", "*", "cm15", ".", "API", ",", "name", "string", ")", "[", "]", "*", "cm15", ".", "Instance", "{", "serverArrayLocator", ":=", "client", ".", "ServerArrayLocator", "(", "\"", "\"", ")", "\n", "serverArrays", ",", "err", ":=", "serverArrayLocator", ".", "Index", "(", "rsapi", ".", "APIParams", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "[", "]", "string", "{", "\"", "\"", "+", "name", "}", "}", ")", "\n", "if", "err", "!=", "nil", "{", "fail", "(", "\"", "\\n", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "if", "len", "(", "serverArrays", ")", "==", "0", "{", "fail", "(", "\"", "\\n", "\"", ",", "name", ")", "\n", "}", "else", "if", "len", "(", "serverArrays", ")", "!=", "1", "{", "fail", "(", "\"", "\\n", "\"", ",", "name", ")", "\n", "}", "\n", "<mask>", ":=", "serverArrays", "[", "0", "]", "\n", "var", "instancesHref", "string", "\n", "for", "_", ",", "l", ":=", "range", "array", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "instancesHref", "=", "l", "[", "\"", "\"", "]", "\n", "break", "\n", "}", "\n", "}", "\n", "instanceLocator", ":=", "client", ".", "InstanceLocator", "(", "instancesHref", ")", "\n", "instances", ",", "err", ":=", "instanceLocator", ".", "Index", "(", "rsapi", ".", "APIParams", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "fail", "(", "\"", "\\n", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "if", "len", "(", "instances", ")", "==", "0", "{", "fail", "(", "\"", "\\n", "\"", ",", "name", ")", "\n", "}", "\n", "return", "instances", "\n", "}" ]
8,427
all-8428
[ "verifyVAppCdromIso", "takes", "VirtualCdrom", "and", "determines", "if", "it", "is", "needed", "for", "vApp", "ISO", "transport", ".", "It", "does", "this", "by", "first", "checking", "if", "it", "has", "an", "ISO", "inserted", "that", "matches", "the", "vApp", "ISO", "naming", "pattern", ".", "If", "it", "does", "then", "the", "next", "step", "is", "to", "see", "if", "vApp", "ISO", "transport", "is", "supported", "on", "the", "VM", ".", "If", "both", "of", "those", "conditions", "are", "met", "then", "the", "CDROM", "is", "considered", "in", "use", "for", "vApp", "transport", "." ]
[ "func", "verifyVAppCdromIso", "(", "d", "*", "schema", ".", "ResourceData", ",", "device", "*", "types", ".", "VirtualCdrom", ",", "l", "object", ".", "VirtualDeviceList", ",", "c", "*", "govmomi", ".", "Client", ")", "(", "bool", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "// If the CDROM is using VirtualCdromIsoBackingInfo and matches the ISO", "// naming pattern, it has been used as a vApp CDROM, and we can move on to", "// checking if the parent VM supports ISO transport.", "if", "backing", ",", "ok", ":=", "device", ".", "Backing", ".", "(", "*", "types", ".", "VirtualCdromIsoBackingInfo", ")", ";", "ok", "{", "dp", ":=", "&", "object", ".", "DatastorePath", "{", "}", "\n", "if", "ok", ":=", "dp", ".", "FromString", "(", "backing", ".", "FileName", ")", ";", "!", "ok", "{", "// If the ISO path can not be read, we can't tell if a vApp ISO is", "// connected.", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "false", ",", "nil", "\n", "}", "\n", "// The pattern used for vApp ISO naming is", "// \"<vmname>/_ovfenv-<vmname>.iso\"", "re", ":=", "regexp", ".", "MustCompile", "(", "\"", "\"", ")", "\n", "if", "!", "re", ".", "MatchString", "(", "<mask>", ".", "Path", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "dp", ".", "Path", ")", "\n", "return", "false", ",", "nil", "\n", "}", "\n", "}", "else", "{", "// vApp CDROMs must be backed by an ISO.", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "false", ",", "nil", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "// Set the vApp transport methods", "tm", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "for", "_", ",", "t", ":=", "range", "tm", "{", "if", "t", ".", "(", "string", ")", "==", "\"", "\"", "{", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ")", "\n", "return", "false", ",", "nil", "\n", "}" ]
8,428
all-8429
[ "applyDeviceChange", "applies", "a", "pending", "types", ".", "BaseVirtualDeviceConfigSpec", "to", "a", "working", "set", "to", "either", "add", "remove", "or", "update", "devices", "so", "that", "the", "working", "VirtualDeviceList", "is", "as", "up", "to", "date", "as", "possible", "." ]
[ "func", "applyDeviceChange", "(", "l", "object", ".", "VirtualDeviceList", ",", "cs", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ")", "object", ".", "VirtualDeviceList", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "DeviceChangeString", "(", "cs", ")", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "DeviceListString", "(", "l", ")", ")", "\n", "for", "_", ",", "s", ":=", "range", "cs", "{", "spec", ":=", "s", ".", "GetVirtualDeviceConfigSpec", "(", ")", "\n", "switch", "spec", ".", "Operation", "{", "case", "types", ".", "VirtualDeviceConfigSpecOperationAdd", ":", "l", "=", "append", "(", "l", ",", "spec", ".", "Device", ")", "\n", "case", "types", ".", "VirtualDeviceConfigSpecOperationEdit", ":", "// Edit operations may not be 100% necessary to apply. This is because", "// more often than not, the device will probably be edited in place off", "// of the original reference, meaning that the slice should actually", "// point to the updated item. However, the safer of the two options is to", "// assume that this may *not* be happening as we are not enforcing that", "// in implementation anywhere.", "for", "n", ",", "dev", ":=", "range", "l", "{", "if", "dev", ".", "GetVirtualDevice", "(", ")", ".", "Key", "==", "spec", ".", "Device", ".", "GetVirtualDevice", "(", ")", ".", "Key", "{", "l", "[", "n", "]", "=", "spec", ".", "Device", "\n", "}", "\n", "}", "\n", "case", "types", ".", "VirtualDeviceConfigSpecOperationRemove", ":", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "l", ")", ";", "i", "++", "{", "dev", ":=", "l", "[", "i", "]", "\n", "if", "dev", ".", "GetVirtualDevice", "(", ")", ".", "Key", "==", "spec", ".", "Device", ".", "GetVirtualDevice", "(", ")", ".", "Key", "{", "l", "=", "append", "(", "l", "[", ":", "i", "]", ",", "l", "[", "i", "+", "1", ":", "]", "...", ")", "\n", "i", "--", "\n", "}", "\n", "}", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "DeviceListString", "(", "l", ")", ")", "\n", "return", "l", "\n", "}" ]
8,429
all-8430
[ "ImageSourceGet", "returns", "the", "image", "source", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageSourceGet", "(", "imageID", "int", ")", "(", "int", ",", "api", ".", "ImageSource", ",", "error", ")", "{", "q", ":=", "`SELECT id, server, protocol, certificate, alias FROM images_source WHERE image_id=?`", "\n\n", "id", ":=", "0", "\n", "protocolInt", ":=", "-", "1", "\n", "result", ":=", "api", ".", "ImageSource", "{", "}", "\n\n", "arg1", ":=", "[", "]", "interface", "{", "}", "{", "imageID", "}", "\n", "arg2", ":=", "[", "]", "interface", "{", "}", "{", "&", "id", ",", "&", "result", ".", "Server", ",", "&", "protocolInt", ",", "&", "<mask>", ".", "Certificate", ",", "&", "result", ".", "Alias", "}", "\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "q", ",", "arg1", ",", "arg2", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "-", "1", ",", "api", ".", "ImageSource", "{", "}", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "-", "1", ",", "api", ".", "ImageSource", "{", "}", ",", "err", "\n", "}", "\n\n", "protocol", ",", "found", ":=", "ImageSourceProtocol", "[", "protocolInt", "]", "\n", "if", "!", "found", "{", "return", "-", "1", ",", "api", ".", "ImageSource", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "protocolInt", ")", "\n", "}", "\n\n", "result", ".", "Protocol", "=", "protocol", "\n\n", "return", "id", ",", "result", ",", "nil", "\n\n", "}" ]
8,430
all-8431
[ "Num", "sets", "the", "next", "sort", "key", "to", "sort", "by", "column", "n", "in", "numeric", "order", ".", "Column", "0", "means", "the", "entire", "string", ".", "Items", "that", "do", "not", "have", "column", "n", "sort", "to", "the", "front", ".", "Items", "whose", "column", "n", "is", "not", "a", "number", "sort", "to", "the", "end", "." ]
[ "func", "(", "s", "*", "SortFilter", ")", "Num", "(", "n", "int", ")", "*", "SortFilter", "{", "s", ".", "add", "(", "func", "(", "a", ",", "b", "string", ")", "int", "{", "a1", ",", "a2", ":=", "<mask>", "(", "a", ",", "n", ")", "\n", "b1", ",", "b2", ":=", "column", "(", "b", ",", "n", ")", "\n", "switch", "{", "case", "a1", "<", "b1", ":", "return", "-", "1", "\n", "case", "a1", ">", "b1", ":", "return", "+", "1", "\n", "}", "\n\n", "// Convert columns from strings to numbers.", "a3", ",", "a4", ":=", "strconv", ".", "ParseFloat", "(", "a2", ",", "64", ")", "\n", "b3", ",", "b4", ":=", "strconv", ".", "ParseFloat", "(", "b2", ",", "64", ")", "\n\n", "if", "a4", "!=", "b4", "{", "// Errors sort after numbers.", "if", "a4", "!=", "nil", "{", "// a had a parse error, b did not", "return", "+", "1", "\n", "}", "\n", "// b had a parse error, a did not", "return", "-", "1", "\n", "}", "\n\n", "switch", "{", "case", "a3", "<", "b3", ":", "return", "-", "1", "\n", "case", "a3", ">", "b3", ":", "return", "+", "1", "\n", "}", "\n", "return", "0", "\n", "}", ")", "\n", "return", "s", "\n", "}" ]
8,431
all-8432
[ "ProvisionHost", "--" ]
[ "func", "(", "s", "*", "IKClient", ")", "ProvisionHost", "(", "sku", "string", ",", "tenantid", "string", ")", "(", "result", "*", "innkeeperclient", ".", "ProvisionHostResponse", ",", "err", "error", ")", "{", "s", ".", "SpyTenantID", ".", "Store", "(", "tenantid", ")", "\n", "result", "=", "new", "(", "innkeeperclient", ".", "ProvisionHostResponse", ")", "\n", "result", ".", "Data", "=", "make", "(", "[", "]", "innkeeperclient", ".", "RequestData", ",", "1", ")", "\n", "if", "len", "(", "s", ".", "FakeStatus", ")", ">", "s", ".", "cnt", "{", "result", ".", "Status", "=", "s", ".", "FakeStatus", "[", "s", ".", "cnt", "]", "\n", "}", "\n", "if", "len", "(", "s", ".", "FakeData", ")", ">", "s", ".", "cnt", "{", "result", ".", "Data", "[", "0", "]", "=", "s", ".", "FakeData", "[", "s", ".", "cnt", "]", "\n", "}", "\n", "if", "len", "(", "s", ".", "FakeMessage", ")", ">", "s", ".", "cnt", "{", "<mask>", ".", "Message", "=", "s", ".", "FakeMessage", "[", "s", ".", "cnt", "]", "\n", "}", "\n", "s", ".", "cnt", "++", "\n", "return", "\n", "}" ]
8,432
all-8433
[ "Connect", "establishes", "a", "new", "connection", "to", "the", "server", ".", "This", "should", "generally", "be", "done", "through", "server", ".", "AcquireSocket", "()", "." ]
[ "func", "(", "server", "*", "mongoServer", ")", "Connect", "(", "timeout", "time", ".", "Duration", ")", "(", "*", "mongoSocket", ",", "error", ")", "{", "server", ".", "RLock", "(", ")", "\n", "master", ":=", "server", ".", "info", ".", "Master", "\n", "dial", ":=", "server", ".", "dial", "\n", "server", ".", "RUnlock", "(", ")", "\n\n", "logf", "(", "\"", "\"", ",", "server", ".", "Addr", ",", "timeout", ")", "\n", "var", "conn", "net", ".", "Conn", "\n", "var", "err", "error", "\n", "<mask>", "{", "case", "!", "dial", ".", "isSet", "(", ")", ":", "// Cannot do this because it lacks timeout support. :-(", "//conn, err = net.DialTCP(\"tcp\", nil, server.tcpaddr)", "conn", ",", "err", "=", "net", ".", "DialTimeout", "(", "\"", "\"", ",", "server", ".", "ResolvedAddr", ",", "timeout", ")", "\n", "case", "dial", ".", "old", "!=", "nil", ":", "conn", ",", "err", "=", "dial", ".", "old", "(", "server", ".", "tcpaddr", ")", "\n", "case", "dial", ".", "new", "!=", "nil", ":", "conn", ",", "err", "=", "dial", ".", "new", "(", "&", "ServerAddr", "{", "server", ".", "Addr", ",", "server", ".", "tcpaddr", "}", ")", "\n", "default", ":", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "logf", "(", "\"", "\"", ",", "server", ".", "Addr", ",", "err", ".", "Error", "(", ")", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "logf", "(", "\"", "\"", ",", "server", ".", "Addr", ")", "\n\n", "stats", ".", "conn", "(", "+", "1", ",", "master", ")", "\n", "return", "newSocket", "(", "server", ",", "conn", ",", "timeout", ")", ",", "nil", "\n", "}" ]
8,433
all-8434
[ "Tags", "returns", "global", "registry", "tags" ]
[ "func", "(", "r", "*", "Registry", ")", "Tags", "(", ")", "[", "]", "string", "{", "r", ".", "mutex", ".", "RLock", "(", ")", "\n", "tags", ":=", "r", ".", "tags", "\n", "r", ".", "mutex", ".", "RUnlock", "(", ")", "\n", "return", "<mask>", "\n", "}" ]
8,434
all-8435
[ "networkFolderFromObject", "returns", "an", "*", "object", ".", "Folder", "from", "a", "given", "object", "and", "relative", "network", "folder", "path", ".", "If", "no", "such", "folder", "is", "found", "of", "if", "it", "is", "not", "a", "network", "folder", "an", "appropriate", "error", "will", "be", "returned", "." ]
[ "func", "networkFolderFromObject", "(", "client", "*", "govmomi", ".", "Client", ",", "obj", "interface", "{", "}", ",", "relative", "string", ")", "(", "*", "object", ".", "Folder", ",", "error", ")", "{", "folder", ",", "err", ":=", "folderFromObject", "(", "client", ",", "obj", ",", "RootPathParticleNetwork", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "validateNetworkFolder", "(", "folder", ")", "\n", "}" ]
8,435
all-8436
[ "/", "*", "Integers", "looks", "for", "an", "array", "of", "ints", "under", "the", "provided", "key", ".", "If", "no", "matches", "are", "found", "nil", "is", "returned", "." ]
[ "func", "(", "config", "*", "Config", ")", "Integers", "(", "key", "string", ")", "[", "]", "int64", "{", "return", "getIntegers", "(", "config", ".", "values", ",", "<mask>", ")", "\n", "}" ]
8,436
all-8437
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestDatabaseReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
8,437
all-8438
[ "ShouldBeReported", "checks", "if", "the", "statechange", "should", "be", "reported", "to", "backend" ]
[ "func", "(", "change", "*", "TaskStateChange", ")", "ShouldBeReported", "(", ")", "bool", "{", "// Events that should be reported:", "// 1. Normal task state change: RUNNING/STOPPED", "// 2. Container state change, with task status in CREATED/RUNNING/STOPPED", "// The task timestamp will be sent in both of the event type", "// TODO Move the Attachment statechange check into this method", "if", "change", ".", "Status", "==", "apitaskstatus", ".", "TaskRunning", "||", "change", ".", "Status", "==", "apitaskstatus", ".", "TaskStopped", "{", "return", "<mask>", "\n", "}", "\n\n", "if", "len", "(", "change", ".", "Containers", ")", "!=", "0", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,438
all-8439
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetBypassCSPParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage13", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,439
all-8440
[ "New", "returns", "a", "pointer", "to", "an", "instance", "of", "kace", "loaded", "with", "a", "common", "initialsms", "trie", "based", "on", "the", "provided", "map", ".", "Before", "conversion", "to", "a", "trie", "the", "provided", "map", "keys", "are", "all", "upper", "cased", "." ]
[ "func", "New", "(", "initialisms", "map", "[", "string", "]", "bool", ")", "(", "*", "Kace", ",", "error", ")", "{", "ci", ":=", "initialisms", "\n", "if", "ci", "==", "nil", "{", "ci", "=", "<mask>", "[", "string", "]", "bool", "{", "}", "\n", "}", "\n\n", "ci", "=", "sanitizeCI", "(", "ci", ")", "\n\n", "t", ",", "err", ":=", "ktrie", ".", "NewKTrie", "(", "ci", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "k", ":=", "&", "Kace", "{", "t", ":", "t", ",", "}", "\n\n", "return", "k", ",", "nil", "\n", "}" ]
8,440
all-8441
[ "parseParts", "recursively", "parses", "a", "MIME", "multipart", "document", "and", "sets", "each", "Parts", "PartID", "." ]
[ "func", "parseParts", "(", "parent", "*", "Part", ",", "reader", "*", "bufio", ".", "Reader", ")", "error", "{", "firstRecursion", ":=", "parent", ".", "Parent", "==", "nil", "\n", "// Loop over MIME boundaries.", "br", ":=", "newBoundaryReader", "(", "reader", ",", "parent", ".", "Boundary", ")", "\n", "for", "indexPartID", ":=", "1", ";", "true", ";", "indexPartID", "++", "{", "next", ",", "err", ":=", "br", ".", "Next", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "errors", ".", "Cause", "(", "err", ")", "!=", "io", ".", "EOF", "{", "return", "err", "\n", "}", "\n", "if", "!", "next", "{", "break", "\n", "}", "\n", "p", ":=", "&", "Part", "{", "}", "\n", "// Set this Part's PartID, indicating its position within the MIME Part tree.", "if", "firstRecursion", "{", "p", ".", "PartID", "=", "strconv", ".", "Itoa", "(", "indexPartID", ")", "\n", "}", "else", "{", "p", ".", "PartID", "=", "parent", ".", "PartID", "+", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "indexPartID", ")", "\n", "}", "\n", "// Look for part header.", "bbr", ":=", "bufio", ".", "NewReader", "(", "br", ")", "\n", "err", "=", "p", ".", "setupHeaders", "(", "bbr", ",", "\"", "\"", ")", "\n", "if", "errors", ".", "Cause", "(", "err", ")", "==", "errEmptyHeaderBlock", "{", "// Empty header probably means the part didn't use the correct trailing \"--\" syntax to", "// close its boundary.", "if", "_", ",", "err", "=", "<mask>", ".", "Next", "(", ")", ";", "err", "!=", "nil", "{", "if", "errors", ".", "Cause", "(", "err", ")", "==", "io", ".", "EOF", "||", "strings", ".", "HasSuffix", "(", "err", ".", "Error", "(", ")", ",", "\"", "\"", ")", "{", "// There are no more Parts. The error must belong to the parent, because this", "// part doesn't exist.", "parent", ".", "addWarning", "(", "ErrorMissingBoundary", ",", "\"", "\"", ",", "parent", ".", "Boundary", ")", "\n", "break", "\n", "}", "\n", "// The error is already wrapped with a stack, so only adding a message here.", "// TODO: Once `errors` releases a version > v0.8.0, change to use errors.WithMessagef()", "return", "errors", ".", "WithMessage", "(", "err", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "parent", ".", "Boundary", ")", ")", "\n", "}", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// Insert this Part into the MIME tree.", "parent", ".", "AddChild", "(", "p", ")", "\n", "if", "p", ".", "Boundary", "==", "\"", "\"", "{", "// Content is text or data, decode it.", "if", "err", ":=", "p", ".", "decodeContent", "(", "bbr", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "// Content is another multipart.", "err", "=", "parseParts", "(", "p", ",", "bbr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "// Store any content following the closing boundary marker into the epilogue.", "epilogue", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "WithStack", "(", "err", ")", "\n", "}", "\n", "parent", ".", "Epilogue", "=", "epilogue", "\n", "// If a Part is \"multipart/\" Content-Type, it will have .0 appended to its PartID", "// i.e. it is the root of its MIME Part subtree.", "if", "!", "firstRecursion", "{", "parent", ".", "PartID", "+=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,441
all-8442
[ "PushAttributes", "saves", "the", "current", "back", "and", "fore", "colors", ".", "Useful", "when", "used", "with", "PopAttributes", ":", "you", "can", "save", "colors", "then", "change", "them", "to", "anything", "you", "like", "and", "as", "the", "final", "step", "just", "restore", "original", "colors" ]
[ "func", "PushAttributes", "(", ")", "{", "p", ":=", "attr", "{", "text", ":", "canvas", ".", "textColor", ",", "<mask>", ":", "canvas", ".", "backColor", "}", "\n", "canvas", ".", "attrStack", "=", "append", "(", "canvas", ".", "attrStack", ",", "p", ")", "\n", "}" ]
8,442
all-8443
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FontFace", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss50", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,443
all-8444
[ "GetLogQuery", "returns", "the", "LogQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "h", "*", "HeatmapRequest", ")", "GetLogQuery", "(", ")", "WidgetApmOrLogQuery", "{", "if", "h", "==", "nil", "||", "h", ".", "LogQuery", "==", "nil", "{", "return", "WidgetApmOrLogQuery", "{", "}", "\n", "}", "\n", "<mask>", "*", "h", ".", "LogQuery", "\n", "}" ]
8,444
all-8445
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "CaptureScreenshotFormat", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "CaptureScreenshotFormat", "(", "<mask>", ".", "String", "(", ")", ")", "{", "case", "CaptureScreenshotFormatJpeg", ":", "*", "t", "=", "CaptureScreenshotFormatJpeg", "\n", "case", "CaptureScreenshotFormatPng", ":", "*", "t", "=", "CaptureScreenshotFormatPng", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
8,445
all-8446
[ "This", "function", "does", "a", "filewalk", "calculates", "the", "size", "of", "vlog", "and", "sst", "files", "and", "stores", "it", "in", "y", ".", "LSMSize", "and", "y", ".", "VlogSize", "." ]
[ "func", "(", "db", "*", "DB", ")", "calculateSize", "(", ")", "{", "newInt", ":=", "func", "(", "val", "int64", ")", "*", "expvar", ".", "Int", "{", "v", ":=", "new", "(", "expvar", ".", "Int", ")", "\n", "v", ".", "Add", "(", "val", ")", "\n", "return", "v", "\n", "}", "\n\n", "totalSize", ":=", "func", "(", "dir", "string", ")", "(", "int64", ",", "int64", ")", "{", "var", "lsmSize", ",", "vlogSize", "int64", "\n", "err", ":=", "filepath", ".", "Walk", "(", "dir", ",", "func", "(", "path", "string", ",", "info", "os", ".", "FileInfo", ",", "err", "error", ")", "error", "{", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "ext", ":=", "filepath", ".", "Ext", "(", "path", ")", "\n", "if", "ext", "==", "\"", "\"", "{", "lsmSize", "+=", "<mask>", ".", "Size", "(", ")", "\n", "}", "else", "if", "ext", "==", "\"", "\"", "{", "vlogSize", "+=", "info", ".", "Size", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "db", ".", "elog", ".", "Printf", "(", "\"", "\"", ",", "dir", ")", "\n", "}", "\n", "return", "lsmSize", ",", "vlogSize", "\n", "}", "\n\n", "lsmSize", ",", "vlogSize", ":=", "totalSize", "(", "db", ".", "opt", ".", "Dir", ")", "\n", "y", ".", "LSMSize", ".", "Set", "(", "db", ".", "opt", ".", "Dir", ",", "newInt", "(", "lsmSize", ")", ")", "\n", "// If valueDir is different from dir, we'd have to do another walk.", "if", "db", ".", "opt", ".", "ValueDir", "!=", "db", ".", "opt", ".", "Dir", "{", "_", ",", "vlogSize", "=", "totalSize", "(", "db", ".", "opt", ".", "ValueDir", ")", "\n", "}", "\n", "y", ".", "VlogSize", ".", "Set", "(", "db", ".", "opt", ".", "Dir", ",", "newInt", "(", "vlogSize", ")", ")", "\n", "}" ]
8,446
all-8447
[ "NewDriver", "returns", "a", "new", "driver", "instance", "." ]
[ "func", "NewDriver", "(", "hostName", ",", "storePath", "<mask>", ")", "drivers", ".", "Driver", "{", "// NOTE(ahmetalpbalkan): any driver initialization I do here gets lost", "// afterwards, especially for non-Create RPC calls. Therefore I am mostly", "// making rest of the driver stateless by just relying on the following", "// piece of info.", "d", ":=", "&", "Driver", "{", "BaseDriver", ":", "&", "drivers", ".", "BaseDriver", "{", "SSHUser", ":", "defaultSSHUser", ",", "MachineName", ":", "hostName", ",", "StorePath", ":", "storePath", ",", "}", ",", "}", "\n", "return", "d", "\n", "}" ]
8,447
all-8448
[ "Vec3Lerp", "performs", "a", "linear", "interpolation", "between", "two", "vectors", ".", "v1", "toward", "v2", "dest", "[", "out", "]", "The", "result", "vector", ".", "v1", "[", "in", "]", "The", "starting", "vector", ".", "v2", "[", "in", "]", "The", "destination", "vector", ".", "t", "[", "in", "]", "The", "interpolation", "factor", ".", "[", "Limits", ":", "0", "<", "=", "value", "<", "=", "1", ".", "0", "]" ]
[ "func", "Vec3Lerp", "(", "<mask>", ",", "v1", ",", "v2", "Vec3", ",", "t", "float32", ")", "{", "dest", "[", "0", "]", "=", "v1", "[", "0", "]", "+", "(", "v2", "[", "0", "]", "-", "v1", "[", "0", "]", ")", "*", "t", "\n", "dest", "[", "1", "]", "=", "v1", "[", "1", "]", "+", "(", "v2", "[", "1", "]", "-", "v1", "[", "1", "]", ")", "*", "t", "\n", "dest", "[", "2", "]", "=", "v1", "[", "2", "]", "+", "(", "v2", "[", "2", "]", "-", "v1", "[", "2", "]", ")", "*", "t", "\n", "}" ]
8,448
all-8449
[ "mergeQualifiers", "merges", "two", "qualifer", "lists", "into", "one", "." ]
[ "func", "mergeQualifiers", "(", "q1", ",", "q2", "Qualifiers", ")", "Qualifiers", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "qual", ":=", "range", "q1", "{", "m", "[", "qual", "]", "=", "<mask>", "\n", "}", "\n", "for", "_", ",", "qual", ":=", "range", "q2", "{", "if", "!", "m", "[", "qual", "]", "{", "q1", "=", "append", "(", "q1", ",", "qual", ")", "\n", "m", "[", "qual", "]", "=", "true", "\n", "}", "\n", "}", "\n", "return", "q1", "\n", "}" ]
8,449
all-8450
[ "PrintWorkerStatus", "pretty", "prints", "a", "worker", "status", "." ]
[ "func", "PrintWorkerStatus", "(", "w", "io", ".", "Writer", ",", "workerStatus", "*", "ppsclient", ".", "WorkerStatus", ",", "fullTimestamps", "bool", ")", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "workerStatus", ".", "WorkerID", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "workerStatus", ".", "JobID", ")", "\n", "for", "_", ",", "datum", ":=", "<mask>", "workerStatus", ".", "Data", "{", "fmt", ".", "Fprintf", "(", "w", ",", "datum", ".", "Path", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ")", "\n", "if", "fullTimestamps", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "workerStatus", ".", "Started", ".", "String", "(", ")", ")", "\n", "}", "else", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "pretty", ".", "Ago", "(", "workerStatus", ".", "Started", ")", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\\n", "\"", ",", "workerStatus", ".", "QueueSize", ")", "\n", "}" ]
8,450
all-8451
[ "DisableRule", "disables", "rules", "that", "match", "with", "a", "regular", "expression", "." ]
[ "func", "(", "s", "*", "Seekret", ")", "DisableRuleByRegexp", "(", "name", "string", ")", "int", "{", "return", "setRuleEnabledByRegexp", "(", "s", ".", "ruleList", ",", "name", ",", "<mask>", ")", "\n", "}" ]
8,451
all-8452
[ "true", "if", "path", "is", "for", "a", "deprecated", "API" ]
[ "func", "isDeprecated", "(", "path", "string", ")", "bool", "{", "return", "strings", ".", "Contains", "(", "<mask>", ",", "\"", "\"", ")", "&&", "!", "strings", ".", "Contains", "(", "path", ",", "\"", "\"", ")", "\n", "}" ]
8,452
all-8453
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniformMatrix2fv", "(", "program", "uint32", ",", "<mask>", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "C", ".", "glowProgramUniformMatrix2fv", "(", "gpProgramUniformMatrix2fv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
8,453
all-8454
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SearchInResourceReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage15", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
8,454
all-8455
[ "NewFilter", "creates", "a", "filter", "for", "a", "hashtree", "shard", "." ]
[ "func", "NewFilter", "(", "numTrees", "int64", ",", "tree", "int64", ")", "Filter", "{", "return", "func", "(", "k", "[", "]", "byte", ")", "bool", "{", "if", "pathToTree", "(", "k", ",", "numTrees", ")", "==", "uint64", "(", "<mask>", ")", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}", "\n", "}" ]
8,455
all-8456
[ "invalidLength", "returns", "true", "iff", "offset", "+", "length", ">", "sliceLength", "or", "if", "the", "addition", "would", "overflow", "." ]
[ "func", "invalidLength", "(", "<mask>", ",", "length", ",", "sliceLength", "int", ")", "bool", "{", "return", "offset", "+", "length", "<", "offset", "||", "offset", "+", "length", ">", "sliceLength", "\n", "}" ]
8,456
all-8457
[ "QueryPullRequests", "is", "a", "query", "function", "that", "returns", "a", "list", "of", "open", "pull", "requests", "owned", "by", "the", "user", "whose", "access", "token", "is", "consumed", "by", "the", "github", "client", "." ]
[ "func", "(", "da", "*", "DashboardAgent", ")", "QueryPullRequests", "(", "ctx", "context", ".", "Context", ",", "ghc", "githubClient", ",", "query", "string", ")", "(", "[", "]", "PullRequest", ",", "error", ")", "{", "var", "prs", "[", "]", "PullRequest", "\n", "vars", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "(", "githubql", ".", "String", ")", "(", "query", ")", ",", "\"", "\"", ":", "(", "*", "githubql", ".", "String", ")", "(", "nil", ")", ",", "}", "\n", "var", "totalCost", "int", "\n", "var", "remaining", "int", "\n", "for", "{", "sq", ":=", "searchQuery", "{", "}", "\n", "if", "err", ":=", "ghc", ".", "Query", "(", "ctx", ",", "&", "sq", ",", "vars", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "totalCost", "+=", "int", "(", "sq", ".", "RateLimit", ".", "Cost", ")", "\n", "remaining", "=", "int", "(", "sq", ".", "RateLimit", ".", "Remaining", ")", "\n", "for", "_", ",", "n", ":=", "range", "sq", ".", "Search", ".", "Nodes", "{", "prs", "=", "append", "(", "prs", ",", "n", ".", "PullRequest", ")", "\n", "}", "\n", "if", "!", "sq", ".", "Search", ".", "PageInfo", ".", "HasNextPage", "{", "break", "\n", "}", "\n", "vars", "[", "\"", "\"", "]", "=", "githubql", ".", "NewString", "(", "sq", ".", "Search", ".", "PageInfo", ".", "EndCursor", ")", "\n", "}", "\n", "da", ".", "<mask>", ".", "Infof", "(", "\"", "\\\"", "\\\"", "\"", ",", "query", ",", "totalCost", ",", "remaining", ")", "\n", "return", "prs", ",", "nil", "\n", "}" ]
8,457
all-8458
[ "GenSQLServer", "generates", "a", "mssql", "DSN", "from", "the", "passed", "URL", "." ]
[ "func", "GenSQLServer", "(", "u", "*", "URL", ")", "(", "string", ",", "error", ")", "{", "<mask>", ",", "port", ",", "dbname", ":=", "hostname", "(", "u", ".", "Host", ")", ",", "hostport", "(", "u", ".", "Host", ")", ",", "strings", ".", "TrimPrefix", "(", "u", ".", "Path", ",", "\"", "\"", ")", "\n\n", "// add instance name to host if present", "if", "i", ":=", "strings", ".", "Index", "(", "dbname", ",", "\"", "\"", ")", ";", "i", "!=", "-", "1", "{", "host", "=", "host", "+", "`\\`", "+", "dbname", "[", ":", "i", "]", "\n", "dbname", "=", "dbname", "[", "i", "+", "1", ":", "]", "\n", "}", "\n\n", "q", ":=", "u", ".", "Query", "(", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "host", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "port", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "dbname", ")", "\n\n", "// add user/pass", "if", "u", ".", "User", "!=", "nil", "{", "q", ".", "Set", "(", "\"", "\"", ",", "u", ".", "User", ".", "Username", "(", ")", ")", "\n", "pass", ",", "_", ":=", "u", ".", "User", ".", "Password", "(", ")", "\n", "q", ".", "Set", "(", "\"", "\"", ",", "pass", ")", "\n", "}", "\n\n", "// save host, port, dbname", "if", "u", ".", "hostPortDB", "==", "nil", "{", "u", ".", "hostPortDB", "=", "[", "]", "string", "{", "host", ",", "port", ",", "dbname", "}", "\n", "}", "\n\n", "return", "genOptionsODBC", "(", "q", ",", "true", ")", ",", "nil", "\n", "}" ]
8,458
all-8459
[ "ReadUint16", "reads", "and", "returns", "an", "uint16", "." ]
[ "func", "(", "r", "*", "Reader", ")", "ReadUint16", "(", ")", "uint16", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "var", "n", "int", "\n", "n", ",", "r", ".", "err", "=", "io", ".", "ReadFull", "(", "r", ".", "rd", ",", "r", ".", "b", "[", ":", "2", "]", ")", "\n", "r", ".", "cnt", "+=", "n", "\n", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "return", "<mask>", ".", "LittleEndian", ".", "Uint16", "(", "r", ".", "b", "[", ":", "2", "]", ")", "\n", "}" ]
8,459
all-8460
[ "getEncoder", "parses", "the", "Accept", "header", "an", "returns", "the", "appropriate", "encoder", "to", "use" ]
[ "func", "(", "cn", "*", "ContentNegotiator", ")", "getEncoder", "(", "req", "*", "http", ".", "Request", ")", "Encoder", "{", "var", "result", "=", "cn", ".", "DefaultEncoder", "\n", "accept", ":=", "req", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n\n", "for", "k", ",", "v", ":=", "range", "cn", ".", "encoderMap", "{", "if", "strings", ".", "Contains", "(", "<mask>", ",", "k", ")", "{", "result", "=", "v", "\n", "break", "\n", "}", "\n", "}", "\n", "return", "result", "\n", "}" ]
8,460
all-8461
[ "Info", "returns", "the", "additional", "info", "about", "a", "service", "instance", ".", "The", "api", "should", "be", "prepared", "to", "receive", "the", "request", "like", "below", ":", "GET", "/", "resources", "/", "<name", ">" ]
[ "func", "(", "c", "*", "endpointClient", ")", "Info", "(", "instance", "*", "ServiceInstance", ",", "requestID", "string", ")", "(", "[", "]", "map", "[", "string", "]", "string", ",", "error", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "instance", ".", "Name", ",", "instance", ".", "ServiceName", ")", "\n", "url", ":=", "\"", "\"", "+", "instance", ".", "GetIdentifier", "(", ")", "\n", "resp", ",", "err", ":=", "c", ".", "issueRequest", "(", "url", ",", "\"", "\"", ",", "nil", ",", "requestID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "<mask>", ":=", "[", "]", "map", "[", "string", "]", "string", "{", "}", "\n", "err", "=", "c", ".", "jsonFromResponse", "(", "resp", ",", "&", "result", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
8,461
all-8462
[ "Set", "sets", "the", "key", "-", "value", "pair", "in", "the", "cache" ]
[ "func", "(", "lru", "*", "lruCache", ")", "Set", "(", "<mask>", "string", ",", "value", "Value", ")", "{", "lru", ".", "Lock", "(", ")", "\n", "defer", "lru", ".", "Unlock", "(", ")", "\n\n", "lru", ".", "cache", "[", "key", "]", "=", "&", "entry", "{", "value", ":", "value", ",", "added", ":", "time", ".", "Now", "(", ")", "}", "\n\n", "// Remove from the evict list if an entry already existed", "lru", ".", "removeFromEvictList", "(", "key", ")", "\n\n", "lru", ".", "evictList", ".", "PushBack", "(", "key", ")", "\n", "lru", ".", "purgeSize", "(", ")", "\n", "}" ]
8,462
all-8463
[ "Set", "value" ]
[ "func", "(", "rs", "*", "redisStore", ")", "Set", "(", "<mask>", ",", "value", "string", ")", "error", "{", "rs", ".", "Values", "[", "key", "]", "=", "value", "\n", "err", ":=", "provider", ".", "refresh", "(", "rs", ")", "\n", "return", "err", "\n", "}" ]
8,463
all-8464
[ "AddNetworkAdapter", "adds", "a", "network", "adapter", "to", "the", "virtual", "machine", ".", "The", "adapter", "parameter", "is", "optional", ".", "If", "not", "specified", "this", "function", "will", "add", "by", "default", "a", "network", "adapter", "with", "NAT", "support", ";", "autogenerated", "MAC", "address", "and", "e1000", "as", "network", "device", ".", "Be", "aware", "that", "the", "adapter", "will", "not", "show", "up", "in", "the", "VMware", "Preferences", "user", "interface", "immediatelly", ".", "Once", "the", "virtual", "machine", "is", "started", "the", "UI", "will", "pick", "it", "up", "." ]
[ "func", "(", "v", "*", "VM", ")", "AddNetworkAdapter", "(", "adapter", "*", "NetworkAdapter", ")", "error", "{", "isVMRunning", ",", "err", ":=", "v", ".", "IsRunning", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "isVMRunning", "{", "return", "&", "Error", "{", "Code", ":", "100000", ",", "Text", ":", "\"", "\"", ",", "}", "\n", "}", "\n\n", "vmxPath", ",", "err", ":=", "v", ".", "VmxPath", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "vmx", ",", "err", ":=", "readVmx", "(", "vmxPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "adapter", "==", "nil", "{", "adapter", "=", "&", "NetworkAdapter", "{", "}", "\n", "}", "\n\n", "adapter", ".", "present", "=", "true", "\n\n", "if", "adapter", ".", "Vdevice", "==", "NETWORK_DEVICE_VMXNET3", "{", "hwversion", ",", "err", ":=", "strconv", ".", "Atoi", "(", "vmx", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "hwversion", "<", "7", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "100001", ",", "Text", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hwversion", ")", ",", "}", "\n", "}", "\n", "}", "\n\n", "if", "adapter", ".", "LinkStatePropagation", "&&", "(", "adapter", ".", "ConnType", "!=", "NETWORK_BRIDGED", ")", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "100003", ",", "Text", ":", "\"", "\"", ",", "}", "\n", "}", "\n\n", "macaddr", ":=", "adapter", ".", "MacAddress", ".", "String", "(", ")", "\n\n", "if", "macaddr", "!=", "\"", "\"", "{", "if", "!", "strings", ".", "HasPrefix", "(", "macaddr", ",", "\"", "\"", ")", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "100004", ",", "Text", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "}", "\n\n", "nextID", ":=", "v", ".", "nextNetworkAdapterID", "(", "vmx", ")", "\n", "prefix", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "nextID", ")", "\n\n", "vmx", "[", "<mask>", "+", "\"", "\"", "]", "=", "strings", ".", "ToUpper", "(", "strconv", ".", "FormatBool", "(", "adapter", ".", "present", ")", ")", "\n\n", "if", "string", "(", "adapter", ".", "ConnType", ")", "!=", "\"", "\"", "{", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "string", "(", "adapter", ".", "ConnType", ")", "\n", "}", "else", "{", "//default", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "\"", "\"", "\n", "}", "\n\n", "if", "string", "(", "adapter", ".", "Vdevice", ")", "!=", "\"", "\"", "{", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "string", "(", "adapter", ".", "Vdevice", ")", "\n", "}", "else", "{", "//default", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "\"", "\"", "\n", "}", "\n\n", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "strconv", ".", "FormatBool", "(", "adapter", ".", "WakeOnPcktRcv", ")", "\n\n", "if", "string", "(", "adapter", ".", "MacAddrType", ")", "!=", "\"", "\"", "{", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "string", "(", "adapter", ".", "MacAddrType", ")", "\n", "}", "else", "{", "//default", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "\"", "\"", "\n", "}", "\n\n", "if", "macaddr", "!=", "\"", "\"", "{", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "macaddr", "\n", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "\"", "\"", "\n\n", "// Makes sure a generated MAC address is removed if it exists", "delete", "(", "vmx", ",", "\"", "\"", ")", "\n", "delete", "(", "vmx", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "adapter", ".", "LinkStatePropagation", "{", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "strconv", ".", "FormatBool", "(", "adapter", ".", "LinkStatePropagation", ")", "\n", "}", "\n\n", "if", "adapter", ".", "ConnType", "==", "NETWORK_CUSTOM", "{", "if", "!", "ExistVSwitch", "(", "adapter", ".", "VSwitch", ".", "id", ")", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "100005", ",", "Text", ":", "\"", "\"", "+", "adapter", ".", "VSwitch", ".", "id", "+", "\"", "\"", ",", "}", "\n", "}", "\n", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "string", "(", "adapter", ".", "VSwitch", ".", "id", ")", "\n", "}", "\n\n", "vmx", "[", "prefix", "+", "\"", "\"", "]", "=", "strconv", ".", "FormatBool", "(", "adapter", ".", "StartConnected", ")", "\n\n", "return", "writeVmx", "(", "vmxPath", ",", "vmx", ")", "\n", "}" ]
8,464
all-8465
[ "FindAsUpper", "..." ]
[ "func", "(", "n", "*", "KNode", ")", "FindAsUpper", "(", "rs", "[", "]", "rune", ")", "bool", "{", "cur", ":=", "n", "\n\n", "for", "_", ",", "v", ":=", "range", "rs", "{", "cur", "=", "cur", ".", "linkByVal", "(", "unicode", ".", "ToUpper", "(", "v", ")", ")", "\n\n", "if", "cur", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n\n", "return", "cur", ".", "end", "\n", "}" ]
8,465
all-8466
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventBackgroundServiceEventReceived", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice5", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,466
all-8467
[ "PeekN", "returns", "at", "max", "the", "N", "topmost", "item", "without", "removing", "them", "from", "the", "stack", "." ]
[ "func", "(", "s", "*", "VecStack", ")", "PeekN", "(", "n", "int", ")", "[", "]", "*", "Vec", "{", "var", "(", "N", "[", "]", "*", "Vec", "\n", "cur", "*", "item", "\n", ")", "\n", "N", "=", "make", "(", "[", "]", "*", "Vec", ",", "0", ",", "n", ")", "\n", "cur", "=", "s", ".", "top", "\n", "for", "len", "(", "N", ")", "<", "n", "{", "if", "cur", "==", "nil", "{", "break", "\n", "}", "\n", "N", "=", "<mask>", "(", "N", ",", "cur", ".", "value", ")", "\n", "cur", "=", "cur", ".", "next", "\n", "}", "\n", "return", "N", "\n", "}" ]
8,467
all-8468
[ "Validate", "validates", "the", "TLS", "options", "." ]
[ "func", "(", "o", "ClientTLSOptions", ")", "Validate", "(", ")", "error", "{", "if", "o", ".", "CertFile", "==", "\"", "\"", "{", "return", "bosherr", ".", "<mask>", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "o", ".", "KeyFile", "==", "\"", "\"", "{", "return", "bosherr", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,468
all-8469
[ "processTags", "removes", "duplicates", "and", "trims", "spaces", "from", "each", "tag" ]
[ "func", "processTags", "(", "<mask>", "[", "]", "string", ")", "[", "]", "string", "{", "if", "tags", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "processedTags", ":=", "[", "]", "string", "{", "}", "\n", "usedTags", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "tag", ":=", "range", "tags", "{", "tag", "=", "strings", ".", "TrimSpace", "(", "tag", ")", "\n", "if", "len", "(", "tag", ")", ">", "0", "&&", "!", "usedTags", "[", "tag", "]", "{", "processedTags", "=", "append", "(", "processedTags", ",", "tag", ")", "\n", "usedTags", "[", "tag", "]", "=", "true", "\n", "}", "\n", "}", "\n", "return", "processedTags", "\n", "}" ]
8,469
all-8470
[ "Returns", "an", "slice", "of", "boolean", "or", "an", "nil", "slice" ]
[ "func", "(", "t", "Typed", ")", "Bools", "(", "key", "string", ")", "[", "]", "bool", "{", "return", "t", ".", "BoolsOr", "(", "<mask>", ",", "nil", ")", "\n", "}" ]
8,470
all-8471
[ "Log", "implements", "the", "Log", "method", "required", "by", "Backend", "." ]
[ "func", "(", "b", "*", "MemoryBackend", ")", "Log", "(", "level", "Level", ",", "calldepth", "int", ",", "rec", "*", "Record", ")", "error", "{", "<mask>", "size", "int32", "\n\n", "n", ":=", "&", "node", "{", "Record", ":", "rec", "}", "\n", "np", ":=", "unsafe", ".", "Pointer", "(", "n", ")", "\n\n", "// Add the record to the tail. If there's no records available, tail and", "// head will both be nil. When we successfully set the tail and the previous", "// value was nil, it's safe to set the head to the current value too.", "for", "{", "tailp", ":=", "b", ".", "tail", "\n", "swapped", ":=", "atomic", ".", "CompareAndSwapPointer", "(", "&", "b", ".", "tail", ",", "tailp", ",", "np", ",", ")", "\n", "if", "swapped", "==", "true", "{", "if", "tailp", "==", "nil", "{", "b", ".", "head", "=", "np", "\n", "}", "else", "{", "(", "*", "node", ")", "(", "tailp", ")", ".", "next", "=", "n", "\n", "}", "\n", "size", "=", "atomic", ".", "AddInt32", "(", "&", "b", ".", "size", ",", "1", ")", "\n", "break", "\n", "}", "\n", "}", "\n\n", "// Since one record was added, we might have overflowed the list. Remove", "// a record if that is the case. The size will fluctate a bit, but", "// eventual consistent.", "if", "b", ".", "maxSize", ">", "0", "&&", "size", ">", "b", ".", "maxSize", "{", "for", "{", "headp", ":=", "b", ".", "head", "\n", "head", ":=", "(", "*", "node", ")", "(", "b", ".", "head", ")", "\n", "if", "head", ".", "next", "==", "nil", "{", "break", "\n", "}", "\n", "swapped", ":=", "atomic", ".", "CompareAndSwapPointer", "(", "&", "b", ".", "head", ",", "headp", ",", "unsafe", ".", "Pointer", "(", "head", ".", "next", ")", ",", ")", "\n", "if", "swapped", "==", "true", "{", "atomic", ".", "AddInt32", "(", "&", "b", ".", "size", ",", "-", "1", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,471
all-8472
[ "Reconfigure", "reconfigures", "a", "cluster", ".", "This", "just", "gets", "dispatched", "to", "computeresource", "as", "both", "methods", "are", "the", "same", "." ]
[ "func", "Reconfigure", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "<mask>", "*", "types", ".", "ClusterConfigSpecEx", ")", "error", "{", "return", "computeresource", ".", "Reconfigure", "(", "cluster", ",", "spec", ")", "\n", "}" ]
8,472
all-8473
[ "Err", "returns", "nil", "if", "no", "errors", "happened", "during", "iteration", "or", "the", "actual", "error", "otherwise", ".", "In", "case", "a", "resulting", "document", "included", "a", "field", "named", "$err", "or", "errmsg", "which", "are", "standard", "ways", "for", "MongoDB", "to", "report", "an", "improper", "query", "the", "returned", "value", "has", "a", "*", "QueryError", "type", "and", "includes", "the", "Err", "message", "and", "the", "Code", "." ]
[ "func", "(", "iter", "*", "Iter", ")", "Err", "(", ")", "<mask>", "{", "iter", ".", "m", ".", "Lock", "(", ")", "\n", "err", ":=", "iter", ".", "err", "\n", "iter", ".", "m", ".", "Unlock", "(", ")", "\n", "if", "err", "==", "ErrNotFound", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}" ]
8,473
all-8474
[ "GetIcon", "returns", "the", "Icon", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetIcon", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "Icon", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "<mask>", "\n", "}" ]
8,474
all-8475
[ "SetRequestURIBytes", "sets", "RequestURI", "." ]
[ "func", "(", "req", "*", "Request", ")", "SetRequestURIBytes", "(", "requestURI", "[", "]", "byte", ")", "{", "req", ".", "Header", ".", "SetRequestURIBytes", "(", "requestURI", ")", "\n", "req", ".", "parsedURI", "=", "<mask>", "\n", "}" ]
8,475
all-8476
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CachedResponse", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
8,476
all-8477
[ "GetIncludeZeroOk", "returns", "a", "tuple", "with", "the", "IncludeZero", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "GetIncludeZeroOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "IncludeZero", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "w", ".", "IncludeZero", ",", "<mask>", "\n", "}" ]
8,477
all-8478
[ "GetNode", "implements", "lookup", "of", "an", "item", "and", "return", "its", "skiplist", "Node", "This", "API", "enables", "to", "lookup", "an", "item", "without", "using", "a", "snapshot", "handle", "." ]
[ "func", "(", "w", "*", "Writer", ")", "GetNode", "(", "bs", "[", "]", "byte", ")", "*", "skiplist", ".", "Node", "{", "iter", ":=", "w", ".", "<mask>", ".", "NewIterator", "(", "w", ".", "iterCmp", ",", "w", ".", "buf", ")", "\n", "defer", "iter", ".", "Close", "(", ")", "\n\n", "x", ":=", "w", ".", "newItem", "(", "bs", ",", "false", ")", "\n", "x", ".", "bornSn", "=", "w", ".", "getCurrSn", "(", ")", "\n\n", "if", "found", ":=", "iter", ".", "SeekWithCmp", "(", "unsafe", ".", "Pointer", "(", "x", ")", ",", "w", ".", "insCmp", ",", "w", ".", "existCmp", ")", ";", "found", "{", "return", "iter", ".", "GetNode", "(", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
8,478
all-8479
[ "bind", "a", "renderbuffer", "to", "a", "renderbuffer", "target" ]
[ "func", "BindRenderbuffer", "(", "target", "uint32", ",", "renderbuffer", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpBindRenderbuffer", ",", "2", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "renderbuffer", ")", ",", "0", ")", "\n", "}" ]
8,479
all-8480
[ "ClientPreUncooperativeCloseRequest", "requests", "the", "closing", "of", "the", "channel", "and", "starts", "the", "challenge", "period", "." ]
[ "func", "(", "w", "*", "Worker", ")", "ClientPreUncooperativeCloseRequest", "(", "job", "*", "data", ".", "<mask>", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "ch", ",", "err", ":=", "w", ".", "relatedChannel", "(", "logger", ",", "job", ",", "data", ".", "JobClientPreUncooperativeCloseRequest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "jdata", ",", "err", ":=", "w", ".", "publishData", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "offer", ",", "err", ":=", "w", ".", "offering", "(", "logger", ",", "ch", ".", "Offering", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "acc", ",", "err", ":=", "w", ".", "account", "(", "logger", ",", "ch", ".", "Client", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "w", ".", "clientValidateChannelForClose", "(", "ch", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "w", ".", "doClientPreUncooperativeCloseRequestAndSaveTx", "(", "logger", ",", "job", ",", "ch", ",", "acc", ",", "offer", ",", "jdata", ".", "GasPrice", ")", "\n", "}" ]
8,480
all-8481
[ "Read", "reads", "from", "the", "current", "file", "in", "the", "RAR", "archive", "." ]
[ "func", "(", "r", "*", "Reader", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "n", ",", "err", ":=", "r", ".", "r", ".", "Read", "(", "p", ")", "\n", "if", "err", "==", "io", ".", "EOF", "&&", "r", ".", "cksum", "!=", "nil", "&&", "!", "r", ".", "cksum", ".", "<mask>", "(", ")", "{", "return", "n", ",", "errBadFileChecksum", "\n", "}", "\n", "return", "n", ",", "err", "\n", "}" ]
8,481
all-8482
[ "listHostOnlyAdapters", "gets", "all", "host", "-", "only", "adapters", "in", "a", "map", "keyed", "by", "NetworkName", "." ]
[ "func", "listHostOnlyAdapters", "(", "vbox", "VBoxManager", ")", "(", "map", "[", "string", "]", "*", "hostOnlyNetwork", ",", "error", ")", "{", "out", ",", "err", ":=", "vbox", ".", "vbmOut", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "byName", ":=", "map", "[", "string", "]", "*", "hostOnlyNetwork", "{", "}", "\n", "byIP", ":=", "map", "[", "string", "]", "*", "hostOnlyNetwork", "{", "}", "\n", "n", ":=", "&", "hostOnlyNetwork", "{", "}", "\n\n", "err", "=", "parseKeyValues", "(", "out", ",", "reColonLine", ",", "func", "(", "key", ",", "val", "string", ")", "error", "{", "switch", "key", "{", "case", "\"", "\"", ":", "n", ".", "Name", "=", "val", "\n", "case", "\"", "\"", ":", "n", ".", "GUID", "=", "val", "\n", "case", "\"", "\"", ":", "n", ".", "DHCP", "=", "(", "val", "!=", "\"", "\"", ")", "\n", "case", "\"", "\"", ":", "n", ".", "IPv4", ".", "IP", "=", "net", ".", "ParseIP", "(", "val", ")", "\n", "case", "\"", "\"", ":", "n", ".", "IPv4", ".", "Mask", "=", "parseIPv4Mask", "(", "val", ")", "\n", "case", "\"", "\"", ":", "mac", ",", "err", ":=", "<mask>", ".", "ParseMAC", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "n", ".", "HwAddr", "=", "mac", "\n", "case", "\"", "\"", ":", "n", ".", "Medium", "=", "val", "\n", "case", "\"", "\"", ":", "n", ".", "Status", "=", "val", "\n", "case", "\"", "\"", ":", "n", ".", "NetworkName", "=", "val", "\n\n", "if", "_", ",", "present", ":=", "byName", "[", "n", ".", "NetworkName", "]", ";", "present", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ".", "NetworkName", ")", "\n", "}", "\n", "byName", "[", "n", ".", "NetworkName", "]", "=", "n", "\n\n", "if", "len", "(", "n", ".", "IPv4", ".", "IP", ")", "!=", "0", "{", "if", "_", ",", "present", ":=", "byIP", "[", "n", ".", "IPv4", ".", "IP", ".", "String", "(", ")", "]", ";", "present", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ".", "IPv4", ".", "IP", ")", "\n", "}", "\n", "byIP", "[", "n", ".", "IPv4", ".", "IP", ".", "String", "(", ")", "]", "=", "n", "\n", "}", "\n\n", "n", "=", "&", "hostOnlyNetwork", "{", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "byName", ",", "nil", "\n", "}" ]
8,482
all-8483
[ "HasName", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsDevice", ")", "HasName", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Name", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
8,483
all-8484
[ "acceptStatus", "allows", "us", "to", "check", "if", "a", "slice", "of", "health", "checks", "pass", "this", "filter", "." ]
[ "func", "acceptStatus", "(", "list", "[", "]", "string", ",", "s", "string", ")", "bool", "{", "for", "_", ",", "<mask>", ":=", "range", "list", "{", "if", "status", "==", "s", "||", "status", "==", "HealthAny", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
8,484
all-8485
[ "Grant", "allows", "a", "team", "to", "have", "access", "to", "an", "app", ".", "It", "returns", "an", "error", "if", "the", "team", "already", "have", "access", "to", "the", "app", "." ]
[ "func", "(", "app", "*", "App", ")", "Grant", "(", "team", "*", "authTypes", ".", "Team", ")", "error", "{", "if", "_", ",", "found", ":=", "app", ".", "findTeam", "(", "team", ")", ";", "found", "{", "return", "ErrAlreadyHaveAccess", "\n", "}", "\n", "app", ".", "Teams", "=", "append", "(", "app", ".", "Teams", ",", "team", ".", "Name", ")", "\n", "conn", ",", "err", ":=", "db", ".", "Conn", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "conn", ".", "Close", "(", ")", "\n", "err", "=", "conn", ".", "Apps", "(", ")", ".", "Update", "(", "bson", ".", "M", "{", "\"", "\"", ":", "app", ".", "<mask>", "}", ",", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "team", ".", "Name", "}", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "users", ",", "err", ":=", "auth", ".", "ListUsersWithPermissions", "(", "permission", ".", "Permission", "{", "Scheme", ":", "permission", ".", "PermAppDeploy", ",", "Context", ":", "permission", ".", "Context", "(", "permTypes", ".", "CtxTeam", ",", "team", ".", "Name", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "conn", ".", "Apps", "(", ")", ".", "Update", "(", "bson", ".", "M", "{", "\"", "\"", ":", "app", ".", "Name", "}", ",", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "team", ".", "Name", "}", "}", ")", "\n", "return", "err", "\n", "}", "\n", "for", "_", ",", "user", ":=", "range", "users", "{", "err", "=", "repository", ".", "Manager", "(", ")", ".", "GrantAccess", "(", "app", ".", "Name", ",", "user", ".", "Email", ")", "\n", "if", "err", "!=", "nil", "{", "conn", ".", "Apps", "(", ")", ".", "Update", "(", "bson", ".", "M", "{", "\"", "\"", ":", "app", ".", "Name", "}", ",", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "M", "{", "\"", "\"", ":", "team", ".", "Name", "}", "}", ")", "\n", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
8,485
all-8486
[ "GetKnownStatus", "safely", "returns", "the", "currently", "known", "status", "of", "the", "task" ]
[ "func", "(", "auth", "*", "ASMAuthResource", ")", "GetKnownStatus", "(", ")", "resourcestatus", ".", "ResourceStatus", "{", "auth", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "auth", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "auth", ".", "knownStatusUnsafe", "\n", "}" ]
8,486
all-8487
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "Duration", "." ]
[ "func", "(", "d", "*", "Duration", ")", "DeepCopy", "(", ")", "*", "Duration", "{", "if", "d", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "<mask>", ":=", "new", "(", "Duration", ")", "\n", "d", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
8,487
all-8488
[ "Align", "left", "pads", "given", "byte", "array", "with", "zeros", "till", "it", "have", "at", "least", "bitSize", "length", "." ]
[ "func", "Align", "(", "data", "[", "]", "byte", ",", "bitSize", "int", ")", "[", "]", "byte", "{", "actual", ":=", "len", "(", "data", ")", "\n", "required", ":=", "bitSize", ">>", "3", "\n", "if", "(", "bitSize", "%", "8", ")", ">", "0", "{", "<mask>", "++", "//extra byte if needed", "\n", "}", "\n", "if", "(", "actual", ">=", "required", ")", "{", "return", "data", "\n", "}", "\n", "return", "append", "(", "bytes", ".", "Repeat", "(", "[", "]", "byte", "{", "0", "}", ",", "required", "-", "actual", ")", ",", "data", "...", ")", "\n", "}" ]
8,488
all-8489
[ "Do", "executes", "Network", ".", "setCacheDisabled", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetCacheDisabledParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetCacheDisabled", ",", "p", ",", "nil", ")", "\n", "}" ]
8,489
all-8490
[ "WriteTo", "writes", "response", "to", "w", ".", "It", "implements", "io", ".", "WriterTo", "." ]
[ "func", "(", "resp", "*", "Response", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "writeBufio", "(", "resp", ",", "w", ")", "\n", "}" ]
8,490
all-8491
[ "CreateSyncedFile", "creates", "a", "new", "file", "(", "using", "O_EXCL", ")", "errors", "if", "it", "already", "existed", "." ]
[ "func", "CreateSyncedFile", "(", "filename", "string", ",", "sync", "bool", ")", "(", "*", "<mask>", ".", "File", ",", "error", ")", "{", "flags", ":=", "os", ".", "O_RDWR", "|", "os", ".", "O_CREATE", "|", "os", ".", "O_EXCL", "\n", "if", "sync", "{", "flags", "|=", "datasyncFileFlag", "\n", "}", "\n", "return", "os", ".", "OpenFile", "(", "filename", ",", "flags", ",", "0666", ")", "\n", "}" ]
8,491
all-8492
[ "Debugf", "logs", "provided", "message", "with", "formatting", "in", "DEBUG", "level", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "Debugf", "(", "format", "string", ",", "a", "...", "<mask>", "{", "}", ")", "{", "logger", ".", "log", "(", "DEBUG", ",", "format", ",", "a", "...", ")", "\n", "}" ]
8,492
all-8493
[ "HasChange", "checks", "to", "see", "if", "there", "has", "been", "a", "change", "in", "the", "resource", "data", "since", "the", "last", "update", ".", "Note", "that", "this", "operation", "may", "only", "be", "useful", "during", "update", "operations", "depending", "on", "subresource", "-", "specific", "workflow", "." ]
[ "func", "(", "r", "*", "Subresource", ")", "HasChange", "(", "key", "string", ")", "bool", "{", "o", ",", "n", ":=", "r", ".", "GetChange", "(", "<mask>", ")", "\n", "return", "!", "reflect", ".", "DeepEqual", "(", "o", ",", "n", ")", "\n", "}" ]
8,493
all-8494
[ "updateSecret", "updates", "our", "secret", "with", "the", "new", "data", "from", "the", "api", "careful", "to", "not", "overwrite", "missing", "data", ".", "Renewals", "don", "t", "include", "the", "original", "secret", "and", "we", "don", "t", "want", "to", "delete", "that", "data", "accidentally", "." ]
[ "func", "updateSecret", "(", "ours", "*", "Secret", ",", "theirs", "*", "api", ".", "Secret", ")", "{", "if", "theirs", ".", "RequestID", "!=", "\"", "\"", "{", "ours", ".", "RequestID", "=", "theirs", ".", "RequestID", "\n", "}", "\n\n", "if", "theirs", ".", "LeaseID", "!=", "\"", "\"", "{", "ours", ".", "LeaseID", "=", "theirs", ".", "LeaseID", "\n", "}", "\n\n", "if", "theirs", ".", "LeaseDuration", "!=", "0", "{", "ours", ".", "LeaseDuration", "=", "theirs", ".", "LeaseDuration", "\n", "}", "\n\n", "if", "theirs", ".", "Renewable", "{", "ours", ".", "Renewable", "=", "theirs", ".", "Renewable", "\n", "}", "\n\n", "if", "len", "(", "theirs", ".", "Data", ")", "!=", "0", "{", "ours", ".", "Data", "=", "theirs", ".", "Data", "\n", "}", "\n\n", "if", "len", "(", "theirs", ".", "Warnings", ")", "!=", "0", "{", "ours", ".", "Warnings", "=", "theirs", ".", "Warnings", "\n", "}", "\n\n", "if", "theirs", ".", "Auth", "!=", "nil", "{", "if", "ours", ".", "Auth", "==", "nil", "{", "ours", ".", "Auth", "=", "&", "SecretAuth", "{", "}", "\n", "}", "\n\n", "if", "theirs", ".", "Auth", ".", "ClientToken", "!=", "\"", "\"", "{", "ours", ".", "Auth", ".", "ClientToken", "=", "theirs", ".", "Auth", ".", "ClientToken", "\n", "}", "\n\n", "if", "theirs", ".", "Auth", ".", "Accessor", "!=", "\"", "\"", "{", "ours", ".", "Auth", ".", "Accessor", "=", "theirs", ".", "Auth", ".", "Accessor", "\n", "}", "\n\n", "if", "len", "(", "theirs", ".", "Auth", ".", "Policies", ")", "!=", "0", "{", "ours", ".", "Auth", ".", "Policies", "=", "theirs", ".", "Auth", ".", "Policies", "\n", "}", "\n\n", "if", "len", "(", "theirs", ".", "Auth", ".", "Metadata", ")", "!=", "0", "{", "ours", ".", "Auth", ".", "Metadata", "=", "theirs", ".", "Auth", ".", "Metadata", "\n", "}", "\n\n", "if", "theirs", ".", "Auth", ".", "LeaseDuration", "!=", "0", "{", "ours", ".", "Auth", ".", "LeaseDuration", "=", "theirs", ".", "Auth", ".", "LeaseDuration", "\n", "}", "\n\n", "if", "theirs", ".", "Auth", ".", "Renewable", "{", "ours", ".", "Auth", ".", "Renewable", "=", "theirs", ".", "Auth", ".", "Renewable", "\n", "}", "\n", "}", "\n\n", "if", "theirs", ".", "WrapInfo", "!=", "nil", "{", "if", "ours", ".", "WrapInfo", "==", "nil", "{", "ours", ".", "WrapInfo", "=", "&", "SecretWrapInfo", "{", "}", "\n", "}", "\n\n", "if", "theirs", ".", "WrapInfo", ".", "Token", "!=", "\"", "\"", "{", "ours", ".", "WrapInfo", ".", "Token", "=", "theirs", ".", "WrapInfo", ".", "<mask>", "\n", "}", "\n\n", "if", "theirs", ".", "WrapInfo", ".", "TTL", "!=", "0", "{", "ours", ".", "WrapInfo", ".", "TTL", "=", "theirs", ".", "WrapInfo", ".", "TTL", "\n", "}", "\n\n", "if", "!", "theirs", ".", "WrapInfo", ".", "CreationTime", ".", "IsZero", "(", ")", "{", "ours", ".", "WrapInfo", ".", "CreationTime", "=", "theirs", ".", "WrapInfo", ".", "CreationTime", "\n", "}", "\n\n", "if", "theirs", ".", "WrapInfo", ".", "WrappedAccessor", "!=", "\"", "\"", "{", "ours", ".", "WrapInfo", ".", "WrappedAccessor", "=", "theirs", ".", "WrapInfo", ".", "WrappedAccessor", "\n", "}", "\n", "}", "\n", "}" ]
8,494
all-8495
[ "IsMember", "checks", "to", "see", "if", "a", "host", "is", "a", "member", "of", "the", "compute", "cluster", "in", "question", ".", "This", "is", "a", "pretty", "basic", "operation", "that", "checks", "that", "the", "parent", "of", "the", "compute", "is", "the", "ClusterComputeResource", "." ]
[ "func", "IsMember", "(", "cluster", "*", "object", ".", "ClusterComputeResource", ",", "<mask>", "*", "object", ".", "HostSystem", ")", "(", "bool", ",", "error", ")", "{", "hprops", ",", "err", ":=", "hostsystem", ".", "Properties", "(", "host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "host", ".", "Name", "(", ")", ",", "err", ")", "\n", "}", "\n", "if", "hprops", ".", "Parent", "==", "nil", "{", "return", "false", ",", "nil", "\n", "}", "\n", "if", "*", "hprops", ".", "Parent", "!=", "cluster", ".", "Reference", "(", ")", "{", "return", "false", ",", "nil", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}" ]
8,495
all-8496
[ "Sum", "appends", "the", "current", "hash", "to", "b", "and", "returns", "the", "resulting", "slice", ".", "It", "does", "not", "change", "the", "underlying", "hash", "state", "." ]
[ "func", "(", "xx", "*", "XXHash64", ")", "Sum", "(", "in", "[", "]", "byte", ")", "[", "]", "byte", "{", "s", ":=", "xx", ".", "Sum64", "(", ")", "\n", "return", "append", "(", "in", ",", "<mask>", "(", "s", ">>", "56", ")", ",", "byte", "(", "s", ">>", "48", ")", ",", "byte", "(", "s", ">>", "40", ")", ",", "byte", "(", "s", ">>", "32", ")", ",", "byte", "(", "s", ">>", "24", ")", ",", "byte", "(", "s", ">>", "16", ")", ",", "byte", "(", "s", ">>", "8", ")", ",", "byte", "(", "s", ")", ")", "\n", "}" ]
8,496
all-8497
[ "Debug", "outputs", "Debug", "level", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Debug", "(", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "g", ".", "out", "(", "DEBG", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
8,497
all-8498
[ "newResult", "creates", "and", "returns", "a", "result", "." ]
[ "func", "newResult", "(", "base", "[", "]", "element", ",", "inner", "[", "]", "element", ",", "includes", "map", "[", "string", "]", "[", "]", "element", ")", "*", "result", "{", "return", "&", "result", "{", "base", ":", "base", ",", "inner", ":", "inner", ",", "<mask>", ":", "includes", ",", "}", "\n", "}" ]
8,498
all-8499
[ "QueryDirect", "executes", "a", "query", "without", "query", "parameters", "." ]
[ "func", "(", "s", "*", "Session", ")", "QueryDirect", "(", "query", "string", ")", "(", "uint64", ",", "*", "ResultFieldSet", ",", "*", "FieldValues", ",", "PartAttributes", ",", "error", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "err", ":=", "s", ".", "writeRequest", "(", "mtExecuteDirect", ",", "false", ",", "command", "(", "query", ")", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "id", "uint64", "\n", "var", "resultFieldSet", "*", "ResultFieldSet", "\n", "fieldValues", ":=", "newFieldValues", "(", ")", "\n\n", "f", ":=", "func", "(", "p", "replyPart", ")", "{", "switch", "p", ":=", "p", ".", "(", "<mask>", ")", "{", "case", "*", "resultsetID", ":", "p", ".", "id", "=", "&", "id", "\n", "case", "*", "resultMetadata", ":", "resultFieldSet", "=", "newResultFieldSet", "(", "p", ".", "numArg", ")", "\n", "p", ".", "resultFieldSet", "=", "resultFieldSet", "\n", "case", "*", "resultset", ":", "p", ".", "s", "=", "s", "\n", "p", ".", "resultFieldSet", "=", "resultFieldSet", "\n", "p", ".", "fieldValues", "=", "fieldValues", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "readReply", "(", "f", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "id", ",", "resultFieldSet", ",", "fieldValues", ",", "s", ".", "ph", ".", "partAttributes", ",", "nil", "\n", "}" ]
8,499
all-8500
[ "HasRole", "check", "if", "current", "user", "has", "role" ]
[ "func", "HasRole", "(", "req", "*", "http", ".", "<mask>", ",", "user", "interface", "{", "}", ",", "roles", "...", "string", ")", "bool", "{", "return", "Global", ".", "HasRole", "(", "req", ",", "user", ")", "\n", "}" ]