id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
1,400
all-1401
[ "HasLink", "returns", "whether", "the", "resource", "has", "a", "link", "with", "the", "given", "name", "." ]
[ "func", "(", "r", "*", "Resource", ")", "HasLink", "(", "name", "string", ")", "bool", "{", "for", "n", ",", "_", ":=", "range", "r", ".", "Links", "{", "if", "n", "==", "name", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
1,401
all-1402
[ "Ellipse", "draws", "an", "ellipse", "using", "a", "path", "with", "center", "(", "cx", "cy", ")", "and", "radius", "(", "rx", "ry", ")" ]
[ "func", "Ellipse", "(", "path", "draw2d", ".", "PathBuilder", ",", "cx", ",", "cy", ",", "rx", ",", "ry", "float64", ")", "{", "<mask>", ".", "ArcTo", "(", "cx", ",", "cy", ",", "rx", ",", "ry", ",", "0", ",", "-", "math", ".", "Pi", "*", "2", ")", "\n", "path", ".", "Close", "(", ")", "\n", "}" ]
1,402
all-1403
[ "CopyTo", "copies", "src", "cookie", "to", "c", "." ]
[ "func", "(", "c", "*", "Cookie", ")", "CopyTo", "(", "src", "*", "Cookie", ")", "{", "c", ".", "Reset", "(", ")", "\n", "c", ".", "key", "=", "append", "(", "c", ".", "key", "[", ":", "0", "]", ",", "src", ".", "key", "...", ")", "\n", "c", ".", "value", "=", "append", "(", "c", ".", "<mask>", "[", ":", "0", "]", ",", "src", ".", "value", "...", ")", "\n", "c", ".", "expire", "=", "src", ".", "expire", "\n", "c", ".", "maxAge", "=", "src", ".", "maxAge", "\n", "c", ".", "domain", "=", "append", "(", "c", ".", "domain", "[", ":", "0", "]", ",", "src", ".", "domain", "...", ")", "\n", "c", ".", "path", "=", "append", "(", "c", ".", "path", "[", ":", "0", "]", ",", "src", ".", "path", "...", ")", "\n", "c", ".", "httpOnly", "=", "src", ".", "httpOnly", "\n", "c", ".", "secure", "=", "src", ".", "secure", "\n", "c", ".", "sameSite", "=", "src", ".", "sameSite", "\n", "}" ]
1,403
all-1404
[ "UpdateScreenboard", "in", "essence", "takes", "a", "Screenboard", "struct", "and", "persists", "it", "back", "to", "the", "server", ".", "Use", "this", "if", "you", "ve", "updated", "your", "local", "and", "need", "to", "push", "it", "back", "." ]
[ "func", "(", "client", "*", "<mask>", ")", "UpdateScreenboard", "(", "board", "*", "Screenboard", ")", "error", "{", "return", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "*", "board", ".", "Id", ")", ",", "board", ",", "nil", ")", "\n", "}" ]
1,404
all-1405
[ "Sum", "returns", "the", "first", "20", "bytes", "of", "SHA256", "of", "the", "bz", "." ]
[ "func", "Sum", "(", "bz", "[", "]", "byte", ")", "[", "]", "byte", "{", "hash", ":=", "sha256", ".", "Sum256", "(", "bz", ")", "\n", "return", "<mask>", "[", ":", "Size", "]", "\n", "}" ]
1,405
all-1406
[ "Fetch", "queries", "the", "Consul", "API", "defined", "by", "the", "given", "client", "and", "returns", "a", "slice", "of", "CatalogService", "objects", "." ]
[ "func", "(", "d", "*", "CatalogServicesQuery", ")", "Fetch", "(", "clients", "*", "ClientSet", ",", "opts", "*", "QueryOptions", ")", "(", "interface", "{", "}", ",", "*", "ResponseMetadata", ",", "error", ")", "{", "select", "{", "<mask>", "<-", "d", ".", "stopCh", ":", "return", "nil", ",", "nil", ",", "ErrStopped", "\n", "default", ":", "}", "\n\n", "opts", "=", "opts", ".", "Merge", "(", "&", "QueryOptions", "{", "Datacenter", ":", "d", ".", "dc", ",", "}", ")", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "&", "url", ".", "URL", "{", "Path", ":", "\"", "\"", ",", "RawQuery", ":", "opts", ".", "String", "(", ")", ",", "}", ")", "\n\n", "entries", ",", "qm", ",", "err", ":=", "clients", ".", "Consul", "(", ")", ".", "Catalog", "(", ")", ".", "Services", "(", "opts", ".", "ToConsulOpts", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "d", ".", "String", "(", ")", ")", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "len", "(", "entries", ")", ")", "\n\n", "var", "catalogServices", "[", "]", "*", "CatalogSnippet", "\n", "for", "name", ",", "tags", ":=", "range", "entries", "{", "catalogServices", "=", "append", "(", "catalogServices", ",", "&", "CatalogSnippet", "{", "Name", ":", "name", ",", "Tags", ":", "ServiceTags", "(", "deepCopyAndSortTags", "(", "tags", ")", ")", ",", "}", ")", "\n", "}", "\n\n", "sort", ".", "Stable", "(", "ByName", "(", "catalogServices", ")", ")", "\n\n", "rm", ":=", "&", "ResponseMetadata", "{", "LastIndex", ":", "qm", ".", "LastIndex", ",", "LastContact", ":", "qm", ".", "LastContact", ",", "}", "\n\n", "return", "catalogServices", ",", "rm", ",", "nil", "\n", "}" ]
1,406
all-1407
[ "SetName", "sets", "header", "name", "of", "current", "instance", "." ]
[ "func", "(", "s", "*", "HttpHeader", ")", "SetName", "(", "<mask>", "string", ")", "*", "HttpHeader", "{", "s", ".", "Name", "=", "name", "\n", "return", "s", "\n", "}" ]
1,407
all-1408
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Bounds", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser21", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,408
all-1409
[ "cleanupResourceIfExists", "checks", "if", "the", "resource", "exists", "if", "it", "does", "and", "it", "does", "not", "have", "any", "attached", "resources", "then", "deletes", "the", "resource", ".", "If", "the", "resource", "does", "not", "exist", "or", "is", "not", "eligible", "for", "cleanup", "returns", "nil", ".", "If", "an", "error", "is", "encountered", "returns", "the", "error", "." ]
[ "func", "(", "a", "AzureClient", ")", "cleanupResourceIfExists", "(", "r", "cleanupResource", ")", "error", "{", "f", ":=", "r", ".", "LogFields", "(", ")", "\n", "log", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ResourceType", "(", ")", ")", ",", "f", ")", "\n", "err", ":=", "r", ".", "Get", "(", "a", ")", "\n", "if", "exists", ",", "err", ":=", "checkResourceExistsFromError", "(", "err", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "else", "if", "!", "exists", "{", "<mask>", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ResourceType", "(", ")", ")", ",", "f", ")", "\n", "return", "nil", "\n", "}", "\n\n", "if", "!", "r", ".", "HasAttachedResources", "(", ")", "{", "log", ".", "Debug", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ResourceType", "(", ")", ")", ",", "f", ")", "\n", "log", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ResourceType", "(", ")", ")", ",", "f", ")", "\n", "return", "r", ".", "Delete", "(", "a", ")", "\n", "}", "\n", "log", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "ResourceType", "(", ")", ")", ",", "f", ")", "\n", "return", "nil", "\n", "}" ]
1,409
all-1410
[ "Open", "takes", "a", "urlstr", "like", "protocol", "+", "transport", ":", "//", "user", ":", "pass" ]
[ "func", "Open", "(", "urlstr", "string", ")", "(", "*", "sql", ".", "<mask>", ",", "error", ")", "{", "u", ",", "err", ":=", "Parse", "(", "urlstr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "sql", ".", "Open", "(", "u", ".", "Driver", ",", "u", ".", "DSN", ")", "\n", "}" ]
1,410
all-1411
[ "Merge", "combines", "all", "values", "in", "this", "configuration", "with", "the", "values", "in", "the", "other", "configuration", "with", "values", "in", "the", "other", "configuration", "taking", "precedence", ".", "Maps", "and", "slices", "are", "merged", "most", "other", "values", "are", "overwritten", ".", "Complex", "structs", "define", "their", "own", "merge", "functionality", "." ]
[ "func", "(", "c", "*", "TemplateConfig", ")", "Merge", "(", "o", "*", "TemplateConfig", ")", "*", "TemplateConfig", "{", "if", "c", "==", "nil", "{", "if", "o", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "o", ".", "Copy", "(", ")", "\n", "}", "\n\n", "if", "o", "==", "nil", "{", "return", "c", ".", "Copy", "(", ")", "\n", "}", "\n\n", "r", ":=", "c", ".", "Copy", "(", ")", "\n\n", "if", "o", ".", "Backup", "!=", "nil", "{", "r", ".", "Backup", "=", "o", ".", "Backup", "\n", "}", "\n\n", "if", "o", ".", "Command", "!=", "nil", "{", "r", ".", "Command", "=", "o", ".", "Command", "\n", "}", "\n\n", "if", "o", ".", "CommandTimeout", "!=", "nil", "{", "r", ".", "CommandTimeout", "=", "o", ".", "CommandTimeout", "\n", "}", "\n\n", "if", "o", ".", "Contents", "!=", "nil", "{", "r", ".", "Contents", "=", "o", ".", "Contents", "\n", "}", "\n\n", "if", "o", ".", "CreateDestDirs", "!=", "nil", "{", "r", ".", "CreateDestDirs", "=", "o", ".", "CreateDestDirs", "\n", "}", "\n\n", "if", "o", ".", "Destination", "!=", "nil", "{", "r", ".", "Destination", "=", "o", ".", "Destination", "\n", "}", "\n\n", "if", "o", ".", "ErrMissingKey", "!=", "nil", "{", "r", ".", "ErrMissingKey", "=", "o", ".", "ErrMissingKey", "\n", "}", "\n\n", "if", "o", ".", "Exec", "!=", "nil", "{", "r", ".", "Exec", "=", "r", ".", "Exec", ".", "Merge", "(", "o", ".", "Exec", ")", "\n", "}", "\n\n", "if", "o", ".", "Perms", "!=", "nil", "{", "r", ".", "Perms", "=", "o", ".", "Perms", "\n", "}", "\n\n", "if", "o", ".", "<mask>", "!=", "nil", "{", "r", ".", "Source", "=", "o", ".", "Source", "\n", "}", "\n\n", "if", "o", ".", "Wait", "!=", "nil", "{", "r", ".", "Wait", "=", "r", ".", "Wait", ".", "Merge", "(", "o", ".", "Wait", ")", "\n", "}", "\n\n", "if", "o", ".", "LeftDelim", "!=", "nil", "{", "r", ".", "LeftDelim", "=", "o", ".", "LeftDelim", "\n", "}", "\n\n", "if", "o", ".", "RightDelim", "!=", "nil", "{", "r", ".", "RightDelim", "=", "o", ".", "RightDelim", "\n", "}", "\n\n", "return", "r", "\n", "}" ]
1,411
all-1412
[ "SetMnemonicModifier", "is", "a", "wrapper", "around", "gtk_window_set_mnemonic_modifier", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetMnemonicModifier", "(", "<mask>", "gdk", ".", "ModifierType", ")", "{", "C", ".", "gtk_window_set_mnemonic_modifier", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GdkModifierType", "(", "mods", ")", ")", "\n", "}" ]
1,412
all-1413
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "CIDR", "." ]
[ "func", "(", "u", "*", "CIDR", ")", "DeepCopy", "(", ")", "*", "CIDR", "{", "if", "u", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "CIDR", ")", "\n", "u", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
1,413
all-1414
[ "CreateSnapshot", "creates", "a", "volume", "snapshot" ]
[ "func", "(", "c", "*", "Client", ")", "CreateSnapshot", "(", "dcid", "string", ",", "volid", "string", ",", "name", "string", ",", "description", "string", ")", "(", "*", "Snapshot", ",", "error", ")", "{", "path", ":=", "volumePath", "(", "dcid", ",", "volid", ")", "+", "\"", "\"", "\n", "data", ":=", "url", ".", "Values", "{", "}", "\n", "data", ".", "Set", "(", "\"", "\"", ",", "name", ")", "\n", "data", ".", "Add", "(", "\"", "\"", ",", "description", ")", "\n\n", "ret", ":=", "&", "Snapshot", "{", "}", "\n", "err", ":=", "c", ".", "<mask>", ".", "Post", "(", "path", ",", "data", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
1,414
all-1415
[ "DefaultCache", "returns", "the", "default", "BlobInfoCache", "implementation", "appropriate", "for", "sys", "." ]
[ "func", "DefaultCache", "(", "sys", "*", "<mask>", ".", "SystemContext", ")", "types", ".", "BlobInfoCache", "{", "dir", ",", "err", ":=", "blobInfoCacheDir", "(", "sys", ",", "getRootlessUID", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "blobInfoCacheFilename", ")", "\n", "return", "memory", ".", "New", "(", ")", "\n", "}", "\n", "path", ":=", "filepath", ".", "Join", "(", "dir", ",", "blobInfoCacheFilename", ")", "\n", "if", "err", ":=", "os", ".", "MkdirAll", "(", "dir", ",", "0700", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "blobInfoCacheFilename", ",", "err", ")", "\n", "return", "memory", ".", "New", "(", ")", "\n", "}", "\n\n", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "path", ")", "\n", "return", "boltdb", ".", "New", "(", "path", ")", "\n", "}" ]
1,415
all-1416
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform1i", "(", "program", "uint32", ",", "<mask>", "int32", ",", "v0", "int32", ")", "{", "syscall", ".", "Syscall", "(", "gpProgramUniform1i", ",", "3", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "v0", ")", ")", "\n", "}" ]
1,416
all-1417
[ "title", ":", "list", "provisioners", "path", ":", "/", "provisioner", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "204", ":", "No", "Content", "401", ":", "Unauthorized" ]
[ "func", "provisionerList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermClusterRead", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "provs", ",", "err", ":=", "provision", ".", "Registry", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "info", ":=", "make", "(", "[", "]", "provisionerInfo", ",", "len", "(", "provs", ")", ")", "\n", "for", "i", ",", "p", ":=", "range", "provs", "{", "info", "[", "i", "]", ".", "Name", "=", "p", ".", "GetName", "(", ")", "\n", "if", "clusterProv", ",", "ok", ":=", "p", ".", "(", "cluster", ".", "ClusteredProvisioner", ")", ";", "ok", "{", "<mask>", "[", "i", "]", ".", "ClusterHelp", "=", "clusterProv", ".", "ClusterHelp", "(", ")", "\n", "}", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "info", ")", "\n", "}" ]
1,417
all-1418
[ "NewAccountEntryExt", "creates", "a", "new", "AccountEntryExt", "." ]
[ "func", "NewAccountEntryExt", "(", "v", "int32", ",", "value", "interface", "{", "}", ")", "(", "result", "AccountEntryExt", ",", "err", "error", ")", "{", "<mask>", ".", "V", "=", "v", "\n", "switch", "int32", "(", "v", ")", "{", "case", "0", ":", "// void", "}", "\n", "return", "\n", "}" ]
1,418
all-1419
[ "RatioForMatrix", "returns", "the", "Levenshtein", "ratio", "for", "the", "given", "matrix", ".", "The", "ratio", "is", "computed", "as", "follows", ":", "(", "sourceLength", "+", "targetLength", "-", "distance", ")", "/", "(", "sourceLength", "+", "targetLength", ")" ]
[ "func", "RatioForMatrix", "(", "matrix", "[", "]", "[", "]", "int", ")", "float64", "{", "sourcelength", ":=", "len", "(", "matrix", ")", "-", "1", "\n", "targetlength", ":=", "len", "(", "matrix", "[", "0", "]", ")", "-", "1", "\n", "<mask>", ":=", "sourcelength", "+", "targetlength", "\n\n", "if", "sum", "==", "0", "{", "return", "0", "\n", "}", "\n\n", "dist", ":=", "DistanceForMatrix", "(", "matrix", ")", "\n", "return", "float64", "(", "sum", "-", "dist", ")", "/", "float64", "(", "sum", ")", "\n", "}" ]
1,419
all-1420
[ "MarshalString", "appends", "the", "string", "to", "the", "buffer", "with", "a", "size", "prefix", "and", "correct", "padding", "." ]
[ "func", "(", "m", "*", "Marshaller", ")", "MarshalString", "(", "s", "string", ")", "{", "if", "m", ".", "Error", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "m", ".", "Data", ")", "<", "m", ".", "offset", "+", "4", "+", "len", "(", "s", ")", "+", "Padding", "(", "len", "(", "s", ")", ")", "{", "m", ".", "Error", "=", "io", ".", "ErrShortBuffer", "\n", "return", "\n", "}", "\n\n", "m", ".", "MarshalUint32", "(", "uint32", "(", "len", "(", "s", ")", ")", ")", "\n", "m", ".", "<mask>", "+=", "copy", "(", "m", ".", "Data", "[", "m", ".", "offset", ":", "]", ",", "s", ")", "\n", "m", ".", "offset", "+=", "copy", "(", "m", ".", "Data", "[", "m", ".", "offset", ":", "]", ",", "padBytes", "[", ":", "Padding", "(", "len", "(", "s", ")", ")", "]", ")", "\n", "}" ]
1,420
all-1421
[ "WriteLen16String", "writes", "a", "16", "-", "bit", "length", "preceded", "string" ]
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteLen16String", "(", "s", "<mask>", ")", "{", "if", "int", "(", "uint16", "(", "len", "(", "s", ")", ")", ")", "!=", "len", "(", "s", ")", "{", "w", ".", "setErr", "(", "errStringTooLong", ")", "\n", "}", "\n\n", "w", ".", "WriteUint16", "(", "uint16", "(", "len", "(", "s", ")", ")", ")", "\n", "w", ".", "WriteString", "(", "s", ")", "\n", "}" ]
1,421
all-1422
[ "EmbedReader", "embeds", "the", "images", "to", "the", "email", "." ]
[ "func", "(", "m", "*", "Message", ")", "EmbedReader", "(", "name", "string", ",", "r", "io", ".", "Reader", ",", "settings", "...", "FileSetting", ")", "{", "m", ".", "embedded", "=", "m", ".", "appendFile", "(", "m", ".", "embedded", ",", "fileFromReader", "(", "<mask>", ",", "r", ")", ",", "settings", ")", "\n", "}" ]
1,422
all-1423
[ "go", ":", "generate", "go", "run", "internal", "/", "generate", "-", "commands", "/", "main", ".", "go", "-", "o", "commands", ".", "go" ]
[ "func", "stringifyArg", "(", "name", ",", "typ", "string", ",", "v", "interface", "{", "}", ")", "string", "{", "switch", "typ", "{", "case", "\"", "\"", ":", "if", "!", "v", ".", "(", "bool", ")", "{", "return", "\"", "\"", "\n", "}", "else", "if", "name", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "\"", "\"", "\n\n", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ")", "\n\n", "<mask>", "\"", "\"", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "(", "time", ".", "Duration", ")", "/", "time", ".", "Second", ")", "\n\n", "case", "\"", "\"", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "(", "time", ".", "Time", ")", ".", "Unix", "(", ")", ")", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
1,423
all-1424
[ "resourceVSphereDatastoreClusterGetPod", "gets", "the", "StoragePod", "from", "the", "ID", "in", "the", "supplied", "ResourceData", "." ]
[ "func", "resourceVSphereDatastoreClusterGetPod", "(", "d", "structure", ".", "ResourceIDStringer", ",", "meta", "<mask>", "{", "}", ")", "(", "*", "object", ".", "StoragePod", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", ":=", "viapi", ".", "ValidateVirtualCenter", "(", "client", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "storagepod", ".", "FromID", "(", "client", ",", "d", ".", "Id", "(", ")", ")", "\n", "}" ]
1,424
all-1425
[ "initialAdvertise", "will", "do", "the", "initial", "Advertise", "call", "to", "Hyperbahn", "with", "additional", "retries", "on", "top", "of", "the", "built", "-", "in", "TChannel", "retries", ".", "It", "will", "use", "exponential", "backoff", "between", "each", "of", "the", "call", "attempts", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "initialAdvertise", "(", ")", "error", "{", "var", "err", "error", "\n", "for", "attempt", ":=", "uint", "(", "0", ")", ";", "attempt", "<", "maxAdvertiseFailures", ";", "attempt", "++", "{", "err", "=", "c", ".", "sendAdvertise", "(", ")", "\n", "if", "err", "==", "nil", "||", "err", "==", "errEphemeralPeer", "{", "break", "\n", "}", "\n\n", "c", ".", "tchan", ".", "Logger", "(", ")", ".", "WithFields", "(", "tchannel", ".", "ErrField", "(", "err", ")", ")", ".", "Info", "(", "\"", "\"", ")", "\n\n", "// Back off for a while.", "sleepFor", ":=", "fuzzInterval", "(", "advertiseRetryInterval", "*", "time", ".", "Duration", "(", "1", "<<", "attempt", ")", ")", "\n", "c", ".", "sleep", "(", "sleepFor", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
1,425
all-1426
[ "seekNextFrame", "seeks", "the", "next", "frame", "and", "returns", "the", "new", "buffer", "with", "the", "new", "position", ".", "seekNextFrame", "also", "returns", "true", "when", "seeking", "is", "successful", "or", "false", "otherwise", ".", "Seeking", "is", "necessary", "when", "decoding", "fails", ".", "Safari", "s", "MP3", "decoder", "can", "t", "treat", "IDs", "well", "(", "#438", ")", "." ]
[ "func", "seekNextFrame", "(", "buf", "[", "]", "<mask>", ")", "(", "[", "]", "byte", ",", "bool", ")", "{", "// TODO: Need to skip tags explicitly? (hajimehoshi/go-mp3#9)", "if", "len", "(", "buf", ")", "<", "1", "{", "return", "nil", ",", "false", "\n", "}", "\n", "buf", "=", "buf", "[", "1", ":", "]", "\n\n", "for", "{", "if", "buf", "[", "0", "]", "==", "0xff", "&&", "buf", "[", "1", "]", "&", "0xfe", "==", "0xfe", "{", "break", "\n", "}", "\n", "buf", "=", "buf", "[", "1", ":", "]", "\n", "if", "len", "(", "buf", ")", "<", "2", "{", "return", "nil", ",", "false", "\n", "}", "\n", "}", "\n", "return", "buf", ",", "true", "\n", "}" ]
1,426
all-1427
[ "Return", "a", "string", "representation", "of", "a", "QueryTiming", "span", "operation", "." ]
[ "func", "(", "s", "QueryTiming", ")", "SpanOperation", "(", ")", "string", "{", "switch", "s", "{", "case", "EvalTotalTime", ":", "return", "\"", "\"", "\n", "case", "ResultSortTime", ":", "return", "\"", "\"", "\n", "case", "QueryPreparationTime", ":", "return", "\"", "\"", "\n", "case", "InnerEvalTime", ":", "return", "\"", "\"", "\n", "case", "ExecQueueTime", ":", "return", "\"", "\"", "\n", "<mask>", "ExecTotalTime", ":", "return", "\"", "\"", "\n", "default", ":", "return", "\"", "\"", "\n", "}", "\n", "}" ]
1,427
all-1428
[ "RequiredMatchersFilter", "returns", "a", "storage", ".", "Queryable", "which", "creates", "a", "requiredMatchersQuerier", "." ]
[ "func", "RequiredMatchersFilter", "(", "next", "storage", ".", "Queryable", ",", "required", "[", "]", "*", "labels", ".", "Matcher", ")", "storage", ".", "Queryable", "{", "return", "storage", ".", "QueryableFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "mint", ",", "maxt", "int64", ")", "(", "storage", ".", "Querier", ",", "error", ")", "{", "q", ",", "err", ":=", "next", ".", "Querier", "(", "ctx", ",", "mint", ",", "maxt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "requiredMatchersQuerier", "{", "Querier", ":", "q", ",", "requiredMatchers", ":", "<mask>", "}", ",", "nil", "\n", "}", ")", "\n", "}" ]
1,428
all-1429
[ "Step", "4", "is", "the", "undoubling", "of", "double", "non", "-", "vowel", "endings", "and", "removal", "of", "superlative", "endings", "." ]
[ "func", "step4", "(", "word", "*", "snowballword", ".", "SnowballWord", ")", "bool", "{", "// (1) Undouble \"н\", or, 2) if the word ends with a SUPERLATIVE ending,", "// (remove it and undouble н n), or 3) if the word ends ь (') (soft sign)", "// remove it.", "// Undouble \"н\"", "if", "word", ".", "HasSuffixRunes", "(", "[", "]", "rune", "(", "\"", ")", " ", "{", "", "word", ".", "RemoveLastNRunes", "(", "1", ")", "\n", "return", "true", "\n", "}", "\n\n", "// Remove superlative endings", "suffix", ",", "_", ":=", "word", ".", "RemoveFirstSuffix", "(", "\"", "е", "й", "\"", "", "", "\n", "if", "suffix", "!=", "\"", "\"", "{", "// Undouble \"н\"", "if", "word", ".", "HasSuffixRunes", "(", "[", "]", "rune", "(", "\"", ")", " ", "{", "", "word", ".", "RemoveLastNRunes", "(", "1", ")", "\n", "}", "\n", "return", "<mask>", "\n", "}", "\n\n", "// Remove soft sign", "if", "rsLen", ":=", "len", "(", "word", ".", "RS", ")", ";", "rsLen", ">", "0", "&&", "word", ".", "RS", "[", "rsLen", "-", "1", "]", "==", "'ь' ", "", "word", ".", "RemoveLastNRunes", "(", "1", ")", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
1,429
all-1430
[ "StringToColor", "returns", "attribute", "by", "its", "string", "description", ".", "Description", "is", "the", "list", "of", "attributes", "separated", "with", "spaces", "plus", "or", "pipe", "symbols", ".", "You", "can", "use", "8", "base", "colors", ":", "black", "white", "red", "green", "blue", "magenta", "yellow", "cyan", "and", "a", "few", "modifiers", ":", "bold", "or", "bright", "underline", "or", "underlined", "reverse", "Note", ":", "some", "terminals", "do", "not", "support", "all", "modifiers", "e", ".", "g", "Windows", "one", "understands", "only", "bold", "/", "bright", "-", "it", "makes", "the", "color", "brighter", "with", "the", "modidierA", "Examples", ":", "red", "bold", "green", "+", "underline", "+", "bold" ]
[ "func", "StringToColor", "(", "str", "string", ")", "term", ".", "Attribute", "{", "var", "parts", "[", "]", "string", "\n", "if", "strings", ".", "ContainsRune", "(", "str", ",", "'+'", ")", "{", "parts", "=", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "\n", "}", "else", "if", "strings", ".", "ContainsRune", "(", "str", ",", "'|'", ")", "{", "parts", "=", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "\n", "}", "else", "if", "strings", ".", "ContainsRune", "(", "str", ",", "' '", ")", "{", "parts", "=", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "\n", "}", "else", "{", "parts", "=", "append", "(", "parts", ",", "str", ")", "\n", "}", "\n\n", "var", "clr", "term", ".", "Attribute", "\n", "for", "_", ",", "item", ":=", "range", "parts", "{", "<mask>", "=", "strings", ".", "Trim", "(", "item", ",", "\"", "\"", ")", "\n", "item", "=", "strings", ".", "ToLower", "(", "item", ")", "\n\n", "c", ",", "ok", ":=", "colorMap", "[", "item", "]", "\n", "if", "ok", "{", "clr", "|=", "c", "\n", "}", "\n", "}", "\n\n", "return", "clr", "\n", "}" ]
1,430
all-1431
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetNodeNameReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,431
all-1432
[ "createConfigChangeEnts", "creates", "a", "series", "of", "Raft", "entries", "(", "i", ".", "e", ".", "EntryConfChange", ")", "to", "remove", "the", "set", "of", "given", "IDs", "from", "the", "cluster", ".", "The", "ID", "self", "is", "_not_", "removed", "even", "if", "present", "in", "the", "set", ".", "If", "self", "is", "not", "inside", "the", "given", "ids", "it", "creates", "a", "Raft", "entry", "to", "add", "a", "default", "member", "with", "the", "given", "self", "." ]
[ "func", "createConfigChangeEnts", "(", "lg", "*", "zap", ".", "Logger", ",", "ids", "[", "]", "uint64", ",", "self", "uint64", ",", "term", ",", "index", "uint64", ")", "[", "]", "raftpb", ".", "Entry", "{", "ents", ":=", "make", "(", "[", "]", "raftpb", ".", "Entry", ",", "0", ")", "\n", "next", ":=", "index", "+", "1", "\n", "found", ":=", "false", "\n", "for", "_", ",", "id", ":=", "range", "ids", "{", "if", "id", "==", "self", "{", "<mask>", "=", "true", "\n", "continue", "\n", "}", "\n", "cc", ":=", "&", "raftpb", ".", "ConfChange", "{", "Type", ":", "raftpb", ".", "ConfChangeRemoveNode", ",", "NodeID", ":", "id", ",", "}", "\n", "e", ":=", "raftpb", ".", "Entry", "{", "Type", ":", "raftpb", ".", "EntryConfChange", ",", "Data", ":", "pbutil", ".", "MustMarshal", "(", "cc", ")", ",", "Term", ":", "term", ",", "Index", ":", "next", ",", "}", "\n", "ents", "=", "append", "(", "ents", ",", "e", ")", "\n", "next", "++", "\n", "}", "\n", "if", "!", "found", "{", "m", ":=", "membership", ".", "Member", "{", "ID", ":", "types", ".", "ID", "(", "self", ")", ",", "RaftAttributes", ":", "membership", ".", "RaftAttributes", "{", "PeerURLs", ":", "[", "]", "string", "{", "\"", "\"", "}", "}", ",", "}", "\n", "ctx", ",", "err", ":=", "json", ".", "Marshal", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "cc", ":=", "&", "raftpb", ".", "ConfChange", "{", "Type", ":", "raftpb", ".", "ConfChangeAddNode", ",", "NodeID", ":", "self", ",", "Context", ":", "ctx", ",", "}", "\n", "e", ":=", "raftpb", ".", "Entry", "{", "Type", ":", "raftpb", ".", "EntryConfChange", ",", "Data", ":", "pbutil", ".", "MustMarshal", "(", "cc", ")", ",", "Term", ":", "term", ",", "Index", ":", "next", ",", "}", "\n", "ents", "=", "append", "(", "ents", ",", "e", ")", "\n", "}", "\n", "return", "ents", "\n", "}" ]
1,432
all-1433
[ "DeleteCollection", "deletes", "a", "collection", "of", "objects", "." ]
[ "func", "(", "c", "*", "FakeApps", ")", "DeleteCollection", "(", "options", "*", "v1", ".", "DeleteOptions", ",", "listOptions", "v1", ".", "ListOptions", ")", "error", "{", "<mask>", ":=", "testing", ".", "NewDeleteCollectionAction", "(", "appsResource", ",", "c", ".", "ns", ",", "listOptions", ")", "\n\n", "_", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "action", ",", "&", "tsuru_v1", ".", "AppList", "{", "}", ")", "\n", "return", "err", "\n", "}" ]
1,433
all-1434
[ "void", "pango_cairo_layout_line_path", "(", "cairo_t", "*", "cr", "PangoLayoutLine", "*", "line", ")", ";" ]
[ "func", "CairoLayoutLinePath", "(", "cr", "*", "cairo", ".", "<mask>", ",", "line", "*", "LayoutLine", ")", "{", "C", ".", "pango_cairo_layout_line_path", "(", "cairo_context", "(", "cr", ")", ",", "line", ".", "native", "(", ")", ")", "\n", "}" ]
1,434
all-1435
[ "Rollback", "a", "transaction", "after", "the", "given", "error", "occurred", ".", "If", "the", "rollback", "succeeds", "the", "given", "error", "is", "returned", "otherwise", "a", "new", "error", "that", "wraps", "it", "gets", "generated", "and", "returned", "." ]
[ "func", "rollback", "(", "tx", "*", "sql", ".", "Tx", ",", "reason", "error", ")", "error", "{", "err", ":=", "<mask>", ".", "Rollback", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warnf", "(", "\"", "\"", ",", "reason", ",", "err", ")", "\n", "}", "\n\n", "return", "reason", "\n", "}" ]
1,435
all-1436
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RareBooleanData", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,436
all-1437
[ "Get", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockCache", ")", "Get", "(", "arg0", "string", ")", "(", "async", ".", "Value", ",", "bool", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "async", ".", "Value", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "bool", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
1,437
all-1438
[ "GarbageCollect", "takes", "a", "lock", "triggers", "a", "GC", "and", "invokes", "the", "accumulated", "GC", "callbacks", "." ]
[ "func", "(", "peers", "*", "Peers", ")", "GarbageCollect", "(", ")", "{", "peers", ".", "Lock", "(", ")", "\n", "<mask>", "pending", "peersPendingNotifications", "\n", "defer", "peers", ".", "unlockAndNotify", "(", "&", "pending", ")", "\n\n", "peers", ".", "garbageCollect", "(", "&", "pending", ")", "\n", "}" ]
1,438
all-1439
[ "create", "a", "dynect", "client", "and", "performs", "login", ".", "You", "need", "to", "clean", "it", "up", ".", "This", "method", "also", "stores", "the", "DynAPI", "version", ".", "Don", "t", "user", "the", "dynect", ".", "Client", ".", "Login", "()" ]
[ "func", "(", "d", "*", "dynProviderState", ")", "login", "(", ")", "(", "*", "dynect", ".", "Client", ",", "error", ")", "{", "if", "d", ".", "LastLoginErrorTime", "!=", "0", "{", "secondsSinceLastError", ":=", "unixNow", "(", ")", "-", "d", ".", "LastLoginErrorTime", "\n", "if", "secondsSinceLastError", "<", "badLoginMinIntervalSeconds", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "secondsSinceLastError", ")", "\n", "}", "\n", "}", "\n", "client", ":=", "dynect", ".", "NewClient", "(", "d", ".", "CustomerName", ")", "\n\n", "var", "req", "=", "dynect", ".", "LoginBlock", "{", "Username", ":", "d", ".", "Username", ",", "Password", ":", "d", ".", "Password", ",", "CustomerName", ":", "d", ".", "CustomerName", "}", "\n\n", "var", "resp", "dynect", ".", "LoginResponse", "\n\n", "err", ":=", "client", ".", "Do", "(", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "&", "resp", ")", "\n", "if", "err", "!=", "nil", "{", "d", ".", "LastLoginErrorTime", "=", "unixNow", "(", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "d", ".", "LastLoginErrorTime", "=", "0", "\n", "client", ".", "Token", "=", "resp", ".", "Data", ".", "Token", "\n\n", "// this is the only change from the original", "d", ".", "DynVersion", "=", "resp", ".", "Data", ".", "<mask>", "\n", "return", "client", ",", "nil", "\n", "}" ]
1,439
all-1440
[ "FindCharsetInHTML", "looks", "for", "charset", "in", "the", "HTML", "meta", "tag", "(", "v4", ".", "01", "and", "v5", ")", "." ]
[ "func", "FindCharsetInHTML", "(", "html", "string", ")", "string", "{", "charsetMatches", ":=", "metaTagCharsetRegexp", ".", "FindAllStringSubmatch", "(", "<mask>", ",", "-", "1", ")", "\n", "if", "len", "(", "charsetMatches", ")", ">", "0", "{", "return", "charsetMatches", "[", "0", "]", "[", "metaTagCharsetIndex", "]", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
1,440
all-1441
[ "Query", "executes", "a", "query", "." ]
[ "func", "(", "s", "*", "Session", ")", "Query", "(", "stmtID", "uint64", ",", "prmFieldSet", "*", "ParameterFieldSet", ",", "resultFieldSet", "*", "ResultFieldSet", ",", "args", "[", "]", "driver", ".", "NamedValue", ")", "(", "uint64", ",", "*", "FieldValues", ",", "PartAttributes", ",", "error", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "s", ".", "statementID", ".", "id", "=", "&", "stmtID", "\n", "if", "err", ":=", "s", ".", "writeRequest", "(", "mtExecute", ",", "false", ",", "s", ".", "statementID", ",", "newInputParameters", "(", "prmFieldSet", ".", "inputFields", "(", ")", ",", "args", ")", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "var", "rsetID", "uint64", "\n", "fieldValues", ":=", "newFieldValues", "(", ")", "\n\n", "f", ":=", "func", "(", "p", "replyPart", ")", "{", "switch", "p", ":=", "p", ".", "(", "type", ")", "{", "case", "*", "resultsetID", ":", "p", ".", "id", "=", "&", "rsetID", "\n", "<mask>", "*", "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", ",", "err", "\n", "}", "\n\n", "return", "rsetID", ",", "fieldValues", ",", "s", ".", "ph", ".", "partAttributes", ",", "nil", "\n", "}" ]
1,441
all-1442
[ "MetadataAsStringSlice", "parses", "the", "Response", "metadata", "into", "a", "slice", "of", "string" ]
[ "func", "(", "r", "*", "<mask>", ")", "MetadataAsStringSlice", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "sl", ":=", "[", "]", "string", "{", "}", "\n", "err", ":=", "r", ".", "MetadataAsStruct", "(", "&", "sl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "sl", ",", "nil", "\n", "}" ]
1,442
all-1443
[ "Observe", "observes", "an", "event", "for", "given", "id", ".", "It", "returns", "false", "and", "exceeded", "duration", "if", "the", "interval", "is", "longer", "than", "the", "expectation", "." ]
[ "func", "(", "td", "*", "TimeoutDetector", ")", "Observe", "(", "which", "uint64", ")", "(", "bool", ",", "time", ".", "Duration", ")", "{", "td", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "td", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "<mask>", ":=", "true", "\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "exceed", ":=", "time", ".", "Duration", "(", "0", ")", "\n\n", "if", "pt", ",", "found", ":=", "td", ".", "records", "[", "which", "]", ";", "found", "{", "exceed", "=", "now", ".", "Sub", "(", "pt", ")", "-", "td", ".", "maxDuration", "\n", "if", "exceed", ">", "0", "{", "ok", "=", "false", "\n", "}", "\n", "}", "\n", "td", ".", "records", "[", "which", "]", "=", "now", "\n", "return", "ok", ",", "exceed", "\n", "}" ]
1,443
all-1444
[ "Value", "retrieves", "the", "value", "of", "the", "item", "from", "the", "value", "log", ".", "This", "method", "must", "be", "called", "within", "a", "transaction", ".", "Calling", "it", "outside", "a", "transaction", "is", "considered", "undefined", "behavior", ".", "If", "an", "iterator", "is", "being", "used", "then", "Item", ".", "Value", "()", "is", "defined", "in", "the", "current", "iteration", "only", "because", "items", "are", "reused", ".", "If", "you", "need", "to", "use", "a", "value", "outside", "a", "transaction", "please", "use", "Item", ".", "ValueCopy", "instead", "or", "copy", "it", "yourself", ".", "Value", "might", "change", "once", "discard", "or", "commit", "is", "called", ".", "Use", "ValueCopy", "if", "you", "want", "to", "do", "a", "Set", "after", "Get", "." ]
[ "func", "(", "item", "*", "Item", ")", "Value", "(", "fn", "func", "(", "val", "[", "]", "byte", ")", "error", ")", "error", "{", "item", ".", "wg", ".", "Wait", "(", ")", "\n", "if", "item", ".", "<mask>", "==", "prefetched", "{", "if", "item", ".", "err", "==", "nil", "&&", "fn", "!=", "nil", "{", "if", "err", ":=", "fn", "(", "item", ".", "val", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "item", ".", "err", "\n", "}", "\n", "buf", ",", "cb", ",", "err", ":=", "item", ".", "yieldItemValue", "(", ")", "\n", "defer", "runCallback", "(", "cb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "fn", "!=", "nil", "{", "return", "fn", "(", "buf", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,444
all-1445
[ "Exec", "executes", "the", "disposeCommand", "." ]
[ "func", "(", "c", "*", "disposeCommand", ")", "Exec", "(", "indexOffset", "int", ")", "error", "{", "c", ".", "<mask>", ".", "image", ".", "Dispose", "(", ")", "\n", "return", "nil", "\n", "}" ]
1,445
all-1446
[ "HasShared", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Screenboard", ")", "HasShared", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Shared", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
1,446
all-1447
[ "Close", "stops", "all", "servers", "by", "calling", "Close", "method", "on", "each", "of", "them", "." ]
[ "func", "(", "s", "*", "Servers", ")", "Close", "(", ")", "{", "wg", ":=", "&", "sync", ".", "WaitGroup", "{", "}", "\n", "for", "_", ",", "srv", ":=", "range", "s", ".", "servers", "{", "wg", ".", "Add", "(", "1", ")", "\n", "<mask>", "func", "(", "srv", "*", "server", ")", "{", "defer", "s", ".", "recover", "(", ")", "\n", "defer", "wg", ".", "Done", "(", ")", "\n\n", "s", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ")", "\n", "if", "err", ":=", "srv", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "err", ")", "\n", "}", "\n", "}", "(", "srv", ")", "\n", "}", "\n", "wg", ".", "Wait", "(", ")", "\n", "return", "\n", "}" ]
1,447
all-1448
[ "Do", "executes", "ServiceWorker", ".", "setForceUpdateOnPageLoad", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetForceUpdateOnPageLoadParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetForceUpdateOnPageLoad", ",", "p", ",", "nil", ")", "\n", "}" ]
1,448
all-1449
[ "StartMockServersOnNetwork", "creates", "mock", "servers", "on", "either", "tcp", "or", "unix", "sockets", "." ]
[ "func", "StartMockServersOnNetwork", "(", "count", "int", ",", "network", "string", ")", "(", "ms", "*", "MockServers", ",", "err", "error", ")", "{", "switch", "network", "{", "case", "\"", "\"", ":", "return", "startMockServersTcp", "(", "count", ")", "\n", "case", "\"", "\"", ":", "return", "startMockServersUnix", "(", "count", ")", "\n", "<mask>", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "network", ")", "\n", "}", "\n", "}" ]
1,449
all-1450
[ "expandCustomizationGuiUnattended", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "CustomizationGuiUnattended", "." ]
[ "func", "expandCustomizationGuiUnattended", "(", "d", "*", "schema", ".", "ResourceData", ")", "types", ".", "CustomizationGuiUnattended", "{", "obj", ":=", "types", ".", "CustomizationGuiUnattended", "{", "TimeZone", ":", "int32", "(", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "AutoLogon", ":", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "bool", ")", ",", "AutoLogonCount", ":", "int32", "(", "d", ".", "Get", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOk", "(", "cWindowsKeyPrefix", "+", "\"", "\"", "+", "\"", "\"", ")", ";", "<mask>", "{", "obj", ".", "Password", "=", "&", "types", ".", "CustomizationPassword", "{", "Value", ":", "v", ".", "(", "string", ")", ",", "PlainText", ":", "true", ",", "}", "\n", "}", "\n\n", "return", "obj", "\n", "}" ]
1,450
all-1451
[ "lookupDockerUser", "looks", "up", "users", "given", "the", "argument", "to", "a", "Dockerfile", "USER", "directive", ".", "According", "to", "Docker", "s", "docs", "this", "directive", "looks", "like", ":", "USER", "<user", ">", "[", ":", "<group", ">", "]", "or", "USER", "<UID", ">", "[", ":", "<GID", ">", "]" ]
[ "func", "lookupDockerUser", "(", "userArg", "string", ")", "(", "_", "*", "user", ".", "User", ",", "retErr", "error", ")", "{", "userParts", ":=", "strings", ".", "Split", "(", "userArg", ",", "\"", "\"", ")", "\n", "userOrUID", ":=", "userParts", "[", "0", "]", "\n", "groupOrGID", ":=", "\"", "\"", "\n", "if", "len", "(", "userParts", ")", ">", "1", "{", "groupOrGID", "=", "userParts", "[", "1", "]", "\n", "}", "\n", "passwd", ",", "err", ":=", "os", ".", "Open", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "passwd", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "passwd", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "scanner", ".", "Text", "(", ")", ",", "\"", "\"", ")", "\n", "if", "parts", "[", "0", "]", "==", "userOrUID", "||", "parts", "[", "2", "]", "==", "userOrUID", "{", "result", ":=", "&", "user", ".", "User", "{", "Username", ":", "parts", "[", "0", "]", ",", "Uid", ":", "parts", "[", "2", "]", ",", "Gid", ":", "parts", "[", "3", "]", ",", "Name", ":", "parts", "[", "4", "]", ",", "HomeDir", ":", "parts", "[", "5", "]", ",", "}", "\n", "if", "groupOrGID", "!=", "\"", "\"", "{", "if", "parts", "[", "0", "]", "==", "userOrUID", "{", "// groupOrGid is a group", "group", ",", "err", ":=", "lookupGroup", "(", "groupOrGID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "<mask>", ".", "Gid", "=", "group", ".", "Gid", "\n", "}", "else", "{", "// groupOrGid is a gid", "result", ".", "Gid", "=", "groupOrGID", "\n", "}", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "scanner", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "userArg", ")", "\n", "}" ]
1,451
all-1452
[ "title", ":", "profile", "index", "handler", "path", ":", "/", "debug", "/", "pprof", "method", ":", "GET", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized" ]
[ "func", "indexHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermDebug", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "pprof", ".", "Index", "(", "w", ",", "r", ")", "\n", "return", "nil", "\n", "}" ]
1,452
all-1453
[ "flattenVirtualMachineConfigInfo", "reads", "various", "fields", "from", "a", "VirtualMachineConfigInfo", "into", "the", "passed", "in", "ResourceData", ".", "This", "is", "the", "flatten", "counterpart", "to", "expandVirtualMachineConfigSpec", "." ]
[ "func", "flattenVirtualMachineConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "VirtualMachineConfigInfo", ")", "error", "{", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Name", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "GuestId", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "AlternateGuestName", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Annotation", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Hardware", ".", "NumCPU", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Hardware", ".", "NumCoresPerSocket", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Hardware", ".", "MemoryMB", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "MemoryHotAddEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "CpuHotAddEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "CpuHotRemoveEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "SwapPlacement", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "Firmware", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "NestedHVEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "VPMCEnabled", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "ChangeVersion", ")", "\n", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "Uuid", ")", "\n\n", "if", "err", ":=", "flattenToolsConfigInfo", "(", "d", ",", "obj", ".", "Tools", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVirtualMachineFlagInfo", "(", "d", ",", "&", "obj", ".", "Flags", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVirtualMachineResourceAllocation", "(", "d", ",", "obj", ".", "CpuAllocation", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVirtualMachineResourceAllocation", "(", "d", ",", "obj", ".", "MemoryAllocation", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenExtraConfig", "(", "d", ",", "obj", ".", "ExtraConfig", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVAppConfig", "(", "d", ",", "obj", ".", "VAppConfig", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenLatencySensitivity", "(", "d", ",", "obj", ".", "LatencySensitivity", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// This method does not operate any different than the above method but we", "// return its error result directly to ensure there are no warnings in the", "// linter. It's awkward, but golint does not allow setting exceptions.", "return", "flattenVirtualMachineBootOptions", "(", "d", ",", "obj", ".", "BootOptions", ")", "\n", "}" ]
1,453
all-1454
[ "Description", "returns", "user", "defined", "description", "for", "the", "snapshot", "." ]
[ "func", "(", "s", "*", "Snapshot", ")", "Description", "(", ")", "(", "string", ",", "error", ")", "{", "<mask>", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "var", "desc", "*", "C", ".", "char", "\n\n", "err", "=", "C", ".", "get_property", "(", "s", ".", "handle", ",", "C", ".", "VIX_PROPERTY_SNAPSHOT_DESCRIPTION", ",", "unsafe", ".", "Pointer", "(", "&", "desc", ")", ")", "\n\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "desc", ")", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "\"", "\"", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "C", ".", "GoString", "(", "desc", ")", ",", "nil", "\n", "}" ]
1,454
all-1455
[ "min", "tests", "whether", "a", "variable", "value", "is", "larger", "or", "equal", "to", "a", "given", "number", ".", "For", "number", "types", "it", "s", "a", "simple", "lesser", "-", "than", "test", ";", "for", "strings", "it", "tests", "the", "number", "of", "characters", "whereas", "for", "maps", "and", "slices", "it", "tests", "the", "number", "of", "items", "." ]
[ "func", "hasMinOf", "(", "top", "interface", "{", "}", ",", "current", "interface", "{", "}", ",", "<mask>", "interface", "{", "}", ",", "param", "string", ")", "bool", "{", "return", "isGte", "(", "top", ",", "current", ",", "field", ",", "param", ")", "\n", "}" ]
1,455
all-1456
[ "ChompRightF", "is", "the", "filter", "form", "of", "ChompRight", "." ]
[ "func", "ChompRightF", "(", "suffix", "string", ")", "func", "(", "string", ")", "string", "{", "return", "func", "(", "s", "<mask>", ")", "string", "{", "return", "ChompRight", "(", "s", ",", "suffix", ")", "\n", "}", "\n", "}" ]
1,456
all-1457
[ "handleReviewEvent", "should", "only", "handle", "reviews", "that", "have", "no", "approval", "command", ".", "Reviews", "with", "approval", "commands", "will", "be", "handled", "by", "handleGenericCommentEvent", "." ]
[ "func", "handleReviewEvent", "(", "pc", "plugins", ".", "Agent", ",", "re", "github", ".", "ReviewEvent", ")", "error", "{", "return", "handleReview", "(", "<mask>", ".", "Logger", ",", "pc", ".", "GitHubClient", ",", "pc", ".", "OwnersClient", ",", "pc", ".", "Config", ".", "GitHubOptions", ",", "pc", ".", "PluginConfig", ",", "&", "re", ",", ")", "\n", "}" ]
1,457
all-1458
[ "Sign", "adds", "the", "username", "and", "password", "authorization", "cookies", "to", "the", "request", ".", "Checks", "the", "freshness", "of", "the", "session", "and", "creates", "a", "new", "one", "if", "needed", "." ]
[ "func", "(", "s", "*", "cookieSigner", ")", "Sign", "(", "req", "*", "http", ".", "<mask>", ")", "error", "{", "if", "time", ".", "Now", "(", ")", ".", "After", "(", "s", ".", "refreshAt", ")", "{", "authReq", ",", "authErr", ":=", "s", ".", "builder", ".", "BuildLoginRequest", "(", "s", ".", "host", ")", "\n", "if", "authErr", "!=", "nil", "{", "return", "authErr", "\n", "}", "\n", "resp", ",", "err", ":=", "s", ".", "client", ".", "DoHidden", "(", "authReq", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "url", ",", "err", ":=", "extractRedirectURL", "(", "resp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "url", "!=", "nil", "{", "authReq", ",", "authErr", "=", "s", ".", "builder", ".", "BuildLoginRequest", "(", "url", ".", "Host", ")", "\n", "if", "authErr", "!=", "nil", "{", "return", "authErr", "\n", "}", "\n", "s", ".", "host", "=", "url", ".", "Host", "\n", "req", ".", "Host", "=", "url", ".", "Host", "\n", "req", ".", "URL", ".", "Host", "=", "url", ".", "Host", "\n", "resp", ",", "err", "=", "s", ".", "client", ".", "DoHidden", "(", "authReq", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "s", ".", "refresh", "(", "resp", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "for", "_", ",", "c", ":=", "range", "s", ".", "cookies", "{", "req", ".", "AddCookie", "(", "c", ")", "\n", "}", "\n", "req", ".", "Header", ".", "Set", "(", "\"", "\"", ",", "strconv", ".", "Itoa", "(", "s", ".", "accountID", ")", ")", "\n", "return", "nil", "\n", "}" ]
1,458
all-1459
[ "ListBranch", "lists", "the", "active", "branches", "on", "a", "Repo", "." ]
[ "func", "(", "c", "APIClient", ")", "ListBranch", "(", "repoName", "string", ")", "(", "[", "]", "*", "pfs", ".", "BranchInfo", ",", "<mask>", ")", "{", "branchInfos", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "ListBranch", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pfs", ".", "ListBranchRequest", "{", "Repo", ":", "NewRepo", "(", "repoName", ")", ",", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "branchInfos", ".", "BranchInfo", ",", "nil", "\n", "}" ]
1,459
all-1460
[ "Gauge", "fetches", "an", "instrument", "from", "the", "registry", "or", "creates", "a", "new", "one", ".", "If", "another", "instrument", "type", "is", "already", "registered", "with", "the", "same", "name", "/", "tags", "a", "blank", "one", "will", "be", "returned", "and", "an", "error", "will", "be", "logged", "to", "the", "Errors", "()", "channel", "." ]
[ "func", "(", "r", "*", "Registry", ")", "Gauge", "(", "<mask>", "string", ",", "tags", "[", "]", "string", ")", "*", "Gauge", "{", "return", "r", ".", "fetchGauge", "(", "name", ",", "tags", ",", "newGauge", ")", "\n", "}" ]
1,460
all-1461
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetResponseBodyReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoFetch4", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
1,461
all-1462
[ "RateLimit", "is", "a", "Gin", "middleware", "for", "rate", "limitting", "incoming", "requests", "based", "on", "the", "client", "s", "IP", "address", ".", "The", "resulting", "middleware", "will", "use", "the", "client", "to", "talk", "to", "the", "Redis", "server", ".", "The", "hasher", "is", "used", "to", "keep", "track", "of", "counters", "and", "to", "provide", "an", "estimate", "of", "when", "the", "client", "should", "be", "able", "to", "do", "requests", "again", ".", "The", "limit", "per", "period", "is", "defined", "by", "the", "max", ".", "Response", "format", "Once", "a", "client", "reaches", "the", "imposed", "limit", "they", "will", "receive", "a", "JSON", "response", "similar", "to", "the", "following", ":", "{", "messages", ":", "[", "Rate", "limit", "exceeded", ".", "Try", "again", "in", "1", "minute", "from", "now", "]", "status", ":", "error", "}" ]
[ "func", "RateLimit", "(", "client", "*", "redis", ".", "Client", ",", "hasher", "speedbump", ".", "RateHasher", ",", "max", "int64", ")", "gin", ".", "HandlerFunc", "{", "limiter", ":=", "speedbump", ".", "NewLimiter", "(", "<mask>", ",", "hasher", ",", "max", ")", "\n\n", "return", "func", "(", "c", "*", "gin", ".", "Context", ")", "{", "// Attempt to perform the request", "ip", ",", "_", ",", "_", ":=", "net", ".", "SplitHostPort", "(", "c", ".", "Request", ".", "RemoteAddr", ")", "\n", "ok", ",", "err", ":=", "limiter", ".", "Attempt", "(", "ip", ")", "\n\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "if", "!", "ok", "{", "nextTime", ":=", "time", ".", "Now", "(", ")", ".", "Add", "(", "hasher", ".", "Duration", "(", ")", ")", "\n\n", "c", ".", "JSON", "(", "429", ",", "gin", ".", "H", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "[", "]", "string", "{", "\"", "\"", "+", "humanize", ".", "Time", "(", "nextTime", ")", "}", ",", "}", ")", "\n", "c", ".", "Abort", "(", ")", "\n", "}", "\n\n", "c", ".", "Next", "(", ")", "\n\n", "// After the request", "// log.Print(ip + \" was limited because it exceeded the max rate\")", "}", "\n", "}" ]
1,462
all-1463
[ "ID", "generates", "a", "base64", "encoded", "URL", "safe", "unique", "ID", "using", "crypto", "/", "rand", ".", "This", "is", "a", "cryptographically", "secure", "pseudorandom", "number", "presented", "as", "an", "unpadded", "base64", "encoded", "string", ".", "bits", "should", "be", "a", "multiple", "of", "8", ".", "Lenght", "of", "generated", "string", "will", "be", "ceiling", "(", "bits", "*", "4", "/", "24", ")" ]
[ "func", "ID", "(", "bits", "int", ")", "(", "string", ",", "error", ")", "{", "if", "math", ".", "Mod", "(", "float64", "(", "bits", ")", ",", "8", ")", "!=", "0", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "b", ":=", "make", "(", "[", "]", "<mask>", ",", "bits", "/", "8", ")", "\n", "if", "_", ",", "err", ":=", "rand", ".", "Read", "(", "b", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "base64", ".", "RawURLEncoding", ".", "EncodeToString", "(", "b", ")", ",", "nil", "\n", "}" ]
1,463
all-1464
[ "Go", "is", "much", "like", "go", ":", "it", "runs", "a", "function", "in", "a", "newly", "spawned", "goroutine", ".", "The", "neat", "part", "of", "Go", "is", "that", "it", "provides", "Process", "object", "to", "communicate", "between", "the", "function", "and", "the", "outside", "world", ".", "Thus", "callers", "can", "easily", "WaitFor", "or", "Close", "the", "function", ".", "It", "is", "the", "function", "s", "responsibility", "to", "respect", "the", "Closing", "of", "its", "Process", "namely", "it", "should", "exit", "(", "return", ")", "when", "<", "-", "Closing", "()", "is", "ready", ".", "It", "is", "simply", ":", "func", "Go", "(", "f", "ProcessFunc", ")", "Process", "{", "p", ":", "=", "WithParent", "(", "Background", "()", ")", "p", ".", "Go", "(", "f", ")", "return", "p", "}", "Note", "that", "a", "naive", "implementation", "of", "Go", "like", "the", "following", "would", "not", "work", ":", "func", "Go", "(", "f", "ProcessFunc", ")", "Process", "{", "return", "Background", "()", ".", "Go", "(", "f", ")", "}", "This", "is", "because", "having", "the", "process", "you" ]
[ "func", "Go", "(", "f", "ProcessFunc", ")", "<mask>", "{", "// return GoChild(Background(), f)", "// we use two processes, one for communication, and", "// one for ensuring we wait on the function (unclosable from the outside).", "p", ":=", "newProcess", "(", "nil", ")", "\n", "waitFor", ":=", "newProcess", "(", "nil", ")", "\n", "p", ".", "WaitFor", "(", "waitFor", ")", "// prevent p from closing", "\n", "go", "func", "(", ")", "{", "f", "(", "p", ")", "\n", "waitFor", ".", "Close", "(", ")", "// allow p to close.", "\n", "p", ".", "Close", "(", ")", "// ensure p closes.", "\n", "}", "(", ")", "\n", "return", "p", "\n", "}" ]
1,464
all-1465
[ "GetEncodedResponse", "returns", "the", "response", "body", "and", "size", "if", "it", "were", "re", "-", "encoded", "with", "the", "specified", "settings", ".", "Only", "applies", "to", "images", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Audits#method", "-", "getEncodedResponse", "parameters", ":", "requestID", "-", "Identifier", "of", "the", "network", "request", "to", "get", "content", "for", ".", "encoding", "-", "The", "encoding", "to", "use", "." ]
[ "func", "GetEncodedResponse", "(", "requestID", "<mask>", ".", "RequestID", ",", "encoding", "GetEncodedResponseEncoding", ")", "*", "GetEncodedResponseParams", "{", "return", "&", "GetEncodedResponseParams", "{", "RequestID", ":", "requestID", ",", "Encoding", ":", "encoding", ",", "}", "\n", "}" ]
1,465
all-1466
[ "SetHost", "sets", "host", "for", "the", "uri", "." ]
[ "func", "(", "u", "*", "URI", ")", "SetHost", "(", "<mask>", "string", ")", "{", "u", ".", "host", "=", "append", "(", "u", ".", "host", "[", ":", "0", "]", ",", "host", "...", ")", "\n", "lowercaseBytes", "(", "u", ".", "host", ")", "\n", "}" ]
1,466
all-1467
[ "HandleFunc", "registers", "the", "handler", "function", "for", "the", "given", "pattern", "." ]
[ "func", "(", "mux", "*", "LoggingServeMux", ")", "HandleFunc", "(", "pattern", "string", ",", "handler", "func", "(", "http", ".", "ResponseWriter", ",", "*", "http", ".", "<mask>", ")", ")", "{", "mux", ".", "serveMux", ".", "Handle", "(", "pattern", ",", "http", ".", "HandlerFunc", "(", "handler", ")", ")", "\n", "}" ]
1,467
all-1468
[ "validateNoIPCollisions", "ensures", "no", "conflicts", "between", "the", "host", "s", "network", "interfaces", "and", "the", "vbox", "host", "-", "only", "network", "that", "will", "be", "used", "for", "machine", "vm", "instances", "." ]
[ "func", "validateNoIPCollisions", "(", "hif", "HostInterfaces", ",", "hostOnlyNet", "*", "<mask>", ".", "IPNet", ",", "currHostOnlyNets", "map", "[", "string", "]", "*", "hostOnlyNetwork", ")", "error", "{", "hostOnlyByCIDR", ":=", "map", "[", "string", "]", "*", "hostOnlyNetwork", "{", "}", "\n", "//listHostOnlyAdapters returns a map w/ virtualbox net names as key. Rekey to CIDRs", "for", "_", ",", "n", ":=", "range", "currHostOnlyNets", "{", "ipnet", ":=", "net", ".", "IPNet", "{", "IP", ":", "n", ".", "IPv4", ".", "IP", ",", "Mask", ":", "n", ".", "IPv4", ".", "Mask", "}", "\n", "hostOnlyByCIDR", "[", "ipnet", ".", "String", "(", ")", "]", "=", "n", "\n", "}", "\n\n", "m", ",", "err", ":=", "listHostInterfaces", "(", "hif", ",", "hostOnlyByCIDR", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "collision", ",", "err", ":=", "checkIPNetCollision", "(", "hostOnlyNet", ",", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "collision", "{", "return", "ErrNetworkAddrCollision", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,468
all-1469
[ "RemoveENIAttachment", "removes", "the", "eni", "from", "state", "and", "stop", "managing" ]
[ "func", "(", "state", "*", "DockerTaskEngineState", ")", "RemoveENIAttachment", "(", "mac", "string", ")", "{", "if", "mac", "==", "\"", "\"", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "state", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "state", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "ok", ":=", "state", ".", "eniAttachments", "[", "mac", "]", ";", "ok", "{", "delete", "(", "state", ".", "eniAttachments", ",", "mac", ")", "\n", "}", "else", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "mac", ")", "\n", "}", "\n", "}" ]
1,469
all-1470
[ "NetworkErrored", "sets", "the", "state", "of", "the", "given", "network", "to", "Errored", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NetworkErrored", "(", "name", "string", ")", "error", "{", "return", "c", ".", "networkState", "(", "<mask>", ",", "networkErrored", ")", "\n", "}" ]
1,470
all-1471
[ "ServeHTTP", "adds", "compression", "to", "the", "original", "http", ".", "Handler", "s", "ServeHTTP", "()", "method", "." ]
[ "func", "(", "c", "CompressionHandler", ")", "ServeHTTP", "(", "<mask>", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "compWriter", ":=", "newCompressedResponseWriter", "(", "writer", ",", "req", ")", "\n", "c", ".", "Handler", ".", "ServeHTTP", "(", "compWriter", ",", "req", ")", "\n", "compWriter", ".", "Close", "(", ")", "\n", "}" ]
1,471
all-1472
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Module", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,472
all-1473
[ "goFileInfo", "returns", "information", "about", "a", ".", "go", "file", ".", "It", "will", "parse", "part", "of", "the", "file", "to", "determine", "the", "package", "name", "imports", "and", "build", "constraints", ".", "If", "the", "file", "can", "t", "be", "read", "an", "error", "will", "be", "logged", "and", "partial", "information", "will", "be", "returned", ".", "This", "function", "is", "intended", "to", "match", "go", "/", "build", ".", "Context", ".", "Import", ".", "TODD", "(", "#53", ")", ":", "extract", "canonical", "import", "path" ]
[ "func", "goFileInfo", "(", "path", ",", "rel", "string", ")", "fileInfo", "{", "info", ":=", "fileNameInfo", "(", "path", ")", "\n", "fset", ":=", "token", ".", "NewFileSet", "(", ")", "\n", "pf", ",", "err", ":=", "parser", ".", "ParseFile", "(", "fset", ",", "info", ".", "path", ",", "nil", ",", "parser", ".", "ImportsOnly", "|", "parser", ".", "ParseComments", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "info", ".", "path", ",", "err", ")", "\n", "return", "info", "\n", "}", "\n\n", "info", ".", "packageName", "=", "pf", ".", "Name", ".", "Name", "\n", "if", "info", ".", "isTest", "&&", "strings", ".", "HasSuffix", "(", "info", ".", "packageName", ",", "\"", "\"", ")", "{", "info", ".", "packageName", "=", "info", ".", "packageName", "[", ":", "len", "(", "info", ".", "packageName", ")", "-", "len", "(", "\"", "\"", ")", "]", "\n", "}", "\n\n", "for", "_", ",", "decl", ":=", "range", "pf", ".", "Decls", "{", "d", ",", "ok", ":=", "decl", ".", "(", "*", "ast", ".", "GenDecl", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "for", "_", ",", "dspec", ":=", "range", "d", ".", "Specs", "{", "spec", ",", "ok", ":=", "dspec", ".", "(", "*", "ast", ".", "ImportSpec", ")", "\n", "if", "!", "ok", "{", "continue", "\n", "}", "\n", "quoted", ":=", "spec", ".", "Path", ".", "Value", "\n", "path", ",", "err", ":=", "strconv", ".", "Unquote", "(", "quoted", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "info", ".", "path", ",", "err", ")", "\n", "continue", "\n", "}", "\n\n", "if", "path", "==", "\"", "\"", "{", "if", "<mask>", ".", "isTest", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "info", ".", "path", ")", "\n", "}", "\n", "info", ".", "isCgo", "=", "true", "\n", "cg", ":=", "spec", ".", "Doc", "\n", "if", "cg", "==", "nil", "&&", "len", "(", "d", ".", "Specs", ")", "==", "1", "{", "cg", "=", "d", ".", "Doc", "\n", "}", "\n", "if", "cg", "!=", "nil", "{", "if", "err", ":=", "saveCgo", "(", "&", "info", ",", "rel", ",", "cg", ")", ";", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "info", ".", "path", ",", "err", ")", "\n", "}", "\n", "}", "\n", "continue", "\n", "}", "\n", "info", ".", "imports", "=", "append", "(", "info", ".", "imports", ",", "path", ")", "\n", "}", "\n", "}", "\n\n", "tags", ",", "err", ":=", "readTags", "(", "info", ".", "path", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "info", ".", "path", ",", "err", ")", "\n", "return", "info", "\n", "}", "\n", "info", ".", "tags", "=", "tags", "\n\n", "return", "info", "\n", "}" ]
1,473
all-1474
[ "Build", "is", "called", "initially", "when", "creating", "ccBalancerWrapper", ".", "grpc", ".", "Dial", "is", "called", "to", "this", "client", "connection", ".", "Then", "resolved", "addresses", "will", "be", "handled", "via", "HandleResolvedAddrs", "." ]
[ "func", "(", "b", "*", "builder", ")", "Build", "(", "cc", "balancer", ".", "ClientConn", ",", "opt", "balancer", ".", "BuildOptions", ")", "balancer", ".", "Balancer", "{", "bb", ":=", "&", "baseBalancer", "{", "id", ":", "strconv", ".", "FormatInt", "(", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ",", "36", ")", ",", "policy", ":", "b", ".", "cfg", ".", "Policy", ",", "name", ":", "b", ".", "cfg", ".", "Name", ",", "lg", ":", "b", ".", "cfg", ".", "Logger", ",", "addrToSc", ":", "make", "(", "map", "[", "resolver", ".", "Address", "]", "balancer", ".", "SubConn", ")", ",", "scToAddr", ":", "make", "(", "<mask>", "[", "balancer", ".", "SubConn", "]", "resolver", ".", "Address", ")", ",", "scToSt", ":", "make", "(", "map", "[", "balancer", ".", "SubConn", "]", "connectivity", ".", "State", ")", ",", "currentConn", ":", "nil", ",", "csEvltr", ":", "&", "connectivityStateEvaluator", "{", "}", ",", "// initialize picker always returns \"ErrNoSubConnAvailable\"", "Picker", ":", "picker", ".", "NewErr", "(", "balancer", ".", "ErrNoSubConnAvailable", ")", ",", "}", "\n", "if", "bb", ".", "lg", "==", "nil", "{", "bb", ".", "lg", "=", "zap", ".", "NewNop", "(", ")", "\n", "}", "\n\n", "// TODO: support multiple connections", "bb", ".", "mu", ".", "Lock", "(", ")", "\n", "bb", ".", "currentConn", "=", "cc", "\n", "bb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "bb", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "id", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "policy", ".", "String", "(", ")", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "cc", ".", "Target", "(", ")", ")", ",", ")", "\n", "return", "bb", "\n", "}" ]
1,474
all-1475
[ "Update", "updates", "the", "metadata", "file", "after", "container", "starts", "and", "dynamic", "metadata", "is", "available" ]
[ "func", "(", "manager", "*", "metadataManager", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "dockerID", "string", ",", "task", "*", "apitask", ".", "Task", ",", "containerName", "string", ")", "error", "{", "// Get docker container information through api call", "dockerContainer", ",", "err", ":=", "manager", ".", "client", ".", "InspectContainer", "(", "ctx", ",", "dockerID", ",", "dockerclient", ".", "InspectContainerTimeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Ensure we do not update a container that is invalid or is not running", "if", "dockerContainer", "==", "nil", "||", "!", "dockerContainer", ".", "State", ".", "Running", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "containerName", ",", "task", ".", "Arn", ")", "\n", "}", "\n\n", "// Acquire the metadata then write it in JSON format to the file", "metadata", ":=", "manager", ".", "parseMetadata", "(", "dockerContainer", ",", "task", ",", "containerName", ")", "\n", "return", "manager", ".", "marshalAndWrite", "(", "metadata", ",", "<mask>", ".", "Arn", ",", "containerName", ")", "\n", "}" ]
1,475
all-1476
[ "Equals", "returns", "true", "if", "other", "is", "equivalent", "to", "a" ]
[ "func", "(", "a", "Asset", ")", "Equals", "(", "other", "Asset", ")", "bool", "{", "if", "a", ".", "Type", "!=", "other", ".", "Type", "{", "return", "false", "\n", "}", "\n", "switch", "a", ".", "Type", "{", "<mask>", "AssetTypeAssetTypeNative", ":", "return", "true", "\n", "case", "AssetTypeAssetTypeCreditAlphanum4", ":", "l", ":=", "a", ".", "MustAlphaNum4", "(", ")", "\n", "r", ":=", "other", ".", "MustAlphaNum4", "(", ")", "\n", "return", "l", ".", "AssetCode", "==", "r", ".", "AssetCode", "&&", "l", ".", "Issuer", ".", "Equals", "(", "r", ".", "Issuer", ")", "\n", "case", "AssetTypeAssetTypeCreditAlphanum12", ":", "l", ":=", "a", ".", "MustAlphaNum12", "(", ")", "\n", "r", ":=", "other", ".", "MustAlphaNum12", "(", ")", "\n", "return", "l", ".", "AssetCode", "==", "r", ".", "AssetCode", "&&", "l", ".", "Issuer", ".", "Equals", "(", "r", ".", "Issuer", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "a", ".", "Type", ")", ")", "\n", "}", "\n", "}" ]
1,476
all-1477
[ "Delete", "takes", "name", "of", "the", "app", "and", "deletes", "it", ".", "Returns", "an", "error", "if", "one", "occurs", "." ]
[ "func", "(", "c", "*", "apps", ")", "Delete", "(", "name", "string", ",", "options", "*", "meta_v1", ".", "DeleteOptions", ")", "error", "{", "return", "c", ".", "<mask>", ".", "Delete", "(", ")", ".", "Namespace", "(", "c", ".", "ns", ")", ".", "Resource", "(", "\"", "\"", ")", ".", "Name", "(", "name", ")", ".", "Body", "(", "options", ")", ".", "Do", "(", ")", ".", "Error", "(", ")", "\n", "}" ]
1,477
all-1478
[ "OCI1FromManifest", "creates", "an", "OCI1", "manifest", "instance", "from", "a", "manifest", "blob", "." ]
[ "func", "OCI1FromManifest", "(", "manifest", "[", "]", "<mask>", ")", "(", "*", "OCI1", ",", "error", ")", "{", "oci1", ":=", "OCI1", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "manifest", ",", "&", "oci1", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "oci1", ",", "nil", "\n", "}" ]
1,478
all-1479
[ "Enumerate", "peeks", "at", "each", "element", "of", "this", "queue", "without", "mutating", "it", "." ]
[ "func", "(", "q", "*", "Queue", ")", "Enumerate", "(", "cancel", "<-", "chan", "struct", "{", "}", ")", "Enumerator", "{", "q", ".", "key", ".", "RLock", "(", ")", "\n", "defer", "q", ".", "<mask>", ".", "RUnlock", "(", ")", "\n", "return", "q", ".", "underlyer", ".", "Enumerate", "(", "cancel", ")", "\n", "}" ]
1,479
all-1480
[ "SeekAnimations", "seek", "a", "set", "of", "animations", "to", "a", "particular", "time", "within", "each", "animation", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Animation#method", "-", "seekAnimations", "parameters", ":", "animations", "-", "List", "of", "animation", "ids", "to", "seek", ".", "currentTime", "-", "Set", "the", "current", "time", "of", "each", "animation", "." ]
[ "func", "SeekAnimations", "(", "animations", "[", "]", "<mask>", ",", "currentTime", "float64", ")", "*", "SeekAnimationsParams", "{", "return", "&", "SeekAnimationsParams", "{", "Animations", ":", "animations", ",", "CurrentTime", ":", "currentTime", ",", "}", "\n", "}" ]
1,480
all-1481
[ "OperationAdd", "adds", "a", "new", "operations", "to", "the", "table", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "OperationAdd", "(", "project", ",", "uuid", "string", ",", "typ", "OperationType", ")", "(", "int64", ",", "error", ")", "{", "var", "projectID", "interface", "{", "}", "\n\n", "if", "project", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "projectID", ",", "err", "=", "c", ".", "ProjectID", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "{", "projectID", "=", "nil", "\n", "}", "\n\n", "columns", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", "\n", "values", ":=", "[", "]", "interface", "{", "}", "{", "uuid", ",", "c", ".", "nodeID", ",", "typ", ",", "projectID", "}", "\n", "return", "query", ".", "UpsertObject", "(", "c", ".", "tx", ",", "\"", "\"", ",", "columns", ",", "values", ")", "\n", "}" ]
1,481
all-1482
[ "warnDeprecated", "prints", "a", "deprecation", "warning", "for", "a", "particular", "configuration", "option", "." ]
[ "func", "warnDeprecated", "(", "last", "*", "time", ".", "Time", ",", "freq", "time", ".", "Duration", ",", "msg", "string", ")", "{", "// have we warned within the last freq?", "warnLock", ".", "RLock", "(", ")", "\n", "fresh", ":=", "time", ".", "Now", "(", ")", ".", "Sub", "(", "*", "last", ")", "<=", "freq", "\n", "warnLock", ".", "RUnlock", "(", ")", "\n", "if", "fresh", "{", "// we've warned recently", "return", "\n", "}", "\n", "// Warning is stale, will we win the race to warn?", "warnLock", ".", "Lock", "(", ")", "\n", "defer", "warnLock", ".", "Unlock", "(", ")", "\n", "now", ":=", "time", ".", "Now", "(", ")", "// Recalculate now, we might wait awhile for the lock", "\n", "if", "<mask>", ".", "Sub", "(", "*", "last", ")", "<=", "freq", "{", "// Nope, we lost", "return", "\n", "}", "\n", "*", "last", "=", "now", "\n", "logrus", ".", "Warn", "(", "msg", ")", "\n", "}" ]
1,482
all-1483
[ "UpdateRepoLabel", "updates", "a", "org", "/", "repo", "label", "to", "new", "name", "description", "and", "color", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "labels", "/", "#update", "-", "a", "-", "label" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateRepoLabel", "(", "org", ",", "repo", ",", "label", ",", "newName", ",", "description", ",", "color", "string", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "label", ",", "newName", ",", "color", ")", "\n", "_", ",", "err", ":=", "c", ".", "<mask>", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPatch", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "label", ")", ",", "accept", ":", "\"", "\"", ",", "// allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview/", "requestBody", ":", "Label", "{", "Name", ":", "newName", ",", "Description", ":", "description", ",", "Color", ":", "color", "}", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
1,483
all-1484
[ "calculateComputedPolicy", "is", "a", "utility", "function", "to", "compute", "a", "map", "of", "state", "attributes", "for", "the", "port", "group", "s", "effective", "policy", ".", "It", "uses", "a", "bit", "of", "a", "roundabout", "way", "to", "set", "the", "attributes", "but", "allows", "us", "to", "utilize", "our", "functional", "deep", "reading", "helpers", "to", "perform", "this", "task", "versus", "having", "to", "re", "-", "write", "code", ".", "This", "function", "relies", "a", "bit", "on", "some", "of", "the", "lower", "-", "level", "utility", "functionality", "of", "helper", "/", "schema", "so", "it", "may", "need", "to", "change", "in", "the", "future", "." ]
[ "func", "calculateComputedPolicy", "(", "policy", "types", ".", "HostNetworkPolicy", ")", "(", "<mask>", "[", "string", "]", "string", ",", "error", ")", "{", "cpr", ":=", "&", "schema", ".", "Resource", "{", "Schema", ":", "schemaHostNetworkPolicy", "(", ")", "}", "\n", "cpd", ":=", "cpr", ".", "Data", "(", "&", "terraform", ".", "InstanceState", "{", "}", ")", "\n", "cpd", ".", "SetId", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "flattenHostNetworkPolicy", "(", "cpd", ",", "&", "policy", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "cpm", ":=", "cpd", ".", "State", "(", ")", ".", "Attributes", "\n", "delete", "(", "cpm", ",", "\"", "\"", ")", "\n", "return", "cpm", ",", "nil", "\n", "}" ]
1,484
all-1485
[ "AddPrefix", "will", "wrap", "a", "UI", "that", "will", "prefix", "the", "message", "on", "top", "of", "ui", ".", "If", "a", "prefix", "is", "set", "to", "nothing", "(", ")", "then", "there", "will", "be", "no", "prefix", "for", "that", "message", "type", ".", "Arguments", "are", "in", "alphabetical", "order", "." ]
[ "func", "AddPrefix", "(", "askPre", ",", "errorPre", ",", "infoPre", ",", "logPre", ",", "outputPre", ",", "runningPre", ",", "successPre", ",", "warnPre", "<mask>", ",", "ui", "UI", ")", "*", "PrefixUI", "{", "return", "&", "PrefixUI", "{", "LogPrefix", ":", "logPre", ",", "OutputPrefix", ":", "outputPre", ",", "SuccessPrefix", ":", "successPre", ",", "InfoPrefix", ":", "infoPre", ",", "ErrorPrefix", ":", "errorPre", ",", "WarnPrefix", ":", "warnPre", ",", "RunningPrefix", ":", "runningPre", ",", "AskPrefix", ":", "askPre", ",", "UI", ":", "ui", ",", "}", "\n", "}" ]
1,485
all-1486
[ "NewThen", "creates", "a", "new", "Then", "command", "." ]
[ "func", "NewThen", "(", "command", "string", ",", "args", "...", "string", ")", "Then", "{", "return", "&", "gitCmd", "{", "command", ":", "<mask>", ",", "args", ":", "args", "}", "\n", "}" ]
1,486
all-1487
[ "NameSpace", "return", "namespaced", "filesystem" ]
[ "func", "(", "fs", "*", "AssetFileSystem", ")", "NameSpace", "(", "nameSpace", "string", ")", "Interface", "{", "if", "<mask>", ".", "nameSpacedFS", "==", "nil", "{", "fs", ".", "nameSpacedFS", "=", "map", "[", "string", "]", "Interface", "{", "}", "\n", "}", "\n", "fs", ".", "nameSpacedFS", "[", "nameSpace", "]", "=", "&", "AssetFileSystem", "{", "}", "\n", "return", "fs", ".", "nameSpacedFS", "[", "nameSpace", "]", "\n", "}" ]
1,487
all-1488
[ "GetReverseMap", "returns", "a", "map", "from", "people", "-", ">", "OWNERS", "files", "for", "which", "they", "are", "an", "approver" ]
[ "func", "(", "o", "Owners", ")", "GetReverseMap", "(", "approvers", "map", "[", "string", "]", "sets", ".", "String", ")", "map", "[", "string", "]", "sets", ".", "String", "{", "approverOwnersfiles", ":=", "map", "[", "string", "]", "sets", ".", "String", "{", "}", "\n", "for", "ownersFile", ",", "approvers", ":=", "range", "approvers", "{", "for", "approver", ":=", "range", "approvers", "{", "if", "_", ",", "ok", ":=", "approverOwnersfiles", "[", "approver", "]", ";", "<mask>", "{", "approverOwnersfiles", "[", "approver", "]", ".", "Insert", "(", "ownersFile", ")", "\n", "}", "else", "{", "approverOwnersfiles", "[", "approver", "]", "=", "sets", ".", "NewString", "(", "ownersFile", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "approverOwnersfiles", "\n", "}" ]
1,488
all-1489
[ "/", "*", "polymorph", "AppsWrapper", "apps", "false", "/", "*", "polymorph", "AppsWrapper", "error", "false", "Validate", "validates", "this", "apps", "wrapper" ]
[ "func", "(", "m", "*", "AppsWrapper", ")", "Validate", "(", "formats", "strfmt", ".", "Registry", ")", "error", "{", "var", "res", "[", "]", "error", "\n\n", "if", "err", ":=", "m", ".", "validateApps", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "append", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "m", ".", "validateError", "(", "formats", ")", ";", "err", "!=", "nil", "{", "// prop", "res", "=", "<mask>", "(", "res", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "res", ")", ">", "0", "{", "return", "errors", ".", "CompositeValidationError", "(", "res", "...", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,489
all-1490
[ "List", "entries", "at", "the", "given", "path" ]
[ "func", "(", "s", "*", "Shell", ")", "List", "(", "path", "string", ")", "(", "[", "]", "*", "LsLink", ",", "error", ")", "{", "<mask>", "out", "struct", "{", "Objects", "[", "]", "LsObject", "}", "\n", "err", ":=", "s", ".", "Request", "(", "\"", "\"", ",", "path", ")", ".", "Exec", "(", "context", ".", "Background", "(", ")", ",", "&", "out", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "len", "(", "out", ".", "Objects", ")", "!=", "1", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "out", ".", "Objects", "[", "0", "]", ".", "Links", ",", "nil", "\n", "}" ]
1,490
all-1491
[ "ListMilestones", "lists", "milestones", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "ListMilestones", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "Milestone", ",", "error", ")", "{", "milestones", ":=", "[", "]", "github", ".", "Milestone", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "f", ".", "MilestoneMap", "{", "milestones", "=", "<mask>", "(", "milestones", ",", "github", ".", "Milestone", "{", "Title", ":", "k", ",", "Number", ":", "v", "}", ")", "\n", "}", "\n", "return", "milestones", ",", "nil", "\n", "}" ]
1,491
all-1492
[ "closestInRange", "finds", "the", "closest", "valid", "value", "within", "the", "range", "to", "a", "given", "value", ".", "Values", "outside", "the", "range", "are", "clipped", "to", "either", "the", "range", "min", "or", "max", "." ]
[ "func", "(", "*", "InclusiveRange", ")", "closestInRange", "(", "value", ",", "start", ",", "end", ",", "step", "int", ")", "int", "{", "// Possibly clamp the value if it is outside the range", "if", "end", ">=", "start", "{", "if", "value", "<", "start", "{", "return", "start", "\n", "}", "else", "if", "value", ">", "<mask>", "{", "return", "end", "\n", "}", "\n\n", "}", "else", "{", "if", "value", ">", "start", "{", "return", "start", "\n", "}", "else", "if", "value", "<", "end", "{", "return", "end", "\n", "}", "\n", "}", "\n\n", "// No calculation needed if there is no stepping", "if", "step", "==", "1", "||", "step", "==", "-", "1", "{", "return", "value", "\n", "}", "\n\n", "// Modified the value so that it is a properly stepped", "// increment within the range", "return", "(", "(", "(", "value", "-", "start", ")", "/", "step", ")", "*", "step", ")", "+", "start", "\n", "}" ]
1,492
all-1493
[ "SetLevel", "changes", "the", "logging", "level", "to", "the", "passed", "level", ".", "This", "is", "part", "of", "the", "Logger", "interface", "implementation", "." ]
[ "func", "(", "l", "*", "slog", ")", "SetLevel", "(", "<mask>", "Level", ")", "{", "atomic", ".", "StoreUint32", "(", "(", "*", "uint32", ")", "(", "&", "l", ".", "lvl", ")", ",", "uint32", "(", "level", ")", ")", "\n", "}" ]
1,493
all-1494
[ "Returns", "the", "value", "of", "a", "uniform", "variable" ]
[ "func", "GetUniformfv", "(", "program", "uint32", ",", "location", "int32", ",", "params", "*", "float32", ")", "{", "syscall", ".", "Syscall", "(", "gpGetUniformfv", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
1,494
all-1495
[ "newGatewayCommand", "returns", "the", "cobra", "command", "for", "gateway", "." ]
[ "func", "newGatewayCommand", "(", ")", "*", "cobra", ".", "Command", "{", "lpc", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "}", "\n", "lpc", ".", "AddCommand", "(", "newGatewayStartCommand", "(", ")", ")", "\n\n", "<mask>", "lpc", "\n", "}" ]
1,495
all-1496
[ "bind", "stages", "of", "a", "program", "object", "to", "a", "program", "pipeline" ]
[ "func", "UseProgramStages", "(", "pipeline", "uint32", ",", "stages", "uint32", ",", "program", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpUseProgramStages", ",", "3", ",", "uintptr", "(", "pipeline", ")", ",", "uintptr", "(", "stages", ")", ",", "uintptr", "(", "<mask>", ")", ")", "\n", "}" ]
1,496
all-1497
[ "getTasksToEventsLen", "returns", "the", "length", "of", "the", "tasksToEvents", "map", ".", "It", "is", "used", "only", "in", "the", "test", "code", "to", "ascertain", "that", "map", "has", "been", "cleaned", "up" ]
[ "func", "(", "handler", "*", "TaskHandler", ")", "getTasksToEventsLen", "(", ")", "int", "{", "<mask>", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "handler", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "len", "(", "handler", ".", "tasksToEvents", ")", "\n", "}" ]
1,497
all-1498
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "FocusParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom54", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
1,498
all-1499
[ "Lookup", "returns", "the", "codec", "associated", "with", "mimetype", "ok", "is", "set", "to", "true", "or", "false", "based", "on", "whether", "a", "codec", "was", "found", "." ]
[ "func", "(", "reg", "*", "Registry", ")", "Lookup", "(", "mimetype", "string", ")", "(", "codec", "Codec", ",", "ok", "bool", ")", "{", "reg", ".", "mutex", ".", "RLock", "(", ")", "\n", "codec", ",", "<mask>", "=", "reg", ".", "codecs", "[", "mimetype", "]", "\n", "reg", ".", "mutex", ".", "RUnlock", "(", ")", "\n", "return", "\n", "}" ]
1,499
all-1500
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "NavigateParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage27", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]